DEMO 源码系列_旋转星云

; File Name   : F:/256B/3D/AWAK-3D.COM

.386
.model tiny

Code segment byte public 'CODE' use16
assume cs:Code, ds:Code
org 100h

public start
start proc near
push 0A000h
pop es

mov ax, 13h
int 10h  ; - VIDEO - SET VIDEO MODE
   ; AL = mode
mov cx, 0FFh
mov dx, 3C8h

@10F:
mov al, cl
out dx, al
inc dx
shr al, 2
out dx, al
out dx, al
out dx, al
dec dx
loop @10F
in al, 40h  ; Timer 8253-5 (AT: 8254.2).
mov ebx, eax
mov cx, 0C0h
mov bp, 200h

@127:
mov eax, 6992F8Bh
mul ebx
mov ebx, eax
sar eax, 19h
mov [bp+0], ax
add bp, 2
loop @127
finit

@142:
mov dx, 3DAh

@145:  ; Video status bits:
in al, dx  ; 0: retrace.  1=display is in vert or horiz retrace.
   ; 1: 1=light pen is triggered; 0=armed
   ; 2: 1=light pen switch is open; 0=closed
   ; 3: 1=vertical sync pulse is occurring.
test al, 8
jz short @145
mov cx, 7A7Eh
mov di, 3FC0h

@150:
mov al, es:[di-1]
add al, es:[di+1]
add al, es:[di-140h]
add al, es:[di+140h]
shr al, 2
stosb
loop @150
mov di, 200h
mov bp, 40h

@16E:
fldpi
fidiv word_1FC
fimul word_1FA
fst flt_1F6
fcos
fimul word ptr [di]
fld flt_1F6
fsin
fimul word ptr [di+4]
fadd st, st(1)
fistp word ptr ds:380h
ffree st
fld flt_1F6
fcos
fimul word ptr [di]
fld flt_1F6
fsin ;FSIN 正弦函数sin st(0) <- SIN( st(0) )
fimul word ptr [di+4]
fadd st, st(1)
fistp word ptr ds:382h
ffree st ;FFREE st(i) 标志寄存器st(i)未被使用
mov ax, ds:380h
mov bx, [di+2]
mov cx, ds:382h
shl ax, 8
shl bx, 8
add cx, 190h
cwd
idiv cx
push ax
mov ax, bx
cwd
idiv cx
pop bx
add bx, 0A0h
add ax, 64h
imul ax, 140h
add bx, ax
mov al, 0FFh
sub al, cl
mov es:[bx], al
add di, 6
dec bp
jnz short @16E
add word_1FA, 2
in al, 60h  ; AT Keyboard controller 8042.
dec al
jnz @142
mov ax, 3
int 10h  ; - VIDEO - SET VIDEO MODE
   ; AL = mode
retn
start endp

align 2
flt_1F6 dd 0.0
word_1FA dw 0
word_1FC dw 80h ;128d
db 0, 1

Code ends
end start

FADD ;加实数 st(0) <-st(0) + st(1)
FADD src ;st(0) <-st(0) + src (mem32/mem64)
FADD st(i),st ;st(i) <- st(i) + st(0)
FADDP st(i),st ;st(i) <- st(i) + st(0);然后执行一次出栈操作

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值