Okay, this is an annoying problem i'm making a command line operating system bootable from a floppy disk and the way i'm testing it atm is by inputting a command and outputting it.
The reason for this is that i want to know EXACTLY what its doing with the string and how it is being referenced etc so that i can compare it with a list of commands. The code function 'check' doesnt work at the moment and is very messy what with me playing around with it alot.
Code that would compare the inputted string with a command would be very helpful along with a thorough description OR a description of how i would go about it.
Currently the code is:
;boot code
;==========================================
;Load boot directive
#MAKE_BOOT#
;Set boot memory address
org 7c00h
push cs ;cs = ds
pop ds
;==========================================
;print welcome
;==========================================
begin:
lea si,welcomeMessage
call print
;==========================================
;gets command
;==========================================
mov bh,0
getCommand:
lea si,message
call print
mov dx,offset buffer
mov ah,0ah ;read string subroutine
int 21h ;get string
call check
jmp getCommand
;==========================================
;reboot
;==========================================
;store 'magic' number at 0040h:0072h
; 0000h = cold reboot
; 1234h = warm reboot
mov ax, 0040h
mov ds,ax
mov w.[0072h],0000h
jmp 0FFFFh:0000h ;reboot!
;==========================================
;procedures
;==========================================
print proc ;arguments: string is in SI
nextChar:
cmp b.[si],0 ;check for null termination
jz stop
mov al,[si] ;get next char
mov ah,0eh ;teletype subroutine
int 10h ;print
inc si ;next lesson
jmp nextChar ;type next char
stop:
ret ;return to caller
print endp
check proc ;arguments: string must be in SI
getNo:
lea di,help
checkCom:
xor bx,bx
lea si,help
mov bx,offset buffer - 1
mov ah, 09
temp:
inc bx
mov dx,[bx]
int 21h
cmp dx,0
jnz temp
ret
check endp
;==========================================
;vars
;==========================================
lfcr equ 13,10,0
welcomeMessage db "Welcome to MYCROS!"
db 13,10, "For a list of commands type 'help'"
db lfcr
message db 13,10, "Command: ",0
buffer db 50,50 dup " "
help db "help",0