fixed screen code to PETSCII conversion
This commit is contained in:
1 parent
37ae435b2d
commit
af1f5b079d
2 files changed
+59
-24
No files matched your search
@@ -94,6 +94,8 @@ chrout_screen_jumptable_hi:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
__before_chrout_screen_jumptable:
|
||||||
|
|
||||||
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
|
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
|
||||||
|
|
||||||
chrout_screen_jumptable:
|
chrout_screen_jumptable:
|
||||||
@@ -121,6 +123,8 @@ chrout_screen_jumptable:
|
|||||||
.word chrout_screen_DEL
|
.word chrout_screen_DEL
|
||||||
.word chrout_screen_RETURN
|
.word chrout_screen_RETURN
|
||||||
|
|
||||||
.if (mod(*, $2) == 0) { brk } // make sure routine size is always the same, needed by build system
|
// Make sure routine size is always the same - build system limitation
|
||||||
|
|
||||||
|
.if (__before_chrout_screen_jumptable == chrout_screen_jumptable) { brk }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -3,42 +3,73 @@
|
|||||||
// #LAYOUT# * KERNAL_0 #TAKE
|
// #LAYOUT# * KERNAL_0 #TAKE
|
||||||
// #LAYOUT# * * #IGNORE
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
//
|
||||||
|
// Screen code to PETSCII conversion - see:
|
||||||
|
//
|
||||||
|
// - https://www.lemon64.com/forum/viewtopic.php?t=66362
|
||||||
|
// - https://sta.c64.org/cbm64scrtopetext.html
|
||||||
|
//
|
||||||
|
|
||||||
// XXX - conversion should depend on QTSW too
|
|
||||||
|
// XXX - part below might depend on QTSW too
|
||||||
|
|
||||||
|
|
||||||
screen_code_to_petscii:
|
screen_code_to_petscii:
|
||||||
cmp #$1B
|
|
||||||
bcc s2p_adc_40
|
|
||||||
|
|
||||||
s2p_not_alpha:
|
cmp #$20
|
||||||
|
bcc s2p_adc_40 // $00-$1F -> $40-$5F
|
||||||
|
|
||||||
cmp #$40
|
cmp #$40
|
||||||
bcc s2p_end
|
bcc s2p_end // $20-$3F -> $20-$3F
|
||||||
|
|
||||||
// FALLTROUGH
|
cmp #$60
|
||||||
|
bcc s2p_adc_80 // $40-$5F -> $C0-$DF
|
||||||
s2p_not_punctuation:
|
|
||||||
cmp #$5B
|
|
||||||
bcs s2p_not_shifted
|
|
||||||
|
|
||||||
// carry already clear here
|
|
||||||
adc #$80
|
|
||||||
|
|
||||||
rts
|
|
||||||
|
|
||||||
s2p_not_shifted:
|
|
||||||
|
|
||||||
cmp #$80
|
cmp #$80
|
||||||
bcs s2p_end // not vendor
|
bcc s2p_adc_40 // $60-$7F -> $A0-$BF
|
||||||
|
|
||||||
// $60-$7F -> $A0-$BF
|
// Here we have to check for quote mode
|
||||||
|
|
||||||
|
bit QTSW
|
||||||
|
bmi screen_code_to_petscii_quote
|
||||||
|
|
||||||
|
// Not quote mode - continue
|
||||||
|
|
||||||
|
cmp #$A0
|
||||||
|
bcc s2p_adc_C0 // $80-$9F -> $40-$5F
|
||||||
|
|
||||||
|
cmp #$C0
|
||||||
|
bcc s2p_adc_80 // $A0-$BF -> $20-$3F
|
||||||
|
|
||||||
|
cmp #$E0
|
||||||
|
bcc s2p_end // $C0-$DF -> $C0-$DF
|
||||||
|
|
||||||
|
clc
|
||||||
|
bcc s2p_adc_C0 // $E0-$FF -> $A0-$BF
|
||||||
|
|
||||||
s2p_adc_40:
|
s2p_adc_40:
|
||||||
|
|
||||||
clc
|
adc #$40 // Carry already clear
|
||||||
adc #$40
|
|
||||||
|
|
||||||
// FALLTROUGH
|
|
||||||
|
|
||||||
s2p_end:
|
s2p_end:
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
s2p_adc_80:
|
||||||
|
|
||||||
|
adc #$80 // Carry already clear
|
||||||
|
rts
|
||||||
|
|
||||||
|
screen_code_to_petscii_quote:
|
||||||
|
|
||||||
|
cmp #$C0
|
||||||
|
bcc s2p_adc_80 // $80-$BF -> $00-$3F
|
||||||
|
|
||||||
|
clc
|
||||||
|
|
||||||
|
// FALLTROUGH $C0-$FF -> $80-$BF
|
||||||
|
|
||||||
|
s2p_adc_C0:
|
||||||
|
|
||||||
|
adc #$C0 // Carry already clear
|
||||||
rts
|
rts
|
||||||
Reference in new issue
Block a user