2021-02-12 16:39:51 +00:00
|
|
|
; Second TH05 .PI assembly translation unit.
|
|
|
|
|
|
|
|
.386
|
2024-01-24 09:18:02 +00:00
|
|
|
.model use16 large SHARED
|
2021-02-12 16:39:51 +00:00
|
|
|
locals
|
|
|
|
|
|
|
|
include pc98.inc
|
|
|
|
include libs/master.lib/func.inc
|
|
|
|
include libs/master.lib/master.inc
|
|
|
|
include th03/arg_bx.inc
|
|
|
|
|
2021-02-13 16:19:06 +00:00
|
|
|
extrn Palettes:palette_t
|
2021-02-12 16:39:51 +00:00
|
|
|
extrn _pi_headers:PiHeader
|
|
|
|
extrn _pi_buffers:far ptr
|
|
|
|
|
2024-01-24 09:18:02 +00:00
|
|
|
.code SHARED
|
2021-02-12 16:39:51 +00:00
|
|
|
|
2022-04-02 04:19:18 +00:00
|
|
|
public @PI_PUT_8_ROWLOOP$QIIIUI
|
|
|
|
@pi_put_8_rowloop$qiiiui proc pascal near
|
2021-02-14 11:51:12 +00:00
|
|
|
; Can't use ARG, because the function doesn't `PUSH BP`!
|
|
|
|
@@stride_packed = word ptr [bp+2]
|
|
|
|
@@w = word ptr [bp+4]
|
|
|
|
@@top = word ptr [bp+6]
|
|
|
|
@@left = word ptr [bp+8]
|
|
|
|
@@h equ di
|
|
|
|
|
|
|
|
mov bp, sp
|
|
|
|
|
|
|
|
@@put_row:
|
|
|
|
push es
|
|
|
|
call graph_pack_put_8_noclip pascal, @@left, @@top, es, si, @@w
|
|
|
|
pop es
|
|
|
|
inc @@top
|
|
|
|
cmp @@top, RES_Y
|
|
|
|
jb short @@next_row
|
|
|
|
sub @@top, RES_Y
|
|
|
|
|
|
|
|
@@next_row:
|
|
|
|
add si, @@stride_packed
|
|
|
|
|
|
|
|
; .PI pointer normalization, see pi_buffer_p_normalize()
|
|
|
|
mov ax, si
|
|
|
|
shr ax, 4
|
|
|
|
mov dx, es
|
|
|
|
add dx, ax
|
|
|
|
mov es, dx
|
|
|
|
and si, 0Fh
|
|
|
|
|
|
|
|
dec @@h
|
|
|
|
jnz short @@put_row
|
|
|
|
retn 8
|
2022-04-02 04:19:18 +00:00
|
|
|
@pi_put_8_rowloop$qiiiui endp
|
2021-02-14 11:51:12 +00:00
|
|
|
|
|
|
|
|
[Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
player_pos_update_and_clamp(), score_update_and_render(), and
slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
stage2_invalidate(), stage2_update(), and space_window_set()
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-05-23 20:04:35 +00:00
|
|
|
public @PI_PALETTE_APPLY$QI
|
|
|
|
func @pi_palette_apply$qi
|
2021-02-13 16:19:06 +00:00
|
|
|
arg_bx far, @slot:word
|
|
|
|
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov si, @slot
|
|
|
|
imul si, size PiHeader
|
|
|
|
add si, offset _pi_headers + PiHeader._palette
|
|
|
|
mov di, offset Palettes
|
|
|
|
mov ax, ds
|
|
|
|
mov es, ax
|
|
|
|
mov cx, (size palette_t / dword)
|
|
|
|
rep movsd
|
|
|
|
call palette_show
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
ret_bx
|
|
|
|
endfunc
|
|
|
|
|
[Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
player_pos_update_and_clamp(), score_update_and_render(), and
slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
stage2_invalidate(), stage2_update(), and space_window_set()
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-05-23 20:04:35 +00:00
|
|
|
public @PI_FREE$QI
|
|
|
|
func @pi_free$qi
|
2021-02-12 16:39:51 +00:00
|
|
|
arg_bx far, @slot:word
|
|
|
|
|
|
|
|
mov bx, @slot
|
|
|
|
mov ax, bx
|
|
|
|
shl bx, 2
|
|
|
|
add bx, offset _pi_buffers
|
|
|
|
cmp dword ptr [bx], 0
|
|
|
|
jz short @@ret
|
|
|
|
imul ax, size PiHeader
|
|
|
|
add ax, offset _pi_headers
|
|
|
|
push ds
|
|
|
|
push ax
|
|
|
|
push word ptr [bx+2]
|
|
|
|
push word ptr [bx]
|
|
|
|
mov dword ptr [bx], 0
|
|
|
|
call graph_pi_free
|
|
|
|
@@ret:
|
|
|
|
ret 2
|
|
|
|
endfunc
|
|
|
|
|
|
|
|
end
|