Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     call gca
  2. ; it's the begin of execution call gca -> push cs
  3. gca:
  4.     pop bx          ; bx=cs=0x0,since bootloader is load at 0x
  5.     mov ax,0x07c0
  6.     mov ds,ax
  7.     mov si,bx
  8.     add si,0x200
  9.     ;
  10. ;DAP
  11.     mov byte [si],0x10
  12.     inc si
  13.     mov byte [si],0x0
  14.     inc si
  15.     mov word [si],0x1
  16.     mov word [si],0x300
  17.     mov word [si],bx
  18.     mov word [si],0x1
  19.     mov word [si],0x0
  20.     mov dword [si],0
  21. ; What to write is here
  22.     mov word [bx+0x300],'AB'
  23. ;
  24. ; Write
  25.     mov ah,0x41
  26.     mov bx,0x55aa
  27.     mov dl,0x80
  28.     int 0x13
  29.     jc error
  30. ;
  31.     mov ah,0x43
  32.     mov dl,0x80
  33.     mov si,bx
  34.     add si,0x200
  35.     int 0x13
  36.     jc error
  37. ;
  38. success:
  39.     mov si,suc_msg
  40. print_succ:
  41.     lodsb
  42.     or al,al
  43.     jz hang
  44.     mov ah,0xe
  45.     int 0x10
  46.     jmp print_succ
  47. ;
  48. error:
  49.     mov si,err_msg
  50. print_err:
  51.     lodsb
  52.     or al,al
  53.     jz hang
  54.     mov ah,0xe
  55.     int 0x10
  56.     jmp print_err
  57. hang:
  58.     jmp hang
  59. err_msg db "You have encountered an error!",0x0
  60. suc_msg db "You are success!",0x0
  61. times 510-($-$$) db 0
  62. dw 0xAA55
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement