Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; BASM - 1.00, by bobo87
  2. ; **********************
  3.  
  4. ; compile command : nasm -f bin test.asm -o test.com
  5.  
  6.     ORG 100h
  7.  
  8. SECTION .text
  9.  
  10. ; Basic Hello World! program
  11.     JMP Line_50
  12. Line_30:
  13.     MOV EAX, StaticString_1_Y4AZCWSSES
  14.     CALL    PrintString
  15.     JMP ProgramEnd
  16. Line_50:
  17.     MOV EAX, StaticString_0_G0E4QX0NZX
  18.     CALL    PrintString
  19.     JMP Line_30
  20.  
  21. ProgramEnd:
  22.     MOV AH, 0x4C
  23.     XOR AL, AL
  24.     INT 0x21
  25. PrintChar:
  26.     PUSH    AX
  27.     MOV AH, 0x02
  28.     INT 0x21
  29.     POP AX
  30.     RET
  31. PrintString:
  32.     MOV CL, [EAX]
  33. PrintStringLoop:
  34.     INC AX
  35.     MOV DL, [EAX]
  36.     CALL    PrintChar
  37.     DEC CL
  38.     CMP CL, 0
  39.     JNZ PrintStringLoop
  40.     RET
  41.  
  42.  
  43. SECTION .data
  44.  
  45. ; string constants
  46. StaticString_0_G0E4QX0NZX   DB  7, "Hello", 0x0D, 0x0A
  47. StaticString_1_Y4AZCWSSES   DB  8, "World!", 0x0D, 0x0A
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement