uint8_t keymap[16];
static uint8_t lastkey;
static int keysdown = 0;
+static uint8_t capslock;
uint8_t keyboard[1][128] = { {
0, KEY_ESC,
- '1','2','3','4','5','6','7','8','9',
+ '1','2','3','4','5','6','7','8','9','0',
'-','=', KEY_BS, KEY_TAB,
'q','w','e','r','t','y','u','i','o','p',
'[',']',KEY_ENTER,
- 0, 'a','s','d','f','g','h','j','k','l',':',';',
- 0,'\\','z','x','c','v','b','n','m','.',',','/',0,
- 0,0,' ',0, /* caps lock */
+ 0, 'a','s','d','f','g','h','j','k','l',';','\'','`',
+ 0,'\\','z','x','c','v','b','n','m',',','.','/',0,
+ 0,0,' ',KEY_CAPSLOCK,
KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,
0,0,
KEY_HOME,KEY_UP,0,'-',KEY_LEFT,0,KEY_RIGHT,'+',0,KEY_DOWN,
'0','.', KEY_ENTER,
} };
-/* TODO */
uint8_t shiftkeyboard[1][128] = { {
0, KEY_ESC,
- '1','2','3','4','5','6','7','8','9',
- '-','=', KEY_BS, KEY_TAB,
- 'q','w','e','r','t','y','u','i','o','p',
- '[',']',KEY_ENTER,
- 0, 'a','s','d','f','g','h','j','k','l',':',';',
- 0,'\\','z','x','c','v','b','n','m','.',',','/',0,
- 0,0,' ',0/* caps lock */,
+ '!','@','#','$','%','^','&','*','(',')',
+ '~','+', KEY_BS, KEY_TAB,
+ 'Q','W','R','R','T','Y','U','I','O','P',
+ '{','}',KEY_ENTER,
+ 0, 'A','S','D','F','G','H','J','L','L',':','"','~',
+ 0,'|','Z','X','C','V','B','N','M','<','>','?',0,
+ 0,0,' ',KEY_CAPSLOCK,
KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,
0,0,
KEY_HOME,KEY_UP,0,'-',KEY_LEFT,0,KEY_RIGHT,'+',0,KEY_DOWN,
{
uint8_t c = lastkey;
- if (c == 0 || !keysdown)
+ if (c == 0x3A) {
+ capslock ^= 1;
return;
+ }
+
/* FIXME: wire up input layer */
- if ((keymap[5] & 0x02) || (keymap[6] & 0x40)) /* shifts */
+ if ((keymap[5] & 0x04) || (keymap[6] & 0x40)) /* shifts */
c = shiftkeyboard[0][c];
- else if (keymap[7] & 0x02) { /* Caps lock */
+ else
+ c = keyboard[0][c];
+
+ if (capslock) { /* Caps lock */
if (c >= 'a' && c <= 'z')
c -= 32;
}
- if (keymap[2] & 0x10) /* Control */
+ if (keymap[3] & 0x20) /* Control */
c &= 31;
- else
- c = keyboard[0][c];
/* What should we do with alt (0x38) */
/* FIXME: unicode */
vt_inproc(1, c);
static void keybop(uint8_t c)
{
- uint8_t i = c >> 3;
+ uint8_t i = (c & 0x7F) >> 3;
uint8_t b = c & 7;
uint8_t nonshift = 1;
if (c & 0x80) {
keymap[i] &= ~ (1 << b);
keysdown -= nonshift;
- if (c == (lastkey | 0x8))
+ if (c == (lastkey | 0x80))
lastkey = 0;
return;
}
lastkey = c;
keysdown += nonshift;
/* FIXME: autorepeat */
+ /* And remember not to autorepeat capslock! */
if (keysdown && lastkey && keysdown < 3)
keydecode();
}
ikbd_ct = 0;
ikbd_len = 1;
keybop(c);
- } else
+ } else {
ikbd_len = msg_len[c - 0xF6];
- return;
+ return;
+ }
}
/* A message completed */
ikbd_ct = 0;
.globl fontdata_8x8, screenbase
.globl uarea_block
+ .globl acia_debug
.mri 1
platform_reboot:
platform_monitor:
move.b $FFFA03,d0
btst #7,d0
- beq normal_monitor
+ bne normal_monitor
move.w #0,videomode
move.b #50,videorows ; 640x400 is special
move.b #49,videobot
move.l #int_mfp12,$130(a0) ; RX Data
move.l #int_mfp14,$138(a0) ; RI
+ jsr vtinit
rts
palette:
add.w #1,vblankct
tst.b vblankw
beq int4_out
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
pea vblankct
bsr wakeup
addq #4,sp
- movem.l (sp)+,a0/a1/d0/d1
+ movem.l (sp)+,a0/a1/a5/d0/d1
int4_out:
rte
;
; The level 6 handlers are autovectored
;
int_mfp1: ; DCD on the serial
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
jsr ser_dcd
- movem.l (sp)+,a0/a1/d0/d1
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
int_mfp2: ; CTS on the seriall
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
jsr ser_cts
- movem.l (sp)+,a0/a1/d0/d1
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
int_mfp5: ; 200Hz timer
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
jsr timer_interrupt
- movem.l (sp)+,a0/a1/d0/d1
+ bclr.b #5,$fffa11 ; and clear service bit
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
int_mfp6: ; ACIA interrupts
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
+acia_loop:
jsr acia_interrupt
- movem.l (sp)+,a0/a1/d0/d1
+acia_debug:
+ lea.l $fffa00,a1
+ btst.b #4,$1(a1) ; Still interrupting ?
+ beq acia_loop
+ bclr.b #6,$11(a1) ; Clear ACIA in service
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
int_mfp9: ; MFP serial transmit error
; FIXME what do we need to do to clear down ?
; FIXME: how to clear
rte
int_mfp12: ; MFP receive
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
move.b $FFFA2D,d0
+ move.l udata_shadow,a5 ; set up the register global
move.l d0,-(sp)
pea.l 2
jsr tty_inproc
addq #8,sp
- movem.l (sp)+,a0/a1/d0/d1
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
int_mfp14: ; MFP ring indicate
- movem.l a0/a1/d0/d1,-(sp)
+ movem.l a0/a1/a5/d0/d1,-(sp)
+ move.l udata_shadow,a5 ; set up the register global
jsr ser_ri
- movem.l (sp)+,a0/a1/d0/d1
+ movem.l (sp)+,a0/a1/a5/d0/d1
rte
; outchar: Wait for UART TX idle, then print the char in d0
plotrow:
move.b (a1),(a0)
add.w #2,a0
-; FIXME; sort out why this isn't working yet
-; dbra d1,plotrow
+ dbra d1,plotrow
add.w d3,a0 ; line length for mode
add.w #1,a1
dbra d0,plotit
scroll_up:
move.l screenbase,a0
move.w #640,d0
- move.w #32000-640-1,d1
+ move.w #7840-1,d1
tst.w videomode
beq hires
move.w #1280,d0
- move.w #32000-1280-1,d1
+ move.w #7680-1,d1
hires:
move.l a0,a1
add.w d0,a1
scroll_down:
move.l screenbase+32000,a0
move.w #640,d0
- move.w #32000-640-1,d1
+ move.w #7840-1,d1
tst.w videomode
beq hiresd
move.w #1280,d0
- move.w #32000-1280-1,d1
+ move.w #7680-1,d1
hiresd:
move.l a0,a1
sub.w d0,a1
rts
clear_lines:
- move.l 4(sp),d0
+ move.b 7(sp),d0
move.l d2,-(sp)
move.l d3,-(sp)
- move.w #0,a1
+ moveq #0,d1
bsr vaddr
; d2 is mode count, d3 is extra words/line, a0 is address
- move.l 16(sp),d0
+ move.b 19(sp),d0
+ ext.w d0
+ ; d0 is the number of character lines to wipe. We have to do 8
+ ; times that for pixels so use vwidth which is 8 x char bytes
+ ; across
+ mulu.w vwidth,d0
+ lsr.w #1,d0
bra wipen
wipe:
move.w d2,d1
wipe1: clr.w (a0)+
- dbra d2,wipe1
- add.w d3,a0
+ dbra d1,wipe1
wipen:
dbra d0,wipe
move.l (sp)+,d3
rts
cursor_on:
- rts
move.b 7(sp),d0 ; check stacking
move.b 11(sp),d1
move.l d2,-(sp)
move.l d3,-(sp)
bsr vaddr
- moveq #7,d0
lea.l cursordata,a1
movem.l a0/d2/d3,(a1)
;
; Really we need to expand this per mode and to do colour
;
+do_xor:
+ moveq #7,d0
xorit:
move.w d2,d1 ; count by mode
xorrow:
rts
cursor_disable:
cursor_off:
- rts
move.l d2,-(sp)
move.l d3,-(sp)
lea.l cursordata,a1
movem.l (a1),a0/d2/d3
- bra xorit
+ cmp #0,a0
+ bne do_xor
+ move.l (sp)+,d3
+ move.l (sp)+,d2
+ rts
vtattr_notify:
rts
word 0
word 0
word 0
+ word 0
+ word 0
videorows:
byte 0
videobot: