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

View File

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

View File

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

View File

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

View File

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

View File

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