2019-12-03 12:18:41 +11:00
|
|
|
; TODO: This recipe has not been tested since its conversion to the BASIC shell.
|
|
|
|
; My PS/2 adapter has been acting up and probably has a loose wire. I need to
|
|
|
|
; fix it beore I can test this recipe on real hardware.
|
|
|
|
; But theoretically, it works...
|
|
|
|
|
2019-07-22 05:37:03 +10:00
|
|
|
; 8K of onboard RAM
|
|
|
|
.equ RAMSTART 0xc000
|
2019-12-03 12:18:41 +11:00
|
|
|
.equ USER_CODE 0xd500
|
2019-07-22 05:37:03 +10:00
|
|
|
; Memory register at the end of RAM. Must not overwrite
|
|
|
|
.equ RAMEND 0xddd0
|
|
|
|
|
|
|
|
jp init
|
|
|
|
|
|
|
|
; *** JUMP TABLE ***
|
|
|
|
jp strncmp
|
|
|
|
jp upcase
|
|
|
|
jp findchar
|
|
|
|
jp parseHex
|
|
|
|
jp blkSel
|
|
|
|
jp blkSet
|
|
|
|
jp fsFindFN
|
|
|
|
jp fsOpen
|
2019-10-31 07:59:35 +11:00
|
|
|
jp fsGetB
|
|
|
|
jp fsPutB
|
2019-07-22 05:37:03 +10:00
|
|
|
jp fsSetSize
|
|
|
|
jp printstr
|
2019-10-31 07:59:35 +11:00
|
|
|
jp _blkGetB
|
|
|
|
jp _blkPutB
|
2019-07-22 05:37:03 +10:00
|
|
|
jp _blkSeek
|
|
|
|
jp _blkTell
|
|
|
|
jp printcrlf
|
|
|
|
jp stdioPutC
|
|
|
|
jp stdioReadLine
|
|
|
|
|
|
|
|
.fill 0x66-$
|
|
|
|
retn
|
|
|
|
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "err.h"
|
2019-11-14 12:38:06 +11:00
|
|
|
.inc "ascii.h"
|
2019-11-16 07:37:49 +11:00
|
|
|
.inc "blkdev.h"
|
|
|
|
.inc "fs.h"
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "core.asm"
|
2019-11-15 01:55:31 +11:00
|
|
|
.inc "str.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "sms/kbd.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
.equ KBD_RAMSTART RAMSTART
|
|
|
|
.equ KBD_FETCHKC smskbdFetchKCB
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "kbd.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "sms/vdp.asm"
|
2020-02-25 12:36:08 +11:00
|
|
|
.equ GRID_RAMSTART KBD_RAMEND
|
|
|
|
.equ GRID_COLS VDP_COLS
|
|
|
|
.equ GRID_ROWS VDP_ROWS
|
|
|
|
.equ GRID_SETCELL vdpSetCell
|
2020-02-27 13:44:37 +11:00
|
|
|
.equ GRID_GETC kbdGetC
|
2020-02-25 12:36:08 +11:00
|
|
|
.inc "grid.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2020-02-25 12:36:08 +11:00
|
|
|
.equ STDIO_RAMSTART GRID_RAMEND
|
2020-02-27 13:44:37 +11:00
|
|
|
.equ STDIO_GETC gridGetC
|
2020-02-25 12:36:08 +11:00
|
|
|
.equ STDIO_PUTC gridPutC
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "stdio.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-07-26 04:23:13 +10:00
|
|
|
.equ MMAP_START 0xd700
|
|
|
|
; 0x180 is to leave some space for the stack
|
|
|
|
.equ MMAP_LEN RAMEND-MMAP_START-0x180
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "mmap.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
|
|
|
.equ BLOCKDEV_RAMSTART STDIO_RAMEND
|
|
|
|
.equ BLOCKDEV_COUNT 3
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "blockdev.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
; List of devices
|
2019-10-31 07:59:35 +11:00
|
|
|
.dw mmapGetB, mmapPutB
|
|
|
|
.dw f0GetB, f0PutB
|
|
|
|
.dw f1GetB, f1PutB
|
2019-07-22 05:37:03 +10:00
|
|
|
|
|
|
|
|
|
|
|
.equ FS_RAMSTART BLOCKDEV_RAMEND
|
|
|
|
.equ FS_HANDLE_COUNT 2
|
2019-10-07 05:32:23 +11:00
|
|
|
.inc "fs.asm"
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-12-03 12:18:41 +11:00
|
|
|
; *** BASIC ***
|
|
|
|
|
|
|
|
; RAM space used in different routines for short term processing.
|
2019-12-13 04:04:56 +11:00
|
|
|
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
|
2019-12-03 12:18:41 +11:00
|
|
|
.equ SCRATCHPAD FS_RAMEND
|
2019-11-16 07:37:49 +11:00
|
|
|
.inc "lib/util.asm"
|
2019-12-03 12:18:41 +11:00
|
|
|
.inc "lib/ari.asm"
|
2019-11-16 07:37:49 +11:00
|
|
|
.inc "lib/parse.asm"
|
2019-12-03 12:18:41 +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"
|
|
|
|
.equ BFS_RAMSTART BUF_RAMEND
|
|
|
|
.inc "basic/fs.asm"
|
|
|
|
.inc "basic/blk.asm"
|
|
|
|
.equ BAS_RAMSTART BFS_RAMEND
|
|
|
|
.inc "basic/main.asm"
|
|
|
|
|
|
|
|
; USER_CODE is set according to this output below.
|
|
|
|
.out BAS_RAMEND
|
2019-07-26 04:23:13 +10:00
|
|
|
|
2019-07-22 05:37:03 +10:00
|
|
|
init:
|
|
|
|
di
|
|
|
|
im 1
|
|
|
|
|
|
|
|
ld sp, RAMEND
|
|
|
|
|
|
|
|
; init a FS in mmap
|
|
|
|
ld hl, MMAP_START
|
|
|
|
ld a, 'C'
|
|
|
|
ld (hl), a
|
|
|
|
inc hl
|
|
|
|
ld a, 'F'
|
|
|
|
ld (hl), a
|
|
|
|
inc hl
|
|
|
|
ld a, 'S'
|
|
|
|
ld (hl), a
|
2019-07-24 13:01:17 +10:00
|
|
|
|
2019-07-22 05:37:03 +10:00
|
|
|
call fsInit
|
|
|
|
xor a
|
2019-07-24 13:01:17 +10:00
|
|
|
ld de, BLOCKDEV_SEL
|
2019-07-22 05:37:03 +10:00
|
|
|
call blkSel
|
2019-07-24 13:01:17 +10:00
|
|
|
call fsOn
|
2019-07-22 05:37:03 +10:00
|
|
|
|
|
|
|
call kbdInit
|
2020-02-25 12:36:08 +11:00
|
|
|
call gridInit
|
2019-07-22 05:37:03 +10:00
|
|
|
call vdpInit
|
|
|
|
|
2019-12-03 12:18:41 +11:00
|
|
|
call basInit
|
|
|
|
ld hl, basFindCmdExtra
|
|
|
|
ld (BAS_FINDHOOK), hl
|
|
|
|
jp basStart
|
|
|
|
|
|
|
|
basFindCmdExtra:
|
|
|
|
ld hl, basFSCmds
|
|
|
|
call basFindCmd
|
|
|
|
ret z
|
|
|
|
ld hl, basBLKCmds
|
|
|
|
call basFindCmd
|
|
|
|
ret z
|
|
|
|
ld hl, .mycmds
|
|
|
|
call basFindCmd
|
|
|
|
ret z
|
|
|
|
jp basPgmHook
|
|
|
|
.mycmds:
|
|
|
|
.db "ed", 0
|
2019-12-30 13:39:51 +11:00
|
|
|
.dw 0x1f00
|
2019-12-03 12:18:41 +11:00
|
|
|
.db "zasm", 0
|
2019-12-30 13:39:51 +11:00
|
|
|
.dw 0x2400
|
2019-12-03 15:00:03 +11:00
|
|
|
.db 0xff
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-31 07:59:35 +11:00
|
|
|
f0GetB:
|
2019-07-22 05:37:03 +10:00
|
|
|
ld ix, FS_HANDLES
|
2019-10-31 07:59:35 +11:00
|
|
|
jp fsGetB
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-31 07:59:35 +11:00
|
|
|
f0PutB:
|
2019-07-22 05:37:03 +10:00
|
|
|
ld ix, FS_HANDLES
|
2019-10-31 07:59:35 +11:00
|
|
|
jp fsPutB
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-31 07:59:35 +11:00
|
|
|
f1GetB:
|
2019-07-22 05:37:03 +10:00
|
|
|
ld ix, FS_HANDLES+FS_HANDLE_SIZE
|
2019-10-31 07:59:35 +11:00
|
|
|
jp fsGetB
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2019-10-31 07:59:35 +11:00
|
|
|
f1PutB:
|
2019-07-22 05:37:03 +10:00
|
|
|
ld ix, FS_HANDLES+FS_HANDLE_SIZE
|
2019-10-31 07:59:35 +11:00
|
|
|
jp fsPutB
|
2019-07-22 05:37:03 +10:00
|
|
|
|
2020-02-25 12:36:08 +11:00
|
|
|
; last time I checked, PC at this point was 0x128f. Let's give us a nice margin
|
2019-07-22 05:37:03 +10:00
|
|
|
; for the start of ed.
|
2019-12-30 13:39:51 +11:00
|
|
|
.fill 0x1f00-$
|
2019-07-22 05:37:03 +10:00
|
|
|
.bin "ed.bin"
|
|
|
|
|
2019-12-30 13:39:51 +11:00
|
|
|
; Last check: 0x23b0
|
|
|
|
.fill 0x2400-$
|
2019-07-22 05:37:03 +10:00
|
|
|
.bin "zasm.bin"
|
|
|
|
|
2020-01-08 14:14:00 +11:00
|
|
|
FNT_DATA:
|
|
|
|
.bin "fnt/7x7.bin"
|
|
|
|
|
2019-07-22 05:37:03 +10:00
|
|
|
.fill 0x7ff0-$
|
|
|
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|