Advertisement
vasilev5

Untitled

Feb 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [BITS 16]
  2. [ORG 0x7C00]
  3. top:
  4.     ;; Put 0 into ds (data segment)
  5.     ;; Can't do it directly
  6.     mov ax,0x0000
  7.     mov ds,ax
  8.     ;; si is the location relative to the data segment of the
  9.     ;; string/char to display
  10.  
  11.  
  12.     mov si, eightSquareDots ;Moves the eightSquareDots string into the system input and continues to rear one character at a time into the buffer until it encounters a null cahracter
  13.                 ;which will indicate the the string has ended at which point the next string will be printed in the same way.
  14.     call writeString
  15.     mov si, eightSquareDots
  16.     call writeString
  17.     mov si, eightSquareDots
  18.     call writeString
  19.     mov si, eightSquareDots
  20.     call writeString
  21.     mov si, eightSquareDots
  22.     call writeString
  23.     mov si, eightSquareDots
  24.     call writeString
  25.     mov si, eightSquareDots
  26.     call writeString
  27.     mov si, eightSquareDots
  28.     call writeString
  29.  
  30.     mov si, studentName    ;studentName variable
  31.     call writeString ; the writeString function prints the variable to the terminal.
  32.     mov si, studentCourse ;studentCourse variable
  33.     call writeString ; Performs the same action as above
  34.     mov si, favouriteMovie ;favouriteMovie variable
  35.     call writeString ; Performs the same action as above
  36.     jmp $ ; Spin
  37. writeString:
  38.     mov ah,0x0E ; Display a chacter (as before)
  39.     mov bh,0x00
  40.     mov bl,0x07
  41. nextchar:
  42.     Lodsb ; Loads [SI] into AL and increases SI by one
  43.     ;; Effectively "pumps" the string through AL
  44.     cmp al,0 ; End of the string?
  45.     jz done
  46.     int 0x10 ; BIOS interrupt
  47.     jmp nextchar
  48. done:
  49.     ret
  50.     ;Tis section of code contains the variables used to print text on the screen.
  51.     studentName db 'Name:  Martin Vasilev' ,13,10,0 ;Null - terminated
  52.     studentCourse db 'Course: Computer Science' ,13,10,0 ;Null -terminated
  53.     favouriteMovie db 'Favourite Movie: Ex Machina' ,13,10,0 ;Null -terminated
  54.     eightSquareDots db '........' ,13,10,0 ;Null - terminated
  55.     times 510-($-$$) db 0
  56.     dw 0xAA55
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement