What is needed to bring-up Coleco ADAM as a CPM suibtype?
What is needed to bring-up Coleco ADAM as a CPM suibtype?
The Coleco ADAM could potentially be provided as a +cpm subtype, as it is literally the same hardware as countless other machines that Z88dk supports, just with a different memory map...
What needs to happen?
-Thom
What needs to happen?
-Thom
I've done a few of these CP/M machines lately, the process tends to be:
1. Gather ROMs and boot disks for target machine
2. Update appmake to generate a CP/M disc with the right geometry (assuming the disc format isn't a weird one)
Once that is done, it'll be a case of copying what was done for the Einstein - allowing access to the TMS and sound libraries from CP/M.
It's not usually a massive amount of work - if you can give some pointers to roms and disks I'll take a look over the weekend.
1. Gather ROMs and boot disks for target machine
2. Update appmake to generate a CP/M disc with the right geometry (assuming the disc format isn't a weird one)
Once that is done, it'll be a case of copying what was done for the Einstein - allowing access to the TMS and sound libraries from CP/M.
It's not usually a massive amount of work - if you can give some pointers to roms and disks I'll take a look over the weekend.
Oh, this is special. Okay, so when we change modes it looks like we enable the VDP interrupt.
On the Adam this ends up as an NMI.
However, there's no code to handle the NMI so it ends up jumping into the middle of the CP/M interpreter.
So, we need to stick a retn at 0x66 so that we don't jump into space. I can't think of a sensible way to do this at the moment in the libraries, so for the moment can you stick:
Somewhere near the start of your code
On the Adam this ends up as an NMI.
However, there's no code to handle the NMI so it ends up jumping into the middle of the CP/M interpreter.
So, we need to stick a retn at 0x66 so that we don't jump into space. I can't think of a sensible way to do this at the moment in the libraries, so for the moment can you stick:
Code: Select all
ld hl,0x45ed
ld (0x66),hl
also, dunno if this is a bug or not, but I had to alter my makefile slightly, it places the binaries in a build/ directory, so when appmake was making the disk image, it puts "BUILD/PL.COM" in the directory... for now, I've worked around it in the makefile, but, am wondering if I am doing something fundamentally wrong?
-Thom
-Thom
not sure. I have some code here for a serial device on the ADAM though:
Code: Select all
DataPort .equ 044h ; Data port (in/out)
StatPort .equ 045h ; Status port (in)
BaudRatePort .equ 046h ; Baud rate port (out)
ControlPort .equ 047h ; Control port (out)
InMask .equ 2 ; 8251 RxRDY
OutMask .equ 1 ; 8251 TxRDY
ChipSet .equ 037h ; 8251 RTS,ER,RxE,DTR,TxEN
ChipOff .equ 035h ; 8251 RTS,ER,RxE,TxEN (no dtr)
Break .equ ChipSet | 8 ; ChipSet OR send break
Freeze .equ 022h
Reset .equ 027h
n71 .equ 001001010b ; 7n1
n81 .equ 001001110b ; 8n1
n72 .equ 011001010b ; 7n2
n82 .equ 011001110b ; 8n2
e71 .equ 001111010b ; 7e1
e81 .equ 001111110b ; 8e1
e72 .equ 011111010b ; 7e2
e82 .equ 011111110b ; 8e2
o71 .equ 001011010b ; 7o1
o81 .equ 001011110b ; 8o1
o72 .equ 011011010b ; 7o2
o82 .equ 011011110b ; 8o2
b19200 .equ 03fh ; 19200
b9600 .equ 03eh ; 9600
b4800 .equ 03ch ; 4800
b2400 .equ 03ah ; 2400
b1200 .equ 037h ; 1200
b600 .equ 036h ; 600
b300 .equ 035h ; 300
BitParityStop .equ n81
BaudRate .equ b300
Echo .equ FALSE
SerialTest: .module SerialTest
ld a,BaudRate ; Setup the serial port
call SetBaudRate
ld a,BitParityStop
call SetBitSetup
call DTROn
call BreakOff
_keyLoop:
call STARTREADKEY ; Setup the keyboard read
jr nz,_keyboardError ; Keyboard error so exit
_loop:
call CharInput ; Get any character from the Serial port
jr nc,_noSC ; Jump if none
call PrintByte ; Display what we got
_noSC:
call ENDREADKEY ; End the keyboard reading
jr nc,_loop ; No key so continue
jr nz,_keyboardError ; Keyboard error so exit
call CharOutput ; Send the character in A
#if Echo = TRUE
call PrintByte ; Echo to our screen
#endif
jr _keyLoop ; Reset the keyboard read
_keyboardError:
ld hl,Serial_KB_Error
call PrintString
Stop
Serial_KB_Error:
.text "Keyboard Error"
.db NULL
; Gets a character from the Serial input if there is one and returns it in A
; If NC set then no character
CharInput: .module CharInput
in a,(StatPort) ; Get the input status
and InMask
rra ; Rotate into carry
rra
jr nc,_exit ; No character so exit
in a,(DataPort) ; Get data
_exit:
ret
; Send the character in A out the serial port, waiting till it is ready to go
CharOutput: .module CharOutput
push af ; Save character
_loop:
in a,(StatPort) ; Get the output status
and OutMask
rra ; Rotate into carry
jr nc,_loop ; Not ready, check again
pop af ; Get character back
out (DataPort),a ; Put data
ret
; Get serial data into A
SerialInput:
in a,(DataPort) ; Get data
ret
; A = 2 if data has been received (RxRDY)
SerialInputStatus:
in a,(StatPort) ; Get the input status
and InMask
ret
; Put serial data from A
SerialOutput:
out (DataPort),a ; Put data
ret
; A = 1 if ready to send data (TxRDY)
SerialOutputStatus:
in a,(StatPort) ; Get the output status
and OutMask
ret
; Turn DTR On
DTROn:
push af
ld a,ChipSet
out (ControlPort),a
pop af
ret
; Turn DTR Off
DTROff:
push af
ld a,ChipOff
out (ControlPort),a
pop af
ret
; Start serial port break
BreakOn:
push af
ld a,Break
out (ControlPort),a
pop af
ret
; Stop serial port break
BreakOff:
push af
ld a,ChipSet
out (ControlPort),a
pop af
ret
; Set the baud rate to the value in A
SetBaudRate:
push af
push bc
ld b,a
in a,(BaudRatePort)
ld c,a
in a,(BaudRatePort)
ld a,Freeze
out (ControlPort),a
ld a,c
out (BaudRatePort),a
ld a,b
out (BaudRatePort),a
ld a,Reset
out (ControlPort),a
pop bc
pop af
ret
; Set the bit setup to the value in A
SetBitSetup:
push af
push bc
ld b,a
in a,(BaudRatePort)
in a,(BaudRatePort)
ld c,a
ld a,Freeze
out (ControlPort),a
ld a,b
out (BaudRatePort),a
ld a,c
out (BaudRatePort),a
ld a,Reset
out (ControlPort),a
pop bc
pop af
ret