Advertisement
Kyl38

Untitled

Aug 23rd, 2023 (edited)
1,798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 1.03 KB | Source Code | 0 0
  1. [org 0x7c00]
  2. bits 16
  3.  
  4. start:
  5.  
  6.     inputLoop:
  7.         mov ah, 00h ;keyboard input is set to register ah
  8.         int 16h ;keyboard input is gotten
  9.         mov ah, 0x0e ;teletype interupt is set to print out al, in other words the keyboard input
  10.         int 0x10    ;teletype is told to output what ever is in ah to the screen
  11.         cmp al, 'v'  
  12.         je printVersion
  13.  
  14.         jmp inputLoop ; allows the user to enter command
  15.  
  16.  
  17.     printVersion:
  18.         mov si, version_string ; Sets the string as a source
  19.         call printFunction ; Calls the print function
  20.  
  21.  
  22. jmp $
  23.  
  24. version_string db 'Version: prealpha 0.0.0.1', 0  ;defines a string I want to output later.
  25.  
  26. printFunction:   ; Credit to mikeos for this function.
  27.     mov ah, 0Eh     ; int 10h 'print char' function
  28.  
  29. .repeat:            ; Loop
  30.     lodsb           ; Get character from string
  31.     cmp al, 0
  32.     je .done        ; If char is zero, end of string
  33.     int 10h         ; Otherwise, print it
  34.     jmp .repeat
  35.  
  36. .done:
  37.     ret
  38.  
  39.  
  40.  
  41. ;
  42. ;   Magic boot number
  43. ;  
  44. times 510 - ($-$$) db 0
  45. dw 0xAA55
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement