diff --git a/th01/core/initexit.cpp b/th01/core/initexit.cpp index 4bfbb3f2..3258a7c0 100644 --- a/th01/core/initexit.cpp +++ b/th01/core/initexit.cpp @@ -36,8 +36,6 @@ void game_init(void) z_text_init(); egc_start(); graph_start(); - respal_create(); - z_respal_set(); vram_planes_set(); } @@ -48,7 +46,6 @@ void game_exit(void) } game_initialized = false; game_exit_inner(); - respal_free(); } void game_switch_binary(void) @@ -81,16 +78,3 @@ void interrupt int06_game_exit(...) game_exit(); exit(0); } - -void game_exit_print_error(const char *fmt, ...) -{ - char buf[256]; - va_list ap; - - va_start(ap, fmt); - vsprintf(buf, fmt, ap); - game_exit(); - z_text_print(buf); - exit(1); - va_end(ap); -} diff --git a/th01/formats/grp.cpp b/th01/formats/grp.cpp index 6786a7ea..bf58c1b4 100644 --- a/th01/formats/grp.cpp +++ b/th01/formats/grp.cpp @@ -1,6 +1,5 @@ #pragma option -zCPTN_GRP_GRZ -#include #include "platform.h" #include "pc98.h" #include "master.hpp" @@ -46,21 +45,6 @@ int grp_palette_load(const char *fn) return 0; } -// ZUN bloat: Random unused function is random -int getkanji(FILE *fp) -{ - int low = getc(fp); - low += (getc(fp) << 8); - return low; -} - -void grp_palette_set_all(const Palette4& pal) -{ - int col; - int comp; - palette_copy(grp_palette, pal, col, comp); -} - int grp_put_palette_show(const char *fn) { extern int8_t* grp_buf; @@ -68,11 +52,6 @@ int grp_put_palette_show(const char *fn) char ret; grp_buf = new int8_t[GRP_BUFFER_SIZE]; - if(flag_palette_show == true) { - // Setting bit 1 should set a resident palette of sorts, but this is - // not actually supported by the PC-98 version of piloadc... - option |= 2; - } if(flag_grp_colorkey == true) { option = PILOAD_OPT_COLORKEY(15); } diff --git a/th01/formats/grp.h b/th01/formats/grp.h index 519b1e4b..1dfda1ad 100644 --- a/th01/formats/grp.h +++ b/th01/formats/grp.h @@ -19,9 +19,6 @@ // Always updated by any of the .GRP loading or blitting functions. extern Palette4 grp_palette; -// Overwrites [grp_palette] with [pal]. -void grp_palette_set_all(const Palette4& pal); - // Just loads [grp_palette] from the .GRP file with the given [fn], and updates // the hardware palette with it. Returns garbage. int grp_palette_load_show(const char *fn); diff --git a/th01/hardware/graph.cpp b/th01/hardware/graph.cpp index 70a546a0..112c9f3d 100644 --- a/th01/hardware/graph.cpp +++ b/th01/hardware/graph.cpp @@ -839,27 +839,6 @@ void graph_putsa_fx( grcg_off_func(); } -void graph_copy_byterect_from_accessed_page_to_other( - screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom -) -{ - pixel_t w = (right - left) / BYTE_DOTS; - pixel_t h = (bottom - top); - Planes_declare(p); - page_t page_front = page_accessed ^ 1; - pixel_t row; - PlanarRow_declare(tmp); - - Planes_offset(p, left, top); - for(row = 0; row < h; row++) { - PlanarRow_blit(tmp, p, w); - graph_accesspage(page_front); - PlanarRow_blit(p, tmp, w); - graph_accesspage(page_accessed); - Planes_next_row(p); - } -} - void graph_move_byterect_interpage( screen_x_t src_left, vram_y_t src_top, @@ -929,107 +908,3 @@ void z_palette_fade_from( delay(step_ms); } } - -// Resident palette -// ---------------- - -#define RESPAL_ID "pal98 grb" - -// MASTER.MAN suggests that GRB ordering is some sort of standard on PC-98. -// It does match the order of the hardware's palette register ports, after -// all. (0AAh = green, 0ACh = red, 0AEh = blue) -struct grb_t { - uint4_t g, r, b; -}; - -struct respal_t { - char id[sizeof(RESPAL_ID)]; - unsigned char tone; - int8_t padding[5]; - grb_t pal[COLOR_COUNT]; -}; -// ---------------- - -// Memory Control Block -// Adapted from FreeDOS' kernel/hdr/mcb.h -// -------------------- - -#define MCB_NORMAL 0x4d -#define MCB_LAST 0x5a - -struct mcb_t { - uint8_t m_type; // mcb type - chain or end - uint16_t __seg* m_psp; // owner id via psp segment - uint16_t m_size; // size of segment in paragraphs - uint8_t m_fill[3]; - uint8_t m_name[8]; -}; -static const uint16_t MCB_PARAS = (sizeof(mcb_t) / 16); - -respal_t __seg* z_respal_exist(void) -{ - union REGS regs; - struct SREGS sregs; - const char ID[] = RESPAL_ID; - seg_t mcb; - int i; - -#define MCB reinterpret_cast(mcb) /* For easy derefencing */ - - // "Get list of lists" - segread(&sregs); - regs.h.ah = 0x52; - intdosx(®s, ®s, &sregs); - - mcb = *reinterpret_cast(MK_FP(sregs.es, regs.w.bx - 2)); - while(1) { - if(MCB->m_psp != 0) { - for(i = 0; i < sizeof(ID); i++) { - if(reinterpret_cast(MCB + 1)->id[i] != ID[i]) { - break; - } - } - if(i == sizeof(ID)) { - return reinterpret_cast(mcb + MCB_PARAS); - } - } - if(MCB->m_type != MCB_NORMAL) { - return 0; - } - mcb += MCB_PARAS + MCB->m_size; - }; - -#undef MCB -} - -int z_respal_get_show(void) -{ - int i; - respal_t __seg *respal_seg = z_respal_exist(); - if(respal_seg) { - grb_t *respal = respal_seg->pal; - for(i = 0; i < COLOR_COUNT; i++) { - z_palette_set_show(i, respal->r, respal->g, respal->b); - respal++; - } - return 0; - } - return 1; -} - -int z_respal_set(void) -{ - int i; - respal_t __seg *respal_seg = z_respal_exist(); - if(respal_seg) { - grb_t *respal = respal_seg->pal; - for(i = 0; i < COLOR_COUNT; i++) { - respal->g = z_Palettes[i].c.g; - respal->r = z_Palettes[i].c.r; - respal->b = z_Palettes[i].c.b; - respal++; - } - return 0; - } - return 1; -} diff --git a/th01/hardware/graph.h b/th01/hardware/graph.h index 4aad8bb5..623c69d8 100644 --- a/th01/hardware/graph.h +++ b/th01/hardware/graph.h @@ -113,16 +113,6 @@ void graph_r_lineloop_unput( /// Blitting /// -------- -// Copies the given rectangle on the current from -// (⌊left/8⌋*8, top) -// to -// (⌊left/8⌋*8 + ⌊(right-left)/8⌋*8, bottom) -// from the VRAM page that was previously set as the accessed one via a call -// to graph_accesspage_func() to the same position on the opposite page. -void graph_copy_byterect_from_accessed_page_to_other( - screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom -); - // Moves the given source rectangle from // (⌊left/8⌋*8, top) // on the [src] page to diff --git a/th01/hardware/palette.h b/th01/hardware/palette.h index 28e4d3dd..01394e10 100644 --- a/th01/hardware/palette.h +++ b/th01/hardware/palette.h @@ -122,14 +122,3 @@ void z_palette_white_out(void); z_palette_set_show(colors[i], RGB4::max(), RGB4::max(), RGB4::max()); \ } /// ---------------- - -/// Resident palette -/// ---------------- - -// Copies the resident palette to z_Palettes and sets all hardware colors. -// Returns 1 on success, 0 on failure. -int z_respal_get_show(void); -// Copies z_Palettes to the resident palette. Returns 1 on success, 0 on -// failure. -int z_respal_set(void); -/// ---------------- diff --git a/th01/hardware/vsync.cpp b/th01/hardware/vsync.cpp index 921165e4..2b6f5ee9 100644 --- a/th01/hardware/vsync.cpp +++ b/th01/hardware/vsync.cpp @@ -15,9 +15,6 @@ extern bool vsync_initialized = false; extern bool16 vsync_callback_is_set = false; -static pixel_t RES_X_HALF = (RES_X / 2); -static pixel_t RES_Y_HALF = (RES_Y / 2); - // Unused mouse cursor (?!) // ------------------- @@ -37,8 +34,6 @@ static void (*vsync_callback)(void); static void interrupt vsync_intfunc(...) { - pixel_t res_x_half = RES_X_HALF; - pixel_t res_y_half = RES_Y_HALF; z_vsync_Count1++; z_vsync_Count2++; if(vsync_callback_is_set) { diff --git a/th01/hardware/ztext.cpp b/th01/hardware/ztext.cpp index 8c4400bb..9ff4cf0f 100644 --- a/th01/hardware/ztext.cpp +++ b/th01/hardware/ztext.cpp @@ -97,16 +97,6 @@ void z_text_setcursor(z_text_cursor_t type) outportb(0x60, ((_BL << 3) + 2)); } -void z_text_locate(char x, char y) -{ - union REGS regs; - regs.h.cl = 0x10; - regs.h.ah = 3; - regs.h.dh = y; - regs.h.dl = x; - int86(0xDC, ®s, ®s); -} - inline uint8_t* tram_jis(uint16_t offset) { return reinterpret_cast(MK_FP(SEG_TRAM_JIS, offset)); } diff --git a/th01_fuuin.asm b/th01_fuuin.asm index 0b71dee6..2686bf52 100644 --- a/th01_fuuin.asm +++ b/th01_fuuin.asm @@ -34,8 +34,6 @@ include libs/master.lib/graph_start.asm include libs/master.lib/graph_scrollup.asm include libs/master.lib/palette_show.asm include libs/master.lib/palette_init.asm -include libs/master.lib/respal_exist.asm -include libs/master.lib/respal_free.asm include libs/master.lib/resdata.asm include libs/master.lib/file_read.asm include libs/master.lib/file_close.asm @@ -54,8 +52,6 @@ _TEXT ends include libs/master.lib/version[data].asm include libs/master.lib/grp[data].asm include libs/master.lib/pal[data].asm -include libs/master.lib/respal_exist[data].asm -include libs/master.lib/resdata[data].asm include libs/master.lib/fil[data].asm include libs/master.lib/dos_ropen[data].asm include libs/master.lib/clip[data].asm @@ -65,6 +61,5 @@ include libs/master.lib/rand[data].asm include libs/master.lib/pal[bss].asm include libs/master.lib/fil[bss].asm -include libs/master.lib/clip[bss].asm end diff --git a/th01_op.asm b/th01_op.asm index 2c70f79f..3aec596d 100644 --- a/th01_op.asm +++ b/th01_op.asm @@ -33,8 +33,6 @@ include libs/master.lib/graph_show.asm include libs/master.lib/graph_start.asm include libs/master.lib/palette_show.asm include libs/master.lib/palette_init.asm -include libs/master.lib/respal_exist.asm -include libs/master.lib/respal_free.asm include libs/master.lib/resdata.asm include libs/master.lib/file_read.asm include libs/master.lib/file_close.asm @@ -53,8 +51,6 @@ _TEXT ends include libs/master.lib/version[data].asm include libs/master.lib/grp[data].asm include libs/master.lib/pal[data].asm -include libs/master.lib/respal_exist[data].asm -include libs/master.lib/resdata[data].asm include libs/master.lib/fil[data].asm include libs/master.lib/keytable[data].asm include libs/master.lib/keystart[data].asm @@ -68,7 +64,6 @@ include libs/master.lib/rand[data].asm include libs/master.lib/pal[bss].asm include libs/master.lib/fil[bss].asm include libs/master.lib/keystart[bss].asm -include libs/master.lib/clip[bss].asm end diff --git a/th01_reiiden.asm b/th01_reiiden.asm index b56fa3d5..c58d7a13 100644 --- a/th01_reiiden.asm +++ b/th01_reiiden.asm @@ -35,8 +35,6 @@ include libs/master.lib/graph_show.asm include libs/master.lib/graph_start.asm include libs/master.lib/palette_show.asm include libs/master.lib/palette_init.asm -include libs/master.lib/respal_exist.asm -include libs/master.lib/respal_free.asm include libs/master.lib/resdata.asm include libs/master.lib/file_read.asm include libs/master.lib/file_close.asm @@ -64,8 +62,6 @@ include libs/master.lib/version[data].asm include libs/master.lib/tx[data].asm include libs/master.lib/grp[data].asm include libs/master.lib/pal[data].asm -include libs/master.lib/respal_exist[data].asm -include libs/master.lib/resdata[data].asm include libs/master.lib/fil[data].asm include libs/master.lib/keytable[data].asm include libs/master.lib/keystart[data].asm @@ -81,6 +77,5 @@ include libs/master.lib/rand[data].asm include libs/master.lib/pal[bss].asm include libs/master.lib/fil[bss].asm include libs/master.lib/keystart[bss].asm -include libs/master.lib/clip[bss].asm end