#make_boot#
org 7c00h
use16
push ds
push ds
push ds
jmp start
e:
ret
e1:
pop ds
ret
put_pix_box:
push ax
push bx
push cx
push dx
push dx
mov ax, 8000h
mov es, ax
mov ax,320
mul cx
pop dx
add ax,dx
mov di,ax
mov al,[boxc]
stosb
pop dx
pop cx
pop bx
pop ax
ret
put_box_new_line:
inc cx
cmp cx,bx
jz e
dec cx
inc cx
mov dx,[bxr]
jmp ppb0
put_box:
mov [bxr],dx
ppb0:
call put_pix_box
cmp cx,bx
jz e
cmp ax,dx
jz put_box_new_line
inc dx
jmp ppb0
;; AX - x2
;; DX - x1
;; CX - y1
;; BX - y2
boxc db 0
bxr dw 0
put_pix:
push ax
push dx
mov ax, 8000h
mov es, ax
mov ax,320
mul cx
pop dx
add ax,dx
mov di,ax
pop ax
stosb
ret
fill_disp:
push ds
push ax
mov ax,8000h
mov ds,ax
pop ax
mov ah,al
mov bx,0000h
mov [bx],ax
p0:
add bx,2
mov [bx],ax
cmp bx,0FFFEh
jz e1
jmp p0
e_draw:
pop dx
pop bx
mov [x],dx
mov [y],bx
pop ds
ret
draw_sprite_nexline:
inc si
mov al,00h
cmp al,[bx+si]
jz e_draw
dec si
add [y],01h
mov ax,[x_ret]
mov [x],ax
inc si
jmp draw_sprite_1
draw_sprite:
push ds
mov ax,bx
mov dx,[x]
mov bx,[y]
push bx
push dx
mov bx,ax
mov ax,[x]
mov [x_ret],ax
mov si,0000h
draw_sprite_1:
mov ax, 8000h
mov es, ax
mov ax,320
mov cx,[y]
mul cx
mov dx,[x]
add ax,dx
mov di,ax
mov al,[bx+si]
cmp al,255
jz draw_sprite_2
stosb
draw_sprite_2:
inc si
mov al,00h
cmp al,[bx+si]
jz draw_sprite_nexline
add [x],1
jmp draw_sprite_1
draw_display:
push ds
mov di,0000h
mov bx,0000h
mov si,0000h
mov ax,8000h
mov ds,ax
mov ax,0A000h
mov es,ax
draw_display_1:
cmp bx,0FFFFh
jz draw_display_2
mov al,[bx]
stosb
inc bx
jmp draw_display_1
draw_display_2:
jz e1
color_clear db 0
clor_clear db 0
move_left:
cmp [x1],70+2+20
jbe p3
sub [x1],2
jmp p3
move_right:
cmp [x1],140+80-13+20-1
jae p3
add [x1],2
jmp p3
fsg:
mov ah,00h
int 1Ah
mov [commet2],01h
mov [commet_2_x],140
mov [commet_2_y],00h
mov [first_start],01h
mov [commet1],01h
mov [commet_1_x],0
mov [commet_1_y],120
jmp fsg1
wait_spawn dw 0
commet1 db 0
commet2 db 0
new_cometa_1:
mov [commet_1_y],0
mov ax,[x1]
mov [commet_1_x],ax
jmp commets_con
cometa_1:
cmp [commet_1_y],195
ja new_cometa_1
mov ax,[commet_1_y]
add ax,03h
mov [commet_1_y],ax
mov ax,[commet_1_x]
mov cx,[commet_1_y]
mov [x],ax
mov [y],cx
mov si,0000h
mov di,si
mov bx,commet1_sprite
call draw_sprite
jmp commets_con
new_cometa_2:
mov [commet_2_y],0
mov ax,[x1]
mov [commet_2_x],ax
ret
cometa_2:
cmp [commet_2_y],195
ja new_cometa_2
mov ax,[commet_2_y]
add ax,03h
mov [commet_2_y],ax
mov ax,[commet_2_x]
mov cx,[commet_2_y]
mov [x],ax
mov [y],cx
mov si,0000h
mov di,si
mov bx,commet2_sprite
call draw_sprite
ret
commets:
cmp [commet1],01h
jz cometa_1
commets_con:
cmp [commet2],01h
jz cometa_2
ret
commets_draw:
mov ax,[commet_2_x]
mov cx,[commet_2_y]
mov [x],ax
mov [y],cx
mov si,0000h
mov di,si
mov bx,commet2_sprite
call draw_sprite
mov ax,[commet_1_x]
mov cx,[commet_1_y]
mov [x],ax
mov [y],cx
mov si,0000h
mov di,si
mov bx,commet1_sprite
call draw_sprite
ret
colision_1:
mov ax,[commet_1_y]
mov cx,[y1]
add cx,18
cmp ax,cx
ja e
mov ax,[commet_1_x]
mov cx,[commet_1_y]
cmp cx,150-8
jb e
add ax,08h
cmp ax,[x1]
jnae e
sub ax,08h
mov dx,[x1]
add dx,13
cmp ax,dx
jnbe e
jmp foul
colision_2:
mov ax,[commet_2_y]
mov cx,[y1]
add cx,18
cmp ax,cx
ja e
mov ax,[commet_2_x]
mov cx,[commet_2_y]
cmp cx,150-07h
jb e
add ax,07h
cmp ax,[x1]
jnae e
sub ax,09h
mov dx,[x1]
add dx,13
cmp ax,dx
jnbe e
jmp foul
foul:
mov [x],160
mov [y],100
mov bx,fouls
mov di,0000h
mov si,di
call draw_sprite
call draw_display
foul0:
mov ah,0
int 16h
jmp foul0
commets_colision:
call colision_1
call colision_2
ret
start:
mov ah,00h
int 1Ah
mov [wait_commets],dx
cld
mov ah, 0
mov al, 13h
int 10h
mov [x],160-23
mov [y],100-3
mov bx,pak
mov di,0000h
mov si,di
call draw_sprite
call draw_display
mov ah,0
int 16h
p4:
mov ah,01h
int 16h
jz p7
mov ah,00h
int 16h
pkr0:
cmp al,'a'
jz move_left
cmp al,'d'
jz move_right
cmp ah,1Ch
jnz p3
p7:
p3:
cmp [first_start],00h
jz fsg
fsg1:
mov di,0000h
mov si,0000h
mov al,11h
call fill_disp
mov ax,[x1]
mov cx,[y1]
mov [x],ax
mov [y],cx
mov di,0000h
mov si,0000h
mov bx,sprite ;; Offset of sprite begin
call draw_sprite ;; Draw sprite
;; call draw_titles
mov ah,0
int 1Ah
mov [wait_commets],dx
pcomm1:
mov ah,00h
int 1Ah
cmp dx,[wait_commets]
jz pcomm1
call commets
pcomm:
call commets_draw
mov di,0000h
mov si,di
mov ax,240
mov dx,89
mov cx,0
mov bx,20
mov [boxc],11h
call put_box
mov di,0000h
mov si,di
mov ax,71+20
mov dx,70+20
mov cx,0
mov bx,200
mov [boxc],02h
call put_box
mov di,0000h
mov si,di
mov ax,140+80+20
mov dx,139+80+20
mov cx,0
mov bx,200
mov [boxc],02h
call put_box
call commets_colision
;; _________________
call draw_display ;; Display all
jmp p4
;; AX - x2
;; DX - x1
;; CX - y1
;; BX - y2
wait_commets dw 0
;; ------------------------------------------
x_ret dw 0 ;-
x dw 0 ;-
y dw 0 ;-
;-
tx dw 0 ;-
ty dw 0 ;-
;; Global offsets for procedure draw_sprite;-
;------------------------------------------;-
x1 dw 160 ;; player
y1 dw 150 ;; player
fouls:
db 28h,255,255,28h,28h,28h,255,28h,28h,255,28h,28h,0
db 28h,255,255,28h,255,28h,255,28h,255,255,28h,255,0
db 28h,255,255,28h,255,28h,255,28h,28h,255,28h,28h,0
db 28h,255,255,28h,255,28h,255,255,28h,255,255,28h,0
db 28h,28h,255,28h,28h,28h,255,28h,28h,255,28h,28h,0,0
commet_1_x dw 90
commet_1_y dw 199
commet_2_x dw 100
commet_2_y dw 20
first_start db 0
commet1_sprite:
db 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0
db 255,255,255,255,15,255,255,255,255,255,255,255,255,255,255,0
db 255,255,255,15,15,15,15,15,15,15,255,255,255,255,255,0
db 255,255,255,15,15,15,15,15,15,15,15,15,255,255,255,0
db 255,255,15,15,15,15,15,15,15,15,15,15,255,255,255,0
db 255,255,255,15,15,15,15,15,15,15,15,255,255,255,255,0
db 255,255,255,255,255,15,15,15,15,255,255,255,255,255,255,0
db 255,255,255,255,255,255,15,15,255,255,255,255,255,255,255,0,0
commet2_sprite:
db 255,255,255,255,255,255,255,255,255,0
db 255,255,15,15,15,255,255,255,255,0
db 255,255,15,15,15,15,15,255,255,0
db 255,15,15,15,15,15,15,15,255,0
db 255,15,15,15,15,15,15,255,255,0
db 255,255,15,15,15,15,255,255,255,0
db 255,255,255,255,15,255,255,255,255,0,0
sprite:
db 255,255,255,255,255,04h,255,04h,255,255,255,255,255,0
db 255,255,255,255,255,17h,255,17h,255,255,255,255,255,0
db 255,255,255,255,17h,17h,255,17h,17h,255,255,255,255,0
db 255,255,255,255,17h,17h,255,17h,17h,255,255,255,255,0
db 255,255,255,255,17h,17h,255,17h,17h,255,255,255,255,0
db 255,255,255,17h,17h,17h,255,17h,17h,17h,255,255,255,0
db 255,255,255,17h,17h,20h,20h,20h,17h,17h,255,255,255,0
db 255,255,255,17h,17h,20h,20h,20h,17h,17h,255,255,255,0
db 255,255,17h,17h,17h,20h,20h,20h,17h,17h,17h,255,255,0
db 255,255,17h,17h,17h,15h,20h,15h,17h,17h,17h,255,255,0
db 255,17h,17h,17h,17h,15h,17h,15h,17h,17h,17h,17h,255,0
db 255,17h,17h,17h,17h,15h,17h,15h,17h,17h,17h,17h,255,0
db 255,17h,17h,17h,17h,15h,17h,15h,17h,17h,17h,17h,255,0
db 17h,17h,17h,17h,17h,15h,17h,15h,17h,17h,17h,17h,17h,0
db 17h,17h,17h,17h,15h,15h,17h,15h,15h,17h,17h,17h,17h,0
db 17h,17h,17h,15h,17h,15h,17h,15h,17h,15h,17h,17h,17h,0
db 255,255,15h,17h,17h,15h,17h,15h,17h,17h,15h,255,255,0
db 255,255,28h,28h,28h,255,255,255,28h,28h,28h,255,255,0,0
pak:
db 15,15,15,255,15,15,15,255,15,15,15,255,15,15,15,255,15,15,15,255,255,15,15,15,255,15,255,255,15,255,15,255,15,255,255,15,255,255,15,255,15,15,15,255,15,255,15,0
db 15,255,15,255,15,255,15,255,15,255,255,255,15,255,255,255,15,255,255,255,255,15,255,15,255,15,15,255,15,255,15,255,15,255,255,15,255,15,255,255,15,255,255,255,15,255,15,0
db 15,15,15,255,15,15,15,255,15,15,15,255,15,15,15,255,15,15,15,255,255,15,255,15,255,15,15,255,15,255,15,15,15,255,255,15,15,255,255,255,15,15,15,255,255,15,255,0
db 15,255,255,255,15,15,255,255,15,255,255,255,255,255,15,255,255,255,15,255,255,15,15,15,255,15,255,15,15,255,255,15,255,255,255,15,255,15,255,255,15,255,255,255,255,15,255,0
db 15,255,255,255,15,255,15,255,15,255,255,255,255,255,15,255,255,255,15,255,255,15,255,15,255,15,255,15,15,255,255,15,255,255,255,15,255,255,15,255,15,255,255,255,255,15,255,0
db 15,255,255,255,15,255,15,255,15,15,15,255,15,15,15,255,15,15,15,255,255,15,255,15,255,15,255,255,15,255,255,15,255,255,255,15,255,255,15,255,15,15,15,255,255,15,255,0,0
;; New line of sprite - ,0
;; End of sprite - ,0,0
;; 16 - black
;; 25 - white_black
;; 30 - white
;; 43 - yellow
;; 40 - red
;; 32 - blue
org 7c00h
use16
push ds
push ds
push ds
jmp start
e:
ret
put_pix:
push ax
push dx
mov ax, 8000h
mov es, ax
mov ax,320
mul cx
pop dx
add ax,dx
mov di,ax
pop ax
stosb
ret
fill_disp:
push ax
mov ax,8000h
mov ds,ax
pop ax
mov ah,al
mov bx,0000h
mov [bx],ax
p0:
add bx,2
mov [bx],ax
cmp bx,0FFFEh
jz e
jmp p0
e_draw:
pop dx
pop bx
mov [x],dx
mov [y],bx
ret
draw_sprite_nexline:
inc si
mov al,00h
cmp al,[bx+si]
jz e_draw
dec si
add [y],01h
mov ax,[x_ret]
mov [x],ax
inc si
jmp draw_sprite_1
draw_sprite:
mov ax,bx
mov dx,[x]
mov bx,[y]
push bx
push dx
mov bx,ax
mov ax,[x]
mov [x_ret],ax
mov si,0000h
draw_sprite_1:
mov ax, 8000h
mov es, ax
mov ax,320
mov cx,[y]
mul cx
mov dx,[x]
add ax,dx
mov di,ax
mov al,[bx+si]
cmp al,255
jz draw_sprite_2
stosb
draw_sprite_2:
inc si
mov al,00h
cmp al,[bx+si]
jz draw_sprite_nexline
add [x],1
jmp draw_sprite_1
draw_display:
mov di,0000h
mov bx,0000h
mov si,0000h
mov ax,8000h
mov ds,ax
mov ax,0A000h
mov es,ax
draw_display_1:
cmp bx,0FFFFh
jz draw_display_2
mov al,[bx]
stosb
inc bx
jmp draw_display_1
draw_display_2:
jz e
left_sprite:
sub [x],02h
jmp p3
right_sprite:
add [x],02h
jmp p3
up_sprite:
sub [y],02h
jmp p3
down_sprite:
add [y],02h
jmp p3
start:
cld
mov ah, 0
mov al, 13h
int 10h
p4:
mov ah,01h
int 16h
jz p7
mov ah,00h
int 16h
cmp al,'a'
jz left_sprite
cmp al,'d'
jz right_sprite
cmp al,'w'
jz up_sprite
cmp al,'s'
jz down_sprite
p7:
p3:
mov di,0000h
mov si,0000h
mov al,200
push ds
call fill_disp
pop ds
mov di,0000h
mov si,0000h
mov bx,sprite
push ds
call draw_sprite
pop ds
push ds
call draw_display
pop ds
jmp p4
x_ret dw 0
x dw 160
y dw 100
sprite db 15,15,15,15,15,15,15,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,255,15,15,15,40,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,15,15,15,15,15,15,15,0,15,15,40,40,40,40,40,15,15,0,15,15,15,15,15,15,15,15,15,0,0
mov ax,cs
mov ds,ax
mov ax,ds
mov [sg],ax
;; ...
mov ds,[sg]
#make_boot#
org 7c00h
use16
mov ax,ds
mov [cssegment],ax
jmp start
cssegment dw 0
e:
mov ax,[cssegment]
mov ds,ax
mov es,ax
ret
put_clear:
mov ax,8000h
mov ds,ax
mov al,200
mov ah,al
mov bx,0000h
put_clear0:
mov [bx],ax
cmp bx,0FFFEh
jz e
add bx,02h
jmp put_clear0
put_sprite:
mov ax,[cssegment]
mov ds,ax
mov ax,8000h
mov es,ax
mov di,420
mov bx,sprite
put_sprite0:
mov al,[bx]
cmp al,00h
jz e
mov cl,al
push ds
mov ax,8000h
mov ds,ax
mov al,cl
mov [di],al
pop ds
inc bx
inc di
jmp put_sprite0
draw:
mov ax,8000h
mov ds,ax
mov ax,0A000h
mov es,ax
mov bx,0000h
mov di,0000h
draw0:
mov al,[bx]
mov cl,al
push ds
mov ax,0A000h
mov ds,ax
mov al,cl
mov [di],al
pop ds
cmp bx,0FFFFh
jz e
inc bx
inc di
jmp draw0
start:
cld
call e
mov ax,0013h
int 10h
call put_clear
cld
call put_sprite
cld
call draw
mov ah,0
int 16h
db 250
db 250
db 250
db 200
db 200
db 200
sprite db 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,0
mov ax,0000h
mov sp,ax
mov ss, ax
org 7c00h
use16
jmp start
e:
mov ax,cs
mov ds,ax
mov es,ax
ret
put_clear:
mov ax,8000h
mov ds,ax
mov al,200
mov ah,al
mov bx,0000h
put_clear0:
mov [bx],ax
cmp bx,0FFFEh
jz e
add bx,02h
jmp put_clear0
put_sprite:
mov ax,cs
mov ds,ax
mov ax,8000h
mov es,ax
mov di,420
mov bx,sprite
put_sprite0:
mov al,[bx]
cmp al,00h
jz e
mov cl,al
push ds
mov ax,8000h
mov ds,ax
mov al,cl
mov [di],al
pop ds
inc bx
inc di
jmp put_sprite0
draw:
mov ax,8000h
mov ds,ax
mov ax,0A000h
mov es,ax
mov bx,0000h
mov di,0000h
draw0:
mov al,[bx]
mov cl,al
push ds
mov ax,0A000h
mov ds,ax
mov al,cl
mov [di],al
pop ds
cmp bx,0FFFFh
jz e
inc bx
inc di
jmp draw0
start:
cld
call e
mov ax,0013h
int 10h
call put_clear
cld
call put_sprite
cld
call draw
mov ah,0
int 16h
db 250
db 250
db 250
db 200
db 200
db 200
sprite db 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,0