mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] Use @@locals for self-modifying code in bfnt_entry_pat()
Which finally allows us to use the PLANE_SIZE macro in ASM land. Yeah, (ROW_SIZE * RES_Y) has finally got old. Part of P0073, funded by [Anonymous] and -Tom-.
This commit is contained in:
parent
cea3ea6dc7
commit
0f3359e1b3
|
@ -79,10 +79,10 @@ func BFNT_ENTRY_PAT ; bfnt_entry_pat() {
|
|||
@@clear_color = (RETSIZE+1)*2
|
||||
|
||||
mov AX,[BP+@@clear_color]
|
||||
mov CS:bftentry_color,AX
|
||||
mov CS:@@color,AX
|
||||
mov CS:_DS_,DS
|
||||
mov AX,[BP+@@handle]
|
||||
mov CS:bftentry_file_handle,AX
|
||||
mov CS:@@file_handle,AX
|
||||
_push DS
|
||||
_lds BX,[BP+@@header]
|
||||
mov AX,(bfnt_header PTR [BX]).Xdots
|
||||
|
@ -98,9 +98,9 @@ func BFNT_ENTRY_PAT ; bfnt_entry_pat() {
|
|||
mov CS:@@patsize,DX
|
||||
mov BYTE PTR CS:[@@ysize],CL
|
||||
mul CX
|
||||
mov CS:plane_size,AX
|
||||
mov CS:@@plane_size,AX
|
||||
shl AX,2 ;pattern size (BRGI)
|
||||
mov CS:read_byte,AX
|
||||
mov CS:@@read_byte,AX
|
||||
xchg BX,AX
|
||||
push BX
|
||||
_call SMEM_WGET
|
||||
|
@ -115,9 +115,9 @@ func BFNT_ENTRY_PAT ; bfnt_entry_pat() {
|
|||
mov DS,CX
|
||||
|
||||
@@NEXT_PATTERN:
|
||||
JMOV CX,read_byte
|
||||
JMOV CX,@@read_byte
|
||||
xor DX,DX
|
||||
JMOV BX,bftentry_file_handle
|
||||
JMOV BX,@@file_handle
|
||||
|
||||
mov AH,3fh
|
||||
int 21h ;read handle
|
||||
|
@ -133,7 +133,7 @@ endif
|
|||
jmp BFTENTRY_INVAL
|
||||
@@NEXT_PATTERN_2:
|
||||
xor SI,SI
|
||||
JMOV DX,plane_size
|
||||
JMOV DX,@@plane_size
|
||||
|
||||
xor BX,BX
|
||||
|
||||
|
@ -211,7 +211,7 @@ B2V_LOOP:
|
|||
push ES ; seg addr
|
||||
xor AX,AX
|
||||
push AX ;offset address
|
||||
JMOV AX,bftentry_color ;clear_color
|
||||
JMOV AX,@@color ;clear_color
|
||||
push AX
|
||||
_call SUPER_ENTRY_PAT ; (patsize, far addr, clear_color)
|
||||
|
||||
|
|
3
pc98.inc
3
pc98.inc
|
@ -16,7 +16,6 @@ GLYPH_H = 16
|
|||
RES_X = 640
|
||||
RES_Y = 400
|
||||
ROW_SIZE = (RES_X / 8)
|
||||
; Collides with master.lib's bfnt_entry_pat.asm
|
||||
; PLANE_SIZE = (ROW_SIZE * RES_Y)
|
||||
PLANE_SIZE = (ROW_SIZE * RES_Y)
|
||||
COLOR_COUNT = 16
|
||||
; ========
|
||||
|
|
|
@ -15,7 +15,7 @@ screen_back_B_snap proc near
|
|||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
call hmem_allocbyte pascal, (ROW_SIZE * RES_Y)
|
||||
call hmem_allocbyte pascal, PLANE_SIZE
|
||||
mov _screen_back_B, ax
|
||||
xor si, si
|
||||
jmp short loc_A5DF
|
||||
|
@ -30,7 +30,7 @@ loc_A5CA:
|
|||
add si, 4
|
||||
|
||||
loc_A5DF:
|
||||
cmp si, (ROW_SIZE * RES_Y)
|
||||
cmp si, PLANE_SIZE
|
||||
jl short loc_A5CA
|
||||
pop si
|
||||
pop bp
|
||||
|
@ -62,7 +62,7 @@ screen_back_B_put proc near
|
|||
mov ds, ax
|
||||
xor di, di
|
||||
xor si, si
|
||||
mov cx, (ROW_SIZE * RES_Y) / 2
|
||||
mov cx, (PLANE_SIZE / 2)
|
||||
rep movsw
|
||||
pop ds
|
||||
pop di
|
||||
|
|
|
@ -37,9 +37,9 @@ spark_render proc near
|
|||
@@blit_loop:
|
||||
movsw
|
||||
add di, (ROW_SIZE - SPARK_VRAM_W)
|
||||
cmp di, (ROW_SIZE * RES_Y)
|
||||
cmp di, PLANE_SIZE
|
||||
jl short @@next_row
|
||||
sub di, (ROW_SIZE * RES_Y)
|
||||
sub di, PLANE_SIZE
|
||||
|
||||
@@next_row:
|
||||
loop @@blit_loop
|
||||
|
|
|
@ -52,7 +52,7 @@ loc_ABE5:
|
|||
add si, 4
|
||||
|
||||
loc_ABFA:
|
||||
cmp si, (ROW_SIZE * RES_Y)
|
||||
cmp si, PLANE_SIZE
|
||||
jl short loc_ABE5
|
||||
pop di
|
||||
pop si
|
||||
|
|
|
@ -4,13 +4,13 @@ bgimage_snap proc far
|
|||
push di
|
||||
cmp bgimage_PL_B, 0
|
||||
jnz short @@already_allocated
|
||||
call hmem_allocbyte pascal, (ROW_SIZE * RES_Y)
|
||||
call hmem_allocbyte pascal, PLANE_SIZE
|
||||
mov bgimage_PL_B, ax
|
||||
call hmem_allocbyte pascal, (ROW_SIZE * RES_Y)
|
||||
call hmem_allocbyte pascal, PLANE_SIZE
|
||||
mov bgimage_PL_R, ax
|
||||
call hmem_allocbyte pascal, (ROW_SIZE * RES_Y)
|
||||
call hmem_allocbyte pascal, PLANE_SIZE
|
||||
mov bgimage_PL_G, ax
|
||||
call hmem_allocbyte pascal, (ROW_SIZE * RES_Y)
|
||||
call hmem_allocbyte pascal, PLANE_SIZE
|
||||
mov bgimage_PL_E, ax
|
||||
|
||||
@@already_allocated:
|
||||
|
@ -30,7 +30,7 @@ bgimage_snap proc far
|
|||
pop ds
|
||||
xor si, si
|
||||
xor di, di
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
rep movsd
|
||||
dec dl
|
||||
jnz short @@next_plane
|
||||
|
@ -61,7 +61,7 @@ bgimage_put proc far
|
|||
pop es
|
||||
xor si, si
|
||||
xor di, di
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
rep movsd
|
||||
dec dl
|
||||
jnz short @@next_plane
|
||||
|
|
|
@ -47,9 +47,9 @@ cdg_put_plane_roll proc far
|
|||
@@plane_src_num_to_offset:
|
||||
add si, ax
|
||||
loop @@plane_src_num_to_offset
|
||||
cmp di, (ROW_SIZE * RES_Y)
|
||||
cmp di, PLANE_SIZE
|
||||
jb short @@start_blitting
|
||||
sub di, (ROW_SIZE * RES_Y)
|
||||
sub di, PLANE_SIZE
|
||||
|
||||
@@start_blitting:
|
||||
cld
|
||||
|
@ -67,7 +67,7 @@ cdg_put_plane_roll proc far
|
|||
loop @@blit_dword
|
||||
sub di, @@stride_backwards
|
||||
jge short @@more_rows?
|
||||
add di, (ROW_SIZE * RES_Y)
|
||||
add di, PLANE_SIZE
|
||||
|
||||
@@more_rows?:
|
||||
dec @@h
|
||||
|
|
|
@ -53,7 +53,7 @@ endif
|
|||
if GAME eq 5
|
||||
or di, di
|
||||
js short @@skip
|
||||
cmp di, (ROW_SIZE * RES_Y)
|
||||
cmp di, PLANE_SIZE
|
||||
jnb short @@skip
|
||||
endif
|
||||
mov al, 1
|
||||
|
|
|
@ -52,7 +52,7 @@ public @spark_render
|
|||
loop @@blit_loop
|
||||
or bx, bx
|
||||
jz short @@ret
|
||||
sub di, (ROW_SIZE * RES_Y)
|
||||
sub di, PLANE_SIZE
|
||||
xchg cx, bx
|
||||
jmp short @@blit_loop
|
||||
|
||||
|
|
|
@ -12663,11 +12663,11 @@ sub_12024 proc near
|
|||
mov ax, 1
|
||||
out 0A6h, ax
|
||||
xor di, di
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
rep stosd
|
||||
xor ax, ax
|
||||
out 0A6h, ax
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
xor di, di
|
||||
rep stosd
|
||||
pop di
|
||||
|
|
|
@ -120,9 +120,9 @@ TEMP_ROW = RES_Y
|
|||
push si
|
||||
mov di, _pi_put_mask_vram_offset
|
||||
add _pi_put_mask_vram_offset, ROW_SIZE
|
||||
cmp _pi_put_mask_vram_offset, (ROW_SIZE * RES_Y)
|
||||
cmp _pi_put_mask_vram_offset, PLANE_SIZE
|
||||
jb short @@next_row
|
||||
sub _pi_put_mask_vram_offset, (ROW_SIZE * RES_Y)
|
||||
sub _pi_put_mask_vram_offset, PLANE_SIZE
|
||||
|
||||
@@next_row:
|
||||
call pi_egc_mask
|
||||
|
|
|
@ -3838,11 +3838,11 @@ sub_CFEE proc near
|
|||
mov ax, 1
|
||||
out 0A6h, ax
|
||||
xor di, di
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
rep stosd
|
||||
xor ax, ax
|
||||
out 0A6h, ax
|
||||
mov cx, (ROW_SIZE * RES_Y) / 4
|
||||
mov cx, (PLANE_SIZE / 4)
|
||||
xor di, di
|
||||
rep stosd
|
||||
pop di
|
||||
|
|
Loading…
Reference in New Issue