Hi there,
I'm just wondering if anyone knows how to use the programmable character generator (PCG) from assembly language on the X1? I've been trying for months to get this to work (with very little in the way of documentation or help) and am completely stuck. The code below works in XMillennium and MESS (it displays a character made up of two blue lines) but on a real X1twin it just appears as a solid blue square.
There must be something that I'm missing, but I just don't know what. Any pointers or even source code would be hugely appreciated at this point.
Many thanks.
Code:
org 0x0000
ld sp, 0xFFFF
di
;toggle concurrent access mode
ld bc, 0x1A02
in a, (c)
or 0x20
out (c), a
;for X1 turbo
ld bc, 0x1FD0
xor a
out (c), a
; *************************************************
;change the Blue PCG entry
ld bc, 0x1500
ld e, 0x08
exx
ld bc, 0x1A01 ;wait for start of VBLANK
_vbl1: in a, (c) ;.
jp p, _vbl1 ;.
_vbl2: in a, (c) ;.
jp m, _vbl2 ;.
exx ;4
SETP: ld a, 0x88 ;7
out (c), a ;12
inc hl ;6
inc bc ;6
;7+12+6+6=31
nop ;4
inc hl ;6
dec hl ;6
;4+6+6=16
call DELAY ;17 + 157
ld d, 0 ;7
nop ;4
nop ;4
dec e ;4
jp nz, SETP ;10 + 4 + 4 + 4 + 7 + (17+157) = 203
; *************************************************
;char1
ld bc, 0x3000
ld a, 0x20
out (c), a
ld bc, 0x2000
ld a, 0x21
out (c), a
LOOP: jp LOOP
; *************************************************
DELAY: ld a, 0x0A ;7
_dly: dec a ;4
jp nz, _dly ;10
ret ;10
;7+(4+10)*10 + 10 = 157