mirror of https://github.com/nmlgc/ReC98.git
[Reverse-engineering] [th03] CDG: VRAM plane iteration
Which is where ZUN adds those additional 0x2000 to make the jump from the 0xB800 plane to the 0xE000 plane. Part of P0114, funded by Lmocinemod.
This commit is contained in:
parent
ecc1372842
commit
97ce07bfc9
5
pc98.h
5
pc98.h
|
@ -114,6 +114,11 @@ typedef int8_t uint4_t;
|
|||
#define SEG_PLANE_R 0xB000
|
||||
#define SEG_PLANE_G 0xB800
|
||||
#define SEG_PLANE_E 0xE000
|
||||
|
||||
// Segment distance between B↔R↔G
|
||||
#define SEG_PLANE_DIST_BRG 0x800
|
||||
// Segment distance between G↔E
|
||||
#define SEG_PLANE_DIST_E 0x2800
|
||||
/// ---------------
|
||||
|
||||
/// Keyboard
|
||||
|
|
7
pc98.inc
7
pc98.inc
|
@ -19,3 +19,10 @@ ROW_SIZE = (RES_X / 8)
|
|||
PLANE_SIZE = (ROW_SIZE * RES_Y)
|
||||
COLOR_COUNT = 16
|
||||
; ========
|
||||
|
||||
SEG_PLANE_B = 0A800h
|
||||
SEG_PLANE_R = 0B000h
|
||||
SEG_PLANE_G = 0B800h
|
||||
SEG_PLANE_E = 0E000h
|
||||
SEG_PLANE_DIST_BRG = 800h
|
||||
SEG_PLANE_DIST_E = 2800h
|
||||
|
|
|
@ -21,3 +21,25 @@ cdg_t struc
|
|||
seg_alpha dw ?
|
||||
seg_colors dw ?
|
||||
cdg_t ends
|
||||
|
||||
vram_plane_next macro seg:req, label_loop:req
|
||||
; Next segment...
|
||||
mov ax, seg
|
||||
add ax, SEG_PLANE_DIST_BRG
|
||||
mov seg, ax
|
||||
|
||||
; Still in the R or G segment?
|
||||
cmp ax, (SEG_PLANE_G + SEG_PLANE_DIST_BRG)
|
||||
jb short label_loop
|
||||
|
||||
; Already in the E segment?
|
||||
cmp ax, (SEG_PLANE_G + (SEG_PLANE_DIST_BRG * 2))
|
||||
jnb short @@vram_plane_next_done
|
||||
|
||||
; Make the large jump between G and E
|
||||
add ax, (SEG_PLANE_DIST_E - SEG_PLANE_DIST_BRG)
|
||||
mov seg, ax
|
||||
jmp short label_loop
|
||||
|
||||
@@vram_plane_next_done:
|
||||
endm
|
||||
|
|
|
@ -63,6 +63,7 @@ cdg_put proc far
|
|||
mov ds, ax
|
||||
assume ds:nothing
|
||||
|
||||
@@row_loop:
|
||||
@@width_2:
|
||||
mov cx, 1234h
|
||||
|
||||
|
@ -73,20 +74,9 @@ cdg_put proc far
|
|||
add di, 4
|
||||
loop @@blit_dword
|
||||
sub di, dx
|
||||
jns short @@width_2
|
||||
jns short @@row_loop
|
||||
mov di, bx
|
||||
mov ax, es
|
||||
add ax, 800h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp ax, 0C000h
|
||||
jb short @@width_2
|
||||
cmp ax, 0C800h
|
||||
jnb short @@ret
|
||||
add ax, 2000h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
jmp short @@width_2
|
||||
vram_plane_next es, @@row_loop
|
||||
|
||||
@@ret:
|
||||
pop ds
|
||||
|
|
|
@ -75,6 +75,7 @@ proc_defconv cdg_put_hflip
|
|||
mov dx, 1234h
|
||||
nop
|
||||
|
||||
@@row_loop:
|
||||
@@width_bytes_colors:
|
||||
mov cx, 1234
|
||||
|
||||
|
@ -86,22 +87,11 @@ proc_defconv cdg_put_hflip
|
|||
dec di
|
||||
loop @@blit_hflip_colors
|
||||
sub di, dx
|
||||
jns short @@width_bytes_colors
|
||||
jns short @@row_loop
|
||||
|
||||
@@last_x_colors:
|
||||
mov di, 1234h
|
||||
mov ax, es
|
||||
add ax, 800h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp ax, 0C000h
|
||||
jb short @@width_bytes_colors
|
||||
cmp ax, 0C800h
|
||||
jnb short @@ret
|
||||
add ax, 2000h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
jmp short @@width_bytes_colors
|
||||
vram_plane_next es, @@row_loop
|
||||
|
||||
@@ret:
|
||||
pop di
|
||||
|
|
|
@ -40,24 +40,14 @@ cdg_put_noalpha proc far
|
|||
cld
|
||||
nop
|
||||
|
||||
@@row_loop:
|
||||
@@width:
|
||||
mov cx, 1234h
|
||||
rep movsd
|
||||
sub di, dx
|
||||
jns short @@width
|
||||
jns short @@row_loop
|
||||
mov di, bx
|
||||
mov ax, es
|
||||
add ax, 800h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
cmp ax, 0C000h
|
||||
jb short @@width
|
||||
cmp ax, 0C800h
|
||||
jnb short @@ret
|
||||
add ax, 2000h
|
||||
mov es, ax
|
||||
assume es:nothing
|
||||
jmp short @@width
|
||||
vram_plane_next es, @@row_loop
|
||||
|
||||
@@ret:
|
||||
pop ds
|
||||
|
|
Loading…
Reference in New Issue