650 lines
8.3 KiB
Text
650 lines
8.3 KiB
Text
;included to koe.asm
|
|
|
|
.386
|
|
|
|
include polyega.asm
|
|
|
|
STARS equ 512
|
|
|
|
starvram dw 0a000h
|
|
emmhandle dw 0
|
|
emmseg dw 0
|
|
emmpage4 dw 0
|
|
starlimit dw 0
|
|
startxtopen dw 0
|
|
startxtclose dw 0
|
|
startxtp0 dw 0
|
|
starframe dw 0
|
|
starpalfade db 0,0
|
|
_nostar1 dw 200
|
|
_nostar2 dw 199
|
|
|
|
rows1 dw 200 dup(0)
|
|
rows dw 400 dup(0)
|
|
|
|
star dw STARS dup(0,0,0,0)
|
|
|
|
muldivx dw 256 dup(0)
|
|
muldivy dw 256 dup(0)
|
|
|
|
ALIGN 2
|
|
seed1 dw 1234
|
|
seed2 dw 1234
|
|
random PROC NEAR
|
|
push dx
|
|
mov dx,cs:seed2
|
|
mov ax,cs:seed1
|
|
shl ax,1
|
|
jnc @@1
|
|
xor ax,0f7ffh
|
|
@@1: mov cs:seed1,ax
|
|
sub dx,ax
|
|
xor ax,dx
|
|
rol dx,1
|
|
mov cs:seed2,dx
|
|
pop dx
|
|
ret
|
|
random ENDP
|
|
|
|
setborder PROC NEAR
|
|
push ax
|
|
mov dx,3dah
|
|
in al,dx
|
|
mov dx,3c0h
|
|
mov al,11h+20h
|
|
out dx,al
|
|
pop ax
|
|
out dx,al
|
|
ret
|
|
setborder ENDP
|
|
|
|
init_stars PROC NEAR
|
|
mov ax,13
|
|
int 10h
|
|
|
|
mov dx,3dah
|
|
in al,dx
|
|
mov dx,3c0h
|
|
xor al,al
|
|
REPT 16
|
|
out dx,al
|
|
out dx,al
|
|
inc al
|
|
ENDM
|
|
mov al,20h
|
|
out dx,al
|
|
|
|
mov dx,3d4h
|
|
mov al,9
|
|
out dx,al
|
|
inc dx
|
|
in al,dx
|
|
and al,127
|
|
out dx,al
|
|
|
|
mov ax,0a000h
|
|
mov es,ax
|
|
xor di,di
|
|
mov cx,32768
|
|
xor ax,ax
|
|
rep stosw
|
|
|
|
mov ah,43h
|
|
mov bx,32
|
|
int 67h
|
|
mov cs:emmhandle,dx
|
|
|
|
mov ah,41h
|
|
int 67h
|
|
mov cs:emmseg,bx
|
|
|
|
call clearsbu
|
|
|
|
mov cx,200
|
|
mov ax,0
|
|
mov dx,320/8
|
|
mov bx,OFFSET rows1
|
|
@@4: mov cs:[bx],ax
|
|
add ax,dx
|
|
add bx,2
|
|
loop @@4
|
|
|
|
mov cx,400
|
|
mov ax,0
|
|
mov dx,320/8
|
|
mov bx,OFFSET rows
|
|
@@4b: mov cs:[bx],ax
|
|
add ax,dx
|
|
add bx,2
|
|
loop @@4b
|
|
|
|
mov ax,cs
|
|
mov es,ax
|
|
|
|
mov di,OFFSET star
|
|
mov cx,STARS
|
|
@@3: mov al,cl
|
|
dec al
|
|
xor ah,ah
|
|
stosw
|
|
call random
|
|
and ax,1023
|
|
sub ax,512
|
|
stosw
|
|
call random
|
|
and ax,1023
|
|
sub ax,512
|
|
stosw
|
|
xor ax,ax
|
|
stosw
|
|
loop @@3
|
|
|
|
mov di,OFFSET muldivy
|
|
mov cx,256
|
|
mov bp,130
|
|
@@2b: mov dx,64
|
|
xor ax,ax
|
|
div bp
|
|
shr ax,1
|
|
stosw
|
|
add bp,4
|
|
loop @@2b
|
|
|
|
mov di,OFFSET muldivx
|
|
mov cx,256
|
|
mov bp,130
|
|
@@2c: mov dx,80 ;64
|
|
xor ax,ax
|
|
div bp
|
|
shr ax,1
|
|
stosw
|
|
add bp,4
|
|
loop @@2c
|
|
|
|
mov cs:starlimit,STARS
|
|
mov cs:starpalfade,0
|
|
|
|
mov cs:startxtopen,-256
|
|
mov cs:startxtclose,800
|
|
|
|
mov cx,100
|
|
@@sa: push cx
|
|
call staradd
|
|
pop cx
|
|
loop @@sa
|
|
ret
|
|
init_stars ENDP
|
|
|
|
deinit_stars PROC NEAR
|
|
mov ah,45h
|
|
mov dx,cs:emmhandle
|
|
int 67h
|
|
ret
|
|
deinit_stars ENDP
|
|
|
|
fetch4ax PROC NEAR
|
|
mov bx,ax
|
|
push ax
|
|
mov ax,4400h
|
|
shr bx,2
|
|
mov dx,cs:emmhandle
|
|
int 67h
|
|
pop ax
|
|
and ax,3
|
|
shl ax,12-4
|
|
add ax,cs:emmseg
|
|
ret
|
|
fetch4ax ENDP
|
|
|
|
clearsbu PROC NEAR
|
|
mov cx,128
|
|
mov ax,0
|
|
@@1: push cx
|
|
push ax
|
|
call fetch4ax
|
|
mov es,ax
|
|
mov cx,4096/4
|
|
xor eax,eax
|
|
xor di,di
|
|
rep stosd
|
|
pop ax
|
|
pop cx
|
|
inc ax
|
|
loop @@1
|
|
ret
|
|
clearsbu ENDP
|
|
|
|
staradd PROC NEAR
|
|
mov ax,cs:emmpage4
|
|
inc ax
|
|
and ax,127
|
|
mov cs:emmpage4,ax
|
|
call fetch4ax
|
|
mov es,ax
|
|
|
|
mov ax,cs
|
|
mov ds,ax
|
|
mov ax,ds:starlimit
|
|
or ax,ax
|
|
jz @@11
|
|
dec ax
|
|
mov ds:starlimit,ax
|
|
@@11: mov bp,STARS
|
|
mov si,OFFSET star
|
|
@@1: movzx bx,ds:[si]
|
|
sub bl,2
|
|
mov ds:[si],bl
|
|
jc @@4
|
|
cmp bp,cs:starlimit
|
|
jb @@2
|
|
shl bx,1
|
|
mov ax,ds:[si+4]
|
|
imul ds:muldivy[bx]
|
|
shld dx,ax,2
|
|
add dx,100
|
|
cmp dx,99
|
|
ja @@2
|
|
mov cx,dx
|
|
mov ax,ds:[si+2]
|
|
imul ds:muldivx[bx]
|
|
mov bx,cx
|
|
shld dx,ax,2
|
|
add dx,160
|
|
cmp dx,319
|
|
ja @@2
|
|
mov cl,dl
|
|
and cl,7
|
|
shr dx,3
|
|
shl bx,1
|
|
mov bx,ds:rows1[bx]
|
|
add bx,dx
|
|
mov ch,80h
|
|
shr ch,cl
|
|
or byte ptr es:[bx],ch
|
|
@@2: add si,8
|
|
dec bp
|
|
jnz @@1
|
|
ret
|
|
@@4: call random
|
|
and ax,1023
|
|
sub ax,512
|
|
mov cs:[si+2],ax
|
|
call random
|
|
and ax,1023
|
|
sub ax,512
|
|
mov cs:[si+4],ax
|
|
jmp @@2
|
|
staradd ENDP
|
|
|
|
risetext PROC NEAR
|
|
mov ax,cs:startxtopen
|
|
cmp ax,100
|
|
jge @@12
|
|
inc ax
|
|
mov cs:startxtopen,ax
|
|
@@12: mov dx,cs:startxtclose
|
|
cmp dx,0
|
|
jle @@21
|
|
dec dx
|
|
mov cs:startxtclose,dx
|
|
@@21: cmp dx,ax
|
|
jge @@22
|
|
mov ax,dx
|
|
@@22: ;ax=startxtuse
|
|
|
|
cmp ax,0
|
|
jg @@tcc
|
|
jmp @@tc0
|
|
@@tcc: cmp ax,1
|
|
jg @@tnz
|
|
mov ax,2
|
|
@@tnz: push ax
|
|
mov di,250
|
|
sub di,ax
|
|
mov cs:_nostar2,ax
|
|
mov ax,40
|
|
mul di
|
|
mov di,ax
|
|
inc di
|
|
mov cs:_nostar1,di
|
|
dec di
|
|
mov ax,SEG _textpic
|
|
mov ds,ax
|
|
mov si,040h
|
|
add si,cs:startxtp0
|
|
pop cx
|
|
dec cx
|
|
|
|
sub di,80
|
|
mov dx,3c4h
|
|
mov ax,0f02h
|
|
out dx,ax
|
|
xor eax,eax
|
|
zzz=0
|
|
REPT 80/4
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
add di,80
|
|
dec cx
|
|
jz @@tc0c
|
|
|
|
mov dx,3c4h
|
|
mov ax,0f02h
|
|
out dx,ax
|
|
mov eax,-1
|
|
zzz=0
|
|
REPT 40/4
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
add di,40
|
|
dec cx
|
|
jz @@tc0
|
|
dec cx
|
|
jz @@tc0b
|
|
|
|
mov dx,3ceh
|
|
mov ax,0400h
|
|
out dx,ax
|
|
mov ax,01h+400h+800h
|
|
out dx,ax
|
|
|
|
@@tc1: mov dx,3c4h
|
|
mov ax,0102h+400h+800h
|
|
out dx,ax
|
|
zzz=0
|
|
REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
add si,40
|
|
mov dx,3c4h
|
|
mov ax,0202h+400h+800h
|
|
out dx,ax
|
|
zzz=0
|
|
REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
add si,40
|
|
add di,40
|
|
dec cx
|
|
jz @@tc0b
|
|
jmp @@tc1
|
|
|
|
@@tc0b: mov dx,3ceh
|
|
mov ax,0001h
|
|
out dx,ax
|
|
|
|
mov dx,3c4h
|
|
mov ax,0f02h
|
|
out dx,ax
|
|
mov eax,-1
|
|
zzz=0
|
|
REPT 40/4
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
add di,40
|
|
|
|
dec di
|
|
mov cs:_nostar2,di
|
|
@@tc0: ret
|
|
@@tc0c: mov dx,3c4h
|
|
mov ax,0f02h
|
|
out dx,ax
|
|
xor eax,eax
|
|
zzz=0
|
|
REPT 80/4
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
ret
|
|
risetext ENDP
|
|
|
|
do_stars PROC NEAR
|
|
@@aga: mov al,0
|
|
;call setborder
|
|
|
|
mov dx,3d4h
|
|
mov ax,cs:starvram
|
|
cmp ax,0a000h
|
|
je @@sw1
|
|
mov cs:starvram,0a000h
|
|
mov ax,400ch
|
|
jmp @@sw0
|
|
@@sw1: mov cs:starvram,0a400h
|
|
mov ax,000ch
|
|
@@sw0: out dx,ax
|
|
call waitb
|
|
|
|
mov al,5
|
|
;call setborder
|
|
|
|
cmp cs:starpalfade,32
|
|
ja @@p1
|
|
|
|
mov bl,cs:starpalfade
|
|
inc bl
|
|
mov cs:starpalfade,bl
|
|
shl bl,3
|
|
jnc @@p2
|
|
mov bl,255
|
|
@@p2:
|
|
mov dx,3c8h
|
|
xor al,al
|
|
out dx,al
|
|
inc dx
|
|
|
|
mov al,0
|
|
out dx,al
|
|
mov al,0
|
|
out dx,al
|
|
mov al,0
|
|
out dx,al
|
|
|
|
mov al,5
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,35
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,35
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
|
|
mov al,30
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,50
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,50
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
|
|
mov al,61
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,61
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
mov al,61
|
|
mul bl
|
|
mov al,ah
|
|
out dx,al
|
|
|
|
;-----
|
|
|
|
mov al,0
|
|
out dx,al
|
|
mov al,0
|
|
out dx,al
|
|
mov al,0
|
|
out dx,al
|
|
|
|
mov al,10
|
|
out dx,al
|
|
mov al,20
|
|
out dx,al
|
|
mov al,35
|
|
out dx,al
|
|
|
|
mov al,20
|
|
out dx,al
|
|
mov al,30
|
|
out dx,al
|
|
mov al,45
|
|
out dx,al
|
|
|
|
mov al,30
|
|
out dx,al
|
|
mov al,40
|
|
out dx,al
|
|
mov al,60
|
|
out dx,al
|
|
@@p1:
|
|
mov ax,cs:starframe
|
|
inc ax
|
|
mov cs:starframe,ax
|
|
cmp ax,4
|
|
jne @@st1
|
|
mov cs:startxtp0,80
|
|
mov cs:startxtopen,-256-100
|
|
mov cs:startxtclose,800+100
|
|
@@st1: cmp ax,1200
|
|
jne @@st2
|
|
mov cs:startxtp0,101*80
|
|
mov cs:startxtopen,-256
|
|
mov cs:startxtclose,800
|
|
@@st2:
|
|
call risetext
|
|
|
|
call staradd
|
|
|
|
mov ax,es
|
|
mov ds,ax
|
|
xor si,si
|
|
|
|
mov dx,3c4h
|
|
mov ax,0102h
|
|
out dx,ax
|
|
|
|
mov ax,cs:starvram
|
|
mov es,ax
|
|
xor di,di
|
|
mov cx,100
|
|
@@3: zzz=0
|
|
cmp di,cs:_nostar1
|
|
jl @@3g
|
|
cmp di,cs:_nostar2
|
|
jg @@3g
|
|
jmp @@3s
|
|
@@3g: REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
@@3s: add si,40
|
|
add di,80
|
|
loop @@3
|
|
|
|
mov ax,cs:emmpage4
|
|
add ax,32
|
|
and ax,127
|
|
call fetch4ax
|
|
mov ds,ax
|
|
mov si,99*40
|
|
mov cx,100
|
|
@@5: zzz=0
|
|
cmp di,cs:_nostar1
|
|
jl @@5g
|
|
cmp di,cs:_nostar2
|
|
jg @@5g
|
|
jmp @@5s
|
|
@@5g: REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
@@5s: sub si,40
|
|
add di,80
|
|
loop @@5
|
|
|
|
mov dx,3c4h
|
|
mov ax,0202h
|
|
out dx,ax
|
|
|
|
mov di,40
|
|
mov ax,cs:emmpage4
|
|
add ax,64
|
|
and ax,127
|
|
call fetch4ax
|
|
mov ds,ax
|
|
xor si,si
|
|
mov cx,100
|
|
@@7: zzz=0
|
|
cmp di,cs:_nostar1
|
|
jl @@7g
|
|
cmp di,cs:_nostar2
|
|
jg @@7g
|
|
jmp @@7s
|
|
@@7g: REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
@@7s: add si,40
|
|
add di,80
|
|
loop @@7
|
|
|
|
mov ax,cs:emmpage4
|
|
add ax,96
|
|
and ax,127
|
|
call fetch4ax
|
|
mov ds,ax
|
|
mov si,99*40
|
|
mov cx,100
|
|
@@8: zzz=0
|
|
cmp di,cs:_nostar1
|
|
jl @@8g
|
|
cmp di,cs:_nostar2
|
|
jg @@8g
|
|
jmp @@8s
|
|
@@8g: REPT 40/4
|
|
mov eax,ds:[si+zzz]
|
|
mov es:[di+zzz],eax
|
|
zzz=zzz+4
|
|
ENDM
|
|
@@8s: sub si,40
|
|
add di,80
|
|
loop @@8
|
|
|
|
; mov dx,3c4h
|
|
; mov ax,0f02h
|
|
; out dx,ax
|
|
; mov cs:polysides,4
|
|
; mov dword ptr cs:polyxy[0], 10000h*10+10+01000000h
|
|
; mov dword ptr cs:polyxy[4], 10000h*310+10+01000000h
|
|
; mov dword ptr cs:polyxy[8], 10000h*310+390+01000000h
|
|
; mov dword ptr cs:polyxy[12],10000h*10+390+01000000h
|
|
; int 3
|
|
; call poly
|
|
|
|
mov bx,2
|
|
int 0fch
|
|
or ax,ax
|
|
jz @@aga
|
|
ret
|
|
do_stars ENDP
|