Sunday, February 17, 2019

Coleco ADAM IDE, Multi-Cart.Boot Code

This is the code I created in 2013 to auto boot the Coleco Adam IDE interface via a game cart.  After seeing the IDE driver had to be loaded from tape, or with a ROM plugged into a parallel board, I asked if there was a version that loaded from a multi-cart.  There wasn't so I volunteered to write it.

More time was spent reading documentation on the ADAM, and disassembling the existing ROM than on creating the loader code.  It simply changes the ADAM memory map settings, copies the driver into low RAM, then it jumps to that code which sets the final memory map, and copies the driver to it's proper address.

The actual driver code data is left out since I don't own the copyright.  I thought it was worth sharing because someone could use this as a starting point to copy other programs from cart to RAM.  Source for the lower RAM code that copies the driver to it's final address had to be assembled separately, and it is also missing, but you can see the first few lines of code in the data starting at LOWRAMCODE.
The <snip> indicates where the driver data was removed.  This code was assembled using the TASM assembler, which requires the #defines at the start, and interrupts are re-enabled once the driver is in place.   The code may have been shared on a forum previously. 


;*****************************************************************
;* IDE Boot Cart.asm
;*****************************************************************
;* Loads the MICRO-INNOVATIONS boot EPROM from a game cart
;* and launches it from intrinsic RAM.
;*****************************************************************
; define standard assembler directives to work with TASM
#define org .org
#define end .end
#define byte .byte
#define word .word

#define DCB  .byte
#define dcb  .byte

#define DCW  .word
#define dcw  .word

;*****************************************************************
;* test cart header
;*****************************************************************
 org $8000 ; start of cart memory
 
 DCB $55,$AA ; test cart ID
 DCB 00,00,00,00,00,00,00,00 ; filler, we don't use this
; org 800AH  ; location of cart start address
 DCW CARTSTART ; cart start address, used to execute cart code
;*****************************************************************

;*****************************************************************
;* the first code executed in the cart 
;*****************************************************************
CARTSTART:

 di   ; interrupts would be bad during this process

 ld a,%00001101   ; 32K lower intrinsic RAM + cartridge ROM
 out ($7F),a    ; set memory map

 ld hl,$45ed   ; interrupt handler
 ld ($0066),hl   ; set interrupt vector
 
 ; copy code from cart into 32K intrinsic RAM
 ld hl,LOWRAMCODE   ; start
 ld de,$0100    ; destination... low RAM
 ld bc,ENDCODE - LOWRAMCODE ; length
 ldir

 jp $0100     ; call code in 24K intrinsic RAM

; start of the eprom data
; we duplicate what this does but from cart ROM so we skip it
;BOOTCODE:
; dcb  $66,$99,$F3,$3E,$05,$D3,$7F,$21,$ED,$45,$22,$66,$00,$21,$1B,$80
; dcb  $11,$00,$01,$01,$7B,$06,$ED,$B0,$C3,$00,$01

LOWRAMCODE:
 
 dcb  $3E,$01  ; ld a,$01
 dcb  $D3,$7F  ; out ($7f),a
 
 dcb  $21,$12,$01 ; ld hl,$0112
 dcb  $11,$00,$80,$01,$69,$06,$ED,$B0,$C3,$00,$80,$ED,$4B,$43
<snip>
ENDCODE:
 end
 

No comments:

Post a Comment