bootloader hack
- 6 or 5bit wide fonts (42, 51 column)
- Optimize zxvid - especially scrolling
-- Colour attributes
-- Graphics mapping
-- Kempston joystick and mouse
- Many of the later Russian clones support putting bank 0 in the low
16K, and more than 8 banks. That would need some changes to the bank
logic and some interesting detection code. Also they have rather
DONE - Move video to 4000 and data to 6000 so that we have video
direct mappable by user space and also make it easier if we
have to work via ROMs that want spectrum system variable stuff
+DONE - Colour attributes
+DONE - Graphics mapping
+DONE - Kempston joystick and mouse
char tbuf1[TTYSIZ];
-uint8_t vtattr_cap;
+uint8_t vtattr_cap = VTA_INVERSE|VTA_FLASH;
+uint8_t curattr = 7;
struct vt_repeat keyrepeat;
static uint8_t kbd_timer;
}
return -1;
}
+
+void vtattr_notify(void)
+{
+ /* Attribute byte fixups: not hard as the colours map directly
+ to the spectrum ones */
+ if (vtattr & VTA_INVERSE)
+ curattr = ((vtink & 7) << 3) | (vtpaper & 7);
+ else
+ curattr = (vtink & 7) | ((vtpaper & 7) << 3);
+ if (vtattr & VTA_FLASH)
+ curattr |= 0x80;
+ /* How to map the bright bit - we go by either */
+ if ((vtink | vtpaper) & 0x10)
+ curattr |= 0x40;
+}
.globl _procmem
.globl _vtoutput
+ .globl _vtinit
.globl outcharhex
.globl outhl, outde, outbc
ld (_procmem), hl
; screen initialization
- ; clear
- ld hl, #0x4000
- ld de, #0x4001
- ld bc, #0x1800 ; There should be 0x17FF, but we are going
- xor a ; to copy additional byte to avoid need of
- ld (hl), a ; DE and HL increment before attribute
- ldir ; initialization (2 bytes of RAM economy)
-
- ; set color attributes
- ld a, #7 ; black paper, white ink
- ld bc, #0x300 - #1
- ld (hl), a
- ldir
+ push af
+ call _vtinit
+ pop af
ret
.globl _clear_lines
.globl _clear_across
.globl _do_beep
- .globl _vtattr_notify
.globl _fontdata_8x8
+ .globl _curattr
.area _VIDEO
ld d,a
ret
+videoattr:
+ ; 32 x E + D into HL
+ ld a,e
+ rrca
+ rrca
+ rrca ; A is now 32xE with the top bits overflowed
+ ; into the low 2 bits
+ ld l,a
+ and #3 ; Extract the low 2 bits for the high
+ add #0x58 ; Attributes start 0x5800
+ ld h,a
+ ld a,l
+ and #0xE0 ; mask the bits that are valid
+ add d ; add the low 5 bits from D
+ ld l,a ; and done (the add can't overflow)
+ ret
+
_plot_char:
pop iy
pop hl
push hl
push iy
+ push de
call videopos
ld b, #0 ; calculating offset in font table
inc d ; next screen line
dec c
jr nz, plot_char_loop
+ pop de
+ call videoattr
+ ld a,(_curattr)
+ ld (hl),a
ret
push de
push hl
push bc
+ ; This way we handle 0 correctly
+ inc d
+ jr nextline
clear_next_line:
push de
pop de
inc e
+nextline:
dec d
jr nz, clear_next_line
push de
push hl
push iy
+ ld a,c
+ or a
+ ret z ; No work to do - bail out
+ push de
+ push bc
call videopos ; first pixel line of first character in DE
push de
pop hl ; copy to hl
clear_char:
ld (de), a
inc d
- dec b
- jr nz, clear_char
+ djnz clear_char
ex de, hl
inc de
dec c
jr nz, clear_line
+ pop bc
+ pop de
+ call videoattr
+ ld a,(_curattr)
+ ld b,c
+setattr:
+ ld (hl),a
+ inc hl
+ djnz setattr
ret
copy_line:
ld (de), a
inc e
inc l
- dec b
- jr nz, copy_pixel_line
+ djnz copy_pixel_line
pop de
pop hl
dec c
jr nz, loop_scroll_down
+ ; Attributes
+ ld hl,#0x5ADF
+ ld de,#0x5AFF
+ ld bc,#0x02E0
+ lddr
+
ret
dec c
jr nz, loop_scroll_up
+ ld hl,#0x5820
+ ld de,#0x5800
+ ld bc,#0x02E0
+ ldir
ret
_cursor_on:
ld d, a
xor a
ld (de), a
-_vtattr_notify:
- ret
_do_beep:
ret