mirror of https://github.com/stid/woz64.git
Fine tune
This commit is contained in:
parent
fb06c63b35
commit
b0c99aa2fa
2
hex.asm
2
hex.asm
|
@ -1,5 +1,4 @@
|
|||
#importonce
|
||||
#import "mem_map.asm"
|
||||
.filenamespace Hex
|
||||
|
||||
* = * "Hex Routines"
|
||||
|
@ -37,3 +36,4 @@ binhex1: cmp #$0a
|
|||
binhex2: eor #%00110000 //finalize nybble
|
||||
rts //done
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
|
|
@ -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"
|
||||
|
|
24
main.asm
24
main.asm
|
@ -1,4 +1,5 @@
|
|||
BasicUpstart2(start)
|
||||
//BasicUpstart2(start)
|
||||
#import "mem_map.asm"
|
||||
|
||||
* = $8000 "Main"
|
||||
|
||||
|
@ -17,7 +18,6 @@ BasicUpstart2(start)
|
|||
//------------------------------------------------------------------------------------
|
||||
#import "screen.asm"
|
||||
#import "keyb2.asm"
|
||||
#import "hex.asm"
|
||||
#import "shell.asm"
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
|
3
math.asm
3
math.asm
|
@ -1,7 +1,6 @@
|
|||
#importonce
|
||||
.filenamespace Math
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
||||
* = * "Math Routines"
|
||||
|
||||
|
@ -34,3 +33,5 @@ multiply: {
|
|||
cli
|
||||
rts
|
||||
}
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
|
72
mem_map.asm
72
mem_map.asm
|
@ -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
|
||||
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
#importonce
|
||||
#import "mem_map.asm"
|
||||
|
||||
* = * "Memory Routines"
|
||||
|
||||
|
@ -54,3 +53,5 @@ md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
|
|||
cli
|
||||
md4: rts
|
||||
}
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
|
38
screen.asm
38
screen.asm
|
@ -1,6 +1,5 @@
|
|||
#importonce
|
||||
#import "math.asm"
|
||||
#import "mem_map.asm"
|
||||
#import "memory.asm"
|
||||
|
||||
// -----------------------
|
||||
|
@ -90,10 +89,8 @@
|
|||
|
||||
|
||||
|
||||
// -----------------------
|
||||
// CODE
|
||||
// -----------------------
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
init: {
|
||||
lda #$00
|
||||
sta MemMap.SCREEN.CursorCol
|
||||
|
@ -101,21 +98,24 @@ init: {
|
|||
rts
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
scrollUp: {
|
||||
pha
|
||||
clone(VIDEO_ADDR+40, VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM)), VIDEO_ADDR)
|
||||
|
||||
// clear last line
|
||||
lda #32
|
||||
ldx #00
|
||||
!:
|
||||
ldx #40
|
||||
!:
|
||||
sta VIDEO_ADDR+(COLUMN_NUM*(ROWS_NUM-1)), x
|
||||
inx
|
||||
cpx #40
|
||||
dex
|
||||
bne !-
|
||||
dec MemMap.SCREEN.CursorRow
|
||||
pla
|
||||
rts
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
printPetChar: {
|
||||
pha
|
||||
stx MemMap.SCREEN.PrintPetCharX
|
||||
|
@ -128,22 +128,22 @@ printPetChar: {
|
|||
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,6 +238,7 @@ print: {
|
|||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
screenNewLine: {
|
||||
pha
|
||||
lda #0
|
||||
|
@ -249,11 +250,10 @@ screenNewLine: {
|
|||
lda #1 // Yes - Scroll up
|
||||
sta MemMap.SCREEN.ScrollUpTriggered
|
||||
jmp done
|
||||
|
||||
noScrollUp:
|
||||
noScrollUp:
|
||||
lda #0
|
||||
sta MemMap.SCREEN.ScrollUpTriggered
|
||||
done:
|
||||
done:
|
||||
inc MemMap.SCREEN.CursorRow
|
||||
pla
|
||||
rts
|
||||
|
@ -322,3 +322,5 @@ petToScreen: {
|
|||
convDone:
|
||||
rts
|
||||
}
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#importonce
|
||||
.filenamespace Shell
|
||||
|
||||
#import "mem_map.asm"
|
||||
#import "screen.asm"
|
||||
|
||||
* = * "Shell Routines"
|
||||
|
@ -9,6 +8,7 @@
|
|||
.const CR = $0d
|
||||
.const R = $52
|
||||
|
||||
|
||||
clear:
|
||||
init: {
|
||||
lda #-1
|
||||
|
@ -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
|
||||
!:
|
||||
|
@ -193,3 +193,5 @@ PRHEX: and #%00001111 // Mask LSD for hex prin
|
|||
rts
|
||||
|
||||
}
|
||||
|
||||
#import "mem_map.asm"
|
||||
|
|
Loading…
Reference in New Issue