From fb06c63b3545f89f02156313ac8c5120e3c8e31a Mon Sep 17 00:00:00 2001 From: stid Date: Wed, 20 Nov 2019 22:18:23 -0800 Subject: [PATCH] Fix Interrupts, BS and more --- main.asm | 82 +++++++++++++++++++++++++++++++++++------------------ math.asm | 13 ++++++--- mem_map.asm | 3 +- memory.asm | 3 +- screen.asm | 29 +++++++++++++++---- shell.asm | 13 ++++++++- 6 files changed, 102 insertions(+), 41 deletions(-) diff --git a/main.asm b/main.asm index 1ac28e2..267bd4d 100644 --- a/main.asm +++ b/main.asm @@ -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 + 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 diff --git a/math.asm b/math.asm index 7c2e2de..623e80e 100644 --- a/math.asm +++ b/math.asm @@ -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 - } \ No newline at end of file diff --git a/mem_map.asm b/mem_map.asm index 423118a..4bffca5 100644 --- a/mem_map.asm +++ b/mem_map.asm @@ -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 { diff --git a/memory.asm b/memory.asm index 41307d2..7b3ea20 100644 --- a/memory.asm +++ b/memory.asm @@ -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 } \ No newline at end of file diff --git a/screen.asm b/screen.asm index 72932cd..a27a8cd 100644 --- a/screen.asm +++ b/screen.asm @@ -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 #