ubee: more updates
authorAlan Cox <alan@linux.intel.com>
Fri, 11 May 2018 22:42:22 +0000 (23:42 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 11 May 2018 22:42:22 +0000 (23:42 +0100)
- non premium colour not works
- font setting *should* now work
- laid foundations for mode switching

Kernel/platform-ubee/README
Kernel/platform-ubee/config.h
Kernel/platform-ubee/devtty.c
Kernel/platform-ubee/devtty.h
Kernel/platform-ubee/ubee.s

index a216c2e..b1c665f 100644 (file)
@@ -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
index db20289..e0898d1 100644 (file)
 #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;
index 6ab8d17..93f744b 100644 (file)
@@ -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:
index 81b6cc7..4eb794b 100644 (file)
@@ -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
index dac959f..2345fc6 100644 (file)
@@ -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
 ;