2011-01-30 12:17:50 +01:00
|
|
|
;
|
|
|
|
; MARIO for MENUET
|
|
|
|
;
|
|
|
|
; Compile with fasm
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
|
|
|
|
|
|
|
org 0x0
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
db 'MENUET01' ; header
|
|
|
|
dd 1 ; version
|
|
|
|
dd START ; program start
|
|
|
|
dd I_END ; image size
|
|
|
|
dd MEM ; size memory program
|
|
|
|
dd STACKTOP ; pointer to begin stack pos
|
|
|
|
dd 0
|
|
|
|
dd 0
|
|
|
|
|
|
|
|
res_base = loadp + 0x36 ; offset on array pixel in BMP file
|
|
|
|
res_width_px = 150
|
|
|
|
res_height_px = 35
|
|
|
|
res_line_size = (res_width_px*3 + 11b) and not 11b ; 150*3 + 2
|
|
|
|
|
|
|
|
|
|
|
|
block_width = 40
|
|
|
|
block_height = 40
|
|
|
|
block_line_size = block_width * 3
|
|
|
|
block_img_size = block_width * block_height * 3
|
|
|
|
block_draw_size = (block_width shl 16) + block_height ; for sysfn 7
|
|
|
|
block_count_pixel = block_width * block_height
|
|
|
|
|
|
|
|
mario_width = 50
|
|
|
|
mario_height = 70
|
|
|
|
mario_line_size = mario_width * 3
|
|
|
|
mario_img_size = mario_width * mario_height * 3
|
|
|
|
mario_draw_size = (mario_width shl 16) + mario_height
|
|
|
|
mario_count_pixel = mario_width * mario_height
|
|
|
|
|
|
|
|
|
|
|
|
wnd_pos_x = 80
|
|
|
|
wnd_pos_y = 20
|
|
|
|
|
|
|
|
wnd_header_size = 0x16
|
|
|
|
wnd_height = 9*block_height + wnd_header_size
|
|
|
|
wnd_width = 12*block_width + 1
|
|
|
|
|
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
START:
|
|
|
|
|
|
|
|
|
|
|
|
call load_graph
|
|
|
|
|
|
|
|
mov [marioxy], dword 300*65536+270
|
|
|
|
mov [leftright], dword 1
|
|
|
|
mov [velocity], dword 0xff
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
sta:
|
|
|
|
|
|
|
|
mov eax,field
|
2024-01-21 12:23:12 +01:00
|
|
|
mov dword[xxyy], 1*65536 + wnd_header_size
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
stl:
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte[eax], ' '
|
|
|
|
jnz @f
|
2011-01-30 12:17:50 +01:00
|
|
|
mov ebx,empty
|
2024-01-21 12:23:12 +01:00
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte[eax], '1'
|
|
|
|
jnz @f
|
2011-01-30 12:17:50 +01:00
|
|
|
mov ebx,build_1
|
2024-01-21 12:23:12 +01:00
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte[eax], '2'
|
|
|
|
jnz @f
|
2011-01-30 12:17:50 +01:00
|
|
|
mov ebx,build_2
|
2024-01-21 12:23:12 +01:00
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte[eax], '3'
|
|
|
|
jnz @f
|
2011-01-30 12:17:50 +01:00
|
|
|
mov ebx,build_3
|
2024-01-21 12:23:12 +01:00
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov edx,[xxyy]
|
|
|
|
|
|
|
|
mov eax,7 ; display image
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, block_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
int 0x40
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
add word [xxyy+2], block_width
|
|
|
|
cmp word [xxyy+2], block_width*12+1
|
|
|
|
jnz .nonewline
|
|
|
|
|
|
|
|
mov word [xxyy+2], 1
|
|
|
|
add word [xxyy+0], block_height
|
|
|
|
.nonewline:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
add eax,1
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp eax, field.end
|
|
|
|
jnz stl
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
; ********* MAIN LOOP ***********
|
|
|
|
|
|
|
|
|
|
|
|
wait_for_event:
|
|
|
|
|
|
|
|
call draw_mario
|
|
|
|
|
2012-06-07 15:13:15 +02:00
|
|
|
mov eax,11 ; check for event
|
2011-01-30 12:17:50 +01:00
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
cmp eax,1
|
|
|
|
jz red
|
|
|
|
cmp eax,2
|
|
|
|
jz key
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp eax,3 ; check pressed button
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz wait_for_event
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov eax, -1 ; close this program
|
|
|
|
int 0x40
|
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
red:
|
|
|
|
|
|
|
|
mov [mariomem],dword 0x0
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
jmp sta
|
|
|
|
|
|
|
|
key:
|
|
|
|
|
|
|
|
mov [mariomem],dword 0x0
|
2012-06-07 15:13:15 +02:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,2 ; ah <- key
|
|
|
|
int 0x40
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp ah,176 ; 'left'
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz key1
|
|
|
|
mov byte [leftright],byte 1
|
|
|
|
key1:
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp ah,179 ; 'right'
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz key2
|
|
|
|
mov byte [leftright],byte 4
|
|
|
|
key2:
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp ah,177 ; 'down'
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz key3
|
|
|
|
mov al,byte [leftright]
|
|
|
|
mov bl,al
|
|
|
|
cmp al,1
|
|
|
|
jnz key31
|
|
|
|
mov bl,2
|
|
|
|
key31:
|
|
|
|
cmp al,4
|
|
|
|
jnz key32
|
|
|
|
mov bl,3
|
|
|
|
key32:
|
|
|
|
mov byte [leftright],bl
|
|
|
|
key3:
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp ah,178 ; 'up'
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz key4
|
|
|
|
cmp [velocity],dword 0xff
|
|
|
|
jnz key4
|
|
|
|
mov [velocity],dword 0x110
|
|
|
|
key4:
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
; this code using for fix defects drawing(draw in caption area)
|
|
|
|
mov eax,71 ;draw caption
|
|
|
|
mov ebx,1
|
|
|
|
mov ecx,title
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
jmp sta ;draw field
|
|
|
|
|
2012-06-07 15:13:15 +02:00
|
|
|
;jmp wait_for_event
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
load_graph:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
; empty block init - set in 0x00500f color
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edi,empty
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, block_count_pixel
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,0x00500f
|
|
|
|
cld
|
2024-01-21 12:23:12 +01:00
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
mov [edi],eax
|
2024-01-21 12:23:12 +01:00
|
|
|
add edi, 3
|
|
|
|
loop @b
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov [width], block_line_size
|
|
|
|
mov [width_move], block_width/2
|
|
|
|
mov [height_move], block_height/2
|
2011-01-30 12:17:50 +01:00
|
|
|
mov [imul_esi],20*3
|
2024-01-21 12:23:12 +01:00
|
|
|
mov [base], res_base + 3*res_width_px * 34 +3*98-1
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
mov esi,0
|
|
|
|
mov edi,build_1
|
|
|
|
call convert
|
|
|
|
|
|
|
|
mov esi,1
|
|
|
|
mov edi,build_2
|
|
|
|
call convert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; build_3
|
|
|
|
mov edi,build_3
|
2024-01-21 12:23:12 +01:00
|
|
|
mov esi, res_base + 230*3+3*300*69
|
|
|
|
mov ecx, block_height
|
2011-01-30 12:17:50 +01:00
|
|
|
build_3l:
|
|
|
|
pusha
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, block_line_size
|
2011-01-30 12:17:50 +01:00
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
popa
|
|
|
|
sub esi,300*3
|
2024-01-21 12:23:12 +01:00
|
|
|
add edi, block_line_size
|
2011-01-30 12:17:50 +01:00
|
|
|
loop build_3l
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov [width], mario_line_size
|
|
|
|
mov [width_move], mario_width/2
|
|
|
|
mov [height_move], mario_height/2
|
2011-01-30 12:17:50 +01:00
|
|
|
mov [imul_esi],25*3
|
2024-01-21 12:23:12 +01:00
|
|
|
mov [base], res_base + 3*res_width_px*34 + 68
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
mov esi,0
|
|
|
|
mov edi,mario_1
|
|
|
|
call convert
|
|
|
|
|
|
|
|
mov esi,1
|
|
|
|
mov edi,mario_2
|
|
|
|
call convert
|
|
|
|
|
|
|
|
mov esi,2
|
|
|
|
mov edi,mario_3
|
|
|
|
call convert
|
|
|
|
|
|
|
|
jmp mario_mirror
|
|
|
|
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
; copy in [edi], image x2
|
2011-01-30 12:17:50 +01:00
|
|
|
convert:
|
|
|
|
|
|
|
|
imul esi,[imul_esi]
|
|
|
|
add esi,[base] ; loadp+18*3+3*150*34+68
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov eax, [width]
|
|
|
|
shl eax, 1 ; *2
|
|
|
|
mov ecx, [height_move] ;?
|
|
|
|
|
|
|
|
.new_line:
|
2011-01-30 12:17:50 +01:00
|
|
|
pusha
|
|
|
|
mov ecx,[width_move]
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
.putpix: ; set 4 pixel: edi, edi+3, edi+width, edi+width+3
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,[esi]
|
|
|
|
mov [edi+00],ax
|
|
|
|
mov [edi+03],ax
|
|
|
|
mov ebx,[width]
|
|
|
|
mov [edi+ebx],ax
|
|
|
|
add ebx,3
|
|
|
|
mov [edi+ebx],ax
|
|
|
|
shr eax,16
|
|
|
|
mov [edi+02],al
|
|
|
|
dec ebx
|
|
|
|
mov [edi+ebx],al
|
|
|
|
mov [edi+05],al
|
|
|
|
add ebx,3
|
|
|
|
mov [edi+ebx],al
|
|
|
|
add esi,3
|
|
|
|
add edi,6
|
2024-01-21 12:23:12 +01:00
|
|
|
loop .putpix
|
2011-01-30 12:17:50 +01:00
|
|
|
popa
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
sub esi,res_line_size
|
|
|
|
add edi, eax
|
|
|
|
loop .new_line
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
ret
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
imul_esi dd 0
|
|
|
|
base dd 0
|
|
|
|
width dd 0
|
|
|
|
width_move dd 0
|
|
|
|
height_move dd 0
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mario_mirror:
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
; mario_green
|
|
|
|
mov edi,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_count_pixel
|
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
mov [edi],dword 0x00500f
|
2024-01-21 12:23:12 +01:00
|
|
|
add edi, 3
|
|
|
|
loop @b
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
; mario_4 - reverse mario_1
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov edi, mario_4
|
|
|
|
mov esi, mario_1 + (mario_width - 1)*3
|
|
|
|
mov ecx, mario_height
|
2011-01-30 12:17:50 +01:00
|
|
|
m4l1:
|
|
|
|
pusha
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_width
|
2011-01-30 12:17:50 +01:00
|
|
|
m4l2:
|
|
|
|
mov eax,[esi]
|
|
|
|
mov [edi],ax
|
|
|
|
shr eax,16
|
|
|
|
mov [edi+2],al
|
|
|
|
add edi,3
|
|
|
|
sub esi,3
|
|
|
|
loop m4l2
|
|
|
|
popa
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
add esi, mario_width*3
|
|
|
|
add edi, mario_width*3
|
2011-01-30 12:17:50 +01:00
|
|
|
loop m4l1
|
|
|
|
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
; mario_5 - reverse mario_2
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov edi, mario_5
|
|
|
|
mov esi, mario_2 + (mario_width - 1)*3
|
|
|
|
mov ecx, mario_height
|
2011-01-30 12:17:50 +01:00
|
|
|
m5l1:
|
|
|
|
pusha
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_width
|
2011-01-30 12:17:50 +01:00
|
|
|
m5l2:
|
|
|
|
mov eax,[esi]
|
|
|
|
mov [edi],ax
|
|
|
|
shr eax,16
|
|
|
|
mov [edi+2],al
|
|
|
|
add edi,3
|
|
|
|
sub esi,3
|
|
|
|
loop m5l2
|
|
|
|
popa
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
add esi, mario_width*3
|
|
|
|
add edi, mario_width*3
|
2011-01-30 12:17:50 +01:00
|
|
|
loop m5l1
|
|
|
|
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
; mario_6 - reverse mario_3
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov edi, mario_6
|
|
|
|
mov esi, mario_3 + (mario_width - 1)*3
|
|
|
|
mov ecx, mario_height
|
2011-01-30 12:17:50 +01:00
|
|
|
m6l1:
|
|
|
|
pusha
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_width
|
2011-01-30 12:17:50 +01:00
|
|
|
m6l2:
|
|
|
|
mov eax,[esi]
|
|
|
|
mov [edi],ax
|
|
|
|
shr eax,16
|
|
|
|
mov [edi+2],al
|
|
|
|
add edi,3
|
|
|
|
sub esi,3
|
|
|
|
loop m6l2
|
|
|
|
popa
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
add esi, mario_width*3
|
|
|
|
add edi, mario_width*3
|
2011-01-30 12:17:50 +01:00
|
|
|
loop m6l1
|
|
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
advance_mario:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,[marioxy] ; wherey ?
|
|
|
|
and eax,65535
|
|
|
|
add eax,40+21
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,40
|
|
|
|
div ebx
|
|
|
|
mov [marioy],eax
|
|
|
|
|
|
|
|
mov eax,[marioxy] ; wherex ?
|
|
|
|
shr eax,16
|
|
|
|
add eax,20
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,40
|
|
|
|
div ebx
|
|
|
|
mov [mariox],eax
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp byte [leftright],byte 1 ; go left
|
|
|
|
jnz noleft
|
|
|
|
mov eax,[marioxy]
|
|
|
|
xor edx,edx
|
|
|
|
shr eax,16
|
|
|
|
sub eax,7
|
|
|
|
mov ebx,40
|
|
|
|
div ebx
|
|
|
|
add eax,field+7*12
|
|
|
|
cmp [eax],byte ' '
|
|
|
|
jz mgoleft
|
|
|
|
mov byte [leftright],byte 2
|
|
|
|
jmp noleft
|
|
|
|
mgoleft:
|
|
|
|
mov eax,[marioxy]
|
|
|
|
sub eax,6*65536
|
|
|
|
mov [marioxy],eax
|
|
|
|
noleft:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp byte [leftright],byte 4 ; go right
|
|
|
|
jnz noright
|
|
|
|
mov eax,[marioxy]
|
|
|
|
xor edx,edx
|
|
|
|
shr eax,16
|
|
|
|
add eax,54
|
|
|
|
mov ebx,40
|
|
|
|
div ebx
|
|
|
|
add eax,field+7*12
|
|
|
|
cmp byte [eax],byte ' '
|
|
|
|
jz mgoright
|
|
|
|
mov byte [leftright],byte 3
|
|
|
|
jmp noright
|
|
|
|
mgoright:
|
|
|
|
mov eax,[marioxy]
|
|
|
|
add eax,6*65536
|
|
|
|
mov [marioxy],eax
|
|
|
|
noright:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmp [velocity],dword 0x100 ; jump up ?
|
|
|
|
jbe nojumpup
|
|
|
|
mov ebx,[velocity]
|
|
|
|
sub ebx,1
|
|
|
|
cmp ebx,0x100
|
|
|
|
jnz no0x100
|
|
|
|
mov [velocity],dword 0xff
|
|
|
|
jmp nojumpup
|
|
|
|
no0x100:
|
|
|
|
mov [velocity],ebx
|
|
|
|
sub ebx,0x100-1
|
|
|
|
mov eax,[marioxy]
|
|
|
|
sub ax,bx
|
|
|
|
mov [marioxy],eax
|
|
|
|
nojumpup:
|
|
|
|
|
|
|
|
call mario_environment
|
|
|
|
|
|
|
|
cmp [velocity],dword 0x100 ; jump -> down ?
|
|
|
|
jge nojumpdown
|
|
|
|
mov eax,[marioy]
|
|
|
|
cmp eax,[mario_below]
|
|
|
|
jb yesgd
|
|
|
|
mov [velocity],dword 0xff
|
|
|
|
mov eax,[marioxy]
|
|
|
|
mov eax,[mario_below]
|
|
|
|
sub eax,1
|
|
|
|
mov ebx,40
|
|
|
|
mul ebx
|
|
|
|
sub eax,10
|
|
|
|
mov word [marioxy],ax
|
|
|
|
jmp nojumpdown
|
|
|
|
yesgd:
|
|
|
|
mov ebx,[velocity]
|
|
|
|
sub ebx,1
|
|
|
|
mov [velocity],ebx
|
|
|
|
mov eax,[marioxy]
|
|
|
|
add ax,0xff
|
|
|
|
sub ax,bx
|
|
|
|
mov [marioxy],eax
|
|
|
|
nojumpdown:
|
|
|
|
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
marioy dd 0x0
|
|
|
|
|
|
|
|
mariox dd 0x0
|
|
|
|
|
|
|
|
mario_below dd 5
|
|
|
|
|
|
|
|
|
|
|
|
mario_environment:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,[marioy]
|
|
|
|
mov ebx,12
|
|
|
|
mul ebx
|
|
|
|
add eax,[mariox]
|
|
|
|
add eax,field
|
|
|
|
|
|
|
|
cmp [eax],byte ' '
|
|
|
|
jz me_ok
|
|
|
|
|
|
|
|
mov eax,[marioy]
|
|
|
|
mov [mario_below],eax
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
me_ok:
|
|
|
|
|
|
|
|
mov [mario_below],dword 100
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
mario_delay:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
mov eax,5 ;pause
|
2011-01-30 12:17:50 +01:00
|
|
|
mov ebx,2
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_mario:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,[mariomem]
|
|
|
|
cmp eax,[marioxy]
|
2024-01-21 12:23:12 +01:00
|
|
|
jnz @f
|
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
2012-06-07 15:13:15 +02:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
popa
|
|
|
|
ret
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
@@:
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,[marioxy]
|
|
|
|
mov [mariomem],eax
|
|
|
|
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte [leftright], 1 ; go left
|
|
|
|
jz m_left
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte [leftright], 4 ; go right
|
|
|
|
jz m_right
|
2011-01-30 12:17:50 +01:00
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
cmp byte [leftright], 2 ; stand left
|
2011-01-30 12:17:50 +01:00
|
|
|
jnz no_r_still
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_1
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
popa
|
|
|
|
ret
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
no_r_still:
|
|
|
|
cmp byte [leftright],byte 3 ; stand right
|
|
|
|
jnz no_l_still
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_4
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
no_l_still:
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
m_left:
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_1
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_2
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_3
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_2
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
m_right:
|
|
|
|
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_4
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_5
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_6
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_green
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call advance_mario
|
|
|
|
mov eax,7
|
|
|
|
mov ebx,mario_5
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ecx, mario_draw_size
|
2011-01-30 12:17:50 +01:00
|
|
|
mov edx,[marioxy]
|
|
|
|
int 0x40
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
call mario_delay
|
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
2024-01-21 12:23:12 +01:00
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
draw_window:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,12 ; tell os about redraw
|
|
|
|
mov ebx,1
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
mov eax,0 ; define and draw window
|
2024-01-21 12:23:12 +01:00
|
|
|
mov ebx, (wnd_pos_x shl 16) + wnd_width ;80*65536+480+1
|
|
|
|
mov ecx, (wnd_pos_y shl 16) + wnd_height ;20*65536+382
|
|
|
|
mov edx,0x5466AA88 ; 4 type window + title + no draw work space
|
2012-06-07 15:13:15 +02:00
|
|
|
mov edi,title
|
2011-01-30 12:17:50 +01:00
|
|
|
int 0x40
|
|
|
|
|
|
|
|
mov eax,12 ; tell os about redraw end
|
|
|
|
mov ebx,2
|
|
|
|
int 0x40
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
; DATA SECTION
|
|
|
|
|
2012-06-07 15:13:15 +02:00
|
|
|
title:
|
|
|
|
db 'SUPER MARIO - USE ARROW KEYS', 0
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
field:
|
|
|
|
|
|
|
|
db '1 1'
|
|
|
|
db '1 1'
|
|
|
|
db '111 111'
|
|
|
|
db '1 1'
|
|
|
|
db '1 1'
|
|
|
|
db '1 111111 1'
|
|
|
|
db '1 1'
|
|
|
|
db '1 1'
|
|
|
|
db '222222222222'
|
2024-01-21 12:23:12 +01:00
|
|
|
.end:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
xxyy dd 0x0
|
|
|
|
|
|
|
|
marioxy dd 0x0
|
|
|
|
|
|
|
|
mariomem dd 0x0
|
|
|
|
|
|
|
|
leftright dd 0x0
|
|
|
|
|
|
|
|
velocity dd 0x0
|
|
|
|
|
2024-01-21 12:23:12 +01:00
|
|
|
align 16
|
|
|
|
loadp:
|
|
|
|
file 'MARIOALL.BMP'
|
|
|
|
|
2011-01-30 12:17:50 +01:00
|
|
|
I_END:
|
2024-01-21 12:23:12 +01:00
|
|
|
|
|
|
|
align 0x1000
|
|
|
|
|
|
|
|
empty: rb block_img_size
|
|
|
|
build_1: rb block_img_size
|
|
|
|
build_2: rb block_img_size
|
|
|
|
build_3: rb block_img_size
|
|
|
|
|
|
|
|
align 0x1000
|
|
|
|
|
|
|
|
mario_1: rb mario_img_size
|
|
|
|
mario_2: rb mario_img_size
|
|
|
|
mario_3: rb mario_img_size
|
|
|
|
mario_4: rb mario_img_size
|
|
|
|
mario_5: rb mario_img_size
|
|
|
|
mario_6: rb mario_img_size
|
|
|
|
mario_green: rb mario_img_size
|
|
|
|
|
|
|
|
|
|
|
|
rb 4096
|
|
|
|
STACKTOP:
|
|
|
|
MEM:
|
2011-01-30 12:17:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|