Skip to content

Commit

Permalink
GRiD GRiDcase 1520 initial support (#269)
Browse files Browse the repository at this point in the history
* add initial support for GRiD GRiDcase 1520

* add emulation of IDE HDD model

Certain BIOSes like GRiD 1520 can only work with a limited selection of IDE hard
drives.
Add capability to emulate particular HDD model.
Add 3 Conner drives that work with GRiD 1520.
  • Loading branch information
techomancer authored Nov 25, 2024
1 parent 1882f17 commit dd1ef68
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 2 deletions.
1 change: 1 addition & 0 deletions includes/private/ibm.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ enum {
ROM_TG286M,
ROM_AWARD286,
ROM_GDC212M,
ROM_GRID1520,
ROM_GW286CT,
ROM_SPC4200P,
ROM_SPC4216P,
Expand Down
5 changes: 5 additions & 0 deletions includes/private/models/grid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#ifndef _GRID_H_
#define _GRID_H_
void grid_init();

#endif /* _GRID_H_ */
7 changes: 7 additions & 0 deletions src/devices/nvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ void loadnvr() {
f = nvrfopen("super286tr.nvr", "rb");
nvrmask = 127;
break;
case ROM_GRID1520:
f = nvrfopen("grid1520.nvr", "rb");
nvrmask = 127;
break;
case ROM_GW286CT:
f = nvrfopen("gw286ct.nvr", "rb");
nvrmask = 127;
Expand Down Expand Up @@ -603,6 +607,9 @@ void savenvr() {
case ROM_HYUNDAI_SUPER286TR:
f = nvrfopen("super286tr.nvr", "wb");
break;
case ROM_GRID1520:
f = nvrfopen("grid1520.nvr", "wb");
break;
case ROM_GW286CT:
f = nvrfopen("gw286ct.nvr", "wb");
break;
Expand Down
30 changes: 29 additions & 1 deletion src/ide/ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,30 @@ typedef struct IDE {
atapi_device_t atapi;
} IDE;

typedef struct IDE_HDD_EMU {
int romset,
char *model;
int tracks, hpc, spt;
} IDE_HDD_EMU;

int cdrom_channel = 2;
int zip_channel = -1;

IDE ide_drives[7];

IDE *ext_ide;

/**
* Table of specific emulated HDD models, starting with Conner drives used
* by GRiD. Their BIOS only works with these, so this allows running GRiD
* BIOS unpatched.
*/
static IDE_HDD_EMU hddemu[] = {
{ ROM_GRID1520, "Conner Peripherals 20MB - CP3024", 615, 4, 17 }, // type 2, 20MB
{ ROM_GRID1520, "Conner Peripherals 40MB - CP3044", 980, 5, 17 }, // type 17,
{ ROM_GRID1520, "Conner Peripherals 104MB - CP3104", 776, 8, 33 } // extended type 224 104MB
};

char ide_fn[7][512];

int (*ide_bus_master_read_data)(int channel, uint8_t *data, int size, void *p);
Expand Down Expand Up @@ -151,6 +168,8 @@ void ide_padstr(char *str, const char *src, int len) {
*/
static void ide_identify(IDE *ide) {
memset(ide->buffer, 0, 512);
char *hdd_model = "PCemHD";
int h;

// ide->buffer[1] = 101; /* Cylinders */

Expand All @@ -163,7 +182,16 @@ static void ide_identify(IDE *ide) {

ide_padstr((char *)(ide->buffer + 10), "", 20); /* Serial Number */
ide_padstr((char *)(ide->buffer + 23), "v1.0", 8); /* Firmware */
ide_padstr((char *)(ide->buffer + 27), "PCemHD", 40); /* Model */
for (h = 0; h < sizeof(hddemu) / sizeof(hddemu[0]); h++)
if (romset == hddemu[h].romset
&& hdc[cur_ide[ide->board]].tracks == hddemu[h].tracks
&& hdc[cur_ide[ide->board]].hpc == hddemu[h].hpc
&& hdc[cur_ide[ide->board]].spt == hddemu[h].spt) {
hdd_model = hddemu[h].model;
break;
}

ide_padstr((char *)(ide->buffer + 27), hdd_model, 40); /* Model */

ide->buffer[0] = (1 << 6); /*Fixed drive*/
ide->buffer[20] = 3; /*Buffer type*/
Expand Down
5 changes: 4 additions & 1 deletion src/keyboard/keyboard_at.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv) {
if (romset == ROM_T3100E)
t3100e_mono_set(val);
break;

case 0xcb: /*AMI - set keyboard mode*/
break;

Expand Down Expand Up @@ -483,6 +482,10 @@ void keyboard_at_write(uint16_t port, uint8_t val, void *priv) {
keyboard_at.command = val;
/*New controller command*/
switch (val) {
case 0x09: /* GRID1520 - set backlight timeout */
if (romset != ROM_GRID1520)
pclog("Bad AT keyboard controller command %02X\n", val);
break;
case 0x20:
case 0x21:
case 0x22:
Expand Down
8 changes: 8 additions & 0 deletions src/memory/mem_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ int loadbios() {
fclose(f);
return 1;

case ROM_GRID1520:
f = romfopen("grid1520/grid1520_891025.bin", "rb");
if (!f)
break;
romfread(rom + 0x8000, 32768, 1, f);
fclose(f);
return 1;

case ROM_HYUNDAI_SUPER286TR:
f = romfopen("super286tr/award.bin", "rb");
if (!f)
Expand Down
Loading

0 comments on commit dd1ef68

Please sign in to comment.