[Debloating] [th01] Remove unused low-level code

Code that serves no purpose in the original game, but would cause quite
the annoyance to other port developers who might not immediately
realize that this code is unused. Keeping some of the functions that
come in handy during debugging, though.

Part of P0229, funded by Ember2528.
This commit is contained in:
nmlgc 2023-01-26 14:30:32 +01:00
parent 6271e32996
commit 0690425551
11 changed files with 0 additions and 216 deletions

View File

@ -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);
}

View File

@ -1,6 +1,5 @@
#pragma option -zCPTN_GRP_GRZ
#include <stdio.h>
#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);
}

View File

@ -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);

View File

@ -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_t __seg *>(mcb) /* For easy derefencing */
// "Get list of lists"
segread(&sregs);
regs.h.ah = 0x52;
intdosx(&regs, &regs, &sregs);
mcb = *reinterpret_cast<seg_t *>(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<respal_t *>(MCB + 1)->id[i] != ID[i]) {
break;
}
}
if(i == sizeof(ID)) {
return reinterpret_cast<respal_t __seg *>(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;
}

View File

@ -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

View File

@ -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);
/// ----------------

View File

@ -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) {

View File

@ -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, &regs, &regs);
}
inline uint8_t* tram_jis(uint16_t offset) {
return reinterpret_cast<uint8_t *>(MK_FP(SEG_TRAM_JIS, offset));
}

View File

@ -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

View File

@ -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

View File

@ -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