95 lines
1.3 KiB
NASM
95 lines
1.3 KiB
NASM
|
fcb1 equ 0x5C
|
||
|
fcb2 equ 0x6C
|
||
|
buf equ 0x80
|
||
|
|
||
|
; length of input buffer
|
||
|
inlen equ 0x90
|
||
|
|
||
|
org 0x100
|
||
|
|
||
|
jmp prompt
|
||
|
|
||
|
banner db "RDOS Console Command Processor",0x0A,0x0D,0x1A
|
||
|
|
||
|
prompt mov ax, cs
|
||
|
mov ds, ax
|
||
|
mov es, ax
|
||
|
; print newline
|
||
|
mov dl, 0x0A
|
||
|
mov ah, 2
|
||
|
int 0x21
|
||
|
mov dl, 0x0D
|
||
|
int 0x21
|
||
|
; query current drive
|
||
|
mov ah, 25
|
||
|
int 0x21
|
||
|
; drivenum to chr
|
||
|
mov dl, al
|
||
|
add dl, 0x41
|
||
|
; print drive and prompt chr
|
||
|
mov ah, 2
|
||
|
int 0x21
|
||
|
mov dl, '>'
|
||
|
int 0x21
|
||
|
; read string
|
||
|
mov byte [inbuf], inlen
|
||
|
mov dx, inbuf
|
||
|
mov ah, 10
|
||
|
int 0x21
|
||
|
|
||
|
; parse inbuf into comfcb, buf, fcb1 and fcb2
|
||
|
; takes no arguments
|
||
|
; parse off command name
|
||
|
parse mov si, inbuf+2
|
||
|
mov di, comfcb
|
||
|
call lodfn
|
||
|
; trim spaces
|
||
|
call eatws
|
||
|
; calculate length of cmdline
|
||
|
mov cx, inbuf+2
|
||
|
add cl, [inbuf+1]
|
||
|
adc ch, 0
|
||
|
sub cx, si
|
||
|
; move into default position at 0x80
|
||
|
mov [buf], cl
|
||
|
mov di, buf+1
|
||
|
rep movsb
|
||
|
mov al, 0x0D
|
||
|
stosb
|
||
|
; parse fcb1
|
||
|
mov si, buf+1
|
||
|
mov di, fcb1
|
||
|
call lodfn
|
||
|
; parse fcb2
|
||
|
call eatws
|
||
|
mov di, fcb2
|
||
|
call lodfn
|
||
|
; dump out everything parsed for me to see
|
||
|
mov si, comfcb
|
||
|
call dump
|
||
|
mov si, fcb1
|
||
|
call dump
|
||
|
mov si, fcb2
|
||
|
call dump
|
||
|
mov si, buf
|
||
|
call dump
|
||
|
ret
|
||
|
|
||
|
; eat leftover spaces
|
||
|
; IN ds:si ptr
|
||
|
eatws jmp .l01
|
||
|
.l02 inc si
|
||
|
.l01 cmp byte [si], 0x20
|
||
|
je .l02
|
||
|
ret
|
||
|
|
||
|
%include "print.inc"
|
||
|
%include "scan.inc"
|
||
|
|
||
|
section .bss
|
||
|
|
||
|
inbuf resb inlen
|
||
|
|
||
|
; FCB for the COM file
|
||
|
comfcb resb 37
|