mirror of https://github.com/nmlgc/ReC98.git
[Reverse-engineering] [th04/th05] Rendering all stage background tiles at once
Funded by -Tom-.
This commit is contained in:
parent
6a6ce47c56
commit
20d05c1653
|
@ -74,5 +74,6 @@ ROW_SIZE = (RES_X / 8)
|
|||
|
||||
TILE_W = 16
|
||||
TILE_H = 16
|
||||
TILE_VRAM_W = (TILE_W / 8)
|
||||
TILES_Y = 1 + (PLAYFIELD_H / TILE_H) + 1
|
||||
TILES_X = (PLAYFIELD_W / TILE_W)
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
; anything with?
|
||||
TILES_MEMORY_X = 512 / TILE_W
|
||||
|
||||
; TH04 starts addressing individual tiles directly via their 16-bit offset
|
||||
; in the VRAM.
|
||||
public _tile_ring
|
||||
_tile_ring dw (TILES_MEMORY_X * TILES_Y) dup(?)
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
; Blits all tiles in the ring buffer to the playfield in VRAM.
|
||||
|
||||
; void tiles_render_all();
|
||||
public tiles_render_all
|
||||
tiles_render_all proc near
|
||||
push si
|
||||
push di
|
||||
call egc_start_copy_inlined_noframe
|
||||
mov di, ((RES_Y - TILE_H) * ROW_SIZE) + PLAYFIELD_VRAM_X
|
||||
mov bx, offset _tile_ring[TILES_MEMORY_X * (TILES_Y - 1) * 2]
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
|
||||
@@start_row:
|
||||
mov dl, TILES_X
|
||||
|
||||
@@next_tile_in_row:
|
||||
mov si, [bx]
|
||||
mov cx, TILE_H
|
||||
nop
|
||||
|
||||
@@blit_tile_lines:
|
||||
mov ax, es:[si]
|
||||
mov es:[di], ax
|
||||
add si, ROW_SIZE
|
||||
add di, ROW_SIZE
|
||||
loop @@blit_tile_lines
|
||||
sub di, (TILE_H * ROW_SIZE) - TILE_VRAM_W
|
||||
add bx, 2
|
||||
dec dl
|
||||
jnz short @@next_tile_in_row
|
||||
sub bx, (TILES_MEMORY_X + TILES_X) * 2
|
||||
sub di, (TILE_H * ROW_SIZE) + (TILE_VRAM_W * TILES_X)
|
||||
jge short @@start_row
|
||||
call egc_off
|
||||
pop di
|
||||
pop si
|
||||
retn
|
||||
tiles_render_all endp
|
||||
|
||||
|
||||
; void egc_start_copy_inlined_noframe();
|
||||
public egc_start_copy_inlined_noframe
|
||||
egc_start_copy_inlined_noframe proc near
|
||||
EGC_START_COPY_INLINED
|
||||
retn
|
||||
egc_start_copy_inlined_noframe endp
|
||||
nop
|
|
@ -901,7 +901,7 @@ loc_B156:
|
|||
mov PaletteTone, 64h ; 'd'
|
||||
call far ptr palette_show
|
||||
call sub_10D77
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
mov byte_25A3C, 1
|
||||
mov byte_25A3D, 0
|
||||
mov dx, 0A6h ; '¦'
|
||||
|
@ -910,7 +910,7 @@ loc_B156:
|
|||
mov dx, 0A4h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
les bx, _humaconfig
|
||||
cmp byte ptr es:[bx+3Eh], 0
|
||||
jnz short loc_B1AE
|
||||
|
@ -980,7 +980,7 @@ sub_B1D0 proc near
|
|||
call sub_15D74
|
||||
call sub_BCB2
|
||||
nopcall sub_F204
|
||||
mov fp_255AC, offset sub_CBB8
|
||||
mov fp_255AC, offset tiles_render_all
|
||||
call sub_CB2E
|
||||
pop bp
|
||||
retn
|
||||
|
@ -4142,7 +4142,7 @@ sub_CB58 endp
|
|||
sub_CB80 proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
dec byte_255B0
|
||||
cmp byte_255B0, 0
|
||||
jnz short loc_CB97
|
||||
|
@ -4186,56 +4186,7 @@ sub_CBA4 endp
|
|||
|
||||
; ---------------------------------------------------------------------------
|
||||
db 0
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_CBB8 proc near
|
||||
push si
|
||||
push di
|
||||
call egc_start_copy_inlined_noframe
|
||||
mov di, 7804h
|
||||
mov bx, offset _tile_ring[TILES_MEMORY_X * (TILES_Y - 1) * 2]
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
|
||||
loc_CBC8:
|
||||
mov dl, TILES_X
|
||||
|
||||
loc_CBCA:
|
||||
mov si, [bx]
|
||||
mov cx, 10h
|
||||
nop
|
||||
|
||||
loc_CBD0:
|
||||
mov ax, es:[si]
|
||||
mov es:[di], ax
|
||||
add si, ROW_SIZE
|
||||
add di, ROW_SIZE
|
||||
loop loc_CBD0
|
||||
sub di, 4FEh
|
||||
add bx, 2
|
||||
dec dl
|
||||
jnz short loc_CBCA
|
||||
sub bx, (TILES_MEMORY_X + TILES_X) * 2
|
||||
sub di, 530h
|
||||
jge short loc_CBC8
|
||||
call egc_off
|
||||
pop di
|
||||
pop si
|
||||
retn
|
||||
tiles_render_all endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
egc_start_copy_inlined_noframe proc near
|
||||
EGC_START_COPY_INLINED
|
||||
retn
|
||||
egc_start_copy_inlined_noframe endp
|
||||
nop
|
||||
include th04/tiles_render_all.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
@ -15251,7 +15202,7 @@ loc_121D3:
|
|||
jg short loc_121E6
|
||||
|
||||
loc_121E1:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -15301,7 +15252,7 @@ loc_1222F:
|
|||
jg short loc_12242
|
||||
|
||||
loc_1223D:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -15380,7 +15331,7 @@ loc_122BF:
|
|||
jg short loc_122D2
|
||||
|
||||
loc_122CD:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -15418,7 +15369,7 @@ loc_122EB:
|
|||
mov [bp+var_1], al
|
||||
cmp [bp+var_1], 8
|
||||
jnb short loc_12309
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
jmp short loc_12327
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -15458,7 +15409,7 @@ loc_1234C:
|
|||
jg short loc_1235F
|
||||
|
||||
loc_1235A:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -15496,7 +15447,7 @@ loc_12378:
|
|||
mov [bp+var_1], al
|
||||
cmp [bp+var_1], 8
|
||||
jnb short loc_12396
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
jmp short loc_123B4
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -15536,7 +15487,7 @@ loc_123D9:
|
|||
jg short loc_123EC
|
||||
|
||||
loc_123E7:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -16272,7 +16223,7 @@ var_1 = byte ptr -1
|
|||
mov fp_2566C, offset nullsub_1
|
||||
|
||||
loc_12991:
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -16287,7 +16238,7 @@ loc_12996:
|
|||
mov [bp+var_1], al
|
||||
cmp [bp+var_1], 8
|
||||
jnb short loc_129B4
|
||||
call sub_CBB8
|
||||
call tiles_render_all
|
||||
jmp short loc_129D2
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -38048,7 +37999,7 @@ loc_1E775:
|
|||
mov word_255C0, ax
|
||||
|
||||
loc_1E778:
|
||||
mov fp_255AC, offset sub_CBB8
|
||||
mov fp_255AC, offset tiles_render_all
|
||||
mov word_266D0, 2
|
||||
inc word_2671A
|
||||
mov ax, word_2671A
|
||||
|
|
|
@ -1035,7 +1035,7 @@ loc_B4BB:
|
|||
mov PaletteTone, 64h ; 'd'
|
||||
call far ptr palette_show
|
||||
call sub_118F3
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
mov byte_25352, 1
|
||||
mov byte_25353, 0
|
||||
mov dx, 0A6h ; '¦'
|
||||
|
@ -1044,7 +1044,7 @@ loc_B4BB:
|
|||
mov dx, 0A4h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
les bx, _ksoconfig
|
||||
cmp byte ptr es:[bx+1Fh], 0
|
||||
jz short loc_B506
|
||||
|
@ -1128,7 +1128,7 @@ sub_B55A proc near
|
|||
call sub_143CA
|
||||
call sub_C29E
|
||||
nopcall sub_106F3
|
||||
mov fp_23F5A, offset sub_BBE8
|
||||
mov fp_23F5A, offset tiles_render_all
|
||||
call sub_BEBC
|
||||
pop bp
|
||||
retn
|
||||
|
@ -1834,56 +1834,7 @@ loc_BBCF:
|
|||
retn
|
||||
sub_BB9A endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
sub_BBE8 proc near
|
||||
push si
|
||||
push di
|
||||
call egc_start_copy_inlined_noframe
|
||||
mov di, 7804h
|
||||
mov bx, offset _tile_ring[TILES_MEMORY_X * (TILES_Y - 1) * 2]
|
||||
mov ax, GRAM_400
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
|
||||
loc_BBF8:
|
||||
mov dl, TILES_X
|
||||
|
||||
loc_BBFA:
|
||||
mov si, [bx]
|
||||
mov cx, 10h
|
||||
nop
|
||||
|
||||
loc_BC00:
|
||||
mov ax, es:[si]
|
||||
mov es:[di], ax
|
||||
add si, ROW_SIZE
|
||||
add di, ROW_SIZE
|
||||
loop loc_BC00
|
||||
sub di, 4FEh
|
||||
add bx, 2
|
||||
dec dl
|
||||
jnz short loc_BBFA
|
||||
sub bx, (TILES_MEMORY_X + TILES_X) * 2
|
||||
sub di, 530h
|
||||
jge short loc_BBF8
|
||||
call egc_off
|
||||
pop di
|
||||
pop si
|
||||
retn
|
||||
tiles_render_all endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
||||
egc_start_copy_inlined_noframe proc near
|
||||
EGC_START_COPY_INLINED
|
||||
retn
|
||||
egc_start_copy_inlined_noframe endp
|
||||
nop
|
||||
include th04/tiles_render_all.asm
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
|
@ -2135,7 +2086,7 @@ sub_BEE6 endp
|
|||
sub_BF0E proc near
|
||||
push bp
|
||||
mov bp, sp
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
dec byte_23F5E
|
||||
cmp byte_23F5E, 0
|
||||
jnz short loc_BF25
|
||||
|
@ -4516,7 +4467,7 @@ loc_D0DC:
|
|||
jg short loc_D0EF
|
||||
|
||||
loc_D0EA:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
pop bp
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -4553,7 +4504,7 @@ loc_D108:
|
|||
mov si, ax
|
||||
cmp si, 8
|
||||
jge short loc_D124
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D142
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4590,7 +4541,7 @@ loc_D167:
|
|||
jg short loc_D17A
|
||||
|
||||
loc_D175:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D17D
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4629,7 +4580,7 @@ loc_D194:
|
|||
mov si, ax
|
||||
cmp si, 8
|
||||
jge short loc_D1B0
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D1CE
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4666,7 +4617,7 @@ loc_D1F3:
|
|||
jg short loc_D206
|
||||
|
||||
loc_D201:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D209
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4706,7 +4657,7 @@ loc_D220:
|
|||
mov [bp+var_1], al
|
||||
cmp [bp+var_1], 8
|
||||
jnb short loc_D23E
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D25C
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4747,7 +4698,7 @@ loc_D286:
|
|||
jg short loc_D299
|
||||
|
||||
loc_D294:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -4779,7 +4730,7 @@ var_1 = byte ptr -1
|
|||
mov [bp+var_1], al
|
||||
cmp [bp+var_1], 8
|
||||
jnb short loc_D2C7
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
jmp short loc_D2E5
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
|
@ -4820,7 +4771,7 @@ loc_D30F:
|
|||
jg short loc_D322
|
||||
|
||||
loc_D31D:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -6155,7 +6106,7 @@ loc_DD2A:
|
|||
jg short loc_DD3D
|
||||
|
||||
loc_DD38:
|
||||
call sub_BBE8
|
||||
call tiles_render_all
|
||||
leave
|
||||
retn
|
||||
; ---------------------------------------------------------------------------
|
||||
|
@ -30840,7 +30791,7 @@ loc_1AEDF:
|
|||
mov word_2CE04, ax
|
||||
|
||||
loc_1AEE2:
|
||||
mov fp_23F5A, offset sub_BBE8
|
||||
mov fp_23F5A, offset tiles_render_all
|
||||
mov word_25FE6, 2
|
||||
mov ax, boss_phase_frame
|
||||
mov bx, 8
|
||||
|
@ -39460,7 +39411,7 @@ loc_1FC52:
|
|||
mov word_2CE04, ax
|
||||
|
||||
loc_1FC55:
|
||||
mov fp_23F5A, offset sub_BBE8
|
||||
mov fp_23F5A, offset tiles_render_all
|
||||
mov word_25FE6, 2
|
||||
mov ax, boss_phase_frame
|
||||
mov bx, 8
|
||||
|
|
Loading…
Reference in New Issue