fork download
  1. %define COUNT 20
  2. [bits 16]
  3. [org 0x7c00]
  4. start:
  5. cli
  6. xor ax, ax
  7. mov ds, ax
  8. mov es, ax
  9. mov ss, ax
  10. mov ax, 0x9c00
  11. mov sp, ax
  12. mov cx, COUNT
  13. sti
  14. fizzbuzz:
  15. .printnumber:
  16. mov ax, cx
  17. call putword
  18. .test3:
  19. mov ax, cx
  20. mov dh, 3
  21. div dh
  22. or ah, ah
  23. jz .fizz
  24. .test5:
  25. mov ax, cx
  26. mov dh, 5
  27. div dh
  28. or ah, ah
  29. jz .buzz
  30. jmp .testcx
  31. .fizz:
  32. mov si, fizz
  33. call putstr
  34. jmp .test5
  35. .buzz:
  36. mov si, buzz
  37. call putstr
  38. .testcx:
  39. mov si, crlf
  40. call putstr
  41. or cx, cx
  42. jz hang
  43. dec cx
  44. jmp fizzbuzz
  45. hang:
  46. cli
  47. hlt
  48. jmp $
  49. putchar:
  50. mov ah, 0x0e
  51. int 0x10
  52. ret
  53. putstr:
  54. .do_char:
  55. lodsb
  56. or al, al
  57. jz .done
  58. call putchar
  59. jmp .do_char
  60. .done:
  61. ret
  62. putnibble:
  63. cmp al, 10
  64. jl .lt10
  65. add al, 'A' - 10
  66. call putchar
  67. jmp .done
  68. .lt10:
  69. add al,'0'
  70. call putchar
  71. .done:
  72. ret
  73. putbyte:
  74. push ax
  75. shr al, 4
  76. call putnibble
  77. pop ax
  78. and al, 0x0f
  79. call putnibble
  80. cmp bx, 0
  81. je .done
  82. mov al, ' '
  83. call putchar
  84. .done:
  85. ret
  86. putword:
  87. push bx
  88. push ax
  89. mov al, ah
  90. mov bx, 0
  91. call putbyte
  92. pop ax
  93. mov bx, 0
  94. call putbyte
  95. mov al, ' '
  96. call putchar
  97. pop bx
  98. ret
  99. fizz: db "fizz", 0
  100. buzz: db "buzz", 0
  101. crlf: db 13, 10, 0
  102. times 510 - ($ - $$) db 0
  103. dw 0xaa55
  104.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.asm:3: error: unrecognised directive [org]
stdout
Standard output is empty