diff --git a/th04/main/tile/bb.hpp b/th04/main/tile/bb.hpp new file mode 100644 index 00000000..e5ef7ae5 --- /dev/null +++ b/th04/main/tile/bb.hpp @@ -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); diff --git a/th04/main/tile/bb_put.asm b/th04/main/tile/bb_put.asm new file mode 100644 index 00000000..52e2cee7 --- /dev/null +++ b/th04/main/tile/bb_put.asm @@ -0,0 +1,46 @@ +public @grcg_tile_bb_put_8 +@grcg_tile_bb_put_8 proc near + @@left equ + @@top equ + + @@rows_after_roll equ + + 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 diff --git a/th04_main.asm b/th04_main.asm index 69a3aa7b..68d1c495 100644 --- a/th04_main.asm +++ b/th04_main.asm @@ -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 ======================================= diff --git a/th05_main.asm b/th05_main.asm index ba51c22a..a898f499 100644 --- a/th05_main.asm +++ b/th05_main.asm @@ -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