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

View File

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

View File

@ -1,13 +1,14 @@
BasicUpstart2(start)
//BasicUpstart2(start)
#import "mem_map.asm"
* = $8000 "Main"
//------------------------------------------------------------------------------------
.const MAIN_COLOR = $03
.const BORDER_COLOR = $05
.const SCREEN_MEM = $0400
.const CR = $0d
.const BS = $14
.const MAIN_COLOR = $03
.const BORDER_COLOR = $05
.const SCREEN_MEM = $0400
.const CR = $0d
.const BS = $14
//------------------------------------------------------------------------------------
.word coldstart // coldstart vector
@ -17,7 +18,6 @@ BasicUpstart2(start)
//------------------------------------------------------------------------------------
#import "screen.asm"
#import "keyb2.asm"
#import "hex.asm"
#import "shell.asm"
//------------------------------------------------------------------------------------
@ -45,7 +45,7 @@ start:
loop:
lda #$FF
Raster: cmp $D012
bne Raster
bne Raster
jsr Keyboard2.ReadKeyb
jsr Keyboard2.GetKey
bcs loop
@ -73,7 +73,18 @@ cr:
//------------------------------------------------------------------------------------
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
and $dc0e
sta $dc0e
@ -85,6 +96,7 @@ initApp: {
jsr Screen.init
jsr Keyboard2.init
jsr Shell.init
cli
rts
}
@ -100,8 +112,12 @@ hoax: {
.encoding "screencode_mixed"
version: .byte 00
revision: .byte 01
minor: .byte 05
testString:
.text "woz64 mon - v 0.1.5a"
.text "woz64 mon - v 0.1.5"
.byte $8e
.text "----------------------------------------"
.byte $8e, 0

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
#importonce
.filenamespace Shell
#import "mem_map.asm"
#import "screen.asm"
* = * "Shell Routines"
@ -9,11 +8,12 @@
.const CR = $0d
.const R = $52
clear:
init: {
lda #-1
sta MemMap.SHELL.pos
rts
lda #-1
sta MemMap.SHELL.pos
rts
}
push: {
@ -97,7 +97,7 @@ wozExec: {
iny // Advance text index
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
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
lda #CR // Print CR first
cPrint()
lda MemMap.SHELL.XAMH // Output high-order byte of address
lda MemMap.SHELL.XAMH // Output high-order byte of address
jsr PRBYTE
lda MemMap.SHELL.XAML // Output low-order byte of address
lda MemMap.SHELL.XAML // Output low-order byte of address
jsr PRBYTE
lda #':' // Print colon
cPrint()
@ -192,4 +192,6 @@ PRHEX: and #%00001111 // Mask LSD for hex prin
cPrint()
rts
}
}
#import "mem_map.asm"