Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [org 0x7c00]
- bits 16
- start:
- inputLoop:
- mov ah, 00h ;keyboard input is set to register ah
- int 16h ;keyboard input is gotten
- mov ah, 0x0e ;teletype interupt is set to print out al, in other words the keyboard input
- int 0x10 ;teletype is told to output what ever is in ah to the screen
- mov di, User_Input
- cmp al, 'version'
- je printVersion
- jmp inputLoop ; allows the user to enter command
- printVersion:
- mov si, version_string ; Sets the string as a source
- call printFunction ; Calls the print function
- jmp $
- version_string db 'Version: prealpha 0.0.0.1', 0 ;defines a string I want to output later.
- User_Input db '', 0
- printFunction: ; Credit to mikeos for this function.
- mov ah, 0Eh ; int 10h 'print char' function
- .repeat: ; Loop
- lodsb ; Get character from string
- cmp al, 0
- je .done ; If char is zero, end of string
- int 10h ; Otherwise, print it
- jmp .repeat
- .done:
- ret
- ;
- ; Magic boot number
- ;
- times 510 - ($-$$) db 0
- dw 0xAA55
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement