1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 01:30:55 +11:00
collapseos/recipes/rc2014/sdcard/glue.asm

115 lines
2.0 KiB
NASM
Raw Normal View History

2019-05-08 05:26:52 +10:00
; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module
; The RAM module is selected on A15, so it has the range 0x8000-0xffff
2019-05-21 01:00:14 +10:00
.equ RAMSTART 0x8000
.equ RAMEND 0xffff
.equ ACIA_CTL 0x80 ; Control and status. RS off.
.equ ACIA_IO 0x81 ; Transmit. RS on.
2019-12-12 03:18:32 +11:00
.equ USER_CODE 0xa000
2019-05-08 05:26:52 +10:00
jp init ; 3 bytes
; *** Jump Table ***
jp printstr
2019-06-02 09:53:42 +10:00
jp sdcWaitResp
jp sdcCmd
jp sdcCmdR1
jp sdcCmdR7
jp sdcSendRecv
2019-05-08 05:26:52 +10:00
; interrupt hook
.fill 0x38-$
jp aciaInt
.inc "err.h"
.inc "ascii.h"
.inc "blkdev.h"
.inc "fs.h"
.inc "core.asm"
.inc "str.asm"
2019-05-21 01:00:14 +10:00
.equ ACIA_RAMSTART RAMSTART
.inc "acia.asm"
2019-05-21 01:00:14 +10:00
.equ BLOCKDEV_RAMSTART ACIA_RAMEND
.equ BLOCKDEV_COUNT 2
.inc "blockdev.asm"
; List of devices
.dw sdcGetB, sdcPutB
.dw blk2GetB, blk2PutB
2019-05-21 01:00:14 +10:00
.equ STDIO_RAMSTART BLOCKDEV_RAMEND
.equ STDIO_GETC aciaGetC
.equ STDIO_PUTC aciaPutC
.inc "stdio.asm"
2019-05-17 22:14:19 +10:00
.equ FS_RAMSTART STDIO_RAMEND
.equ FS_HANDLE_COUNT 1
.inc "fs.asm"
2019-12-12 03:18:32 +11:00
; *** BASIC ***
; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
2019-12-12 03:18:32 +11:00
.equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm"
2019-12-12 03:18:32 +11:00
.inc "lib/ari.asm"
.inc "lib/parse.asm"
2019-12-12 03:18:32 +11:00
.inc "lib/fmt.asm"
.equ EXPR_PARSE parseLiteralOrVar
.inc "lib/expr.asm"
.inc "basic/util.asm"
.inc "basic/parse.asm"
.inc "basic/tok.asm"
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
.inc "basic/var.asm"
.equ BUF_RAMSTART VAR_RAMEND
.inc "basic/buf.asm"
.inc "basic/blk.asm"
.inc "basic/sdc.asm"
.equ BFS_RAMSTART BUF_RAMEND
.inc "basic/fs.asm"
.equ BAS_RAMSTART BFS_RAMEND
.inc "basic/main.asm"
.equ SDC_RAMSTART BAS_RAMEND
.equ SDC_PORT_CSHIGH 6
.equ SDC_PORT_CSLOW 5
.equ SDC_PORT_SPI 4
.inc "sdc.asm"
init:
di
2019-12-12 03:18:32 +11:00
ld sp, RAMEND
im 1
call aciaInit
call fsInit
2019-12-12 03:18:32 +11:00
call basInit
ld hl, basFindCmdExtra
ld (BAS_FINDHOOK), hl
xor a
ld de, BLOCKDEV_SEL
call blkSel
ei
2019-12-12 03:18:32 +11:00
jp basStart
basFindCmdExtra:
ld hl, basFSCmds
call basFindCmd
ret z
ld hl, basBLKCmds
call basFindCmd
ret z
ld hl, basSDCCmds
jp basFindCmd
; *** blkdev 2: file handle 0 ***
blk2GetB:
ld ix, FS_HANDLES
jp fsGetB
blk2PutB:
ld ix, FS_HANDLES
jp fsPutB