Guest User

Untitled

a guest
Dec 17th, 2023
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [org 0x7C00]
  2. [bits 16]
  3. jmp start
  4. bootDisk: db 0x00
  5. errorMessage: db 'Drive Error',0
  6. errorMessage2: db 'Display Error',0
  7. global start
  8. start:
  9.     mov [bootDisk], dl
  10.     ;Set up segments
  11.     cli
  12.     mov ax, 0x00
  13.     mov ds, ax
  14.     mov es, ax
  15.     mov ss, ax
  16.     mov sp, 0x6C00
  17.     sti
  18.  
  19.     ;Read disk
  20.     mov ah, 2
  21.     mov al, 60 ; sector count
  22.     mov dl, [bootDisk]
  23.     mov cl, 2
  24.     mov ch, 0
  25.     mov dh, 0
  26.     mov bx, 0x7E00
  27.     int 0x13
  28.     jc derror
  29.  
  30.     mov ax, 0
  31.     mov es, ax
  32.  
  33.     mov ah, 0
  34.     mov al, 3
  35.     int 0x10
  36.  
  37.         jmp end
  38. verror:
  39.     lea si, [errorMessage2]
  40.     jmp loop
  41. derror:
  42.     lea si, [errorMessage]
  43. loop:
  44.     mov al, [si]
  45.     cmp al, 0
  46.     je loop
  47.     inc si
  48.     mov ah, 0xE
  49.     int 0x10
  50.     cmp al, 0
  51.     jnz loop
  52.     jmp $
  53.  
  54.     times 510-($-$$) db 0
  55.     dw 0xAA55
  56. end:
Advertisement
Add Comment
Please, Sign In to add comment