[Reverse-engineering] [th05] Music Room piano coordinates

This commit is contained in:
wintiger0222 2019-12-03 20:03:23 +09:00 committed by nmlgc
parent b74b7f9bce
commit 2b617dfa75
3 changed files with 65 additions and 67 deletions

View File

@ -1,3 +1,9 @@
#define PIANO_X 384
#define PIANO_Y 64
#define PIANO_H 15
#define PIANO_PADDING_BOTTOM 3
#define PIANO_H_PADDED (PIANO_H + PIANO_PADDING_BOTTOM)
// Using the same naming convention as for the gaiji characters...
#pragma option -b-
typedef enum {
@ -18,5 +24,21 @@ typedef enum {
extern const unsigned char PIANO_LABEL_FONT[pl_COUNT][PIANO_LABEL_FONT_H];
#define PIANO_LABEL_DIST_X 32
#define PIANO_LABEL_DIST_Y 4
#define PIANO_LABEL_X(col) (PIANO_X - PIANO_LABEL_DIST_X + (col * PIANO_LABEL_FONT_W))
#define PIANO_LABEL_Y(row) (PIANO_Y + PIANO_LABEL_DIST_Y + (row * PIANO_H_PADDED))
// Assumes that the GRCG is active.
#define piano_label_puts(row, chr1, chr2, chr3) \
piano_label_putc(0, row, chr1); \
piano_label_putc(1, row, chr2); \
piano_label_putc(2, row, chr3); \
#define piano_label_putc(col, row, chr) \
_AL = chr; \
_DI = (PIANO_LABEL_Y(row) * ROW_SIZE) + (PIANO_LABEL_X(col) / 8); \
piano_label_put_raw();
void pascal piano_label_put_raw();

23
th05/music/piano.inc Normal file
View File

@ -0,0 +1,23 @@
PIANO_X = 384
PIANO_Y = 64
PIANO_H = 15
PIANO_PADDING_BOTTOM = 3
PIANO_H_PADDED = (PIANO_H + PIANO_PADDING_BOTTOM)
PIANO_LABEL_DIST_X = 32
PIANO_LABEL_DIST_Y = 4
PIANO_LABEL_X = PIANO_X - PIANO_LABEL_DIST_X
PIANO_LABEL_Y = PIANO_Y + PIANO_LABEL_DIST_Y
piano_label_puts macro row:req, chr1:req, chr2:req, chr3:req
piano_label_putc 0, row, chr1
piano_label_putc 1, row, chr2
piano_label_putc 2, row, chr3
endm
piano_label_putc macro col:req, row:req, chr:req
mov al, chr
mov di, ((PIANO_LABEL_Y + (row * PIANO_H_PADDED)) * ROW_SIZE) + ((PIANO_LABEL_X + (col * PIANO_LABEL_FONT_W)) / 8)
call piano_label_put_raw
endm

View File

@ -22,6 +22,7 @@
include ReC98.inc
include th05/th05.inc
include th05/music/music.inc
include th05/music/piano.inc
extern SCOPY@:proc
extern _execl:proc
@ -5133,74 +5134,26 @@ sub_D894 proc far
mov ax, 0A800h
mov es, ax
assume es:nothing
mov di, 1400h
mov di, (PIANO_Y + (0 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov di, 19A0h
mov di, (PIANO_Y + (1 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov di, 1F40h
mov di, (PIANO_Y + (2 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov di, 24E0h
mov di, (PIANO_Y + (3 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov di, 2A80h
mov di, (PIANO_Y + (4 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov di, 3020h
mov di, (PIANO_Y + (5 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
mov ah, GC_RI
call grcg_setcolor_direct_noint_1
mov al, pl_F
mov di, 156Ch
call piano_label_put_raw
mov al, pl_M
mov di, 156Dh
call piano_label_put_raw
mov al, pl_1
mov di, 156Eh
call piano_label_put_raw
mov al, pl_F
mov di, 1B0Ch
call piano_label_put_raw
mov al, pl_M
mov di, 1B0Dh
call piano_label_put_raw
mov al, pl_2
mov di, 1B0Eh
call piano_label_put_raw
mov al, pl_F
mov di, 20ACh
call piano_label_put_raw
mov al, pl_M
mov di, 20ADh
call piano_label_put_raw
mov al, pl_3
mov di, 20AEh
call piano_label_put_raw
mov al, pl_F
mov di, 264Ch
call piano_label_put_raw
mov al, pl_M
mov di, 264Dh
call piano_label_put_raw
mov al, pl_4
mov di, 264Eh
call piano_label_put_raw
mov al, pl_F
mov di, 2BECh
call piano_label_put_raw
mov al, pl_M
mov di, 2BEDh
call piano_label_put_raw
mov al, pl_5
mov di, 2BEEh
call piano_label_put_raw
mov al, pl_S
mov di, 318Ch
call piano_label_put_raw
mov al, pl_S
mov di, 318Dh
call piano_label_put_raw
mov al, pl_G
mov di, 318Eh
call piano_label_put_raw
piano_label_puts 0, pl_F, pl_M, pl_1
piano_label_puts 1, pl_F, pl_M, pl_2
piano_label_puts 2, pl_F, pl_M, pl_3
piano_label_puts 3, pl_F, pl_M, pl_4
piano_label_puts 4, pl_F, pl_M, pl_5
piano_label_puts 5, pl_S, pl_S, pl_G
GRCG_OFF_VIA_XOR al
push ds
mov ah, PMD_GET_WORKAREA_ADDRESS
@ -5227,31 +5180,31 @@ sub_D96E proc far
GRCG_SETMODE_VIA_MOV al, GC_RMW
mov ax, 0A800h
mov es, ax
mov di, 3020h
mov di, (PIANO_Y + (5 * PIANO_H_PADDED)) * ROW_SIZE
call sub_DA30
lds bx, dword_1281A
mov di, 1400h
mov di, (PIANO_Y + (0 * PIANO_H_PADDED)) * ROW_SIZE
mov si, 0
call sub_D9E2
add bx, 2
mov di, 19A0h
mov di, (PIANO_Y + (1 * PIANO_H_PADDED)) * ROW_SIZE
mov si, 1
call sub_D9E2
add bx, 2
mov di, 1F40h
mov di, (PIANO_Y + (2 * PIANO_H_PADDED)) * ROW_SIZE
mov si, 2
call sub_D9E2
add bx, 2
mov di, 24E0h
mov di, (PIANO_Y + (3 * PIANO_H_PADDED)) * ROW_SIZE
mov si, 3
call sub_D9E2
add bx, 2
mov di, 2A80h
mov di, (PIANO_Y + (4 * PIANO_H_PADDED)) * ROW_SIZE
mov si, 4
call sub_D9E2
mov ah, GC_RI
call grcg_setcolor_direct_noint_1
mov di, 3020h
mov di, (PIANO_Y + (5 * PIANO_H_PADDED)) * ROW_SIZE
add bx, 4
call sub_DA12
call near ptr sub_DA6B