Chips
In order to get some of the software working in advance of the hardware being ready and due to the lack of debugging support on the hardware I'm tying to rejig a simulator to provide some support. After trying to get several to work I ended up with CHIPS which allows me to play with the driving the CTC, which I'll need to get working to support the 50hz clock.
While none of the exiting ones is is perfect, the LC-80 emulator provides a good base, you can see them all at Tiny Emus.
I made a simple ROM which is below. To get it to work the source is assembled to chips-test\examples\roms\lc80_2k.bin then the chips-test\examples\roms\lc80-roms.h deleted at the project make is run. I am using Visual Studio so I thin make the individual project and run it in debug mode. To check that it is working some bytes in the RAM as 0x2000 are updated.
CH1 equ 1h
CH2 equ 2h
CH3 equ 3h
IBASE equ 200h
CTCIBASE equ 0h
SIOIBASE equ 8h
.org 0000h
di ;disable interrupts
jr start
.org 0066h
jr NMIINT
start:
ld sp, 23EAh
IM 2
LD A,INTTBL/256
LD I,A
EI
INI_CTC:
ld A,00000000
out (CH0),A
ld A,10100101b
out (CH0),A
ld A,02h
out (CH0),A
ld A,10100111b
out (CH1),A
ld A,04h
out (CH1),A
ld A,10100111b
out (CH2),A
ld A,08h
out (CH2),A
ld A,10100111b
out (CH3),A
ld A,0FFh
out (CH3),A
iloop:
nop
nop
jr iloop
NMIINT:
di
push af
ld A,(five)
inc A
ld (five),A
pop af
ei
reti
CTC0INT:
; ... interrupt routine
di
push af
ld A,(one)
inc A
ld (one),A
pop af
ei
RETI
CTC1INT:
; ... interrupt routine
di
push af
ld A,(two)
inc A
ld (two),A
pop af
ei
RETI
CTC2INT:
; ... interrupt routine
di
push af
ld A,(three)
inc A
ld (three),A
pop af
ei
RETI
CTC3INT:
; ... interrupt routine
di
push af
ld A,(four)
inc A
ld (four),A
pop af
ei
RETI
SIO0INT:
; ... interrupt routine
di
push af
ld A,(six)
inc A
ld (six),A
pop af
ei
RETI
org 0200h
INTTBL:
DW CTC0INT
DW CTC1INT
DW CTC2INT
DW CTC3INT
org IBASE + SIOIBASE
DW SIO0INT
org 07FFh
EndofROM DB 0 ;Pad out to fill ROM
one equ 2000h
two equ 2001h
three equ 2002h
four equ 2003h
five equ 2004h
six equ 2005h
Comments
Post a Comment