From 4249f6a72a251e78ade70c2d723e0961fe39d266 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 11 May 2018 23:42:22 +0100 Subject: [PATCH] ubee: more updates - non premium colour not works - font setting *should* now work - laid foundations for mode switching --- Kernel/platform-ubee/README | 42 ++++++++++++------------ Kernel/platform-ubee/config.h | 10 +++--- Kernel/platform-ubee/devtty.c | 29 ++++++++++++++++- Kernel/platform-ubee/devtty.h | 3 ++ Kernel/platform-ubee/ubee.s | 61 +++++++++++++++++++++++++++-------- 5 files changed, 104 insertions(+), 41 deletions(-) diff --git a/Kernel/platform-ubee/README b/Kernel/platform-ubee/README index a216c2e7..b1c665f5 100644 --- a/Kernel/platform-ubee/README +++ b/Kernel/platform-ubee/README @@ -91,19 +91,35 @@ Done so far: - IDE driver (note the ubee512 emulator ide appears to be very busted as of 5.8.0) - If we have wd1002-5 and fd wtf do we put IDE in major/minors ? +- Video support (colour, attributes) DONE +- Map video at 0x8000 DONE +- Clear attribute ram if present DONE +- Move common up DONE +- Do buffer over discard change DONE +- Check we have video latches/map right everywhere DONE +- Init vtattr_cap and the video variables correctly DONE (I think) +- Check if scrolling in hw is doable or not in 80x25 NO +- Support 'map video into my process at 0x8000 hack' DONE +- Non premium video COLOUR DONE +- Non premium video setup COLOUR DONE +- Support RAM font setting DONE +- Figure out how I broke the 6545 cursor DONE In Progress +- Debugging floppy driver - we seem to have broken it +- Swap +- Graphics not just vt interfaces +- RAM based fonts +- Premium models hang somewhere as if there's a memory banking bug + (seems to be a size related Heisenbug) To Do: - Floppy - media detect/sectors per track etc/ hard skew - Fix reboot/panic logic - Keyboard repeat -- Graphics not just vt interfaces -- Premium models hang somewhere as if there's a memory banking bug +- Speed up RTC timer a bit for lpen based boxes so we don't miss keys Longer Term -- RAM based fonts (load the ROM one into RAM - customised for bold/italic ?) - Do delayed video output via a buffer off vblank event for non premium - Proper support for Z80 PIO interfaces - Z8530 SCC @@ -167,21 +183,3 @@ bit patterns. Also it's banked and banked so will be horrible to program and we'll need graphics mode support for other modes - -Currently in progress - -- Video support (colour, attributes) DEBUGGING -- Map video at 0x8000 DONE -- Clear attribute ram if present DONE -- Move common up DONE -- Do buffer over discard change DONE -- Check we have video latches/map right everywhere DEBUGGING -- Init vtattr_cap and the video variables correctly DONE (I think) -- Check if scrolling in hw is doable or not in 80x25 NO -- Support 'map video into my process at 0x8000 hack' DONE -- Non premium video COLOUR IN PROGRESS -- Non premium video setup COLOUR IN PROGRESS -- Copy ROM font to RAM, support RAM font setting -- Figure out how I broke the 6545 cursor DONE - -Currently debugging scrolling, swap diff --git a/Kernel/platform-ubee/config.h b/Kernel/platform-ubee/config.h index db202896..e0898d13 100644 --- a/Kernel/platform-ubee/config.h +++ b/Kernel/platform-ubee/config.h @@ -17,15 +17,17 @@ #define MAX_MAPS 16 /* 512 KByte... */ #define MAP_SIZE 0x8000 -#define CONFIG_NET -#define CONFIG_NET_NATIVE +/* Set these two for networking - no point right now */ +//#define CONFIG_NET +//#define CONFIG_NET_NATIVE +/* Set this for IDE */ +//#define CONFIG_IDE #define CONFIG_DYNAMIC_BUFPOOL #define CONFIG_DYNAMIC_SWAP #define CONFIG_LARGE_IO_DIRECT #define MAX_BLKDEV 4 -#define CONFIG_IDE #define CONFIG_BANKS 2 /* 2 x 32K */ @@ -59,7 +61,7 @@ /* Device parameters */ #define NUM_DEV_TTY 1 #define TTYDEV BOOT_TTY /* Device used by kernel for messages, panics */ -#define NBUFS 6 /* Number of block buffers */ +#define NBUFS 5 /* Number of block buffers */ #define NMOUNTS 4 /* Number of mounts at a time */ extern unsigned int swap_dev; diff --git a/Kernel/platform-ubee/devtty.c b/Kernel/platform-ubee/devtty.c index 6ab8d178..93f744b7 100644 --- a/Kernel/platform-ubee/devtty.c +++ b/Kernel/platform-ubee/devtty.c @@ -309,11 +309,38 @@ static const struct videomap displaymap = { MAP_FBMEM }; +/* The low characters are in ROM so we only really have the UDG range */ +static const struct fontinfo fontinfo = { + 128, 255, 128, 255, FONT_INFO_8X11P16 +}; +/* FIXME: need to make sure we have done the rest of the stuff to get all + the fonts into 'from RAM' mode */ int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr) { + uint16_t size = 0x400; + uint8_t *base = (uint8_t *)0x8C00; + int r; /* Change this if we add multiple console support */ - if (minor != 1 || (arg >> 8) != 0x03) + if (minor != 1) + return tty_ioctl(minor, arg, ptr); + switch(arg) { + case VTFONTINFO: + return uput(&fontinfo, ptr, sizeof(fontinfo)); + case VTGETFONT: + case VTGETUDG: + map_video_font(); + r = uget(base, ptr, size); + unmap_video_font(); + return r; + case VTSETFONT: + case VTSETUDG: + map_video_font(); + r = uput(base, ptr, size); + unmap_video_font(); + return r; + } + if ((arg >> 8) != 0x03) return vt_ioctl(minor, arg, ptr); switch(arg) { case GFXIOC_GETINFO: diff --git a/Kernel/platform-ubee/devtty.h b/Kernel/platform-ubee/devtty.h index 81b6cc7b..4eb794be 100644 --- a/Kernel/platform-ubee/devtty.h +++ b/Kernel/platform-ubee/devtty.h @@ -19,4 +19,7 @@ extern void do_cursor_on(void); extern int gfx_ioctl(uint8_t minor, uarg_t arg, char *ptr); +extern void map_video_font(void); +extern void unmap_video_font(void); + #endif diff --git a/Kernel/platform-ubee/ubee.s b/Kernel/platform-ubee/ubee.s index dac959fc..2345fc6c 100644 --- a/Kernel/platform-ubee/ubee.s +++ b/Kernel/platform-ubee/ubee.s @@ -143,27 +143,41 @@ to_reboot: out (0x50), a jp 0xE000 - .area _DISCARD - +_ctc_load: + pop de + pop hl + push hl + push de +ctcload: + ld bc, #0x0F0C +ctcloop: out (c), b ; register + ld a, (hl) + out (0x0D), a ; data + inc hl + dec b + jp p, ctcloop + ret + ; ; This setting list comes from the Microbee 256TC documentation ; and is the quoted table for 80x25 mode ; _ctc6545: ; registers in reverse order .db 0x00, 0x00, 0x00, 0x20, 0x0A, 0x09, 0x0A, 0x48 - .db 0x1a, 0x19, 0x05, 0x1B, 0x37, 0x58, 0x50, 0x6B + .db 0x1A, 0x19, 0x05, 0x1B, 0x37, 0x58, 0x50, 0x6B +_ctc6545_64: + .db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x2F, 0x0F, 0x48 + .db 0x12, 0x10, 0x09, 0x12, 0x37, 0x51, 0x40, 0x6B +_ctc6545_40: + .db 0x00, 0x00, 0x00, 0x20, 0x0A, 0x2A, 0x0A, 0x48 + .db 0x1A, 0x19, 0x05, 0x1B, 0x24, 0x2D, 0x28, 0x35 + .area _DISCARD init_early: ; load the 6545 parameters ld hl, #_ctc6545 - ld bc, #0x0F0C -ctcloop: out (c), b ; register - ld a, (hl) - out (0x0D), a ; data - inc hl - dec b - jp p, ctcloop + call ctcload ; ensure the CTC clock is right ld a, #0 in a, (9) ; manual says in but double check @@ -571,8 +585,8 @@ scanner_done: .globl _scroll_up .globl _scroll_down .globl _vwrite - .globl _patch_std - .globl _patch_std_end + .globl _map_video_font + .globl _unmap_video_font .globl ___hard_di @@ -743,13 +757,15 @@ _vwrite: vloop: ld a,(_vtchar) ld (hl),a ; character + ld a,(_ubee_model) + or a + jr z, noattrib ld a,#0x90 ; attribute RAM / 0x90 if we enable PCG extended -_patch_std: out (0x1c),a ; latch in attribute RAM ld (hl),e ; attribute xor a ; #0x80 if enable PCG extended out (0x1c),a -_patch_std_end: +noattrib: set 3,h ; colour is at F8-FF ld (hl),d ; colour dec bc @@ -761,6 +777,23 @@ nextchar: res 3,h inc hl jr vloop + +_map_video_font: + ld a, (mapreg) + and #0xF7 + or #0x10 + di + out (0x50),a + xor a + out (0x08),a + ret +_unmap_video_font: + ld a,#0x40 + out (0x08),a + ld a, (mapreg) + out (0x50),a + ei + ret ; ; Ensure these are in the video mapping ; -- 2.34.1