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

Woz alpha

This commit is contained in:
stid 2019-11-16 23:41:00 -08:00
parent 6013ca5d87
commit 65687a91fd
7 changed files with 323 additions and 101 deletions

View File

@ -12,39 +12,39 @@
init: init:
lda #64 lda #64
sta MemMap.KEYB2_SPACE.SYS_Lstx sta MemMap.KEYB2.SYS_Lstx
sta MemMap.KEYB2_SPACE.SYS_Sfdx sta MemMap.KEYB2.SYS_Sfdx
lda #cSYS_DelayValue lda #cSYS_DelayValue
sta MemMap.KEYB2_SPACE.SYS_Delay sta MemMap.KEYB2.SYS_Delay
lda #6 lda #6
sta MemMap.KEYB2_SPACE.SYS_Kount sta MemMap.KEYB2.SYS_Kount
lda #0 lda #0
sta MemMap.KEYB2_SPACE.SYS_Shflag sta MemMap.KEYB2.SYS_Shflag
sta MemMap.KEYB2_SPACE.SYS_Lstshf sta MemMap.KEYB2.SYS_Lstshf
sta MemMap.KEYB2_SPACE.SYS_Ndx sta MemMap.KEYB2.SYS_Ndx
lda #10 lda #10
sta MemMap.KEYB2_SPACE.SYS_Xmax sta MemMap.KEYB2.SYS_Xmax
// CLODE TO RAM // CLODE TO RAM
lda #<cloneStart lda #<cloneStart
sta MemMap.MEMORY_SPACE.from sta MemMap.MEMORY.from
lda #>cloneStart lda #>cloneStart
sta MemMap.MEMORY_SPACE.from+1 sta MemMap.MEMORY.from+1
lda #<$1000 lda #<$1000
sta MemMap.MEMORY_SPACE.to sta MemMap.MEMORY.to
lda #>$1000 lda #>$1000
sta MemMap.MEMORY_SPACE.to+1 sta MemMap.MEMORY.to+1
lda #<cloneEnd-ReadKeyb lda #<cloneEnd-ReadKeyb
sta MemMap.MEMORY_SPACE.size+1 sta MemMap.MEMORY.size+1
lda #>cloneEnd-ReadKeyb lda #>cloneEnd-ReadKeyb
sta MemMap.MEMORY_SPACE.size sta MemMap.MEMORY.size
jsr Memory.clone jsr Memory.clone
@ -114,10 +114,10 @@ ReadKeyb:
// Clear Shift Flag // Clear Shift Flag
lda #$40 lda #$40
sta MemMap.KEYB2_SPACE.SYS_Sfdx sta MemMap.KEYB2.SYS_Sfdx
lda #0 lda #0
sta MemMap.KEYB2_SPACE.SYS_Shflag sta MemMap.KEYB2.SYS_Shflag
sta CIA1_KeybWrite sta CIA1_KeybWrite
ldx CIA1_KeybRead ldx CIA1_KeybRead
@ -127,7 +127,7 @@ ReadKeyb:
ldy #$00 ldy #$00
lda #7 lda #7
sta MemMap.KEYB2_SPACE.KeyR sta MemMap.KEYB2.KeyR
lda #cKeybW_Row1 lda #cKeybW_Row1
sta @SMC_Row + 1 sta @SMC_Row + 1
@ -155,11 +155,11 @@ ReadKeyb:
beq @NotShift // Stop Key beq @NotShift // Stop Key
// Accumulate shift key types (SHIFT=1, COMM=2, CTRL=4) // Accumulate shift key types (SHIFT=1, COMM=2, CTRL=4)
ora MemMap.KEYB2_SPACE.SYS_Shflag ora MemMap.KEYB2.SYS_Shflag
sta MemMap.KEYB2_SPACE.SYS_Shflag sta MemMap.KEYB2.SYS_Shflag
bpl @SMC_A bpl @SMC_A
@NotShift: sty MemMap.KEYB2_SPACE.SYS_Sfdx @NotShift: sty MemMap.KEYB2.SYS_Sfdx
@SMC_A: lda #0 @SMC_A: lda #0
@ -169,63 +169,63 @@ ReadKeyb:
sec sec
rol @SMC_Row + 1 rol @SMC_Row + 1
dec MemMap.KEYB2_SPACE.KeyR dec MemMap.KEYB2.KeyR
bpl @SMC_Row bpl @SMC_Row
jmp @ProcKeyImg jmp @ProcKeyImg
// Handles the key repeat // Handles the key repeat
@Process: ldy MemMap.KEYB2_SPACE.SYS_Sfdx @Process: ldy MemMap.KEYB2.SYS_Sfdx
@SMC_Key: lda $FFFF,Y @SMC_Key: lda $FFFF,Y
tax tax
cpy MemMap.KEYB2_SPACE.SYS_Lstx cpy MemMap.KEYB2.SYS_Lstx
beq @SameKey beq @SameKey
ldy #cSYS_DelayValue ldy #cSYS_DelayValue
sty MemMap.KEYB2_SPACE.SYS_Delay // Repeat delay counter sty MemMap.KEYB2.SYS_Delay // Repeat delay counter
bne @Cleanup bne @Cleanup
@SameKey: and #$7F @SameKey: and #$7F
ldy MemMap.KEYB2_SPACE.SYS_Delay ldy MemMap.KEYB2.SYS_Delay
beq @EndDelay beq @EndDelay
dec MemMap.KEYB2_SPACE.SYS_Delay dec MemMap.KEYB2.SYS_Delay
bne @Exit bne @Exit
@EndDelay: dec MemMap.KEYB2_SPACE.SYS_Kount @EndDelay: dec MemMap.KEYB2.SYS_Kount
bne @Exit bne @Exit
ldy #$04 ldy #$04
sty MemMap.KEYB2_SPACE.SYS_Kount sty MemMap.KEYB2.SYS_Kount
ldy MemMap.KEYB2_SPACE.SYS_Ndx ldy MemMap.KEYB2.SYS_Ndx
dey dey
bpl @Exit bpl @Exit
// Updates the previous key and shift storage // Updates the previous key and shift storage
@Cleanup: ldy MemMap.KEYB2_SPACE.SYS_Sfdx @Cleanup: ldy MemMap.KEYB2.SYS_Sfdx
sty MemMap.KEYB2_SPACE.SYS_Lstx sty MemMap.KEYB2.SYS_Lstx
ldy MemMap.KEYB2_SPACE.SYS_Shflag ldy MemMap.KEYB2.SYS_Shflag
sty MemMap.KEYB2_SPACE.SYS_Lstshf sty MemMap.KEYB2.SYS_Lstshf
cpx #$FF cpx #$FF
beq @Exit beq @Exit
txa txa
ldx MemMap.KEYB2_SPACE.SYS_Ndx ldx MemMap.KEYB2.SYS_Ndx
cpx MemMap.KEYB2_SPACE.SYS_Xmax cpx MemMap.KEYB2.SYS_Xmax
bcs @Exit bcs @Exit
sta MemMap.KEYB2_SPACE.SYS_Keyd,X sta MemMap.KEYB2.SYS_Keyd,X
inx inx
stx MemMap.KEYB2_SPACE.SYS_Ndx stx MemMap.KEYB2.SYS_Ndx
@Exit: lda #$7F @Exit: lda #$7F
sta CIA1_KeybWrite sta CIA1_KeybWrite
rts rts
@ProcKeyImg: @ProcKeyImg:
lda MemMap.KEYB2_SPACE.SYS_Shflag lda MemMap.KEYB2.SYS_Shflag
cmp #$03 // C= + SHIFT cmp #$03 // C= + SHIFT
bne @SetDecodeTable bne @SetDecodeTable
cmp MemMap.KEYB2_SPACE.SYS_Lstshf cmp MemMap.KEYB2.SYS_Lstshf
beq @Exit beq @Exit
@SetDecodeTable: @SetDecodeTable:
@ -241,21 +241,21 @@ ReadKeyb:
jmp @Process jmp @Process
// -------------------------- // --------------------------
GetKey: lda MemMap.KEYB2_SPACE.SYS_Ndx GetKey: lda MemMap.KEYB2.SYS_Ndx
bne @IsKey bne @IsKey
@NoKey: lda #255 // Null @NoKey: lda #255 // Null
sec sec
rts rts
@IsKey: ldy MemMap.KEYB2_SPACE.SYS_Keyd @IsKey: ldy MemMap.KEYB2.SYS_Keyd
ldx #0 ldx #0
@Loop: lda MemMap.KEYB2_SPACE.SYS_Keyd + 1,X @Loop: lda MemMap.KEYB2.SYS_Keyd + 1,X
sta MemMap.KEYB2_SPACE.SYS_Keyd,X sta MemMap.KEYB2.SYS_Keyd,X
inx inx
cpx MemMap.KEYB2_SPACE.SYS_Ndx cpx MemMap.KEYB2.SYS_Ndx
bne @Loop bne @Loop
dec MemMap.KEYB2_SPACE.SYS_Ndx dec MemMap.KEYB2.SYS_Ndx
tya tya
clc clc
rts rts

View File

@ -17,6 +17,7 @@ BasicUpstart2(start)
#import "screen.asm" #import "screen.asm"
#import "keyb2.asm" #import "keyb2.asm"
#import "hex.asm" #import "hex.asm"
#import "shell.asm"
* = * "Kernel Start" * = * "Kernel Start"
@ -38,19 +39,25 @@ 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 Skip bcs Skip
cmp #$0d
bne inputChar
.break // Execute Item
jsr Shell.push
jsr Shell.wozExec
lda #$0d
jsr Screen.petToScreen
cPrint()
jsr Shell.clear
jmp loop
inputChar:
jsr Shell.push
jsr Screen.petToScreen jsr Screen.petToScreen
//jsr Hex.byteToHex
//cPrint()
//txa
cPrint() cPrint()
@ -65,6 +72,7 @@ initApp: {
SetBackgroundColor(constants.BORDER_COLOR) SetBackgroundColor(constants.BORDER_COLOR)
jsr Screen.init jsr Screen.init
jsr Keyboard2.init jsr Keyboard2.init
jsr Shell.init
rts rts
} }

View File

@ -6,25 +6,25 @@
* = * "Math Routines" * = * "Math Routines"
multiply: { multiply: {
stx MemMap.MATH_SPACE.multiTmpX stx MemMap.MATH.multiTmpX
pha pha
lda #$00 lda #$00
ldx #$08 ldx #$08
clc clc
m0: bcc.r m1 m0: bcc.r m1
clc clc
adc MemMap.MATH_SPACE.factor2 adc MemMap.MATH.factor2
m1: ror m1: ror
ror MemMap.MATH_SPACE.factor1 ror MemMap.MATH.factor1
dex dex
bpl.r m0 bpl.r m0
ldx MemMap.MATH_SPACE.factor1 ldx MemMap.MATH.factor1
sta MemMap.MATH_SPACE.result sta MemMap.MATH.result
stx MemMap.MATH_SPACE.result+1 stx MemMap.MATH.result+1
pla pla
ldx MemMap.MATH_SPACE.multiTmpX ldx MemMap.MATH.multiTmpX
rts rts

View File

@ -4,23 +4,24 @@
.const ZPAGE_BASE = $2 .const ZPAGE_BASE = $2
.namespace SCREEN_SPACE { .namespace SCREEN {
.label TempVideoPointer = ZPAGE_BASE // 2 bytes .label TempVideoPointer = ZPAGE_BASE // 2 bytes
.label TempStringPointer = ZPAGE_BASE+2 // 2 bytes .label TempStringPointer = ZPAGE_BASE+2 // 2 bytes
.label CursorCol = ZPAGE_BASE+4 // 1 byte .label CursorCol = ZPAGE_BASE+4 // 1 byte
.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
} }
.namespace MATH_SPACE { .namespace MATH {
.label factor1 = ZPAGE_BASE+8 // 1 byte .label factor1 = ZPAGE_BASE+9 // 1 byte
.label factor2 = ZPAGE_BASE+9 // 1 byte .label factor2 = ZPAGE_BASE+10 // 1 byte
.label multiTmpX = ZPAGE_BASE+10 // 1 byte .label multiTmpX = ZPAGE_BASE+11 // 1 byte
.label result = ZPAGE_BASE+11 // 2 bytes .label result = ZPAGE_BASE+12 // 2 bytes
} }
.namespace KEYB2_SPACE { .namespace KEYB2 {
.label KeyR = ZPAGE_BASE+37 // 1 bytes .label KeyR = ZPAGE_BASE+37 // 1 bytes
.label SYS_Keyd = ZPAGE_BASE+38 // 10 bytes .label SYS_Keyd = ZPAGE_BASE+38 // 10 bytes
.label SYS_Ndx = ZPAGE_BASE+48 // 1 bytes .label SYS_Ndx = ZPAGE_BASE+48 // 1 bytes
@ -33,8 +34,23 @@
.label SYS_Lstshf = ZPAGE_BASE+55 // 1 bytes .label SYS_Lstshf = ZPAGE_BASE+55 // 1 bytes
} }
.namespace MEMORY_SPACE { .namespace MEMORY {
.label from = ZPAGE_BASE+56 // 2 bytes .label from = ZPAGE_BASE+56 // 2 bytes
.label to = ZPAGE_BASE+58 // 2 bytes .label to = ZPAGE_BASE+58 // 2 bytes
.label size = ZPAGE_BASE+60 // 2 bytes .label size = ZPAGE_BASE+60 // 2 bytes
}
.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
.label buffer = $3000 // 256 bytes
} }

View File

@ -13,20 +13,20 @@
// //
clone: clone:
ldy #0 ldy #0
ldx MemMap.MEMORY_SPACE.size ldx MemMap.MEMORY.size
beq md2 beq md2
md1: lda (MemMap.MEMORY_SPACE.from),y // move a page at a time md1: lda (MemMap.MEMORY.from),y // move a page at a time
sta (MemMap.MEMORY_SPACE.to),y sta (MemMap.MEMORY.to),y
iny iny
bne md1 bne md1
inc MemMap.MEMORY_SPACE.from+1 inc MemMap.MEMORY.from+1
inc MemMap.MEMORY_SPACE.to+1 inc MemMap.MEMORY.to+1
dex dex
bne md1 bne md1
md2: ldx MemMap.MEMORY_SPACE.size+1 md2: ldx MemMap.MEMORY.size+1
beq md4 beq md4
md3: lda (MemMap.MEMORY_SPACE.from),y // move the remaining bytes md3: lda (MemMap.MEMORY.from),y // move the remaining bytes
sta (MemMap.MEMORY_SPACE.to),y sta (MemMap.MEMORY.to),y
iny iny
dex dex
bne md3 bne md3

View File

@ -15,7 +15,9 @@
} }
.macro cPrint() { .macro cPrint() {
sty MemMap.SCREEN.cTempY
jsr Screen.printChar jsr Screen.printChar
ldy MemMap.SCREEN.cTempY
} }
.macro ClearScreen(screen, clearByte) { .macro ClearScreen(screen, clearByte) {
@ -94,13 +96,13 @@
init: { init: {
lda #$00 lda #$00
sta MemMap.SCREEN_SPACE.CursorCol sta MemMap.SCREEN.CursorCol
sta MemMap.SCREEN_SPACE.CursorRow sta MemMap.SCREEN.CursorRow
rts rts
} }
printChar: { printChar: {
stx MemMap.SCREEN_SPACE.tempX stx MemMap.SCREEN.tempX
// New Line // New Line
cmp #$8e cmp #$8e
bne.r !+ bne.r !+
@ -110,47 +112,47 @@ printChar: {
!: !:
// Store Base Video Address 16 bit // Store Base Video Address 16 bit
ldx #<constants.VIDEO_ADDR // Low byte ldx #<constants.VIDEO_ADDR // Low byte
stx MemMap.SCREEN_SPACE.TempVideoPointer stx MemMap.SCREEN.TempVideoPointer
ldx #>constants.VIDEO_ADDR // High byte ldx #>constants.VIDEO_ADDR // High byte
stx MemMap.SCREEN_SPACE.TempVideoPointer+1 stx MemMap.SCREEN.TempVideoPointer+1
// Temp Save Y // Temp Save Y
sty MemMap.SCREEN_SPACE.tempY sty MemMap.SCREEN.tempY
// CursorRow * 40 // CursorRow * 40
ldy MemMap.SCREEN_SPACE.CursorRow ldy MemMap.SCREEN.CursorRow
sty MemMap.MATH_SPACE.factor1 sty MemMap.MATH.factor1
ldy #constants.COLUMN_NUM ldy #constants.COLUMN_NUM
sty MemMap.MATH_SPACE.factor2 sty MemMap.MATH.factor2
jsr Math.multiply jsr Math.multiply
// Add mul result to TempVideoPointer // Add mul result to TempVideoPointer
clc clc
pha pha
lda MemMap.MATH_SPACE.result lda MemMap.MATH.result
adc MemMap.SCREEN_SPACE.TempVideoPointer+1 adc MemMap.SCREEN.TempVideoPointer+1
sta MemMap.SCREEN_SPACE.TempVideoPointer+1 sta MemMap.SCREEN.TempVideoPointer+1
lda MemMap.MATH_SPACE.result+1 lda MemMap.MATH.result+1
adc MemMap.SCREEN_SPACE.TempVideoPointer adc MemMap.SCREEN.TempVideoPointer
sta MemMap.SCREEN_SPACE.TempVideoPointer sta MemMap.SCREEN.TempVideoPointer
pla pla
// Add column // Add column
ldy MemMap.SCREEN_SPACE.CursorCol ldy MemMap.SCREEN.CursorCol
sta (MemMap.SCREEN_SPACE.TempVideoPointer), y sta (MemMap.SCREEN.TempVideoPointer), y
ldy MemMap.SCREEN_SPACE.tempY ldy MemMap.SCREEN.tempY
iny iny
inc MemMap.SCREEN_SPACE.CursorCol inc MemMap.SCREEN.CursorCol
lda MemMap.SCREEN_SPACE.CursorCol lda MemMap.SCREEN.CursorCol
cmp #constants.COLUMN_NUM+1 cmp #constants.COLUMN_NUM+1
bcc.r exita bcc.r exita
// CursorCol > COLUMN_NUM ? new line // CursorCol > COLUMN_NUM ? new line
jsr screenNewLine jsr screenNewLine
exita: exita:
ldx MemMap.SCREEN_SPACE.tempX ldx MemMap.SCREEN.tempX
rts rts
} }
@ -167,10 +169,10 @@ exita:
// //
print: { print: {
ldy #$00 ldy #$00
sta MemMap.SCREEN_SPACE.TempStringPointer sta MemMap.SCREEN.TempStringPointer
stx MemMap.SCREEN_SPACE.TempStringPointer+1 stx MemMap.SCREEN.TempStringPointer+1
printLoop: printLoop:
lda (MemMap.SCREEN_SPACE.TempStringPointer), y lda (MemMap.SCREEN.TempStringPointer), y
cmp #0 cmp #0
beq exit beq exit
jsr Screen.printChar jsr Screen.printChar
@ -181,8 +183,8 @@ print: {
screenNewLine: { screenNewLine: {
lda #0 lda #0
sta MemMap.SCREEN_SPACE.CursorCol sta MemMap.SCREEN.CursorCol
inc MemMap.SCREEN_SPACE.CursorRow inc MemMap.SCREEN.CursorRow
rts rts
} }

196
shell.asm Normal file
View File

@ -0,0 +1,196 @@
#importonce
.filenamespace Shell
#import "mem_map.asm"
#import "screen.asm"
* = * "Shell Routines"
.const CR = $0d
init: {
lda #-1
sta MemMap.SHELL.pos
rts
}
push: {
ldy MemMap.SHELL.pos
iny
cpy #127
beq 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: sta MemMap.SHELL.MODE
BLSKIP: iny
NEXTITEM:
.break
lda MemMap.SHELL.buffer,Y //Get character
cmp #$0d
bne CONT // We're done if it's CR!
rts
CONT:
cmp #'.'
bcc BLSKIP // Ignore everything below "."!
beq SETMODE // Set BLOCK XAM mode ("." = $AE)
cmp #':'
beq SETSTOR // Set STOR mode! $BA will become $7B
cmp #'R'
beq RUN // Run the program! Forget the rest
stx MemMap.SHELL.L // Clear input value (X=0)
stx MemMap.SHELL.H
sty MemMap.SHELL.YSAV // Save Y for comparison
// Here we're trying to parse a new hex value
NEXTHEX:
lda MemMap.SHELL.buffer,y // Get character for hex test
eor #$30 // Map digits to 0-9
cmp #9+1 // Is it a decimal digit?
bcc DIG // Yes!
// TODO: THIS IS NOT WORKING
adc #$08 // Map letter "A"-"F" to $FA-FF
cmp #$FA // Hex letter?
bcc NOTHEX // No! Character not hex
DIG:
asl
asl // Hex digit to MSD of A
asl
asl
ldx #4 // Shift count
HEXSHIFT: asl // Hex digit left, MSB to carry
rol MemMap.SHELL.L // Rotate into LSD
rol MemMap.SHELL.H // Rotate into MSD's
dex // Done 4 shifts?
bne HEXSHIFT // No, loop
iny // Advance text index
bne NEXTHEX // Always taken
NOTHEX: cpy MemMap.SHELL.YSAV //Was at least 1 hex digit given?
bne !+ // No! Ignore all, start from scratch
rts
!:
bit MemMap.SHELL.MODE //Test MODE byte
bvc NOTSTOR // B6=0 is STOR, 1 is XAM or BLOCK XAM
// STOR mode, save LSD of new hex byte
lda MemMap.SHELL.L // LSD's of hex data
sta (MemMap.SHELL.STL,X) //Store current 'store index'(X=0)
inc MemMap.SHELL.STL //Increment store index.
bne NEXTITEM // No carry!
inc MemMap.SHELL.STH // Add carry to 'store index' high
TONEXTITEM: jmp NEXTITEM //Get next command item.
//-------------------------------------------------------------------------
// RUN user's program from last opened location
//-------------------------------------------------------------------------
RUN: jmp (MemMap.SHELL.XAML) // Run user's program
//-------------------------------------------------------------------------
// We're not in Store mode
//-------------------------------------------------------------------------
NOTSTOR: bmi XAMNEXT // B7 = 0 for XAM, 1 for BLOCK XAM
// We're in XAM mode now
ldx #2 // Copy 2 bytes
SETADR: lda MemMap.SHELL.L-1,X // Copy hex data to
sta MemMap.SHELL.STL-1,X // 'store index'
sta MemMap.SHELL.XAML-1,X // and to 'XAM index'
dex // Next of 2 bytes
bne SETADR // Loop unless X = 0
// 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
cPrint()
lda MemMap.SHELL.XAMH // Output high-order byte of address
jsr PRBYTE
lda MemMap.SHELL.XAML // Output low-order byte of address
jsr PRBYTE
lda #':' // Print colon
cPrint()
PRDATA: lda #' ' // Print space
cPrint()
lda (MemMap.SHELL.XAML,X) // Get data from address (X=0)
jsr PRBYTE // Output it in hex format
XAMNEXT: stx MemMap.SHELL.MODE // 0 -> MODE (XAM mode).
lda MemMap.SHELL.XAML // See if there's more to print
cmp MemMap.SHELL.L
lda MemMap.SHELL.XAMH
sbc MemMap.SHELL.H
bcs TONEXTITEM // Not less! No more data to output
inc MemMap.SHELL.XAML // Increment 'examine index'
bne MOD8CHK // No carry!
inc MemMap.SHELL.XAMH
MOD8CHK: lda MemMap.SHELL.XAML // If address MOD 8 = 0 start new line
and #%00000111
bpl NXTPRNT // Always taken.
// -------------------------------------------------------------------------
// Subroutine to print a byte in A in hex form (destructive)
// -------------------------------------------------------------------------
PRBYTE: pha // Save A for LSD
lsr
lsr
lsr // MSD to LSD position
lsr
jsr PRHEX // Output hex digit
pla // Restore A
// Fall through to print hex routine
// -------------------------------------------------------------------------
// Subroutine to print a hexadecimal digit
// -------------------------------------------------------------------------
PRHEX: and #%00001111 // Mask LSD for hex print
ora #'0' // Add "0"
cmp #'9'+1 // Is it a decimal digit?
bcc ECHO // Yes! output it
adc #6 // Add offset for letter A-F
jsr Screen.petToScreen
cPrint()
rts
done:
.break
rts
ECHO:
cPrint()
rts
}