1
0
mirror of https://github.com/stid/woz64.git synced 2024-11-25 15:33:34 +00:00

Fix Interrupts, BS and more

This commit is contained in:
stid 2019-11-20 22:18:23 -08:00
parent 18f5c005c2
commit fb06c63b35
6 changed files with 102 additions and 41 deletions

View File

@ -2,24 +2,27 @@ BasicUpstart2(start)
* = $8000 "Main"
// Constants
.namespace constants {
.label MAIN_COLOR = $05
.label BORDER_COLOR = $03
.label SCREEN_MEM = $0400
}
//------------------------------------------------------------------------------------
.const MAIN_COLOR = $03
.const BORDER_COLOR = $05
.const SCREEN_MEM = $0400
.const CR = $0d
.const BS = $14
//------------------------------------------------------------------------------------
.word coldstart // coldstart vector
.word start // start vector
.byte $C3,$C2,$CD,'8','0' //..CBM80..
//------------------------------------------------------------------------------------
#import "screen.asm"
#import "keyb2.asm"
#import "hex.asm"
#import "shell.asm"
//------------------------------------------------------------------------------------
// Main Program
//------------------------------------------------------------------------------------
* = * "Kernel Start"
coldstart:
@ -33,55 +36,78 @@ coldstart:
jsr $fd15 // Init I/O
jsr $ff5b // Init video
cli
//------------------------------------------------------------------------------------
start:
//sei
jsr initApp;
print(testString)
loop:
lda #$FF
Raster: cmp $D012
bne Raster
jsr Keyboard2.ReadKeyb
jsr Keyboard2.GetKey
bcs Skip
cmp #$0d
bne inputChar
bcs loop
// Execute Item
jsr Shell.push
jsr Shell.wozExec
jsr Screen.screenNewLine
jsr Screen.screenNewLine
jsr Shell.clear
jmp loop
cmp #CR
beq cr
cmp #BS
beq backspace
inputChar:
jsr Shell.push
cPrint()
jmp loop
backspace:
jsr Shell.backspace
cPrint()
jmp loop
cr:
jsr Shell.push
jsr Screen.screenNewLine
jsr Shell.wozExec
jsr Screen.screenNewLine
jsr Shell.clear
jmp loop
Skip: jmp loop
//------------------------------------------------------------------------------------
initApp: {
// Disable Basic
lda #254
and $dc0e
sta $dc0e
ClearColorRam($00)
ClearScreen(constants.SCREEN_MEM, ' ')
SetBorderColor(constants.MAIN_COLOR)
SetBackgroundColor(constants.BORDER_COLOR)
ClearScreen(SCREEN_MEM, ' ')
SetBorderColor(BORDER_COLOR)
SetBackgroundColor(MAIN_COLOR)
jsr Screen.init
jsr Keyboard2.init
jsr Shell.init
rts
}
//------------------------------------------------------------------------------------
* = * "Hoax"
hoax: {
print(hoaxString)
jmp loop
}
//------------------------------------------------------------------------------------
* = * "Kernel Data"
.encoding "screencode_mixed"
testString:
.text "woz64 - v 0.1.5a"
.text "woz64 mon - v 0.1.5a"
.byte $8e
.text "----------------------------------------"
.byte $8e, 0
hoaxString:
.text "=stid= 1972"
.byte $8e, 0
* = $9FFF "EpromFiller"
.byte 0

View File

@ -5,9 +5,14 @@
* = * "Math Routines"
//------------------------------------------------------------------------------------
multiply: {
stx MemMap.MATH.multiTmpX
sei
pha
txa
pha
lda #$00
ldx #$08
clc
@ -24,8 +29,8 @@ multiply: {
stx MemMap.MATH.result+1
pla
ldx MemMap.MATH.multiTmpX
tax
pla
cli
rts
}

View File

@ -19,8 +19,7 @@
.namespace MATH {
.label factor1 = ZPAGE_BASE+11 // 1 byte
.label factor2 = ZPAGE_BASE+12 // 1 byte
.label multiTmpX = ZPAGE_BASE+13 // 1 byte
.label result = ZPAGE_BASE+14 // 2 bytes
.label result = ZPAGE_BASE+13 // 2 bytes
}
.namespace KEYB2 {

View File

@ -1,5 +1,4 @@
#importonce
#import "mem_map.asm"
* = * "Memory Routines"
@ -33,6 +32,7 @@
// size = number of bytes to move
//
_clone: {
sei
ldy #0
ldx MemMap.MEMORY.size
beq md2
@ -51,5 +51,6 @@ md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
iny
dex
bne md3
cli
md4: rts
}

View File

@ -85,6 +85,9 @@
.const VIDEO_ADDR = $0400
.const COLUMN_NUM = 40
.const ROWS_NUM = 25
.const CR = $8e
.const BS = $95
// -----------------------
@ -128,11 +131,18 @@ printPetChar: {
printChar: {
stx MemMap.SCREEN.tempX
// New Line
cmp #$8e
cmp #CR
bne.r !+
jsr screenNewLine
iny
rts
jmp exit
!:
cmp #BS
bne.r !+
ldx MemMap.SCREEN.CursorCol
cmp #0
beq exit
dec MemMap.SCREEN.CursorCol
!:
// Store Base Video Address 16 bit
ldx #<VIDEO_ADDR // Low byte
@ -168,9 +178,8 @@ printChar: {
ldy #1
cpy MemMap.SCREEN.ScrollUpTriggered
bne noScrollTriggered
.break
// Compesat Scroll
// Compensate Scroll
sec
lda MemMap.SCREEN.TempVideoPointer
sbc #1
@ -184,6 +193,14 @@ noScrollTriggered:
noEndOfLine:
pla
// This is a backspace
cmp #BS
bne !+
lda #' '
sta (MemMap.SCREEN.TempVideoPointer), y
jmp exit
!:
// insert into screen
sta (MemMap.SCREEN.TempVideoPointer), y
ldy MemMap.SCREEN.tempY
@ -219,6 +236,8 @@ print: {
rts
}
screenNewLine: {
pha
lda #0

View File

@ -7,6 +7,7 @@
* = * "Shell Routines"
.const CR = $0d
.const R = $52
clear:
init: {
@ -26,6 +27,16 @@ push: {
rts
}
backspace: {
ldy MemMap.SHELL.pos
cpy #-1
beq done
dey
sty MemMap.SHELL.pos
done:
rts
}
// WOZ MONITOR FLOW - FROM APPLE1
wozExec: {
@ -54,7 +65,7 @@ wozExec: {
beq SETMODE // Set BLOCK XAM mode ("." = $AE)
cmp #':'
beq SETSTOR // Set STOR mode! $BA will become $7B
cmp #'r'
cmp #R
beq RUN // Run the program! Forget the rest
stx MemMap.SHELL.L // Clear input value (X=0)
stx MemMap.SHELL.H