Fine tune

This commit is contained in:
stid 2019-11-22 18:50:25 -08:00
parent fb06c63b35
commit b0c99aa2fa
8 changed files with 174 additions and 150 deletions

View File

@ -1,5 +1,4 @@
#importonce #importonce
#import "mem_map.asm"
.filenamespace Hex .filenamespace Hex
* = * "Hex Routines" * = * "Hex Routines"
@ -25,7 +24,7 @@ byteToHex: pha //save byte
lsr lsr
pha //save msn pha //save msn
txa //lsn txa //lsn
jsr binhex1 //generate ascii lsn jsr binhex1 //generate ascii lsn
tax //save tax //save
pla //get msn & fall thru pla //get msn & fall thru
// //
@ -37,3 +36,4 @@ binhex1: cmp #$0a
binhex2: eor #%00110000 //finalize nybble binhex2: eor #%00110000 //finalize nybble
rts //done rts //done
#import "mem_map.asm"

View File

@ -1,7 +1,6 @@
// Advanced Version of Keyb Input routine // Advanced Version of Keyb Input routine
#importonce #importonce
.filenamespace Keyboard2 .filenamespace Keyboard2
#import "mem_map.asm"
#import "memory.asm" #import "memory.asm"
.const CIA1_KeybWrite = $DC00 .const CIA1_KeybWrite = $DC00
@ -10,6 +9,7 @@
.const cSYS_DelayValue = 32 .const cSYS_DelayValue = 32
.const cKeybW_Row1 = $FE .const cKeybW_Row1 = $FE
//------------------------------------------------------------------------------------
init: { init: {
lda #64 lda #64
sta MemMap.KEYB2.SYS_Lstx sta MemMap.KEYB2.SYS_Lstx
@ -90,6 +90,7 @@ KeyMap4:
cloneStart: cloneStart:
//------------------------------------------------------------------------------------
.pseudopc $1000 { .pseudopc $1000 {
ReadKeyb: ReadKeyb:
lda #<KeyMap1 lda #<KeyMap1
@ -225,7 +226,7 @@ ReadKeyb:
sta @SMC_Key + 2 sta @SMC_Key + 2
jmp @Process jmp @Process
// -------------------------- //------------------------------------------------------------------------------------
GetKey: lda MemMap.KEYB2.SYS_Ndx GetKey: lda MemMap.KEYB2.SYS_Ndx
bne @IsKey bne @IsKey
@ -251,3 +252,6 @@ GetKey: lda MemMap.KEYB2.SYS_Ndx
* = * "Keyb: cloneEnd" * = * "Keyb: cloneEnd"
cloneEnd: cloneEnd:
#import "mem_map.asm"

View File

@ -1,13 +1,14 @@
BasicUpstart2(start) //BasicUpstart2(start)
#import "mem_map.asm"
* = $8000 "Main" * = $8000 "Main"
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
.const MAIN_COLOR = $03 .const MAIN_COLOR = $03
.const BORDER_COLOR = $05 .const BORDER_COLOR = $05
.const SCREEN_MEM = $0400 .const SCREEN_MEM = $0400
.const CR = $0d .const CR = $0d
.const BS = $14 .const BS = $14
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
.word coldstart // coldstart vector .word coldstart // coldstart vector
@ -17,7 +18,6 @@ BasicUpstart2(start)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
#import "screen.asm" #import "screen.asm"
#import "keyb2.asm" #import "keyb2.asm"
#import "hex.asm"
#import "shell.asm" #import "shell.asm"
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -45,7 +45,7 @@ start:
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 loop bcs loop
@ -73,7 +73,18 @@ cr:
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
initApp: { initApp: {
// Disable Basic
sei
lda #$7f
sta $dc0d // disable timer interrupts which can be generated by the two CIA chips
sta $dd0d // the kernal uses such an interrupt to flash the cursor and scan the keyboard, so we better
// stop it.
lda $dc0d // by reading this two registers we negate any pending CIA irqs.
lda $dd0d // 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 lda #254
and $dc0e and $dc0e
sta $dc0e sta $dc0e
@ -85,6 +96,7 @@ initApp: {
jsr Screen.init jsr Screen.init
jsr Keyboard2.init jsr Keyboard2.init
jsr Shell.init jsr Shell.init
cli
rts rts
} }
@ -100,8 +112,12 @@ hoax: {
.encoding "screencode_mixed" .encoding "screencode_mixed"
version: .byte 00
revision: .byte 01
minor: .byte 05
testString: testString:
.text "woz64 mon - v 0.1.5a" .text "woz64 mon - v 0.1.5"
.byte $8e .byte $8e
.text "----------------------------------------" .text "----------------------------------------"
.byte $8e, 0 .byte $8e, 0

View File

@ -1,7 +1,6 @@
#importonce #importonce
.filenamespace Math .filenamespace Math
#import "mem_map.asm"
* = * "Math Routines" * = * "Math Routines"
@ -33,4 +32,6 @@ multiply: {
pla pla
cli cli
rts rts
} }
#import "mem_map.asm"

View File

@ -1,57 +1,55 @@
.filenamespace MemMap .filenamespace MemMap
#importonce #importonce
.const ZPAGE_BASE = $2 *=$2 "ZERO PAGE" virtual
.namespace SCREEN { .namespace SCREEN {
.label TempVideoPointer = ZPAGE_BASE // 2 bytes TempVideoPointer: .word 0
.label TempStringPointer = ZPAGE_BASE+2 // 2 bytes TempStringPointer: .word 0
.label CursorCol = ZPAGE_BASE+4 // 1 byte CursorCol: .byte 0
.label CursorRow = ZPAGE_BASE+5 // 1 byte CursorRow: .byte 0
.label tempY = ZPAGE_BASE+6 // 1 byte tempY: .byte 0
.label tempX = ZPAGE_BASE+7 // 1 byte tempX: .byte 0
.label PrintPetCharY = ZPAGE_BASE+8 // 1 byte PrintPetCharY: .byte 0
.label PrintPetCharX = ZPAGE_BASE+9 // 1 byte PrintPetCharX: .byte 0
.label ScrollUpTriggered = ZPAGE_BASE+10 // 1 byte ScrollUpTriggered: .byte 0
} }
.namespace MATH { .namespace MATH {
.label factor1 = ZPAGE_BASE+11 // 1 byte factor1: .byte 0
.label factor2 = ZPAGE_BASE+12 // 1 byte factor2: .byte 0
.label result = ZPAGE_BASE+13 // 2 bytes result: .word 0
} }
.namespace KEYB2 { .namespace KEYB2 {
.label KeyR = ZPAGE_BASE+37 // 1 bytes KeyR: .byte 0
.label SYS_Keyd = ZPAGE_BASE+38 // 10 bytes SYS_Keyd: .fill $10,0
.label SYS_Ndx = ZPAGE_BASE+48 // 1 bytes SYS_Ndx: .byte 0
.label SYS_Xmax = ZPAGE_BASE+49 // 1 bytes SYS_Xmax: .byte 0
.label SYS_Shflag = ZPAGE_BASE+50 // 1 bytes SYS_Shflag: .byte 0
.label SYS_Sfdx = ZPAGE_BASE+51 // 1 bytes SYS_Sfdx: .byte 0
.label SYS_Lstx = ZPAGE_BASE+52 // 1 bytes SYS_Lstx: .byte 0
.label SYS_Delay = ZPAGE_BASE+53 // 1 bytes SYS_Delay: .byte 0
.label SYS_Kount = ZPAGE_BASE+54 // 1 bytes SYS_Kount: .byte 0
.label SYS_Lstshf = ZPAGE_BASE+55 // 1 bytes SYS_Lstshf: .byte 0
} }
.namespace MEMORY { .namespace MEMORY {
.label from = ZPAGE_BASE+56 // 2 bytes from: .word 0
.label dest = ZPAGE_BASE+58 // 2 bytes dest: .word 0
.label size = ZPAGE_BASE+60 // 2 bytes size: .word 0
} }
.namespace SHELL { .namespace SHELL {
.label pos = ZPAGE_BASE+62 // 1 bytes pos: .byte 0
.label MODE = ZPAGE_BASE+63 // 1 bytes MODE: .byte 0
.label L = ZPAGE_BASE+64 // 1 bytes L: .byte 0
.label H = ZPAGE_BASE+65 // 1 bytes H: .byte 0
.label YSAV = ZPAGE_BASE+66 // 1 bytes YSAV: .byte 0
.label STL = ZPAGE_BASE+67 // 1 bytes STL: .byte 0
.label STH = ZPAGE_BASE+68 // 1 bytes STH: .byte 0
.label XAML = ZPAGE_BASE+69 // 1 bytes XAML: .byte 0
.label XAMH = ZPAGE_BASE+70 // 1 bytes XAMH: .byte 0
.label buffer = $3000 // 256 bytes .label buffer = $3000 // 256 bytes
}
}

View File

@ -1,5 +1,4 @@
#importonce #importonce
#import "mem_map.asm"
* = * "Memory Routines" * = * "Memory Routines"
@ -53,4 +52,6 @@ md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
bne md3 bne md3
cli cli
md4: rts md4: rts
} }
#import "mem_map.asm"

View File

@ -1,6 +1,5 @@
#importonce #importonce
#import "math.asm" #import "math.asm"
#import "mem_map.asm"
#import "memory.asm" #import "memory.asm"
// ----------------------- // -----------------------
@ -20,59 +19,59 @@
} }
.macro ClearScreen(screen, clearByte) { .macro ClearScreen(screen, clearByte) {
lda #clearByte lda #clearByte
ldx #0 ldx #0
!loop: !loop:
sta screen, x sta screen, x
sta screen + $100, x sta screen + $100, x
sta screen + $200, x sta screen + $200, x
sta screen + $300, x sta screen + $300, x
inx inx
bne.r !loop- bne.r !loop-
} }
.macro ClearColorRam(clearByte) { .macro ClearColorRam(clearByte) {
lda #clearByte lda #clearByte
ldx #0 ldx #0
!loop: !loop:
sta $D800, x sta $D800, x
sta $D800 + $100, x sta $D800 + $100, x
sta $D800 + $200, x sta $D800 + $200, x
sta $D800 + $300, x sta $D800 + $300, x
inx inx
bne.r !loop- bne.r !loop-
} }
.macro SetBorderColor(color) { .macro SetBorderColor(color) {
lda #color lda #color
sta $d020 sta $d020
} }
.macro SetBackgroundColor(color) { .macro SetBackgroundColor(color) {
lda #color lda #color
sta $d021 sta $d021
} }
.macro SetMultiColor1(color) { .macro SetMultiColor1(color) {
lda #color lda #color
sta $d022 sta $d022
} }
.macro SetMultiColor2(color) { .macro SetMultiColor2(color) {
lda #color lda #color
sta $d023 sta $d023
} }
.macro SetMultiColorMode() { .macro SetMultiColorMode() {
lda $d016 lda $d016
ora #16 ora #16
sta $d016 sta $d016
} }
.macro SetScrollMode() { .macro SetScrollMode() {
lda $D016 lda $D016
eor #%00001000 eor #%00001000
sta $D016 sta $D016
} }
.filenamespace Screen .filenamespace Screen
@ -90,60 +89,61 @@
// -----------------------
// CODE
// -----------------------
//------------------------------------------------------------------------------------
init: { init: {
lda #$00 lda #$00
sta MemMap.SCREEN.CursorCol sta MemMap.SCREEN.CursorCol
sta MemMap.SCREEN.CursorRow sta MemMap.SCREEN.CursorRow
rts rts
} }
//------------------------------------------------------------------------------------
scrollUp: { scrollUp: {
pha pha
clone(VIDEO_ADDR+40, VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM)), VIDEO_ADDR) clone(VIDEO_ADDR+40, VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM)), VIDEO_ADDR)
lda #32
ldx #00 // clear last line
!: lda #32
sta VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM-1)), x ldx #40
inx !:
cpx #40 sta VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM-1)), x
bne !- dex
dec MemMap.SCREEN.CursorRow bne !-
pla dec MemMap.SCREEN.CursorRow
rts pla
rts
} }
//------------------------------------------------------------------------------------
printPetChar: { printPetChar: {
pha pha
stx MemMap.SCREEN.PrintPetCharX stx MemMap.SCREEN.PrintPetCharX
sty MemMap.SCREEN.PrintPetCharY sty MemMap.SCREEN.PrintPetCharY
jsr Screen.petToScreen jsr Screen.petToScreen
jsr Screen.printChar jsr Screen.printChar
ldy MemMap.SCREEN.PrintPetCharY ldy MemMap.SCREEN.PrintPetCharY
ldx MemMap.SCREEN.PrintPetCharX ldx MemMap.SCREEN.PrintPetCharX
pla pla
rts rts
} }
//------------------------------------------------------------------------------------
printChar: { printChar: {
stx MemMap.SCREEN.tempX stx MemMap.SCREEN.tempX
// New Line
cmp #CR cmp #CR
bne.r !+ bne.r !+
jsr screenNewLine jsr screenNewLine
iny iny
jmp exit jmp exit
!: !:
cmp #BS cmp #BS
bne.r !+ bne.r !+
ldx MemMap.SCREEN.CursorCol ldx MemMap.SCREEN.CursorCol
cmp #0 cmp #0
beq exit beq exit
dec MemMap.SCREEN.CursorCol 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
stx MemMap.SCREEN.TempVideoPointer stx MemMap.SCREEN.TempVideoPointer
@ -186,9 +186,9 @@ printChar: {
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
@ -200,14 +200,14 @@ noEndOfLine:
sta (MemMap.SCREEN.TempVideoPointer), y sta (MemMap.SCREEN.TempVideoPointer), y
jmp exit 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
iny iny
inc MemMap.SCREEN.CursorCol inc MemMap.SCREEN.CursorCol
exit: exit:
ldx MemMap.SCREEN.tempX ldx MemMap.SCREEN.tempX
rts rts
} }
@ -238,25 +238,25 @@ print: {
//------------------------------------------------------------------------------------
screenNewLine: { screenNewLine: {
pha pha
lda #0 lda #0
sta MemMap.SCREEN.CursorCol sta MemMap.SCREEN.CursorCol
lda #ROWS_NUM-1 lda #ROWS_NUM-1
cmp MemMap.SCREEN.CursorRow // Are we at the screen bottom? cmp MemMap.SCREEN.CursorRow // Are we at the screen bottom?
bne noScrollUp bne noScrollUp
jsr Screen.scrollUp jsr Screen.scrollUp
lda #1 // Yes - Scroll up lda #1 // Yes - Scroll up
sta MemMap.SCREEN.ScrollUpTriggered sta MemMap.SCREEN.ScrollUpTriggered
jmp done jmp done
noScrollUp:
noScrollUp: lda #0
lda #0 sta MemMap.SCREEN.ScrollUpTriggered
sta MemMap.SCREEN.ScrollUpTriggered done:
done: inc MemMap.SCREEN.CursorRow
inc MemMap.SCREEN.CursorRow pla
pla rts
rts
} }
@ -321,4 +321,6 @@ petToScreen: {
lda $5E lda $5E
convDone: convDone:
rts rts
} }
#import "mem_map.asm"

View File

@ -1,7 +1,6 @@
#importonce #importonce
.filenamespace Shell .filenamespace Shell
#import "mem_map.asm"
#import "screen.asm" #import "screen.asm"
* = * "Shell Routines" * = * "Shell Routines"
@ -9,11 +8,12 @@
.const CR = $0d .const CR = $0d
.const R = $52 .const R = $52
clear: clear:
init: { init: {
lda #-1 lda #-1
sta MemMap.SHELL.pos sta MemMap.SHELL.pos
rts rts
} }
push: { push: {
@ -97,7 +97,7 @@ wozExec: {
iny // Advance text index iny // Advance text index
bne NEXTHEX // Always taken bne NEXTHEX // Always taken
NOTHEX: cpy MemMap.SHELL.YSAV //Was at least 1 hex digit given? NOTHEX: cpy MemMap.SHELL.YSAV //Was at least 1 hex digit given?
bne !+ // No! Ignore all, start from scratch bne !+ // No! Ignore all, start from scratch
rts rts
!: !:
@ -139,9 +139,9 @@ SETADR: lda MemMap.SHELL.L-1,X // Copy hex data to
NXTPRNT: bne PRDATA // NE means no address to print NXTPRNT: bne PRDATA // NE means no address to print
lda #CR // Print CR first lda #CR // Print CR first
cPrint() cPrint()
lda MemMap.SHELL.XAMH // Output high-order byte of address lda MemMap.SHELL.XAMH // Output high-order byte of address
jsr PRBYTE jsr PRBYTE
lda MemMap.SHELL.XAML // Output low-order byte of address lda MemMap.SHELL.XAML // Output low-order byte of address
jsr PRBYTE jsr PRBYTE
lda #':' // Print colon lda #':' // Print colon
cPrint() cPrint()
@ -192,4 +192,6 @@ PRHEX: and #%00001111 // Mask LSD for hex prin
cPrint() cPrint()
rts rts
} }
#import "mem_map.asm"