pastebin - collaborative debugging tool
kpaste.net RSS


Untitled
Posted by Anonymous on Thu 17th Jan 2013 04:56
raw | new post

  1. global _start
  2.  
  3. section .data
  4.     black: dd 0
  5.         white: dd 15
  6.         onetwentyeight: dd 128
  7.         twofiftyfive: dd 255
  8.         eight: dd 8
  9. section .bss
  10.     colour: resw 1     ;reserve 1 quad word for result
  11.     x: resq 1
  12.         y: resq 1
  13.         z: resq 1
  14. section .text
  15. %macro waitkp 0
  16.     MOV AH,0x00
  17.     INT 0x16
  18. %endmacro
  19.   _start:
  20.     FINIT
  21.     MOV AH,00h                      ;get into video mode.  00 = Set Video Mode
  22.     MOV AL,13h                      ;13h = 320x240x16
  23.     INT 10h
  24. ; starting X & Y location + starting colour
  25.     MOV CX,0
  26.     MOV DX,0
  27.     MOV AL,black
  28. LL1:
  29.     MOV CX,0
  30. ResetAL:
  31.     MOV AL,black
  32. LL2:
  33.         PUSH CX
  34.         PUSH DX
  35.         MOV [x],CX ; store CX in [x]
  36.         fld qword [x] ; push [x] to the FPU's stack              [x] = s0
  37.         fld qword [eight] ; push [x] to the FPU's stack          [eight] = s0 [x] = s1
  38.         fdivr st1                                    ;           s1 / s0
  39.         fwait
  40.         fld1                                         ;           result = s0
  41.         fsin ; take the sine of s(0)                             sin(s0)
  42.         fwait
  43.         fld1                                         ;           result = s0
  44.         fld qword [onetwentyeight]                   ;           s0 = s1 s0 = 128
  45.         fmul st0,st1 ; multiply by 128               ;           s0 * s1 = res
  46.         fwait
  47.         fld1                                         ;           res = s0
  48.         fld qword [onetwentyeight]                   ;           s0 = s1 128 = s0
  49.         fadd st0,st1                                 ;           s0 + s1 = res
  50.         fwait
  51.         fld1                                         ;           res = s0
  52.         fld qword [twofiftyfive]                     ;           s0 = s1 255 = s0
  53.         FCOMPP
  54.         fwait                                        ;           s0 CMP s1
  55. ;waitkp
  56.         POP DX
  57.         POP CX
  58. ;waitkp
  59.  
  60.         JLE BLACK
  61.         JG WHITE
  62.          ;BLUE
  63. ;BLUE:
  64. ;     POP DX
  65. ;POP CX
  66. ;POP BX
  67. ;MOV AL,5
  68. ;JMP DRAW
  69. WHITE:
  70.         MOV AL,2
  71.         JMP DRAW
  72. BLACK:
  73.         MOV AL,1 ;black
  74. DRAW:
  75.     MOV AH,0x0C
  76.     MOV BX,0x1
  77.     INT 0x10
  78.     CMP CX,320
  79.     JE NLINE
  80.     JNE Continue
  81. Continue:
  82.     ADD CX,1
  83. ;    ADD AL,0x01
  84.  ;   CMP AL,16
  85.   ;  JE ResetAL
  86.     JMP LL2
  87. NLINE:
  88.     ADD DX,1
  89.     CMP DX,240
  90.     JL LL1
  91. WAIT_FOR_KEY_PRESS:
  92.     MOV AH,0x00
  93.     INT 0x16
  94. REBOOT:
  95.     DB 0xEA
  96.     DW 0x0000
  97.     DW 0xFFFF
  98. times 0200h - 2 - ($ - $$)  db 0
  99. SIGNATURE DW 0xAA55

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at