Advertisement
Xlonix

ASM Files 1

Oct 27th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- BOOT.ASM --
  2. [org 0x7c00]
  3.  
  4. mov dx, 0x7c00
  5. call printhex
  6. mov bx, printthistoo
  7. call printaddr
  8. jmp $
  9.  
  10. %include "print.asm"
  11.  
  12. printthis:
  13.     db 'Letters!', 0
  14. printthistoo:
  15.     db ' Yes, all of these!', 0
  16.  
  17. times 510-($-$$) db 0
  18.  
  19. dw 0xaa55
  20.  
  21. -- PRINT.ASM --
  22. printaddr:
  23.     pusha
  24.     mov ah, 0x0e
  25.     lp:
  26.     mov al, [bx]
  27.     cmp al, 0
  28.     jne printch
  29.     jmp doneaddr
  30.     printch:
  31.     int 0x10
  32.     add bx, 1
  33.     jmp lp
  34.     doneaddr:
  35.     popa
  36.     ret
  37.  
  38. printhex:
  39.     mov cx, 0x3
  40.     mov ax, 0xF
  41.     lph:
  42.     mov bx, 0x0
  43.     add bx, ax
  44.     and bx, dx
  45.     cmp bx, ax
  46.     je log
  47.     sub ax, 0x1
  48.     jmp lph
  49.     log:
  50.     cmp ax, 0x9
  51.     jle lognum
  52.     jmp loglet
  53.     finlog:
  54.     cmp cx, 0x0
  55.     je printnd
  56.     mov ax, 0xF
  57.     sub cx, 0x1
  58.     shr dx, 4
  59.     jmp lph
  60.     lognum:
  61.     mov bx, extemplate
  62.     add bx, cx
  63.     add bx, 0x2
  64.     add ax, 48
  65.     mov [bx], al
  66.     jmp finlog
  67.     loglet:
  68.     mov bx, extemplate
  69.     add bx, cx
  70.     add bx, 0x2
  71.     add ax, 0x7
  72.     add ax, 48
  73.     mov [bx], al
  74.     jmp finlog
  75.     printnd:
  76.     mov bx, extemplate
  77.     call printaddr
  78.     ret
  79.  
  80. extemplate:
  81.     db '0x0000', 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement