Continued F8 refactoring.

This commit is contained in:
Martin Haye 2016-08-08 08:09:46 -07:00
parent 6c9515b63c
commit 779b61f7c0
3 changed files with 44 additions and 33 deletions

View File

@ -399,11 +399,12 @@ loMemBegin: !pseudopc $800 {
jmp __asmPlasm_bank2 jmp __asmPlasm_bank2
; Vectors for debug macros ; Vectors for debug macros
jmp __iosaveROM jmp __safeBell
jmp __iorestLC
jmp __safeCout jmp __safeCout
jmp __safePrbyte jmp __safePrbyte
jmp __safeHome jmp __safeHome
jmp __safePrhex
jmp __safeRdkey
jmp __writeStr jmp __writeStr
jmp __prByte jmp __prByte
jmp __prSpace jmp __prSpace
@ -706,16 +707,28 @@ _prShared: !zone {
jmp __iorestLC jmp __iorestLC
} }
__safeBell: !zone {
jsr saveLCState
jsr ROM_bell
jmp restLCState
}
__safeCout: !zone { __safeCout: !zone {
jsr saveLCState jsr saveLCState
jsr ROM_cout jsr ROM_cout
jmp restLCState jmp restLCState
} }
safePrhex: !zone { __safePrhex: !zone {
jsr __iosaveROM jsr saveLCState
jsr ROM_prhex jsr ROM_prhex
jmp __iorestLC jmp restLCState
}
__safeRdkey: !zone {
jsr saveLCState
jsr ROM_rdkey
jmp restLCState
} }
__prSpace: !zone { __prSpace: !zone {
@ -769,10 +782,7 @@ __crout: !zone {
__waitKey: !zone { __waitKey: !zone {
jsr __iosaveROM jsr __iosaveROM
jsr ROM_rdkey jsr ROM_rdkey
pha jmp __iorestLC
jsr __iorestLC
pla
rts
} }
; Support for very compact abort in the case of internal errors. Prints ; Support for very compact abort in the case of internal errors. Prints
@ -1583,7 +1593,7 @@ aux_printMem:
txa txa
and #$F and #$F
tax tax
jsr safePrhex +safePrhex
txa txa
beq + beq +
lda #':' lda #':'
@ -2342,7 +2352,7 @@ disk_finishLoad: !zone
.debug1:+prStr : !text "Ld t=",0 .debug1:+prStr : !text "Ld t=",0
pha pha
lda resType lda resType
jsr safePrhex +safePrhex
+prSpace +prSpace
pla pla
+prStr : !text "n=",0 +prStr : !text "n=",0
@ -2350,7 +2360,7 @@ disk_finishLoad: !zone
+prStr : !text "aux=",0 +prStr : !text "aux=",0
pha pha
lda isAuxCmd lda isAuxCmd
jsr safePrhex +safePrhex
+prSpace +prSpace
pla pla
rts rts

View File

@ -398,12 +398,13 @@ _asmPlasm = auxLoader+3
_asmPlasm_bank2 = _asmPlasm+3 _asmPlasm_bank2 = _asmPlasm+3
; Debug support routines (defined in core/mem.s) ; Debug support routines (defined in core/mem.s)
_iosaveROM = _asmPlasm_bank2+3 _safeBell = _asmPlasm_bank2+3
_iorestLC = _iosaveROM+3 _safeCout = _safeBell+3
_safeCout = _iorestLC+3
_safePrbyte = _safeCout+3 _safePrbyte = _safeCout+3
_safeHome = _safePrbyte+3 _safeHome = _safePrbyte+3
_writeStr = _safeHome+3 _safePrhex = _safeHome+3
_safeRdkey = _safePrhex+3
_writeStr = _safeRdkey+3
_prByte = _writeStr+3 _prByte = _writeStr+3
_prSpace = _prByte+3 _prSpace = _prByte+3
_prWord = _prSpace+3 _prWord = _prSpace+3
@ -416,12 +417,8 @@ _internalErr = _waitKey+3
fixedRTS = _internalErr+3 fixedRTS = _internalErr+3
; Debug macros ; Debug macros
!macro iosaveROM { !macro safeBell {
jsr _iosaveROM jsr _safeBell
}
!macro iorestLC {
jsr _iorestLC
} }
!macro safeCout { !macro safeCout {
@ -429,13 +426,21 @@ fixedRTS = _internalErr+3
} }
!macro safePrbyte { !macro safePrbyte {
jsr _safeCout jsr _safePrbyte
} }
!macro safeHome { !macro safeHome {
jsr _safeHome jsr _safeHome
} }
!macro safePrhex {
jsr _safePrhex
}
!macro safeRdkey {
jsr _safeRdkey
}
!macro prStr { !macro prStr {
jsr _writeStr jsr _writeStr
} }

View File

@ -503,7 +503,7 @@ end
// Get a character from the keyboard // Get a character from the keyboard
export asm rdkey export asm rdkey
+asmPlasm 0 +asmPlasm 0
+waitKey +safeRdkey
ldy #0 ldy #0
rts rts
end end
@ -550,8 +550,7 @@ end
// Print a 16-bit hex value // Print a 16-bit hex value
asm printHex asm printHex
+asmPlasm 1 +asmPlasm 1
+prYA jmp _safePrhex
rts
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
@ -574,22 +573,19 @@ end
// Ring the bell // Ring the bell
export asm beep export asm beep
+asmPlasm 0 +asmPlasm 0
+iosaveROM +safeBell
jsr ROM_bell rts
jmp _iorestLC
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Read a string from the keyboard, turn it into a PLASMA string and return a pointer to the string. // Read a string from the keyboard, turn it into a PLASMA string and return a pointer to the string.
asm readStr asm readStr
+asmPlasm 0 +asmPlasm 0
+iosaveROM bit setROM
jsr ROM_getln1 jsr ROM_getln1
bit setLcRW+lcBank2
txa txa
pha pha
+iorestLC
pla
pha
beq + beq +
- lda inbuf-1,x - lda inbuf-1,x
and #$7F and #$7F