mirror of
https://github.com/stid/woz64.git
synced 2024-11-29 12:49:17 +00:00
Refactor
This commit is contained in:
parent
391ff1d7a3
commit
6af62c2859
121
core/boot.asm
Normal file
121
core/boot.asm
Normal file
@ -0,0 +1,121 @@
|
||||
|
||||
#importonce
|
||||
#import "../core/pseudo.asm"
|
||||
#import "../core/module.asm"
|
||||
|
||||
#import "../core/system.asm"
|
||||
|
||||
.filenamespace Boot
|
||||
|
||||
.const INIT_IRQ = $fda3
|
||||
.const INIT_MEM = $fd50
|
||||
.const INIT_IO = $fd15
|
||||
.const INIT_VID = $ff5b
|
||||
.const SCRN_CTRL = $d016
|
||||
|
||||
.const MAIN_COLOR = $03
|
||||
.const BORDER_COLOR = $05
|
||||
.const INTERRUPT_CTRL = $dc0d
|
||||
.const NMSK_INTERRUPT_CTRL = $dd0d
|
||||
.const TIMER_A_CTRL = $DC0E
|
||||
|
||||
* = * "Boot Core"
|
||||
|
||||
|
||||
// ========================================================
|
||||
// ////// METHODS /////////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
// --------------------------------------------------------
|
||||
// coldstart -
|
||||
// Power ON initialization
|
||||
// --------------------------------------------------------
|
||||
coldStart: {
|
||||
ldx #$FF
|
||||
sei
|
||||
txs
|
||||
cld
|
||||
stx SCRN_CTRL // Set Screen Bits
|
||||
jsr INIT_IRQ // Prepare IRQ
|
||||
jsr INIT_MEM // Init memory. Rewrite this routine to speed up boot process.
|
||||
jsr INIT_IO // Init I/O
|
||||
jsr INIT_VID // Init video
|
||||
cli
|
||||
jmp warmStart
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// warmStart -
|
||||
// Restore pressed or program restart after first Power ON
|
||||
// --------------------------------------------------------
|
||||
warmStart: {
|
||||
|
||||
sei
|
||||
lda #$7f
|
||||
sta INTERRUPT_CTRL // disable timer interrupts which can be generated by the two CIA chips
|
||||
sta NMSK_INTERRUPT_CTRL // the kernal uses such an interrupt to flash the cursor and scan the keyboard, so we better
|
||||
// stop it.
|
||||
|
||||
lda INTERRUPT_CTRL // by reading this two registers we negate any pending CIA irqs.
|
||||
lda NMSK_INTERRUPT_CTRL // if we don't do this, a pending CIA irq might occur after we finish setting up our irq.
|
||||
// we don't want that to happen.
|
||||
|
||||
// Disable 0e TIMER
|
||||
lda #254
|
||||
and TIMER_A_CTRL
|
||||
sta TIMER_A_CTRL
|
||||
|
||||
ScreenClearColorRam($00)
|
||||
ScreenClear(' ')
|
||||
ScreenSetBorderColor(BORDER_COLOR)
|
||||
ScreenSetBackgroundColor(MAIN_COLOR)
|
||||
cli
|
||||
|
||||
jsr Boot.init // Init Self as Module
|
||||
jsr System.start // Start Core System
|
||||
|
||||
// If System Exit - reboot
|
||||
// TODO: We can print a message here
|
||||
// and delay a bit...
|
||||
jmp warmStart
|
||||
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// init -
|
||||
// Module Init.
|
||||
// --------------------------------------------------------
|
||||
init: {
|
||||
// Sequence matter
|
||||
jsr Module.init
|
||||
jsr Pseudo.init
|
||||
jsr System.init
|
||||
rts
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// toDebug -
|
||||
// Print debug info.
|
||||
// --------------------------------------------------------
|
||||
toDebug: {
|
||||
ModuleToDebug(module_type, module_name, version)
|
||||
rts
|
||||
}
|
||||
|
||||
|
||||
// ========================================================
|
||||
// ////// DATA ////////////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
* = * "Boot Core Data"
|
||||
module_type: .byte Module.TYPES.CORE
|
||||
version: .byte 1, 0, 0
|
||||
|
||||
.encoding "screencode_mixed"
|
||||
module_name:
|
||||
.text "boot"
|
||||
.byte 0
|
||||
|
||||
|
||||
#import "../core/mem_map.asm"
|
||||
|
@ -1,32 +1,37 @@
|
||||
.filenamespace MemMap
|
||||
#importonce
|
||||
|
||||
.const SHELL_BUGGER_ADDR = $3000
|
||||
.const XSTACK_ADDRESS = $3100
|
||||
.const YSTACK_ADDRESS = $3200
|
||||
.const SHELL_BUFFER_ADDR = $1000 // 256 bytes (3000-30FF)
|
||||
.const XSTACK_ADDRESS = $1100 // 256 bytes (3100-31FF)
|
||||
.const YSTACK_ADDRESS = $1200 // 256 bytes (3200-32FF)
|
||||
.const KEYB_RAM_CODE = $1300 // Safe to use > $1400
|
||||
|
||||
*=$2 "ZERO PAGE" virtual
|
||||
|
||||
.namespace CORE {
|
||||
yStackOffset: .byte 0
|
||||
xStackOffset: .byte 0
|
||||
// PHx/PLx pseudo commands
|
||||
yStackOffset: .byte 0 // Y Stack offset used by phy/ply
|
||||
xStackOffset: .byte 0 // X Stack offset used by phx/plx
|
||||
.label XStack = XSTACK_ADDRESS // 256 bytes phy/ply stack buffer pointer
|
||||
.label YStack = YSTACK_ADDRESS // 256 bytes phx/plx stack buffer pointer
|
||||
}
|
||||
|
||||
.label XStack = XSTACK_ADDRESS // 256 bytes
|
||||
.label YStack = YSTACK_ADDRESS // 256 bytes
|
||||
.namespace PRINT {
|
||||
TempStringPointer: .word 0 // Pointer to string address as it get printend to screen
|
||||
}
|
||||
|
||||
.namespace SCREEN {
|
||||
TempVideoPointer: .word 0
|
||||
TempStringPointer: .word 0
|
||||
CursorCol: .byte 0
|
||||
CursorRow: .byte 0
|
||||
ScrollUpTriggered: .byte 0
|
||||
TempVideoPointer: .word 0 // Pointer to video mem used to target char pos
|
||||
CursorCol: .byte 0 // Actual cursor column position
|
||||
CursorRow: .byte 0 // Actual cursor row position
|
||||
ScrollUpTriggered: .byte 0 // Set to 1 if a scroll up was triggered
|
||||
}
|
||||
|
||||
.namespace MATH {
|
||||
factor1: .byte 0
|
||||
factor2: .byte 0
|
||||
result: .word 0
|
||||
factor1: .byte 0 // Factor 1 used in MUL ops
|
||||
factor2: .byte 0 // Factor 2 used in MUL ops
|
||||
|
||||
result: .word 0 // 16 Bit math operation result
|
||||
}
|
||||
|
||||
.namespace KEYBOARD {
|
||||
@ -40,6 +45,8 @@
|
||||
SYS_Delay: .byte 0
|
||||
SYS_Kount: .byte 0
|
||||
SYS_Lstshf: .byte 0
|
||||
|
||||
.label keybRamCode = KEYB_RAM_CODE
|
||||
}
|
||||
|
||||
.namespace MEMORY {
|
||||
@ -63,7 +70,7 @@
|
||||
XAML: .byte 0
|
||||
XAMH: .byte 0
|
||||
|
||||
.label buffer = SHELL_BUGGER_ADDR // 256 bytes
|
||||
.label buffer = SHELL_BUFFER_ADDR // 256 bytes
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#importonce
|
||||
#import "print.asm"
|
||||
#import "../libs/print.asm"
|
||||
|
||||
// ========================================================
|
||||
// ////// MACROS //////////////////////////////////////////
|
||||
@ -101,13 +101,13 @@ printVersion: {
|
||||
sta MemMap.MODULE.versionPtr
|
||||
stx MemMap.MODULE.versionPtr+1
|
||||
ldy #0
|
||||
jsr printNext
|
||||
jsr printNext // Major
|
||||
lda #'.'
|
||||
PrintChar()
|
||||
jsr printNext
|
||||
jsr printNext // Minor
|
||||
lda #'.'
|
||||
PrintChar()
|
||||
jsr printNext
|
||||
jsr printNext // Revision
|
||||
rts
|
||||
printNext:
|
||||
lda (MemMap.MODULE.versionPtr), y
|
||||
@ -154,8 +154,8 @@ printType: {
|
||||
// ========================================================
|
||||
|
||||
* = * "Module Lib Data"
|
||||
module_type: .byte Module.TYPES.LIB
|
||||
version: .byte 1, 1, 0
|
||||
module_type: .byte Module.TYPES.CORE
|
||||
version: .byte 1, 2, 0
|
||||
|
||||
.encoding "screencode_mixed"
|
||||
module_name:
|
@ -1,6 +1,6 @@
|
||||
#importonce
|
||||
#import "../core/mem_map.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
|
||||
|
||||
// ========================================================
|
||||
|
@ -1,54 +1,79 @@
|
||||
|
||||
#importonce
|
||||
#import "../core/pseudo.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../core/boot.asm"
|
||||
#import "../libs/memory.asm"
|
||||
#import "../libs/math.asm"
|
||||
#import "../libs/print.asm"
|
||||
#import "../core/keyboard.asm"
|
||||
#import "../core/screen.asm"
|
||||
#import "../core/pseudo.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../libs/keyboard.asm"
|
||||
#import "../libs/screen.asm"
|
||||
#import "../progs/woz_shell.asm"
|
||||
|
||||
.filenamespace Init
|
||||
.filenamespace System
|
||||
|
||||
* = * "Init Core"
|
||||
* = * "System Core"
|
||||
|
||||
|
||||
// ========================================================
|
||||
// ////// METHODS /////////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
// --------------------------------------------------------
|
||||
// start -
|
||||
// System Start
|
||||
// --------------------------------------------------------
|
||||
start: {
|
||||
|
||||
|
||||
// Start Main Program
|
||||
jsr WozShell.start
|
||||
|
||||
// TODO: Program exited here
|
||||
// We can ask program to set a ram param and let us know
|
||||
// if exit is due to a sort of error.
|
||||
|
||||
rts
|
||||
|
||||
// TODO: Can we use Timed Interrupt to execute small system recurring tasks?
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// init -
|
||||
// Module Init.
|
||||
// --------------------------------------------------------
|
||||
init: {
|
||||
// Init All Modules
|
||||
jsr Pseudo.init
|
||||
jsr Module.init
|
||||
// TODO: How we can make this dynamic?
|
||||
jsr Memory.init
|
||||
jsr Math.init
|
||||
jsr Print.init
|
||||
jsr Keyboard.init
|
||||
jsr Screen.init
|
||||
jsr Print.init
|
||||
jsr Math.init
|
||||
jsr Keyboard.init
|
||||
|
||||
jsr WozShell.init
|
||||
rts
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
// toDebug -
|
||||
// Print debug info.
|
||||
// --------------------------------------------------------
|
||||
toDebug: {
|
||||
// Debug All Modules
|
||||
jsr Boot.toDebug
|
||||
ModuleToDebug(module_type, module_name, version)
|
||||
jsr Keyboard.toDebug
|
||||
jsr Screen.toDebug
|
||||
|
||||
jsr Pseudo.toDebug
|
||||
jsr Module.toDebug
|
||||
|
||||
jsr Keyboard.toDebug
|
||||
jsr Math.toDebug
|
||||
jsr Memory.toDebug
|
||||
jsr Print.toDebug
|
||||
jsr Math.toDebug
|
||||
jsr Screen.toDebug
|
||||
|
||||
jsr WozShell.toDebug
|
||||
rts
|
||||
}
|
||||
@ -58,13 +83,13 @@ toDebug: {
|
||||
// ////// DATA ////////////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
* = * "Init Core Data"
|
||||
* = * "System Core Data"
|
||||
module_type: .byte Module.TYPES.CORE
|
||||
version: .byte 1, 1, 0
|
||||
version: .byte 1, 0, 0
|
||||
|
||||
.encoding "screencode_mixed"
|
||||
module_name:
|
||||
.text "init"
|
||||
.text "system"
|
||||
.byte 0
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#importonce
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../libs/memory.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
|
||||
|
||||
.filenamespace Keyboard
|
||||
@ -18,7 +18,11 @@
|
||||
.const cSYS_DelayValue = 32
|
||||
.const cKeybW_Row1 = $FE
|
||||
|
||||
* = * "Keyboard Module"
|
||||
.const RASTER_LINE = $d012
|
||||
|
||||
|
||||
|
||||
* = * "Keyboard Lib"
|
||||
|
||||
// ========================================================
|
||||
// ////// METHODS ROM /////////////////////////////////////
|
||||
@ -49,7 +53,26 @@ init: {
|
||||
sta MemMap.KEYBOARD.SYS_Xmax
|
||||
|
||||
// Clone self altering Methods to RAM
|
||||
MemoryClone(cloneStart, cloneEnd, $1000)
|
||||
MemoryClone(cloneStart, cloneEnd, MemMap.KEYBOARD.keybRamCode)
|
||||
rts
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
// waitForKey -
|
||||
// Loop until a new key is available.
|
||||
//
|
||||
// Result:
|
||||
// A = Pressed key code
|
||||
// --------------------------------------------------------
|
||||
waitForKey: {
|
||||
loop:
|
||||
lda #$FF
|
||||
raster:
|
||||
cmp RASTER_LINE // Raster done?
|
||||
bne raster
|
||||
jsr Keyboard.ReadKeyb
|
||||
jsr Keyboard.GetKey
|
||||
bcs loop
|
||||
rts
|
||||
}
|
||||
|
||||
@ -63,7 +86,7 @@ toDebug: {
|
||||
}
|
||||
|
||||
// ========================================================
|
||||
// ////// KEYMAPPING RON //////////////////////////////////
|
||||
// ////// KEYMAPPING ROM //////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
KeyMapVec:
|
||||
@ -144,7 +167,7 @@ cloneStart:
|
||||
// bcs loop
|
||||
// // Key here is in A
|
||||
// --------------------------------------------------------
|
||||
.pseudopc $1000 {
|
||||
.pseudopc MemMap.KEYBOARD.keybRamCode {
|
||||
ReadKeyb: {
|
||||
lda #<KeyMap1
|
||||
sta @SMC_Vec
|
||||
@ -333,8 +356,8 @@ cloneEnd:
|
||||
// ////// DATA ////////////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
* = * "Keyboard Module Data"
|
||||
module_type: .byte Module.TYPES.CORE
|
||||
* = * "Keyboard Lib Data"
|
||||
module_type: .byte Module.TYPES.LIB
|
||||
version: .byte 1, 1, 0
|
||||
|
||||
.encoding "screencode_mixed"
|
@ -1,12 +1,12 @@
|
||||
|
||||
#importonce
|
||||
#import "../libs/module.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../core/module.asm"
|
||||
|
||||
|
||||
.filenamespace Math
|
||||
|
||||
* = * "Math Lin"
|
||||
* = * "Math Lib"
|
||||
|
||||
// ========================================================
|
||||
// ////// METHODS /////////////////////////////////////////
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
#importonce
|
||||
#import "../libs/module.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../core/pseudo.asm"
|
||||
|
||||
|
||||
@ -223,5 +223,5 @@ module_name:
|
||||
|
||||
|
||||
#import "../core/mem_map.asm"
|
||||
#import "../core/screen.asm"
|
||||
#import "../libs/screen.asm"
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
#importonce
|
||||
#import "math.asm"
|
||||
#import "../core/screen.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../libs/screen.asm"
|
||||
#import "../core/module.asm"
|
||||
|
||||
|
||||
// ========================================================
|
||||
@ -75,10 +75,10 @@ printPetChar: {
|
||||
// --------------------------------------------------------
|
||||
printLine: {
|
||||
ldy #$00
|
||||
sta MemMap.SCREEN.TempStringPointer
|
||||
stx MemMap.SCREEN.TempStringPointer+1
|
||||
sta MemMap.PRINT.TempStringPointer
|
||||
stx MemMap.PRINT.TempStringPointer+1
|
||||
printLoop:
|
||||
lda (MemMap.SCREEN.TempStringPointer), y
|
||||
lda (MemMap.PRINT.TempStringPointer), y
|
||||
cmp #0
|
||||
beq exit
|
||||
jsr Screen.sendChar
|
||||
|
@ -1,7 +1,7 @@
|
||||
#importonce
|
||||
#import "../libs/math.asm"
|
||||
#import "../libs/memory.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../core/pseudo.asm"
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
// ========================================================
|
||||
|
||||
|
||||
* = * "Screen Module"
|
||||
* = * "Screen Lib"
|
||||
|
||||
// --------------------------------------------------------
|
||||
// ScreenClearChunks -
|
||||
@ -292,8 +292,8 @@ screenNewLine: {
|
||||
rts
|
||||
}
|
||||
|
||||
* = * "Screen Module Data"
|
||||
module_type: .byte Module.TYPES.CORE
|
||||
* = * "Screen Lib Data"
|
||||
module_type: .byte Module.TYPES.LIB
|
||||
version: .byte 1, 0, 0
|
||||
module_name:
|
||||
.text "screen"
|
117
main.asm
117
main.asm
@ -1,124 +1,17 @@
|
||||
.cpu _6502
|
||||
|
||||
//BasicUpstart2(start)
|
||||
//BasicUpstart2(Boot.warmStart)
|
||||
#import "./core/mem_map.asm"
|
||||
|
||||
* = $8000 "Main"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
.const MAIN_COLOR = $03
|
||||
.const BORDER_COLOR = $05
|
||||
.const CR = $0d
|
||||
.const BS = $14
|
||||
.const ADV_CHAR = '@'
|
||||
.const INIT_IRQ = $fda3
|
||||
.const INIT_MEM = $fd50
|
||||
.const INIT_IO = $fd15
|
||||
.const INIT_VID = $ff5b
|
||||
.const SCRN_CTRL = $d016
|
||||
.const RASTER_LINE = $d012
|
||||
.const INTERRUPT_CTRL = $dc0d
|
||||
.const NMSK_INTERRUPT_CTRL = $dd0d
|
||||
.const TIMER_A_CTRL = $DC0E
|
||||
.word Boot.coldStart // coldstart vector
|
||||
.word Boot.warmStart // start vector
|
||||
.byte $C3,$C2,$CD,'8','0' //..CBM80..
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
.word coldstart // coldstart vector
|
||||
.word start // start vector
|
||||
.byte $C3,$C2,$CD,'8','0' //..CBM80..
|
||||
#import "./core/boot.asm"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
#import "./core/init.asm"
|
||||
#import "./libs/print.asm"
|
||||
#import "./core/screen.asm"
|
||||
#import "./core/keyboard.asm"
|
||||
#import "./progs/woz_shell.asm"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Main Program
|
||||
//------------------------------------------------------------------------------------
|
||||
* = * "Kernel Start"
|
||||
|
||||
coldstart: {
|
||||
ldx #$FF
|
||||
sei
|
||||
txs
|
||||
cld
|
||||
stx SCRN_CTRL // Set Screen Bits
|
||||
jsr INIT_IRQ // Prepare IRQ
|
||||
jsr INIT_MEM // Init memory. Rewrite this routine to speed up boot process.
|
||||
jsr INIT_IO // Init I/O
|
||||
jsr INIT_VID // Init video
|
||||
cli
|
||||
}
|
||||
|
||||
* = * "App Start"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
start: {
|
||||
jsr initApp;
|
||||
jsr WozShell.start
|
||||
loop:
|
||||
lda #$FF
|
||||
Raster:
|
||||
cmp RASTER_LINE // Raster done?
|
||||
bne Raster
|
||||
jsr Keyboard.ReadKeyb
|
||||
jsr Keyboard.GetKey
|
||||
bcs loop
|
||||
|
||||
cmp #CR
|
||||
beq execute
|
||||
|
||||
cmp #BS
|
||||
beq backspace
|
||||
inputChar:
|
||||
jsr WozShell.push // Char in Buffer
|
||||
PrintChar()
|
||||
jmp loop
|
||||
backspace:
|
||||
jsr WozShell.backspace
|
||||
PrintChar()
|
||||
jmp loop
|
||||
|
||||
execute:
|
||||
jsr WozShell.push // CR in Buffer
|
||||
jsr Screen.screenNewLine
|
||||
jsr WozShell.exec
|
||||
jsr Screen.screenNewLine
|
||||
jsr WozShell.clear
|
||||
jmp loop
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
initApp: {
|
||||
|
||||
sei
|
||||
lda #$7f
|
||||
sta INTERRUPT_CTRL // disable timer interrupts which can be generated by the two CIA chips
|
||||
sta NMSK_INTERRUPT_CTRL // the kernal uses such an interrupt to flash the cursor and scan the keyboard, so we better
|
||||
// stop it.
|
||||
|
||||
lda INTERRUPT_CTRL // by reading this two registers we negate any pending CIA irqs.
|
||||
lda NMSK_INTERRUPT_CTRL // if we don't do this, a pending CIA irq might occur after we finish setting up our irq.
|
||||
// we don't want that to happen.
|
||||
|
||||
// Disable 0e TIMER
|
||||
lda #254
|
||||
and TIMER_A_CTRL
|
||||
sta TIMER_A_CTRL
|
||||
|
||||
ScreenClearColorRam($00)
|
||||
ScreenClear(' ')
|
||||
ScreenSetBorderColor(BORDER_COLOR)
|
||||
ScreenSetBackgroundColor(MAIN_COLOR)
|
||||
jsr Init.init
|
||||
cli
|
||||
rts
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
* = * "Kernel Data"
|
||||
|
||||
* = $9FFF "EpromFiller"
|
||||
.byte 0
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#importonce
|
||||
#import "../libs/print.asm"
|
||||
#import "../libs/module.asm"
|
||||
#import "../core/init.asm"
|
||||
#import "../core/pseudo.asm"
|
||||
#import "../core/system.asm"
|
||||
#import "../libs/print.asm"
|
||||
#import "../core/module.asm"
|
||||
#import "../libs/keyboard.asm"
|
||||
|
||||
.filenamespace WozShell
|
||||
|
||||
@ -12,9 +13,9 @@
|
||||
// ////// CONSTANTS ///////////////////////////////////////
|
||||
// ========================================================
|
||||
|
||||
.const CR = $0d
|
||||
.const R = $52
|
||||
|
||||
.const R = $52
|
||||
.const CR = $0d
|
||||
.const BS = $14
|
||||
|
||||
// ========================================================
|
||||
// ////// METHODS /////////////////////////////////////////
|
||||
@ -32,7 +33,34 @@ start: {
|
||||
PrintLine(lineString)
|
||||
PrintLine(aboutString)
|
||||
PrintLine(lineString)
|
||||
rts
|
||||
jmp WozShell.loop
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
loop: {
|
||||
jsr Keyboard.waitForKey
|
||||
|
||||
cmp #CR
|
||||
beq execute
|
||||
|
||||
cmp #BS
|
||||
beq backspace
|
||||
inputChar:
|
||||
jsr WozShell.push // Char in Buffer
|
||||
PrintChar()
|
||||
jmp loop
|
||||
backspace:
|
||||
jsr WozShell.backspace
|
||||
PrintChar()
|
||||
jmp loop
|
||||
|
||||
execute:
|
||||
jsr WozShell.push // CR in Buffer
|
||||
jsr Screen.screenNewLine
|
||||
jsr WozShell.exec
|
||||
jsr Screen.screenNewLine
|
||||
jsr WozShell.clear
|
||||
jmp loop
|
||||
}
|
||||
|
||||
toDebug: {
|
||||
@ -81,7 +109,7 @@ stidExec: {
|
||||
cmp #$52 // R
|
||||
beq cmdReset
|
||||
|
||||
cmp #$56 // Z
|
||||
cmp #$56 // V
|
||||
beq cmdZeroPageInfo
|
||||
done:
|
||||
rts
|
||||
@ -93,7 +121,7 @@ stidExec: {
|
||||
jmp $fce2 // SYS 64738
|
||||
|
||||
cmdZeroPageInfo:
|
||||
jsr Init.toDebug
|
||||
jsr System.toDebug
|
||||
jmp done
|
||||
}
|
||||
|
||||
@ -237,13 +265,13 @@ wozExec: {
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
PRBYTE:
|
||||
pha // Save A for LSD
|
||||
pha // Save A for LSD
|
||||
lsr
|
||||
lsr
|
||||
lsr // MSD to LSD position
|
||||
lsr
|
||||
jsr PRHEX // Output hex digit
|
||||
pla // Restore A
|
||||
jsr PRHEX // Output hex digit
|
||||
pla // Restore A
|
||||
|
||||
// Fall through to print hex routine
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user