mirror of https://github.com/nmlgc/ReC98.git
[Reverse-engineering] [th04/th05] .BB tile animation: Filling a single tile
Sure, it's still a micro-optimization, but at least it's __fastcall for
once! And doesn't assume ES to have been set to a VRAM segment. So not
*that* optimized 😛
Part of P0147, funded by -Tom- and Ember2528.
This commit is contained in:
parent
ebbb5b8255
commit
f3afd37e8f
|
@ -0,0 +1,3 @@
|
|||
// Fills the playfield tile starting at (⌊left/8⌋*8, top) with the current
|
||||
// GRCG tile. Assumes that the GRCG is set to TDW mode.
|
||||
void fastcall near grcg_tile_bb_put_8(screen_x_t left, vram_y_t top);
|
|
@ -0,0 +1,46 @@
|
|||
public @grcg_tile_bb_put_8
|
||||
@grcg_tile_bb_put_8 proc near
|
||||
@@left equ <ax>
|
||||
@@top equ <dx>
|
||||
|
||||
@@rows_after_roll equ <bx>
|
||||
|
||||
push di
|
||||
mov @@rows_after_roll, @@top
|
||||
sar @@left, 3
|
||||
shl @@top, 6
|
||||
add @@left, @@top
|
||||
shr @@top, 2
|
||||
add @@left, @@top
|
||||
mov di, @@left
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp bx, PLAYFIELD_BOTTOM
|
||||
ja short @@roll_needed
|
||||
mov cx, TILE_H
|
||||
xor @@rows_after_roll, @@rows_after_roll
|
||||
jmp short @@row_loop
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@roll_needed:
|
||||
mov cx, RES_Y
|
||||
sub cx, @@rows_after_roll
|
||||
mov @@rows_after_roll, TILE_H
|
||||
sub @@rows_after_roll, cx
|
||||
|
||||
@@row_loop:
|
||||
stosw
|
||||
add di, (ROW_SIZE - TILE_VRAM_W)
|
||||
loop @@row_loop
|
||||
or @@rows_after_roll, @@rows_after_roll
|
||||
jz short @@ret
|
||||
sub di, PLANE_SIZE
|
||||
xchg cx, @@rows_after_roll
|
||||
jmp short @@row_loop
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
@@ret:
|
||||
pop di
|
||||
retn
|
||||
@grcg_tile_bb_put_8 endp
|
|
@ -1740,7 +1740,7 @@ loc_BF48:
|
|||
sub dx, RES_Y
|
||||
|
||||
loc_BF62:
|
||||
call main_01:sub_11FC8
|
||||
call @grcg_tile_bb_put_8
|
||||
|
||||
loc_BF65:
|
||||
shl [bp+var_1], 1
|
||||
|
@ -10879,51 +10879,7 @@ sub_11ECB endp
|
|||
|
||||
include th03/formats/cfg_lres.asm
|
||||
db 0
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_11FC8 proc near
|
||||
push di
|
||||
mov bx, dx
|
||||
sar ax, 3
|
||||
shl dx, 6
|
||||
add ax, dx
|
||||
shr dx, 2
|
||||
add ax, dx
|
||||
mov di, ax
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp bx, PLAYFIELD_BOTTOM
|
||||
ja short loc_11FEC
|
||||
mov cx, TILE_H
|
||||
xor bx, bx
|
||||
jmp short loc_11FF6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_11FEC:
|
||||
mov cx, RES_Y
|
||||
sub cx, bx
|
||||
mov bx, TILE_H
|
||||
sub bx, cx
|
||||
|
||||
loc_11FF6:
|
||||
stosw
|
||||
add di, (ROW_SIZE - word)
|
||||
loop loc_11FF6
|
||||
or bx, bx
|
||||
jz short loc_12008
|
||||
sub di, PLANE_SIZE
|
||||
xchg cx, bx
|
||||
jmp short loc_11FF6
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_12008:
|
||||
pop di
|
||||
retn
|
||||
sub_11FC8 endp
|
||||
|
||||
include th04/main/tile/bb_put.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
|
|
@ -2867,51 +2867,7 @@ bomb_yuuka endp
|
|||
db 0
|
||||
|
||||
include th05/formats/bb_playchar.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_CE80 proc near
|
||||
push di
|
||||
mov bx, dx
|
||||
sar ax, 3
|
||||
shl dx, 6
|
||||
add ax, dx
|
||||
shr dx, 2
|
||||
add ax, dx
|
||||
mov di, ax
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp bx, PLAYFIELD_BOTTOM
|
||||
ja short loc_CEA4
|
||||
mov cx, TILE_H
|
||||
xor bx, bx
|
||||
jmp short loc_CEAE
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_CEA4:
|
||||
mov cx, RES_Y
|
||||
sub cx, bx
|
||||
mov bx, TILE_H
|
||||
sub bx, cx
|
||||
|
||||
loc_CEAE:
|
||||
stosw
|
||||
add di, (ROW_SIZE - word)
|
||||
loop loc_CEAE
|
||||
or bx, bx
|
||||
jz short loc_CEC0
|
||||
sub di, PLANE_SIZE
|
||||
xchg cx, bx
|
||||
jmp short loc_CEAE
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_CEC0:
|
||||
pop di
|
||||
retn
|
||||
sub_CE80 endp
|
||||
|
||||
include th04/main/tile/bb_put.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
@ -3962,7 +3918,7 @@ loc_DF7F:
|
|||
sub dx, RES_Y
|
||||
|
||||
loc_DF89:
|
||||
call sub_CE80
|
||||
call @grcg_tile_bb_put_8
|
||||
|
||||
loc_DF8C:
|
||||
shl [bp+var_1], 1
|
||||
|
|
Loading…
Reference in New Issue