1
0
mirror of https://github.com/stid/woz64.git synced 2024-11-29 12:49:17 +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 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
sta MemMap.KEYB2.SYS_Sfdx sta MemMap.KEYB2.SYS_Sfdx
@ -31,24 +31,9 @@ init:
sta MemMap.KEYB2.SYS_Xmax sta MemMap.KEYB2.SYS_Xmax
// CLODE TO RAM // CLODE TO RAM
lda #<cloneStart clone(cloneStart, cloneEnd, $1000)
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
rts rts
}
KeyMapVec: KeyMapVec:
.word KeyMap1, KeyMap2, KeyMap3, KeyMap4 .word KeyMap1, KeyMap2, KeyMap3, KeyMap4
@ -259,8 +244,10 @@ GetKey: lda MemMap.KEYB2.SYS_Ndx
tya tya
clc clc
rts rts
}
* = * "Keyb: cloneEnd"
cloneEnd: cloneEnd:
}

View File

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

View File

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

View File

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

View File

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

View File

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