From: Alan Cox Date: Thu, 5 Jul 2018 21:59:26 +0000 (+0100) Subject: trs80: clean up graphics X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=401e042843ea7d719753d4c1101b06be72924a9d;p=FUZIX.git trs80: clean up graphics As we can direct map stuff and the card is already slow as molasses there isn't a good reason to support the Graphics ioctl ops except map so throw them out. While we are at it update the README --- diff --git a/Kernel/platform-trs80/README b/Kernel/platform-trs80/README index 8032f8a1..1b0fee8f 100644 --- a/Kernel/platform-trs80/README +++ b/Kernel/platform-trs80/README @@ -1,6 +1,24 @@ TRS80 Model 4/4P (or right now more accurately sdltrs/xtrs) +This port supports the following configurations currently + + TRS80 Model 4/4P (including gate array floppy disk workarounds) + Options: + Floppy Disk (somewhat basic support, no format tool yet) + Hard Disk (Tandy compatible) + Dave Huffman style banked memory (on Port 0x94) + In Progress: + Tandy hi-res graphics + Orchestra 90 sound card + Planned: + Micro Labs Grafyx + Alpha Joystick + IDE adapter + Not Supported: + XLR8R - to do it well is a different port + + Requres: Patched xtrs from Fuzix git tree diff --git a/Kernel/platform-trs80/devgfx.c b/Kernel/platform-trs80/devgfx.c index 158c2be5..ca2b3b09 100644 --- a/Kernel/platform-trs80/devgfx.c +++ b/Kernel/platform-trs80/devgfx.c @@ -36,6 +36,8 @@ static const struct display trsdisplay[2] = { 32, GFX_DRAW|GFX_READ|GFX_WRITE } + /* FIXME: Need to add Micrographyx at some point (needs a different id to + the TRS80 model III one */ }; /* Assumes a Tandy board */ @@ -53,50 +55,6 @@ __sfr __at 0x83 gfx_ctrl; static uint8_t vmode; -static int gfx_draw_op(uarg_t arg, char *ptr, uint8_t *buf) -{ - int l; - int c = 8; /* 4 x uint16_t */ - uint16_t *p = (uint16_t *)buf; - l = ugetw(ptr); - if (l < 6 || l > 512) - return EINVAL; - if (arg != GFXIOC_READ) - c = l; - if (uget(buf, ptr + 2, c)) - return EFAULT; - switch(arg) { - case GFXIOC_DRAW: - /* TODO - if (draw_validate(ptr, l, 1024, 256)) - return EINVAL */ - video_cmd(buf); - break; - case GFXIOC_WRITE: - case GFXIOC_READ: - case GFXIOC_EXG: - if (l < 8) - return EINVAL; - l -= 8; - if (p[0] > 128 || p[1] > 255 || p[2] > 128 || p[3] > 255 || - p[0] + p[2] > 128 || p[1] + p[3] > 255 || - (p[2] * p[3]) > l) - return -EFAULT; - if (arg == GFXIOC_WRITE) - video_write(buf); - else { - if (arg == GFXIOC_READ) - video_read(buf); - else - video_exg(buf); - if (uput(buf + 10, ptr, l - 2)) - return EFAULT; - return 0; - } - } - return 0; -} - int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) { uint8_t m; @@ -126,21 +84,6 @@ int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) if (vmode == 0) break; return uput(&trsmap, ptr, sizeof(trsmap)); - case GFXIOC_DRAW: - case GFXIOC_READ: - case GFXIOC_WRITE: - case GFXIOC_EXG: - if (vmode == 1) { - uint8_t *tmp = (uint8_t *)tmpbuf(); - err = gfx_draw_op(arg, ptr, tmp); - tmpfree(tmp); - if (err) { - udata.u_error = err; - err = -1; - } - return err; - } - /* Fall through */ } return -1; } diff --git a/Kernel/platform-trs80/trs80.s b/Kernel/platform-trs80/trs80.s index 6b3c56d1..e66b08dd 100644 --- a/Kernel/platform-trs80/trs80.s +++ b/Kernel/platform-trs80/trs80.s @@ -17,12 +17,6 @@ ; and the page from the C code .globl _hd_page - ; video - .globl _video_cmd - .globl _video_read - .globl _video_write - .globl _video_exg - ; exported debugging tools .globl _platform_monitor .globl _platform_reboot @@ -202,119 +196,3 @@ _hd_xfer_out: call map_kernel ret -; -; Graphics card -; -_video_cmd: - pop de - pop hl - push hl - push de - ld e,(hl) ; X byte, Y line - inc hl ; The hardware does the conversion - inc hl - ld d,(hl) ; for us - inc hl ; skip high bytes - inc hl - ld a, #0x43 ; auto incremeent X on write only - out (0x83), a ; set the register up -nextline: - push de - ld c, #0x80 - out (c), e ; X - inc c - out (c), d ; Y -nextop: - xor a - ld b, (hl) - cp b - jr z, endline - inc hl - ld c,(hl) - inc hl -oploop: - in a, (0x82) ; read data - and c - xor (hl) - out (0x82), a ; autoincrements X - djnz oploop - inc hl - jr nextop -endline: pop de - inc d ; down a scan line (easy peasy) - inc hl - xor a - cp (hl) ; 0 0 = end (for blank lines just do 01 ff 00) - jr nz, nextline - ret - -_video_write: - ld a, #0xB3 - ld (patch_io + 1), a ; OTIR - ld a, #0x43 -video_do: - out (0x83), a ; autoincrement on write - pop de - pop iy - push iy - push de - push iy - pop hl - ld de, #8 - add hl, de ; Data start into HL - ld e, (iy) ; x - ld d, 2(iy) ; y -next_rw: - ld c, #0x80 - out (c), e ; x - inc c - out (c), d ; y - inc c ; to data - ld b, 4(iy) ; count of bytes per line -patch_io: - otir ; wheee... - inc d ; next line - dec 6(iy) ; height - jr nz, next_rw - ret - -_video_read: - ld a, #0xB2 ; inir - ld (patch_io + 1), a - ld a, #0x13 ; autoincrement on read - jr video_do - -_video_exg: ; not quite worth self modifying - ld a, #0xB3 ; this one too - ld (patch_io + 1), a ; OTIR - ld a, #0x43 - out (0x83), a ; autoincrement on write - pop de - pop iy - push iy - push de - push iy - pop hl - ld de, #8 - add hl, de ; Data start into HL - ld e, (iy) ; x - ld d, 2(iy) ; y -next_ex: - ld c, #0x80 - out (c), e ; x - inc c - out (c), d ; y - ld b, 4(iy) ; count of bytes per line -ex_line: - in a, (0x82) ; faster than in a,(c) - ex af,af' ; icky but no free registers - ld a, (hl) - out (0x82), a ; write and inc - ex af, af - ld (hl), a - inc hl - djnz ex_line - inc d ; next line - dec 6(iy) ; height - jr nz, next_ex - ret