Skip to content

Commit 65596f2

Browse files
authored
Merge pull request #1153 from GmEsoft/GmEsoft_fix_trs80_discard.c
Fixed function 'probe_gfx' in Kernel/platform/platform-trs80/discard.c, not working because of write-only registers.
2 parents 80b0db9 + 1bd595c commit 65596f2

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

Kernel/platform/platform-trs80/discard.c

+20-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ __sfr __at 0x8E gfx_xor;
1818
1919
The control port differs as follows
2020
Tandy
21-
0: set to tun graphics on, clear for alpha
21+
0: set to turn graphics on, clear for alpha
2222
1: set to turn on wait states (no flicker on update)
2323
2424
Micrografyx
@@ -35,25 +35,35 @@ static uint_fast8_t probe_gfx(void)
3535
{
3636
kputs("Probing gfx\n");
3737
gfx_x = 1;
38-
if (gfx_x != 1)
38+
gfx_y = 1;
39+
gfx_ctrl = 0xA0; /* Graphics off, inc X on read/write */
40+
gfx_data = 0x55;
41+
gfx_data = 0xAA;
42+
gfx_x = 1;
43+
if (gfx_data != 0x55) {
44+
kputs("none\n") ;
3945
return 0;
40-
gfx_ctrl = 0x10; /* Graphics off, inc X on read */
41-
gfx_data;
42-
if (gfx_x != 0x11)
46+
}
47+
if (gfx_data != 0xAA) {
48+
kputs("none\n") ;
4349
return 0;
50+
}
4451
/* We have either a TRS80 or a clone card present */
45-
gfx_xpan = 0xAA;
46-
if (gfx_xpan != 0xAA)
52+
gfx_x = 0x7F;
53+
gfx_y = 0xFF;
54+
gfx_ctrl = 0xF0; /* No inc of X or Y */
55+
gfx_data = 0xA5;
56+
if (gfx_data != 0xA5) { /* this may need to be forced for Grafyx clone */
57+
kputs("uLabs Grafyx (original)\n") ;
4758
return 2;
48-
gfx_xpan = 0;
59+
}
60+
kputs("Tandy (assumed) or Grafyx clone (unhandled)\n") ;
4961
return 1;
5062
}
5163

5264
void device_init(void)
5365
{
54-
kputs("Probing gfx\n");
5566
gfxtype = probe_gfx();
56-
kputs("Done\n");
5767
vtbuf_init();
5868
#ifdef CONFIG_RTC
5969
/* Time of day clock */

0 commit comments

Comments
 (0)