1
0
mirror of https://github.com/stid/woz64.git synced 2024-11-25 15:33:34 +00:00

Scroll Progress

This commit is contained in:
stid 2019-11-17 19:28:54 -08:00
parent 04c83fd5a2
commit 18f5c005c2
6 changed files with 274 additions and 231 deletions

View File

@ -10,7 +10,7 @@
.const cSYS_DelayValue = 32
.const cKeybW_Row1 = $FE
init:
init: {
lda #64
sta MemMap.KEYB2.SYS_Lstx
sta MemMap.KEYB2.SYS_Sfdx
@ -31,24 +31,9 @@ init:
sta MemMap.KEYB2.SYS_Xmax
// CLODE TO RAM
lda #<cloneStart
sta MemMap.MEMORY.from
lda #>cloneStart
sta MemMap.MEMORY.from+1
lda #<$1000
sta MemMap.MEMORY.to
lda #>$1000
sta MemMap.MEMORY.to+1
lda #<cloneEnd-ReadKeyb
sta MemMap.MEMORY.size+1
lda #>cloneEnd-ReadKeyb
sta MemMap.MEMORY.size
jsr Memory.clone
clone(cloneStart, cloneEnd, $1000)
rts
}
KeyMapVec:
.word KeyMap1, KeyMap2, KeyMap3, KeyMap4
@ -259,8 +244,10 @@ GetKey: lda MemMap.KEYB2.SYS_Ndx
tya
clc
rts
}
* = * "Keyb: cloneEnd"
cloneEnd:
}

View File

@ -1,4 +1,4 @@
///BasicUpstart2(start)
BasicUpstart2(start)
* = $8000 "Main"
@ -56,7 +56,6 @@ Raster: cmp $D012
jmp loop
inputChar:
jsr Shell.push
jsr Screen.petToScreen
cPrint()

View File

@ -11,14 +11,16 @@
.label CursorRow = ZPAGE_BASE+5 // 1 byte
.label tempY = ZPAGE_BASE+6 // 1 byte
.label tempX = ZPAGE_BASE+7 // 1 byte
.label cTempY = ZPAGE_BASE+8 // 1 byte
.label PrintPetCharY = ZPAGE_BASE+8 // 1 byte
.label PrintPetCharX = ZPAGE_BASE+9 // 1 byte
.label ScrollUpTriggered = ZPAGE_BASE+10 // 1 byte
}
.namespace MATH {
.label factor1 = ZPAGE_BASE+9 // 1 byte
.label factor2 = ZPAGE_BASE+10 // 1 byte
.label multiTmpX = ZPAGE_BASE+11 // 1 byte
.label result = ZPAGE_BASE+12 // 2 bytes
.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
}
.namespace KEYB2 {
@ -36,7 +38,7 @@
.namespace MEMORY {
.label from = ZPAGE_BASE+56 // 2 bytes
.label to = ZPAGE_BASE+58 // 2 bytes
.label dest = ZPAGE_BASE+58 // 2 bytes
.label size = ZPAGE_BASE+60 // 2 bytes
}

View File

@ -1,33 +1,55 @@
#importonce
.filenamespace Memory
#import "mem_map.asm"
* = * "Memory Routines"
.macro clone(from, to, dest) {
lda #<from
sta MemMap.MEMORY.from
lda #>from
sta MemMap.MEMORY.from+1
lda #<dest
sta MemMap.MEMORY.dest
lda #>dest
sta MemMap.MEMORY.dest+1
lda #<to-from
sta MemMap.MEMORY.size+1
lda #>to-from
sta MemMap.MEMORY.size
jsr Memory._clone
}
.filenamespace Memory
// move memory down
//
// from = source start address
// to = destination start address
// size = number of bytes to move
//
clone:
_clone: {
ldy #0
ldx MemMap.MEMORY.size
beq md2
md1: lda (MemMap.MEMORY.from),y // move a page at a time
sta (MemMap.MEMORY.to),y
sta (MemMap.MEMORY.dest),y
iny
bne md1
inc MemMap.MEMORY.from+1
inc MemMap.MEMORY.to+1
inc MemMap.MEMORY.dest+1
dex
bne md1
md2: ldx MemMap.MEMORY.size+1
beq md4
md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
sta (MemMap.MEMORY.to),y
sta (MemMap.MEMORY.dest),y
iny
dex
bne md3
md4: rts
}

View File

@ -1,6 +1,7 @@
#importonce
#import "math.asm"
#import "mem_map.asm"
#import "memory.asm"
// -----------------------
// MACROS
@ -15,9 +16,7 @@
}
.macro cPrint() {
sty MemMap.SCREEN.cTempY
jsr Screen.printChar
ldy MemMap.SCREEN.cTempY
jsr Screen.printPetChar
}
.macro ClearScreen(screen, clearByte) {
@ -83,11 +82,9 @@
// CONSTANTS
// -----------------------
.namespace constants {
.label VIDEO_ADDR = $0400
.label COLUMN_NUM = 40
.label ROWS_NUM = 25
}
.const VIDEO_ADDR = $0400
.const COLUMN_NUM = 40
.const ROWS_NUM = 25
// -----------------------
@ -101,6 +98,33 @@ init: {
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
}
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
}
printChar: {
stx MemMap.SCREEN.tempX
// New Line
@ -111,9 +135,9 @@ printChar: {
rts
!:
// Store Base Video Address 16 bit
ldx #<constants.VIDEO_ADDR // Low byte
ldx #<VIDEO_ADDR // Low byte
stx MemMap.SCREEN.TempVideoPointer
ldx #>constants.VIDEO_ADDR // High byte
ldx #>VIDEO_ADDR // High byte
stx MemMap.SCREEN.TempVideoPointer+1
// Temp Save Y
@ -122,7 +146,7 @@ printChar: {
// CursorRow * 40
ldy MemMap.SCREEN.CursorRow
sty MemMap.MATH.factor1
ldy #constants.COLUMN_NUM
ldy #COLUMN_NUM
sty MemMap.MATH.factor2
jsr Math.multiply
@ -135,26 +159,40 @@ printChar: {
lda MemMap.MATH.result+1
adc MemMap.SCREEN.TempVideoPointer
sta MemMap.SCREEN.TempVideoPointer
ldy MemMap.SCREEN.CursorCol
cpy #COLUMN_NUM // Is this > col num?
bcc.r noEndOfLine
jsr screenNewLine // Yes? Add new list first
ldy #1
cpy MemMap.SCREEN.ScrollUpTriggered
bne noScrollTriggered
.break
// Compesat Scroll
sec
lda MemMap.SCREEN.TempVideoPointer
sbc #1
sta MemMap.SCREEN.TempVideoPointer
bcs !+
dec MemMap.SCREEN.TempVideoPointer+1
!:
noScrollTriggered:
noEndOfLine:
pla
// Add column
ldy MemMap.SCREEN.CursorCol
// insert into screen
sta (MemMap.SCREEN.TempVideoPointer), y
ldy MemMap.SCREEN.tempY
iny
inc MemMap.SCREEN.CursorCol
lda MemMap.SCREEN.CursorCol
cmp #constants.COLUMN_NUM+1
bcc.r exita
// CursorCol > COLUMN_NUM ? new line
jsr screenNewLine
exita:
exit:
ldx MemMap.SCREEN.tempX
rts
}
@ -182,9 +220,23 @@ 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
}
@ -204,13 +256,11 @@ petToScreen: {
sec
adc #128
jmp convDone
// $20-$3F
!:
cmp #$3f
bcs !+
jmp convDone
// $40-$5F
!:
cmp #$5f
@ -218,8 +268,6 @@ petToScreen: {
sec
sbc #$40
jmp convDone
// $60-$7F
!:
cmp #$7F
@ -227,7 +275,6 @@ petToScreen: {
sec
sbc #32
jmp convDone
// $80-$9F
!:
cmp #$9F
@ -242,7 +289,6 @@ petToScreen: {
sec
sbc #64
jmp convDone
// $C0-$DF
// $E0-$FE
!:
@ -251,13 +297,9 @@ petToScreen: {
sec
sbc #128
jmp convDone
// $FF
!:
lda $5E
convDone:
rts
}

View File

@ -8,7 +8,7 @@
.const CR = $0d
clear:
init: {
lda #-1
sta MemMap.SHELL.pos
@ -19,31 +19,24 @@ push: {
ldy MemMap.SHELL.pos
iny
cpy #127
beq done
beq.r done
sty MemMap.SHELL.pos
sta MemMap.SHELL.buffer, y
done:
rts
}
clear: {
ldy #-1
sty MemMap.SHELL.pos
rts
}
// WOZ MONITOR FLOW - FROM APPLE1
wozExec: {
ldy #-1
lda #0
tax
SETSTOR:
asl
SETMODE:
cmp #0
beq !+
beq.r !+
eor #%10000000
!:
sta MemMap.SHELL.MODE
@ -51,10 +44,9 @@ wozExec: {
BLSKIP: iny
NEXTITEM:
.break
lda MemMap.SHELL.buffer,Y //Get character
cmp #$0d
bne CONT // We're done if it's CR!
cmp #CR
bne.r CONT // We're done if it's CR!
rts
CONT:
cmp #'.'
@ -134,7 +126,7 @@ SETADR: lda MemMap.SHELL.L-1,X // Copy hex data to
// Print address and data from this address, fall through next BNE.
NXTPRNT: bne PRDATA // NE means no address to print
lda #$8e // Print CR first
lda #CR // Print CR first
cPrint()
lda MemMap.SHELL.XAMH // Output high-order byte of address
jsr PRBYTE
@ -185,7 +177,6 @@ PRHEX: and #%00001111 // Mask LSD for hex print
cmp #'9'+1 // Is it a decimal digit?
bcc !+ // Yes! output it
adc #6 // Add offset for letter A-F
jsr Screen.petToScreen
!:
cPrint()
rts