- global _start
- section .data
- black: dd 0
- white: dd 15
- onetwentyeight: dd 128
- twofiftyfive: dd 255
- eight: dd 8
- section .bss
- colour: resw 1 ;reserve 1 quad word for result
- x: resq 1
- y: resq 1
- z: resq 1
- section .text
- %macro waitkp 0
- MOV AH,0x00
- INT 0x16
- %endmacro
- _start:
- FINIT
- MOV AH,00h ;get into video mode. 00 = Set Video Mode
- MOV AL,13h ;13h = 320x240x16
- INT 10h
- ; starting X & Y location + starting colour
- MOV CX,0
- MOV DX,0
- MOV AL,black
- LL1:
- MOV CX,0
- ResetAL:
- MOV AL,black
- LL2:
- PUSH CX
- PUSH DX
- MOV [x],CX ; store CX in [x]
- fld qword [x] ; push [x] to the FPU's stack [x] = s0
- fld qword [eight] ; push [x] to the FPU's stack [eight] = s0 [x] = s1
- fdivr st1 ; s1 / s0
- fwait
- fld1 ; result = s0
- fsin ; take the sine of s(0) sin(s0)
- fwait
- fld1 ; result = s0
- fld qword [onetwentyeight] ; s0 = s1 s0 = 128
- fmul st0,st1 ; multiply by 128 ; s0 * s1 = res
- fwait
- fld1 ; res = s0
- fld qword [onetwentyeight] ; s0 = s1 128 = s0
- fadd st0,st1 ; s0 + s1 = res
- fwait
- fld1 ; res = s0
- fld qword [twofiftyfive] ; s0 = s1 255 = s0
- FCOMPP
- fwait ; s0 CMP s1
- ;waitkp
- POP DX
- POP CX
- ;waitkp
- JLE BLACK
- JG WHITE
- ;BLUE
- ;BLUE:
- ; POP DX
- ;POP CX
- ;POP BX
- ;MOV AL,5
- ;JMP DRAW
- WHITE:
- MOV AL,2
- JMP DRAW
- BLACK:
- MOV AL,1 ;black
- DRAW:
- MOV AH,0x0C
- MOV BX,0x1
- INT 0x10
- CMP CX,320
- JE NLINE
- JNE Continue
- Continue:
- ADD CX,1
- ; ADD AL,0x01
- ; CMP AL,16
- ; JE ResetAL
- JMP LL2
- NLINE:
- ADD DX,1
- CMP DX,240
- JL LL1
- WAIT_FOR_KEY_PRESS:
- MOV AH,0x00
- INT 0x16
- REBOOT:
- DB 0xEA
- DW 0x0000
- DW 0xFFFF
- times 0200h - 2 - ($ - $$) db 0
- SIGNATURE DW 0xAA55
Untitled
Posted by Anonymous on Thu 17th Jan 2013 04:56
raw | new post
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.
kpaste.net RSS