fixed screen code to PETSCII conversion

This commit is contained in:
FeralChild64 committed 2020-02-12 20:37:10 +01:00
1 parent 37ae435b2d
commit af1f5b079d
2 files changed
+60 -25

No files matched your search

@@ -94,6 +94,8 @@ chrout_screen_jumptable_hi:
#else
__before_chrout_screen_jumptable:
.if (mod(*, $2) == 1) { brk } // align code so that vector never crosses page boundary
chrout_screen_jumptable:
@@ -121,6 +123,8 @@ chrout_screen_jumptable:
.word chrout_screen_DEL
.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
+55 -24
View File
@@ -3,42 +3,73 @@
// #LAYOUT# * KERNAL_0 #TAKE
// #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:
cmp #$1B
bcc s2p_adc_40
s2p_not_alpha:
cmp #$20
bcc s2p_adc_40 // $00-$1F -> $40-$5F
cmp #$40
bcc s2p_end
bcc s2p_end // $20-$3F -> $20-$3F
// FALLTROUGH
s2p_not_punctuation:
cmp #$5B
bcs s2p_not_shifted
// carry already clear here
adc #$80
rts
s2p_not_shifted:
cmp #$60
bcc s2p_adc_80 // $40-$5F -> $C0-$DF
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:
clc
adc #$40
// FALLTROUGH
adc #$40 // Carry already clear
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