mirror of
https://github.com/hsoft/collapseos.git
synced 2024-09-07 04:38:46 +10:00
That's my mega-commit you've all been waiting for. The code for the shell share more routines with userspace apps than with kernel units, because, well, its behavior is that of a userspace app, not a device driver. This created a weird situation with libraries and jump tables. Some routine belonging to the `kernel/` directory felt weird there. And then comes `apps/basic`, which will likely share even more code with the shell. I was seeing myself creating huge jump tables to reuse code from the shell. It didn't feel right. Moreover, we'll probably want basic-like apps to optionnally replace the shell. So here I am with this huge change in the project structure. I didn't test all recipes on hardware yet, I will do later. I might have broken some... But now, the structure feels better and the line between what belongs to `kernel` and what belongs to `apps` feels clearer.
62 lines
1.0 KiB
NASM
62 lines
1.0 KiB
NASM
; 8K of onboard RAM
|
|
.equ RAMSTART 0xc000
|
|
; Memory register at the end of RAM. Must not overwrite
|
|
.equ RAMEND 0xddd0
|
|
|
|
jp init
|
|
|
|
.fill 0x66-$
|
|
retn
|
|
|
|
.inc "err.h"
|
|
.inc "ascii.h"
|
|
.inc "core.asm"
|
|
.inc "str.asm"
|
|
|
|
.inc "sms/kbd.asm"
|
|
.equ KBD_RAMSTART RAMSTART
|
|
.equ KBD_FETCHKC smskbdFetchKCB
|
|
.inc "kbd.asm"
|
|
|
|
.equ VDP_RAMSTART KBD_RAMEND
|
|
.inc "sms/vdp.asm"
|
|
|
|
.equ STDIO_RAMSTART VDP_RAMEND
|
|
.equ STDIO_GETC kbdGetC
|
|
.equ STDIO_PUTC vdpPutC
|
|
.inc "stdio.asm"
|
|
|
|
; *** Shell ***
|
|
.inc "lib/util.asm"
|
|
.inc "lib/parse.asm"
|
|
.inc "lib/args.asm"
|
|
.inc "lib/stdio.asm"
|
|
.equ SHELL_RAMSTART STDIO_RAMEND
|
|
.equ SHELL_EXTRA_CMD_COUNT 0
|
|
.inc "shell/main.asm"
|
|
|
|
init:
|
|
di
|
|
im 1
|
|
|
|
ld sp, RAMEND
|
|
|
|
; Initialize the keyboard latch by "dummy reading" once. This ensures
|
|
; that the adapter knows it can fill its '164.
|
|
; Port B TH output, high
|
|
ld a, 0b11110111
|
|
out (0x3f), a
|
|
nop
|
|
; Port A/B reset
|
|
ld a, 0xff
|
|
out (0x3f), a
|
|
|
|
call kbdInit
|
|
call vdpInit
|
|
call shellInit
|
|
jp shellLoop
|
|
|
|
.fill 0x7ff0-$
|
|
.db "TMR SEGA", 0x00, 0x00, 0xfb, 0x68, 0x00, 0x00, 0x00, 0x4c
|
|
|