diff --git a/pc98.h b/pc98.h index 1897bee8..2e89d42e 100644 --- a/pc98.h +++ b/pc98.h @@ -55,6 +55,10 @@ typedef int8_t uint4_t; RGBType& operator [](int col) { return colors[col]; } + + const RGBType& operator [](int col) const { + return colors[col]; + } }; typedef RGB RGB4; diff --git a/th01/hardware/color.asm b/th01/hardware/color.asm deleted file mode 100644 index 5b3f4e3e..00000000 --- a/th01/hardware/color.asm +++ /dev/null @@ -1,159 +0,0 @@ -public _z_palette_show_single -_z_palette_show_single proc far - -@@col = byte ptr 6 -@@r = byte ptr 8 -@@g = byte ptr 0Ah -@@b = byte ptr 0Ch - - push bp - mov bp, sp - mov dx, 0A8h - mov al, [bp+@@col] - out dx, al - mov dx, 0AAh - mov al, [bp+@@g] - out dx, al - mov dx, 0ACh - mov al, [bp+@@r] - out dx, al - mov dx, 0AEh - mov al, [bp+@@b] - out dx, al - pop bp - retf -_z_palette_show_single endp - - -public _grcg_setcolor_rmw -_grcg_setcolor_rmw proc far - -@@color = word ptr 6 - - push bp - mov bp, sp - mov bx, [bp+@@color] - GRCG_SETMODE_CLOBBERING dx, GC_RMW - test bl, 1 - jz short @@bit0_0 - mov al, 0FFh - jmp short @@bit0_set -; --------------------------------------------------------------------------- - -@@bit0_0: - mov al, 0 - -@@bit0_set: - mov dx, 7Eh - out dx, al - test bl, 2 - jz short @@bit1_0 - mov al, 0FFh - jmp short @@bit1_set -; --------------------------------------------------------------------------- - -@@bit1_0: - mov al, 0 - -@@bit1_set: - mov dx, 7Eh - out dx, al - test bl, 4 - jz short @@bit2_0 - mov al, 0FFh - jmp short @@bit2_set -; --------------------------------------------------------------------------- - -@@bit2_0: - mov al, 0 - -@@bit2_set: - mov dx, 7Eh - out dx, al - test bl, 8 - jz short @@bit3_0 - mov al, 0FFh - jmp short @@bit3_set -; --------------------------------------------------------------------------- - -@@bit3_0: - mov al, 0 - -@@bit3_set: - mov dx, 7Eh - out dx, al - pop bp - retf -_grcg_setcolor_rmw endp - - -public _grcg_setcolor_tdw -_grcg_setcolor_tdw proc far - -@@color = word ptr 6 - - push bp - mov bp, sp - mov bx, [bp+@@color] - GRCG_SETMODE_CLOBBERING dx, GC_TDW - test bl, 1 - jz short @@bit0_0 - mov al, 0FFh - jmp short @@bit0_set -; --------------------------------------------------------------------------- - -@@bit0_0: - mov al, 0 - -@@bit0_set: - mov dx, 7Eh - out dx, al - test bl, 2 - jz short @@bit1_0 - mov al, 0FFh - jmp short @@bit1_set -; --------------------------------------------------------------------------- - -@@bit1_0: - mov al, 0 - -@@bit1_set: - mov dx, 7Eh - out dx, al - test bl, 4 - jz short @@bit2_0 - mov al, 0FFh - jmp short @@bit2_set -; --------------------------------------------------------------------------- - -@@bit2_0: - mov al, 0 - -@@bit2_set: - mov dx, 7Eh - out dx, al - test bl, 8 - jz short @@bit3_0 - mov al, 0FFh - jmp short @@bit3_set -; --------------------------------------------------------------------------- - -@@bit3_0: - mov al, 0 - -@@bit3_set: - mov dx, 7Eh - out dx, al - pop bp - retf -_grcg_setcolor_tdw endp - - -public _grcg_off_func -_grcg_off_func proc far - push bp - mov bp, sp - GRCG_OFF_CLOBBERING dx - pop bp - retf -_grcg_off_func endp diff --git a/th01/hardware/graph.cpp b/th01/hardware/graph.cpp index 8ffcea0d..7dc2358c 100644 --- a/th01/hardware/graph.cpp +++ b/th01/hardware/graph.cpp @@ -10,6 +10,9 @@ extern "C" { #include "th01/hardware/graph.h" #include "th01/hardware/palette.hpp" +#undef grcg_off +#define grcg_off() outportb(0x7C, 0); + extern page_t page_back; /// VRAM plane "structures" @@ -81,62 +84,82 @@ extern page_t page_back; /// Temporary translation unit mismatch workarounds /// ----------------------------------------------- -#define GRCG_SETCOLOR_RMW(col) __asm { \ - push col; \ - push cs; \ - call near ptr grcg_setcolor_rmw; \ - pop cx; \ -} -#define GRCG_OFF() __asm { \ - push cs; \ - call near ptr grcg_off_func; \ -} #define GRAPH_ACCESSPAGE_FUNC(page, stack_clear_size) __asm { \ push page; \ push cs; \ call near ptr graph_accesspage_func; \ } \ _SP += stack_clear_size; -#define FADEPAL_PUSH_COMP(pal, comp) \ - db 0x8B, 0xDE; /* MOV BX, SI */ \ - db 0x6B, 0xDB, 0x03; /* IMUL BX, 3, which Turbo C++ can't into? */ \ - lea ax, (pal + comp); \ - db 0x03, 0xD8; /* Turbo C++'s preferred opcode for ADD BX, AX */ \ - mov al, ss:[bx]; \ - cbw; \ - push ax; -#define Z_PALETTE_SHOW_SINGLE_FADEPAL(pal) __asm { \ - FADEPAL_PUSH_COMP(pal, 2) \ - FADEPAL_PUSH_COMP(pal, 1) \ - FADEPAL_PUSH_COMP(pal, 0) \ - db 0x56; \ - push cs; \ - call near ptr z_palette_show_single; \ - add sp, 8; \ -} /// ----------------------------------------------- +/// Hardware +/// -------- +void z_palette_show_single(int col, int r, int g, int b) +{ + outportb(0xA8, col); + outportb(0xAA, g); + outportb(0xAC, r); + outportb(0xAE, b); +} + +#define grcg_setcolor(mode, col) \ + outportb(0x7C, mode); \ + outportb(0x7E, (col & 1) ? 0xFF : 0x00); \ + outportb(0x7E, (col & 2) ? 0xFF : 0x00); \ + outportb(0x7E, (col & 4) ? 0xFF : 0x00); \ + outportb(0x7E, (col & 8) ? 0xFF : 0x00); + +void grcg_setcolor_rmw(int col) +{ + grcg_setcolor(0xC0, col); +} + +void grcg_setcolor_tdw(int col) +{ + grcg_setcolor(0x80, col); +} + +void grcg_off_func(void) +{ + grcg_off(); +} +/// -------- + +/// Palette +/// ------- +void z_palette_set_all_show(const Palette4& pal) +{ + for(int i = 0; i < COLOR_COUNT; i++) { + z_palette_set_show(i, pal[i].c.r, pal[i].c.g, pal[i].c.b); + } +} + +void z_palette_set_show(int col, int r, int g, int b) +{ +#define clamp_max(comp) ((comp) < RGB4::max() ? (comp) : RGB4::max()) +#define clamp_min(comp) ((comp) > 0 ? (comp) : 0) + r = clamp_min(clamp_max(r)); + g = clamp_min(clamp_max(g)); + b = clamp_min(clamp_max(b)); + + z_Palettes[col].c.r = r; + z_Palettes[col].c.g = g; + z_Palettes[col].c.b = b; + z_palette_show_single(col, r, g, b); +#undef clamp_max +#undef clamp_min +} +/// ------- + /// Whole-page functions /// -------------------- void z_graph_clear() { planar8_t *plane = reinterpret_cast(MK_FP(SEG_PLANE_B, 0)); - /* TODO: Replace with the decompiled calls - * grcg_setcolor_rmw(0); - * memset(plane, 0xFF, PLANE_SIZE); - * once grcg_setcolor_rmw is part of this translation unit */ - __asm { - push 0; - push cs; - call near ptr grcg_setcolor_rmw; - db 0x66, 0x68, 0xFF, 0x00, 0x00, 0x7D; - db 0x66, 0xFF, 0x76, 0xFC; - call far ptr memset; - add sp, 10; - } - (plane); - GRCG_OFF(); + grcg_setcolor_rmw(0); + memset(plane, 0xFF, PLANE_SIZE); + grcg_off_func(); } void z_graph_clear_0(void) @@ -151,23 +174,9 @@ void z_graph_clear_col(uint4_t col) { planar8_t *plane = reinterpret_cast(MK_FP(SEG_PLANE_B, 0)); - /* TODO: Replace with the decompiled calls - * grcg_setcolor_rmw(col); - * memset(plane, 0xFF, PLANE_SIZE); - * once grcg_setcolor_rmw is part of this translation unit */ - __asm { - mov al, col; - cbw; - push ax; - push cs; - call near ptr grcg_setcolor_rmw; - db 0x66, 0x68, 0xFF, 0x00, 0x00, 0x7D; - db 0x66, 0xFF, 0x76, 0xFC; - call far ptr memset; - add sp, 10; - } - (plane); - GRCG_OFF(); + grcg_setcolor_rmw(col); + memset(plane, 0xFF, PLANE_SIZE); + grcg_off_func(); } void graph_copy_page_back_to_front(void) @@ -196,10 +205,7 @@ void graph_copy_page_back_to_front(void) for(int comp = 0; comp < sizeof(RGB4); comp++) { \ per_comp; \ } \ - /* TODO: Replace with the decompiled call \ - * z_palette_show_single_col(col, pal[col]); \ - * once that function is part of this translation unit */ \ - Z_PALETTE_SHOW_SINGLE_FADEPAL(pal); \ + z_palette_show_single_col(col, pal[col]); \ } \ delay(FADE_DELAY); \ } @@ -207,17 +213,7 @@ void graph_copy_page_back_to_front(void) void z_palette_black(void) { for(int col = 0; col < COLOR_COUNT; col++) { - /* TODO: Replace with the decompiled call - * z_palette_show_single(col, 0, 0, 0); - * once that function is part of this translation unit */ - __asm { - db 0x66, 0x6A, 0x00; - push 0x00; - db 0x56; - push cs; - call near ptr z_palette_show_single; - add sp, 8; - } + z_palette_show_single(col, 0, 0, 0); } } @@ -247,17 +243,7 @@ void z_palette_black_out(void) void z_palette_white(void) { for(int col = 0; col < COLOR_COUNT; col++) { - /* TODO: Replace with the decompiled call - * z_palette_show_single(col, RGB4::max(), RGB4::max(), RGB4::max()); - * once that function is part of this translation unit */ - __asm { - db 0x66, 0x68, 0x0F, 0x00, 0x0F, 0x00; - push 0x0F; - db 0x56; - push cs; - call near ptr z_palette_show_single; - add sp, 8; - } + z_palette_show_single(col, RGB4::max(), RGB4::max(), RGB4::max()); } } @@ -288,27 +274,7 @@ void z_palette_white_out(void) void z_palette_show(void) { for(int i = 0; i < COLOR_COUNT; i++) { - /* TODO: Replace with the decompiled call - * z_palette_show_single_col(i, z_Palettes[i]); - * once that function is part of this translation unit */ - __asm { -#define push_comp(comp) \ - db 0x8B, 0xDE; /* MOV BX, SI */ \ - db 0x6B, 0xDB, 0x03; /* IMUL BX, 3, which Turbo C++ can't into? */ \ - mov al, byte ptr (z_Palettes + comp)[bx]; \ - cbw; \ - push ax; - push_comp(2); - push_comp(1); - push_comp(0); - // Spelling out PUSH SI causes Turbo C++ to interpret SI as - // reserved, and it then moves [i] to DI rather than SI - db 0x56; - push cs; - call near ptr z_palette_show_single; - add sp, 8; -#undef push_comp - } + z_palette_show_single_col(i, z_Palettes[i]); } } /// ------------- @@ -320,9 +286,9 @@ void z_palette_show(void) void z_grcg_pset(int x, int y, int col) { - GRCG_SETCOLOR_RMW(col); + grcg_setcolor_rmw(col); VRAM_SBYTE(B, ((y * ROW_SIZE) + (x >> 3))) = (0x80 >> (x & 7)); - GRCG_OFF(); + grcg_off_func(); } int z_col_at(int x, int y) @@ -360,6 +326,7 @@ extern planar16_t graph_r_pattern; void graph_r_hline(int left, int right, int y, int col) { + int x; int full_bytes_to_put; int order_tmp; planar8_t left_pixels; @@ -378,7 +345,7 @@ void graph_r_hline(int left, int right, int y, int col) right_pixels = 0xFF << (7 - (right & 7)); if(!graph_r_restore_from_1) { - GRCG_SETCOLOR_RMW(col); + grcg_setcolor_rmw(col); } if(graph_r_restore_from_1) { egc_copy_rect_1_to_0(left, y, RES_X - left, 1); @@ -387,14 +354,14 @@ void graph_r_hline(int left, int right, int y, int col) vram_row[0] = (left_pixels & right_pixels); } else { vram_row[0] = left_pixels; - for(register int x = 1; x < full_bytes_to_put; x++) { + for(x = 1; x < full_bytes_to_put; x++) { vram_row[x] = 0xFF; } vram_row[full_bytes_to_put] = right_pixels; } } if(!graph_r_restore_from_1) { - GRCG_OFF(); + grcg_off_func(); } } @@ -419,12 +386,12 @@ void graph_r_vline(int x, int top, int bottom, int col) pattern = graph_r_pattern >> (x & 7); pattern |= graph_r_pattern << (16 - (x & 7)); - GRCG_SETCOLOR_RMW(col); + grcg_setcolor_rmw(col); for(y = top; y <= bottom; y++) { VRAM_PUT(B, vram_row_offset, pattern, 16); vram_row_offset += ROW_SIZE; } - GRCG_OFF(); + grcg_off_func(); } void graph_r_line_from_1(int left, int top, int right, int bottom) @@ -556,7 +523,7 @@ void graph_r_line(int left, int top, int right, int bottom, int col) y_vram = y_cur; if(!graph_r_restore_from_1) { - GRCG_SETCOLOR_RMW(col); + grcg_setcolor_rmw(col); } if(w > h) { plot_loop(x_cur, w, 1, y_cur, h, y_direction); @@ -568,7 +535,7 @@ restore_last: restore_at(vram_offset); end: if(!graph_r_restore_from_1) { - GRCG_OFF(); + grcg_off_func(); } #undef plot_loop @@ -594,7 +561,7 @@ void z_grcg_boxfill(int left, int top, int right, int bottom, int col) clip_x(left, right); clip_y(top, bottom); - GRCG_SETCOLOR_RMW(col); + grcg_setcolor_rmw(col); vram_row = (planar8_t *)(MK_FP(GRAM_400, (top * ROW_SIZE) + (left >> 3))); for(y = top; y <= bottom; y++) { full_bytes_to_put = (right >> 3) - (left >> 3); @@ -612,7 +579,7 @@ void z_grcg_boxfill(int left, int top, int right, int bottom, int col) } vram_row += ROW_SIZE; } - GRCG_OFF(); + grcg_off_func(); } void graph_r_box(int left, int top, int right, int bottom, int col) @@ -652,6 +619,7 @@ int text_extent_fx(int fx, const unsigned char *str) void graph_putsa_fx(int left, int top, int fx, const unsigned char *str) { + register int x = left; uint16_t codepoint; planar16_t glyph_row; unsigned char far *vram; @@ -665,27 +633,27 @@ void graph_putsa_fx(int left, int top, int fx, const unsigned char *str) int w; int line; planar16_t glyph[GLYPH_H]; - planar16_t glyph_row_tmp; + register planar16_t glyph_row_tmp; if(clear_bg) { w = text_extent_fx(fx, str); if(underline) { - z_grcg_boxfill(left, top, (left + w - 1), (top + GLYPH_H + 1), 0); - graph_r_hline(left, (left + w - 1), (top + GLYPH_H + 1), 7); + z_grcg_boxfill(x, top, (x + w - 1), (top + GLYPH_H + 1), 0); + graph_r_hline(x, (x + w - 1), (top + GLYPH_H + 1), 7); } else { - z_grcg_boxfill(left, top, (left + w - 1), (top + GLYPH_H - 1), 0); + z_grcg_boxfill(x, top, (x + w - 1), (top + GLYPH_H - 1), 0); } } else if(underline) { w = text_extent_fx(fx, str); - graph_r_hline(left, (left + w - 1), (top + GLYPH_H + 1), 7); + graph_r_hline(x, (x + w - 1), (top + GLYPH_H + 1), 7); } - GRCG_SETCOLOR_RMW(fx); + grcg_setcolor_rmw(fx); OUTB(0x68, 0xB); // CG ROM dot access while(str[0]) { - set_vram_ptr(vram, first_bit, left, top); - get_glyph(glyph, codepoint, fullwidth, str, left, line); + set_vram_ptr(vram, first_bit, x, top); + get_glyph(glyph, codepoint, fullwidth, str, x, line); for(line = 0; line < GLYPH_H; line++) { apply_weight(glyph_row, glyph[line], glyph_row_tmp, weight); @@ -698,11 +666,11 @@ void graph_putsa_fx(int left, int top, int fx, const unsigned char *str) } put_row_and_advance(vram, glyph_row, first_bit); } - advance_left(left, fullwidth, spacing); + advance_left(x, fullwidth, spacing); } OUTB(0x68, 0xA); // CG ROM code access - GRCG_OFF(); + grcg_off_func(); } void graph_copy_byterect_back_to_front( @@ -786,26 +754,7 @@ void z_palette_fade_from( : -1; } } - /* TODO: Replace with the decompiled call - * z_palette_show_single_col(col, fadepal[col]); - * once that function is part of this translation unit */ - __asm { -#define push_comp(comp) \ - mov bx, col; \ - db 0x6B, 0xDB, 0x03; /* IMUL BX, 3, which Turbo C++ can't into? */ \ - lea ax, fadepal[comp]; \ - db 0x03, 0xD8; /* Turbo C++'s preferred opcode for ADD BX, AX */ \ - mov al, ss:[bx]; \ - cbw; \ - push ax; - push_comp(2) - push_comp(1) - push_comp(0) - push col - push cs - call near ptr z_palette_show_single - add sp, 8 - } + z_palette_show_single_col(col, fadepal[col]); } delay(step_ms); } @@ -893,27 +842,7 @@ int z_respal_get_show(void) if(respal_seg) { grb_t *respal = respal_seg->pal; for(i = 0; i < COLOR_COUNT; i++) { - /* TODO: Replace with the decompiled call - * z_palette_set_show(i, respal->r, respal->g, respal->b); - * once that function is part of this translation unit */ - __asm { - les bx, respal - mov al, es:[bx+2] - cbw - push ax - mov al, es:[bx+0] - cbw - push ax - mov al, es:[bx+1] - cbw - push ax - // Spelling out PUSH SI causes Turbo C++ to interpret SI as - // reserved, and it then moves [i] to DI rather than SI - db 0x56 - push cs - call near ptr z_palette_set_show - add sp, 8 - } + z_palette_set_show(i, respal->r, respal->g, respal->b); respal++; } return 0; diff --git a/th01/hardware/palette.hpp b/th01/hardware/palette.hpp index bde8a6db..efb01319 100644 --- a/th01/hardware/palette.hpp +++ b/th01/hardware/palette.hpp @@ -4,14 +4,17 @@ extern Palette4 z_Palettes; // Sets the given hardware [col] to the given RGB value. #define UINT4 int -void z_palette_show_single(uint4_t col, UINT4 r, UINT4 g, UINT4 b); +void z_palette_show_single(UINT4 col, UINT4 r, UINT4 g, UINT4 b); #define z_palette_show_single_col(col, rgb) \ z_palette_show_single(col, rgb.c.r, rgb.c.g, rgb.c.b); #undef UINT4 // Clamps #[r][g][b] to the 4-bit 0-15 range, then sets the given [col] in // both z_Palettes and the hardware palette to that value. -void z_palette_set_show(uint4_t col, int r, int g, int b); +void z_palette_set_show(int col, int r, int g, int b); + +// Calls z_palette_set_show() for all colors in [pal]. +void z_palette_set_all_show(const Palette4& pal); // Sets all hardware colors to #000, without touching z_Palettes. void z_palette_black(void); diff --git a/th01/hardware/palette_set_show.asm b/th01/hardware/palette_set_show.asm deleted file mode 100644 index 76d8507a..00000000 --- a/th01/hardware/palette_set_show.asm +++ /dev/null @@ -1,119 +0,0 @@ -public _z_palette_set_show -_z_palette_set_show proc far - -@@col = word ptr 6 -@@r = word ptr 8 -@@g = word ptr 0Ah -@@b = word ptr 0Ch - - push bp - mov bp, sp - push si - mov si, [bp+@@col] - cmp [bp+@@r], 0Fh - jge short @@r_above - mov ax, [bp+@@r] - jmp short @@r_below? -; --------------------------------------------------------------------------- - -@@r_above: - mov ax, 0Fh - -@@r_below?: - or ax, ax - jle short @@r_below - cmp [bp+@@r], 0Fh - jge short @@r_REALLY_above - mov ax, [bp+@@r] - jmp short @@r_in_range -; --------------------------------------------------------------------------- - -@@r_REALLY_above: - mov ax, 0Fh - -@@r_in_range: - jmp short @@r_set -; --------------------------------------------------------------------------- - -@@r_below: - xor ax, ax - -@@r_set: - mov [bp+@@r], ax - cmp [bp+@@g], 0Fh - jge short @@g_above_4bit - mov ax, [bp+@@g] - jmp short @@g_below? -; --------------------------------------------------------------------------- - -@@g_above_4bit: - mov ax, 0Fh - -@@g_below?: - or ax, ax - jle short @@g_below - cmp [bp+@@g], 0Fh - jge short @@g_REALLY_above - mov ax, [bp+@@g] - jmp short @@g_in_range -; --------------------------------------------------------------------------- - -@@g_REALLY_above: - mov ax, 0Fh - -@@g_in_range: - jmp short @@g_set -; --------------------------------------------------------------------------- - -@@g_below: - xor ax, ax - -@@g_set: - mov [bp+@@g], ax - cmp [bp+@@b], 0Fh - jge short @@b_above - mov ax, [bp+@@b] - jmp short @@b_below? -; --------------------------------------------------------------------------- - -@@b_above: - mov ax, 0Fh - -@@b_below?: - or ax, ax - jle short @@b_below - cmp [bp+@@b], 0Fh - jge short @@b_REALLY_above - mov ax, [bp+@@b] - jmp short @@b_in_range -; --------------------------------------------------------------------------- - -@@b_REALLY_above: - mov ax, 0Fh - -@@b_in_range: - jmp short @@b_set -; --------------------------------------------------------------------------- - -@@b_below: - xor ax, ax - -@@b_set: - mov [bp+@@b], ax - mov bx, si - imul bx, 3 - mov al, byte ptr [bp+@@r] - mov _z_Palettes[bx].r, al - mov bx, si - imul bx, 3 - mov al, byte ptr [bp+@@g] - mov _z_Palettes[bx].g, al - mov bx, si - imul bx, 3 - mov al, byte ptr [bp+@@b] - mov _z_Palettes[bx].b, al - call _z_palette_show_single c, si, [bp+@@r], [bp+@@g], [bp+@@b] - pop si - pop bp - retf -_z_palette_set_show endp diff --git a/th01_fuuin.asm b/th01_fuuin.asm index 2209e378..eb855dfd 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -5125,10 +5125,7 @@ loc_C6C7: mov _z_Palettes[7 * 3].r, 0Fh mov _z_Palettes[7 * 3].g, 0Fh mov _z_Palettes[7 * 3].b, 0Fh - push ds - push offset _z_Palettes - call sub_D1D9 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds cmp byte_14021, 1 jnz short loc_C71C push ds @@ -5402,10 +5399,7 @@ loc_C8F1: loc_C8F9: mov ax, [bp+arg_0] mov word_13507, ax - push ds - push offset _z_Palettes - call sub_D1D9 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds pop di pop si leave @@ -5932,7 +5926,7 @@ inregs = REGS ptr -10h ; push ds push offset _z_Palettes - nopcall sub_D1D9 + nopcall _z_palette_set_all_show push 0 nopcall _graph_accesspage_func push 0 @@ -6057,59 +6051,8 @@ inregs = REGS ptr -10h sub_D0E0 endp include th01/hardware/graph_page.asm -include th01/hardware/color.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_D1D9 proc far - -arg_0 = dword ptr 6 - - push bp - mov bp, sp - push si - xor si, si - jmp short loc_D21A -; --------------------------------------------------------------------------- - -loc_D1E1: - mov ax, si - imul ax, 3 - les bx, [bp+arg_0] - add bx, ax - mov al, es:[bx+2] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx+1] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx] - cbw - push ax - push si - nopcall _z_palette_set_show - add sp, 8 - inc si - -loc_D21A: - cmp si, COLOR_COUNT - jl short loc_D1E1 - pop si - pop bp - retf -sub_D1D9 endp - -include th01/hardware/palette_set_show.asm + extern _z_palette_set_all_show:proc + extern _z_palette_set_show:proc extern _z_graph_clear:proc extern _z_graph_clear_0:proc extern _graph_copy_page_back_to_front:proc diff --git a/th01_op.asm b/th01_op.asm index 52fe3d86..ee0edbaa 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -114,8 +114,7 @@ loc_A1CE: loc_A1E5: cmp si, 50h ; 'P' jl short loc_A1CE - push 4 - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 4 push 1 call _graph_accesspage_func add sp, 4 @@ -671,8 +670,7 @@ arg_0 = word ptr 6 shl dx, 4 add ax, dx mov si, ax - push 0Fh - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 15 pop cx xor di, di jmp short loc_A65C @@ -2350,7 +2348,7 @@ op_06_TEXT segment byte public 'CODE' use16 ; push ds push offset _z_Palettes - nopcall sub_BA15 + nopcall _z_palette_set_all_show push 0 nopcall _graph_accesspage_func push 0 @@ -2463,59 +2461,11 @@ inregs = REGS ptr -10h sub_B91C endp include th01/hardware/graph_page.asm -include th01/hardware/color.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_BA15 proc far - -arg_0 = dword ptr 6 - - push bp - mov bp, sp - push si - xor si, si - jmp short loc_BA56 -; --------------------------------------------------------------------------- - -loc_BA1D: - mov ax, si - imul ax, 3 - les bx, [bp+arg_0] - add bx, ax - mov al, es:[bx+2] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx+1] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx] - cbw - push ax - push si - nopcall _z_palette_set_show - add sp, 8 - inc si - -loc_BA56: - cmp si, COLOR_COUNT - jl short loc_BA1D - pop si - pop bp - retf -sub_BA15 endp - -include th01/hardware/palette_set_show.asm + extern _grcg_setcolor_rmw:proc + extern _grcg_setcolor_tdw:proc + extern _grcg_off_func:proc + extern _z_palette_set_all_show:proc + extern _z_palette_set_show:proc extern _z_graph_clear:proc extern _z_graph_clear_0:proc extern _graph_copy_page_back_to_front:proc @@ -2933,7 +2883,7 @@ op_09_TEXT segment byte public 'CODE' use16 sub_D631 proc far -var_38 = byte ptr -38h +@@palette = byte ptr -38h var_33 = byte ptr -33h var_8 = dword ptr -8 var_4 = word ptr -4 @@ -2948,7 +2898,7 @@ arg_2 = dword ptr 8 pushd [bp+arg_2] call @arc_file_load$qnxc push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax push 6 call @arc_file_get$qncui @@ -2987,16 +2937,16 @@ loc_D677: loc_D6A7: push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax - push 30h ; '0' + push size palette_t call @arc_file_get$qncui cmp word_129B8, 0 jz short loc_D6C7 push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax - call sub_BA15 + call _z_palette_set_all_show add sp, 4 loc_D6C7: @@ -3362,17 +3312,9 @@ arg_0 = dword ptr 6 ; --------------------------------------------------------------------------- loc_D9F8: - pushd 12h - push 0 - call file_seek - push ds - push offset unk_136D2 - push 30h ; '0' - call file_read - push ds - push offset unk_136D2 - call sub_BA15 - add sp, 4 + call file_seek pascal, large 12h, 0 + call file_read pascal, ds, offset palette_136D2, size palette_t + call _z_palette_set_all_show c, offset palette_136D2, ds call file_close xor ax, ax pop bp @@ -3400,13 +3342,8 @@ arg_0 = dword ptr 6 ; --------------------------------------------------------------------------- loc_DA37: - pushd 12h - push 0 - call file_seek - push ds - push offset unk_136D2 - push 30h ; '0' - call file_read + call file_seek pascal, large 12h, 0 + call file_read pascal, ds, offset palette_136D2, size palette_t call file_close xor ax, ax pop bp @@ -3476,24 +3413,24 @@ loc_DAC0: loc_DAC4: mov ax, dx - imul ax, 3 + imul ax, size rgb_t les bx, [bp+6] add bx, ax add bx, cx mov al, es:[bx] mov bx, dx - imul bx, 3 + imul bx, size rgb_t add bx, cx - mov [bx+1442h], al + mov byte ptr palette_136D2[bx], al inc cx loc_DADF: - cmp cx, 3 + cmp cx, size rgb_t jl short loc_DAC4 inc dx loc_DAE5: - cmp dx, 10h + cmp dx, COLOR_COUNT jl short loc_DAC0 pop bp retf @@ -3702,8 +3639,7 @@ arg_0 = word ptr 6 mov al, byte_129C9 cbw dec ax - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax pop cx loc_DC66: @@ -4912,7 +4848,7 @@ include th01/hardware/vram_planes[bss].asm dd ? dd ? dd ? -unk_136D2 db ? ; +palette_136D2 palette_t dd ? dd ? dd ? @@ -5197,20 +5133,6 @@ unk_136D2 db ? ; dd ? dd ? dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - db ? ; - db ? ; - db ? ; ; void (*font)(void) font dd ? include libs/master.lib/pal[bss].asm diff --git a/th01_reiiden.asm b/th01_reiiden.asm index 2833c091..fa1c7609 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -1337,13 +1337,13 @@ sub_BEB1 endp sub_BECF proc far -var_32 = byte ptr -32h +@@palette = byte ptr -32h var_2 = word ptr -2 arg_0 = word ptr 6 enter 32h, 0 push si - lea ax, [bp+var_32] + lea ax, [bp+@@palette] push ss push ax push ds @@ -1407,18 +1407,18 @@ loc_BF50: loc_BF5F: mov bx, si - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_2] - mov [bx+3D9Ch], al + mov byte ptr palette_3873C[bx], al inc [bp+var_2] loc_BF6E: - cmp [bp+var_2], 3 + cmp [bp+var_2], size rgb_t jl short loc_BF1C inc si loc_BF75: - cmp si, 10h + cmp si, COLOR_COUNT jl short loc_BF15 mov byte_3876C, 0FFh jmp loc_C42E @@ -1673,7 +1673,7 @@ loc_C1A2: or dx, dx jnz short loc_C1B6 push ss - lea ax, [bp+var_32] + lea ax, [bp+@@palette] push ax jmp short loc_C1C8 ; --------------------------------------------------------------------------- @@ -1686,10 +1686,10 @@ loc_C1B6: cmp dx, 2 jnz short loc_C1D0 push ds - push offset unk_3873C + push offset palette_3873C loc_C1C8: - call sub_EB10 + call _z_palette_set_all_show add sp, 4 loc_C1D0: @@ -1880,12 +1880,12 @@ loc_C3A6: loc_C3AD: mov bx, si - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_2] - mov al, [bx+3D9Ch] + mov al, byte ptr palette_3873C[bx] push ax mov bx, si - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_2] cbw cmp ax, 0Fh @@ -1901,18 +1901,18 @@ loc_C3CE: pop dx add dl, al mov bx, si - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_2] - mov [bx+3D9Ch], dl + mov byte ptr palette_3873C[bx], dl inc [bp+var_2] loc_C3E0: - cmp [bp+var_2], 3 + cmp [bp+var_2], size rgb_t jl short loc_C3AD inc si loc_C3E7: - cmp si, 10h + cmp si, COLOR_COUNT jl short loc_C3A6 jmp short loc_C42E ; --------------------------------------------------------------------------- @@ -1930,10 +1930,7 @@ loc_C3EE: push 0 call _graph_accesspage_func pop cx - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds mov _player_invincibility_time, BOMB_INVINCIBILITY_FRAMES_AFTER mov byte_34A58, 0 mov ax, 1 @@ -1971,24 +1968,24 @@ loc_C43A: loc_C43E: mov ax, dx - imul ax, 3 + imul ax, size rgb_t les bx, [bp+arg_0] add bx, ax add bx, cx mov al, es:[bx] mov bx, dx - imul bx, 3 + imul bx, size rgb_t add bx, cx - mov [bx+51ECh], al + mov byte ptr palette_39B8C[bx], al inc cx loc_C459: - cmp cx, 3 + cmp cx, size rgb_t jl short loc_C43E inc dx loc_C45F: - cmp dx, 10h + cmp dx, COLOR_COUNT jl short loc_C43A pop bp retf @@ -2595,10 +2592,7 @@ loc_C92C: loc_C92D: cmp si, 10h jl short loc_C8D0 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds pop di pop si pop bp @@ -2752,10 +2746,7 @@ loc_CB91: ; --------------------------------------------------------------------------- loc_CB96: - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_B87C push 2000B0h push 8000E8h @@ -5536,7 +5527,7 @@ inregs = REGS ptr -10h ; push ds push offset _z_Palettes - nopcall sub_EB10 + nopcall _z_palette_set_all_show push 0 nopcall _graph_accesspage_func push 0 @@ -5661,59 +5652,11 @@ inregs = REGS ptr -10h sub_EA17 endp include th01/hardware/graph_page.asm -include th01/hardware/color.asm - -; =============== S U B R O U T I N E ======================================= - -; Attributes: bp-based frame - -sub_EB10 proc far - -arg_0 = dword ptr 6 - - push bp - mov bp, sp - push si - xor si, si - jmp short loc_EB51 -; --------------------------------------------------------------------------- - -loc_EB18: - mov ax, si - imul ax, 3 - les bx, [bp+arg_0] - add bx, ax - mov al, es:[bx+2] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx+1] - cbw - push ax - mov ax, si - imul ax, 3 - mov bx, word ptr [bp+arg_0] - add bx, ax - mov al, es:[bx] - cbw - push ax - push si - nopcall _z_palette_set_show - add sp, 8 - inc si - -loc_EB51: - cmp si, COLOR_COUNT - jl short loc_EB18 - pop si - pop bp - retf -sub_EB10 endp - -include th01/hardware/palette_set_show.asm + extern _grcg_setcolor_rmw:proc + extern _grcg_setcolor_tdw:proc + extern _grcg_off_func:proc + extern _z_palette_set_all_show:proc + extern _z_palette_set_show:proc extern _z_graph_clear:proc extern _z_graph_clear_0:proc extern _graph_copy_page_back_to_front:proc @@ -6176,7 +6119,7 @@ main_08_TEXT segment byte public 'CODE' use16 sub_106F3 proc far -var_38 = byte ptr -38h +@@palette = byte ptr -38h var_33 = byte ptr -33h var_8 = dword ptr -8 var_4 = word ptr -4 @@ -6191,7 +6134,7 @@ arg_2 = dword ptr 8 pushd [bp+arg_2] call @arc_file_load$qnxc push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax push 6 call @arc_file_get$qncui @@ -6230,16 +6173,16 @@ loc_10739: loc_10769: push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax - push 30h ; '0' + push size palette_t call @arc_file_get$qncui cmp word_350CE, 0 jz short loc_10789 push ss - lea ax, [bp+var_38] + lea ax, [bp+@@palette] push ax - call sub_EB10 + call _z_palette_set_all_show add sp, 4 loc_10789: @@ -6667,17 +6610,9 @@ arg_0 = dword ptr 6 ; --------------------------------------------------------------------------- loc_10ABA: - pushd 12h - push 0 - call file_seek - push ds - push offset unk_38988 - push 30h ; '0' - call file_read - push ds - push offset unk_38988 - call sub_EB10 - add sp, 4 + call file_seek pascal, large 18, 0 + call file_read pascal, ds, offset palette_38988, size palette_t + call _z_palette_set_all_show c, offset palette_38988, ds call file_close xor ax, ax pop bp @@ -6709,7 +6644,7 @@ loc_10AF9: push 0 call file_seek push ds - push offset unk_38988 + push offset palette_38988 push 30h ; '0' call file_read call file_close @@ -6799,24 +6734,24 @@ loc_10B82: loc_10B86: mov ax, dx - imul ax, 3 + imul ax, size rgb_t les bx, [bp+arg_0] add bx, ax add bx, cx mov al, es:[bx] mov bx, dx - imul bx, 3 + imul bx, size rgb_t add bx, cx - mov [bx+3FE8h], al + mov byte ptr palette_38988[bx], al inc cx loc_10BA1: - cmp cx, 3 + cmp cx, size rgb_t jl short loc_10B86 inc dx loc_10BA7: - cmp dx, 10h + cmp dx, COLOR_COUNT jl short loc_10B82 pop bp retf @@ -7060,8 +6995,7 @@ arg_0 = word ptr 6 mov al, byte_350DF cbw dec ax - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax pop cx loc_10D28: @@ -7812,7 +7746,7 @@ sub_1133E proc far arg_0 = word ptr 6 arg_2 = word ptr 8 -arg_4 = word ptr 0Ah +@@col = word ptr 0Ah arg_6 = word ptr 0Ch push bp @@ -7828,8 +7762,7 @@ arg_6 = word ptr 0Ch shl dx, 4 add ax, dx mov di, ax - push [bp+arg_4] - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, [bp+@@col] pop cx xor si, si jmp short loc_11398 @@ -8648,7 +8581,7 @@ var_6 = word ptr -6 var_4 = word ptr -4 var_2 = word ptr -2 arg_0 = word ptr 6 -arg_2 = dword ptr 8 +@@palette = dword ptr 8 arg_6 = dword ptr 0Ch enter 0Eh, 0 @@ -8728,7 +8661,7 @@ loc_11B22: loc_11B26: mov ax, di imul ax, 3 - les bx, [bp+arg_2] + les bx, [bp+@@palette] add bx, ax mov al, es:[bx+si] mov dx, di @@ -8739,7 +8672,7 @@ loc_11B26: jz short loc_11B7E mov ax, di imul ax, 3 - les bx, [bp+arg_2] + les bx, [bp+@@palette] add bx, ax mov al, es:[bx+si] mov dx, di @@ -8758,12 +8691,12 @@ loc_11B62: loc_11B64: mov dx, di imul dx, 3 - les bx, [bp+arg_2] + les bx, [bp+@@palette] add bx, dx add al, es:[bx+si] mov dx, di imul dx, 3 - les bx, [bp+arg_2] + les bx, [bp+@@palette] add bx, dx mov es:[bx+si], al @@ -8778,10 +8711,7 @@ loc_11B7F: loc_11B85: cmp di, 10h jl short loc_11B22 - push word ptr [bp+arg_2+2] - push word ptr [bp+arg_2] - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, word ptr [bp+@@palette], word ptr [bp+@@palette+2] loc_11B98: mov ax, [bp+var_6] @@ -9002,8 +8932,7 @@ arg_0 = dword ptr 6 mov [bp+var_A], ax mov al, es:[bx+40h] mov ah, 0 - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax pop cx jmp short loc_12203 ; --------------------------------------------------------------------------- @@ -9303,8 +9232,7 @@ arg_0 = word ptr 6 mov ax, [bp+arg_0] imul ax, 50h mov si, ax - push 7 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 7 pop cx xor di, di jmp short loc_1260D @@ -9417,10 +9345,7 @@ loc_126A1: loc_126A7: cmp si, 10h jl short loc_12684 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_126B8: push 1 @@ -9454,9 +9379,7 @@ loc_126DB: loc_126E1: cmp si, 10h jl short loc_126CC - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds push 1 call _graph_accesspage_func call _graph_copy_page_back_to_front @@ -9513,10 +9436,7 @@ loc_12754: loc_1275A: cmp si, 10h jl short loc_1272D - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_1276B: cmp [bp+var_6], 30h ; '0' @@ -9566,9 +9486,7 @@ loc_127AC: mov _z_Palettes[7 * 3].r, 0Fh mov _z_Palettes[7 * 3].g, 0Fh mov _z_Palettes[7 * 3].b, 0Fh - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds push 1 call _graph_accesspage_func call _z_graph_clear @@ -9818,10 +9736,7 @@ loc_12AC2: loc_12AC8: cmp si, 10h jl short loc_12AA5 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_12AD9: push 1 @@ -9855,9 +9770,7 @@ loc_12AFC: loc_12B02: cmp si, 10h jl short loc_12AED - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds push 1 call _graph_accesspage_func call _graph_copy_page_back_to_front @@ -9914,10 +9827,7 @@ loc_12B75: loc_12B7B: cmp si, 10h jl short loc_12B4E - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_12B8C: cmp [bp+var_6], 30h ; '0' @@ -10312,13 +10222,13 @@ loc_12EC0: loc_12EC7: mov bx, [bp+var_C] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_E] mov al, _z_Palettes[bx] mov bx, [bp+var_C] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_E] - cmp al, [bx+3FE8h] + cmp al, byte ptr palette_38988[bx] jz short loc_12F1B mov bx, [bp+var_C] imul bx, 3 @@ -10326,7 +10236,7 @@ loc_12EC7: mov bx, [bp+var_C] imul bx, 3 add bx, [bp+var_E] - cmp al, [bx+3FE8h] + cmp al, byte ptr palette_38988[bx] jge short loc_12EFF mov al, 1 jmp short loc_12F01 @@ -10349,17 +10259,14 @@ loc_12F1B: inc [bp+var_E] loc_12F1E: - cmp [bp+var_E], 3 + cmp [bp+var_E], size rgb_t jb short loc_12EC7 inc [bp+var_C] loc_12F27: - cmp [bp+var_C], 10h + cmp [bp+var_C], COLOR_COUNT jb short loc_12EC0 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_12F39: mov ax, [bp+var_A] @@ -10425,8 +10332,7 @@ var_2 = word ptr -2 mov di, 3844h mov eax, dword_3573A mov [bp+var_C], eax - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx mov [bp+var_6], di xor si, si @@ -10652,10 +10558,7 @@ arg_0 = word ptr 6 push ax call sub_13033 add sp, 6 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_12F91 pushd [bp+var_4] push (2Ah shl 16) or 80 @@ -13991,8 +13894,7 @@ loc_14E99: add bx, di cmp byte ptr es:[bx], 0 jz loc_14FFB - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 push 0 call _graph_accesspage_func mov ax, [bp+arg_8] @@ -14218,8 +14120,7 @@ loc_1509A: add bx, si cmp byte ptr es:[bx], 0 jz loc_151CF - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 push 0 call _graph_accesspage_func add sp, 4 @@ -14608,8 +14509,7 @@ loc_153F6: add bx, si cmp byte ptr es:[bx], 0 jz loc_15535 - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 push 0 call _graph_accesspage_func add sp, 4 @@ -15179,8 +15079,7 @@ loc_15900: not ax or ax, ax jz loc_159FD - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, [bp+var_C] les bx, es:[bx+10h] @@ -15432,8 +15331,7 @@ loc_15ACF: ; --------------------------------------------------------------------------- loc_15B4D: - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx mov al, byte ptr [bp+si+var_18] les bx, _VRAM_PLANE_B @@ -15470,8 +15368,7 @@ loc_15B9F: ; --------------------------------------------------------------------------- loc_15BA4: - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx mov al, byte ptr [bp+si+var_18] mov ah, 0 @@ -16229,8 +16126,7 @@ loc_161A7: jnz loc_16300 or si, si jl loc_16300 - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 push 0 call _graph_accesspage_func add sp, 4 @@ -17674,8 +17570,7 @@ loc_16DEB: add bx, ax cmp word ptr es:[bx], 0 jz short loc_16E33 - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, [bp+var_C] les bx, es:[bx+10h] @@ -18118,7 +18013,7 @@ arg_0 = word ptr 6 arg_2 = word ptr 8 arg_4 = word ptr 0Ah arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh +@@col = word ptr 0Eh enter 0Ah, 0 push si @@ -18150,8 +18045,7 @@ arg_8 = word ptr 0Eh jg loc_1767E cmp [bp+arg_2], 190h jge loc_1767E - push [bp+arg_8] - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, [bp+@@col] pop cx mov [bp+var_4], 0 jmp loc_17669 @@ -18323,14 +18217,13 @@ var_2 = word ptr -2 arg_0 = word ptr 6 arg_2 = byte ptr 8 arg_4 = dword ptr 0Ah -arg_8 = word ptr 0Eh +@@col = word ptr 0Eh enter 2, 0 push si push di mov di, [bp+arg_0] - push [bp+arg_8] - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, [bp+@@col] pop cx xor si, si jmp short loc_17733 @@ -18573,7 +18466,7 @@ arg_0 = word ptr 6 arg_2 = word ptr 8 arg_4 = word ptr 0Ah arg_6 = word ptr 0Ch -arg_8 = word ptr 0Eh +@@col = word ptr 0Eh arg_A = byte ptr 10h arg_C = byte ptr 12h arg_E = byte ptr 14h @@ -18583,8 +18476,7 @@ arg_E = byte ptr 14h push di mov [bp+var_1], 0 mov di, 0FFFFh - push [bp+arg_8] - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, [bp+@@col] pop cx mov al, [bp+arg_C] cmp al, [bp+arg_E] @@ -18799,8 +18691,7 @@ arg_4 = word ptr 0Ah mov [bp+var_4], dx cmp di, 3 jg short loc_17AA5 - push 0Ah - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 10 pop cx xor si, si jmp short loc_17A9B @@ -18890,8 +18781,7 @@ arg_4 = word ptr 0Ah mov [bp+var_2], dx cmp [bp+arg_4], 3 jg loc_17BAA - push 0Ah - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 10 pop cx xor di, di jmp loc_17B9E @@ -21126,8 +21016,7 @@ var_1 = byte ptr -1 mov al, byte_39DA0 mov [bp+var_3], al cli - push 0Ah - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 10 pop cx xor si, si jmp short loc_18C7C @@ -22631,8 +22520,7 @@ loc_196FC: pop cx cmp [bp+var_4], 0 jz loc_197CC - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 les bx, _VRAM_PLANE_B add bx, si mov eax, [bp+var_4] @@ -22762,8 +22650,7 @@ loc_19851: mov [bp+var_4], eax cmp [bp+var_4], 0 jz loc_19900 - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, _VRAM_PLANE_B add bx, di @@ -22918,8 +22805,7 @@ loc_1998E: mov di, ax or di, di jz loc_19A4B - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 les bx, _VRAM_PLANE_B add bx, si mov es:[bx], di @@ -23075,8 +22961,7 @@ loc_19AF3: mov [bp+var_2], ax cmp [bp+var_2], 0 jz loc_19BAF - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, _VRAM_PLANE_B add bx, di @@ -23288,8 +23173,7 @@ loc_19CBE: jnz short loc_19D54 cmp [bp+var_4], 0 jz loc_19E2B - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, _VRAM_PLANE_B add bx, di @@ -23358,8 +23242,7 @@ loc_19D54: mov cl, [bp+var_9] shr ax, cl mov byte ptr [bp+var_E+2], al - push 0 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 0 pop cx les bx, _VRAM_PLANE_B add bx, di @@ -28974,21 +28857,7 @@ byte_38723 db ? dd ? dd ? dd ? -unk_3873C db ? ; - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - db ? ; - db ? ; - db ? ; +palette_3873C palette_t byte_3876C db ? word_3876D dw ? dd ? @@ -29125,7 +28994,7 @@ include th01/hardware/vram_planes[bss].asm dd ? dd ? dd ? -unk_38988 db ? ; +palette_38988 palette_t dd ? dd ? dd ? @@ -29410,20 +29279,6 @@ unk_38988 db ? ; dd ? dd ? dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - db ? ; - db ? ; - db ? ; ; void (*off_38E28)(void) off_38E28 dd ? include libs/master.lib/pal[bss].asm @@ -30143,26 +29998,16 @@ include th01/pf[bss].asm dd ? dd ? db ? ; -unk_39B8C db ? ; +palette_39B8C palette_t dd ? dd ? dd ? - db ? ; - db ? ; -byte_39B9B db ? - db ? ; -byte_39B9D db ? dd ? dd ? dd ? dd ? dd ? dd ? - db ? ; - db ? ; - db ? ; -byte_39BB9 db ? -byte_39BBA db ? dd ? dd ? dd ? @@ -30241,16 +30086,6 @@ byte_39BBA db ? dd ? dd ? dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - db ? ; byte_39D18 db ? dd ? dd ? @@ -30748,21 +30583,7 @@ word_3A385 dw ? word_3A387 dw ? point_3A389 Point db ? -unk_3A38E db ? ; - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - dd ? - db ? ; - db ? ; - db ? ; +palette_3A38E palette_t byte_3A3BE db ? dd ? dd ? diff --git a/th01_reiiden_2.inc b/th01_reiiden_2.inc index b52658f2..d30bc3f4 100644 --- a/th01_reiiden_2.inc +++ b/th01_reiiden_2.inc @@ -1092,12 +1092,9 @@ loc_1BA6C: jnz short loc_1BAFD inc _z_Palettes[15 * 3].r inc _z_Palettes[15 * 3].g - inc byte_39BB9 - inc byte_39BBA - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + inc palette_39B8C[15 * size rgb_t].r + inc palette_39B8C[15 * size rgb_t].g + call _z_palette_set_all_show c, offset palette_39B8C, ds loc_1BAFD: cmp word_3A6CA, 64h ; 'd' @@ -1359,10 +1356,7 @@ loc_1BE24: mov byte_3A6CE, 1 mov word_35B54, 0 mov word_3A6CA, 0 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 mov byte ptr word_39E14+1, 0 mov word_3984E, 4 @@ -1595,10 +1589,7 @@ loc_1C02D: mov word_3A6CA, 0 mov word_39E04, 0 mov x_39E06, 0 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 cmp _rank, 0 jnz short loc_1C097 @@ -1978,10 +1969,7 @@ loc_1C3EB: mov word_3A6CA, 0 mov word_39E04, 0 mov x_39E06, 0 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 mov ax, RES_Y sub ax, point_3982A.y @@ -2320,10 +2308,7 @@ loc_1C741: mov word_39E04, 0 mov x_39E06, 0 mov word_39E12, 0 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 cmp _rank, 0 jnz short loc_1C7B1 @@ -3982,10 +3967,7 @@ loc_1D88A: mov word_39E0E, 0 loc_1D8C1: - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 jmp loc_1DFFC ; --------------------------------------------------------------------------- @@ -4776,19 +4758,16 @@ loc_1E0EB: or ax, ax jle short loc_1E114 dec _z_Palettes[15 * 3][si] - dec byte ptr [si+5219h] + dec byte ptr palette_39B8C[15 * size rgb_t][si] loc_1E114: - cmp di, 3 + cmp di, size rgb_t jge short loc_1E121 inc _z_Palettes[15 * 3][di] - inc byte ptr [di+5219h] + inc byte ptr palette_39B8C[15 * size rgb_t][di] loc_1E121: - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds loc_1E12D: les bx, [bp+arg_8] @@ -6721,9 +6700,7 @@ loc_1F0F8: push ds push offset point_3982A call sub_1588A - push ds - push offset unk_39B8C - call sub_EB10 + call _z_palette_set_all_show stdcall, offset palette_39B8C, ds add sp, 1Ch mov byte_39E25, 0FFh mov al, 1 @@ -6799,8 +6776,7 @@ arg_4 = word ptr 0Ah shl dx, 4 add ax, dx mov di, ax - push 0Ah - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 10 pop cx xor si, si jmp short loc_1F1EA @@ -11374,7 +11350,7 @@ arg_2 = word ptr 8 mov si, ax cmp di, 2 jnz short loc_218C1 - push 0Ah + push 10 jmp short loc_218C7 ; --------------------------------------------------------------------------- @@ -13161,9 +13137,7 @@ sub_22731 proc far push bp mov bp, sp call sub_232A4 - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds push 1300040h push 2E00000h push 200040h @@ -14280,19 +14254,19 @@ loc_22FD7: loc_22FE8: mov al, _z_Palettes[5 * 3][si] - cmp al, [si+51FBh] + cmp al, byte ptr palette_39B8C[5 * size rgb_t][si] jge short loc_22FF6 inc _z_Palettes[5 * 3][si] loc_22FF6: mov al, _z_Palettes[9 * 3][si] - cmp al, [si+5207h] + cmp al, byte ptr palette_39B8C[9 * size rgb_t][si] jge short loc_23004 inc _z_Palettes[9 * 3][si] loc_23004: mov al, _z_Palettes[15 * 3][si] - cmp al, [si+5219h] + cmp al, byte ptr palette_39B8C[15 * size rgb_t][si] jge short loc_23012 inc _z_Palettes[15 * 3][si] @@ -14300,12 +14274,9 @@ loc_23012: inc si loc_23013: - cmp si, 3 + cmp si, size rgb_t jl short loc_22FE8 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_23024: push 1 @@ -14603,22 +14574,22 @@ loc_232AB: loc_232AF: mov bx, dx - imul bx, 3 + imul bx, size rgb_t add bx, cx mov al, _z_Palettes[bx] mov bx, dx - imul bx, 3 + imul bx, size rgb_t add bx, cx - mov [bx+59EEh], al + mov byte ptr palette_3A38E[bx], al inc cx loc_232C6: - cmp cx, 3 + cmp cx, size rgb_t jl short loc_232AF inc dx loc_232CC: - cmp dx, 10h + cmp dx, COLOR_COUNT jl short loc_232AB pop bp retf @@ -14632,10 +14603,7 @@ sub_232A4 endp sub_232D3 proc far push bp mov bp, sp - push ds - push offset unk_3A38E - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_3A38E, ds pop bp retf sub_232D3 endp @@ -14775,20 +14743,20 @@ loc_2333E: loc_23342: mov bx, si - imul bx, 3 + imul bx, size rgb_t mov al, _z_Palettes[bx+di] mov bx, si - imul bx, 3 - mov [bx+di+59EEh], al + imul bx, size rgb_t + mov byte ptr palette_3A38E[bx+di], al inc di loc_23355: - cmp di, 3 + cmp di, size rgb_t jl short loc_23342 inc si loc_2335B: - cmp si, 10h + cmp si, COLOR_COUNT jl short loc_2333E xor si, si jmp short loc_2336A @@ -17324,25 +17292,25 @@ loc_24A9D: ; --------------------------------------------------------------------------- loc_24AB5: - mov al, [si+59F4h] + mov al, byte ptr palette_3A38E[2 * size rgb_t][si] cmp al, _z_Palettes[2 * 3][si] jge short loc_24AC3 dec _z_Palettes[2 * 3][si] loc_24AC3: - mov al, [si+5A00h] + mov al, byte ptr palette_3A38E[6 * size rgb_t][si] cmp al, _z_Palettes[6 * 3][si] jge short loc_24AD1 dec _z_Palettes[6 * 3][si] loc_24AD1: - mov al, [si+5A06h] + mov al, byte ptr palette_3A38E[8 * size rgb_t][si] cmp al, _z_Palettes[8 * 3][si] jge short loc_24ADF dec _z_Palettes[8 * 3][si] loc_24ADF: - mov al, [si+5A0Fh] + mov al, byte ptr palette_3A38E[11 * size rgb_t][si] cmp al, _z_Palettes[11 * 3][si] jge short loc_24AED dec _z_Palettes[11 * 3][si] @@ -17351,12 +17319,9 @@ loc_24AED: inc si loc_24AEE: - cmp si, 3 + cmp si, size rgb_t jl short loc_24AB5 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_24AFF: mov ax, word_3A6CA @@ -17438,12 +17403,9 @@ loc_24BA3: jnz short loc_24BDA inc _z_Palettes[5 * 3].r dec _z_Palettes[5 * 3].b - inc byte_39B9B - dec byte_39B9D - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + inc palette_39B8C[5 * size rgb_t].r + dec palette_39B8C[5 * size rgb_t].b + call _z_palette_set_all_show c, offset palette_39B8C, ds loc_24BDA: cmp word_3A6CA, 64h ; 'd' @@ -17451,10 +17413,7 @@ loc_24BDA: mov byte_3A3BE, 4 mov word_3A6CA, 0 mov word_35D14, 0 - push ds - push offset unk_39B8C - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset palette_39B8C, ds call sub_232A4 jmp loc_24DFB ; --------------------------------------------------------------------------- @@ -26035,8 +25994,7 @@ loc_29ADC: ; --------------------------------------------------------------------------- loc_29AE4: - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 pop cx call IRand mov bx, 8 @@ -26170,8 +26128,7 @@ loc_29BE5: loc_29BE7: add ax, word_3AC5E - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax pop cx les bx, _VRAM_PLANE_B add bx, word_3AC5C @@ -26195,8 +26152,7 @@ loc_29C16: jl loc_29B87 loc_29C1D: - push 0Ch - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 12 pop cx xor di, di jmp loc_29CAC @@ -26444,8 +26400,7 @@ loc_29E32: loc_29E46: cmp byte ptr [si+1445h], 0 jz loc_29FD6 - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 pop cx mov bx, si shl bx, 3 @@ -26488,8 +26443,7 @@ loc_29EA2: mov ax, 0C0h ; '?' sar ax, cl and [bp+var_3], al - push 0Ch - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 12 push 0 call _graph_accesspage_func add sp, 6 @@ -26540,8 +26494,7 @@ loc_29F5B: ; --------------------------------------------------------------------------- loc_29F62: - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 push 1 call _graph_accesspage_func les bx, _VRAM_PLANE_B @@ -26561,8 +26514,7 @@ loc_29F62: and [bp+var_3], al mov al, [si+1445h] cbw - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax push 0 call _graph_accesspage_func add sp, 8 @@ -27093,8 +27045,7 @@ loc_2A4C5: loc_2A4D9: cmp byte ptr [si+1465h], 0 jz loc_2A68A - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 mov bx, si add bx, bx mov bx, [bx+665Bh] @@ -27140,8 +27091,7 @@ loc_2A4D9: mov ax, 0C0h ; '?' sar ax, cl and [bp+var_5], al - push 0Ch - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 12 push 0 call _graph_accesspage_func add sp, 8 @@ -27207,8 +27157,7 @@ loc_2A59F: ; --------------------------------------------------------------------------- loc_2A618: - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 push 1 call _graph_accesspage_func mov ax, 0A800h @@ -27229,8 +27178,7 @@ loc_2A618: and [bp+var_5], al mov al, [si+1465h] cbw - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax push 0 call _graph_accesspage_func add sp, 8 @@ -28681,8 +28629,7 @@ loc_2B3E0: loc_2B3F4: cmp byte ptr [si+1483h], 0 jz loc_2B6D7 - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 mov bx, si shl bx, 3 fld qword ptr [bx+66B7h] @@ -28734,8 +28681,7 @@ loc_2B3F4: and [bp+var_3], 80h loc_2B4A2: - push 0Ch - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 12 push 0 call _graph_accesspage_func add sp, 4 @@ -28867,8 +28813,7 @@ loc_2B604: ; --------------------------------------------------------------------------- loc_2B60C: - push 0Ch - call _grcg_setcolor_tdw + call _grcg_setcolor_tdw stdcall, 12 push 1 call _graph_accesspage_func add sp, 4 @@ -28903,8 +28848,7 @@ loc_2B60C: loc_2B671: mov al, [si+1483h] cbw - push ax - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, ax push 0 call _graph_accesspage_func add sp, 4 @@ -30844,14 +30788,14 @@ loc_2C9C6: ; --------------------------------------------------------------------------- loc_2C9D4: - mov byte ptr [si+4015h], 0 + mov byte ptr palette_38988.colors[15 * size rgb_t][si], 0 inc si loc_2C9DA: - cmp si, 3 + cmp si, size rgb_t jb short loc_2C9D4 push ds - push offset unk_38988 + push offset palette_38988 push ds push offset _z_Palettes push 0 @@ -31112,10 +31056,7 @@ loc_2CC5F: dec _z_Palettes[6 * 3].b loc_2CC6B: - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds call sub_232A4 loc_2CC7C: @@ -31239,10 +31180,7 @@ loc_2CD81: loc_2CD87: cmp si, 10h jb short loc_2CD59 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_2CD98: cmp word_3A6CA, 0E6h @@ -31475,9 +31413,7 @@ loc_2CF20: loc_2CF26: cmp di, 10h jl short loc_2CF11 - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds call text_fillca pascal, (' ' shl 16) + TX_WHITE mov word_39854, 1 push 0 @@ -31566,11 +31502,11 @@ loc_2D00A: loc_2D011: mov bx, [bp+var_4] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_6] - mov al, [bx+3FE8h] + mov al, byte ptr palette_38988[bx] mov bx, [bp+var_4] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_6] cmp al, _z_Palettes[bx] jle short loc_2D031 @@ -31593,17 +31529,14 @@ loc_2D033: inc [bp+var_6] loc_2D050: - cmp [bp+var_6], 3 + cmp [bp+var_6], size rgb_t jl short loc_2D011 inc [bp+var_4] loc_2D059: - cmp [bp+var_4], 10h + cmp [bp+var_4], COLOR_COUNT jl short loc_2D00A - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_2D06B: inc [bp+var_8] @@ -31773,9 +31706,7 @@ loc_2D1CF: dec _z_Palettes[9 * 3].b loc_2D1DC: - push ds - push offset _z_Palettes - call sub_EB10 + call _z_palette_set_all_show stdcall, offset _z_Palettes, ds push 0Ah call _frame_delay add sp, 6 @@ -35011,10 +34942,7 @@ loc_2F0AC: dec _z_Palettes[9 * 3].b loc_2F0B9: - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_2F0C5: push 280060h @@ -35258,10 +35186,7 @@ loc_2F2FC: dec _z_Palettes[9 * 3].b loc_2F309: - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_2F315: push 280060h @@ -35504,10 +35429,7 @@ loc_2F557: dec _z_Palettes[9 * 3].b loc_2F564: - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds loc_2F570: push 280060h @@ -35929,10 +35851,7 @@ loc_2F9DA: loc_2F9E0: cmp si, 10h jl short loc_2F9AF - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds push 7 call _mdrv2_se_play pop cx @@ -36020,10 +35939,7 @@ loc_2FA86: loc_2FA8C: cmp si, 10h jl short loc_2FA77 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds push ds push offset a0 ; "\x1B)0" call _printf @@ -36093,11 +36009,11 @@ loc_2FB1B: loc_2FB22: mov bx, [bp+var_2] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_4] - mov al, [bx+3FE8h] + mov al, byte ptr palette_38988[bx] mov bx, [bp+var_2] - imul bx, 3 + imul bx, size rgb_t add bx, [bp+var_4] cmp al, _z_Palettes[bx] jle short loc_2FB42 @@ -36120,17 +36036,14 @@ loc_2FB44: inc [bp+var_4] loc_2FB61: - cmp [bp+var_4], 3 + cmp [bp+var_4], size rgb_t jl short loc_2FB22 inc [bp+var_2] loc_2FB6A: - cmp [bp+var_2], 10h + cmp [bp+var_2], COLOR_COUNT jl short loc_2FB1B - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds jmp loc_2FC06 ; --------------------------------------------------------------------------- @@ -36191,10 +36104,7 @@ loc_2FBDD: loc_2FBE6: cmp [bp+var_2], 10h jl short loc_2FBA1 - push ds - push offset _z_Palettes - call sub_EB10 - add sp, 4 + call _z_palette_set_all_show c, offset _z_Palettes, ds cmp _z_Palettes[7 * 3].r, 0 jz short loc_2FC1C cmp [bp+var_6], 0DCh ; '?' @@ -37883,8 +37793,7 @@ arg_4 = word ptr 0Ah push bp mov bp, sp - push 7 - call _grcg_setcolor_rmw + call _grcg_setcolor_rmw stdcall, 7 push [bp+arg_4] push [bp+arg_2] push [bp+arg_0]