more work towards MEGA65 native mode screen support

This commit is contained in:
FeralChild64 committed 2020-08-16 21:43:18 +02:00
1 parent 0d4898d91c
commit ee549361ab
7 files changed
+101 -38

No files matched your search

+7
View File
@@ -20,6 +20,13 @@
.label M65_LPNT_KERN = $EE // $EE-$F1 4-byte pointer for temporary usage by KERNAL
.label M65_TMP__K2 = $F2 // $F2 -- UNUSED -- temporary value for various Kernal routines
//
// Page 0 - other reused values
//
.label M65__TXTROW = PNTR // screen row
.label M65__TXTCOL = TBLX // screen column
//
// Pages 4-7 - reused screen memory
//
+1
View File
@@ -22,6 +22,7 @@
.label return_from_interrupt = KERNAL_0.return_from_interrupt
.label clrchn_reset = KERNAL_0.clrchn_reset
.label udtim_keyboard = KERNAL_0.udtim_keyboard
.label chrout_to_screen_code = KERNAL_0.chrout_to_screen_code
.label setup_irq_timer = KERNAL_0.setup_irq_timer
.label wait_x_bars = KERNAL_0.wait_x_bars
+3 -36
View File
@@ -26,49 +26,16 @@ chrout_screen:
// ones are always printable characters; separate away control codes
and #$60
bne !+
jmp chrout_screen_control
!:
beq_16 chrout_screen_control
txa
// Literals - first convert PETSCII to screen code
// Codes $C0-$DF become $40-$5F
cmp #$E0
bcs !+
cmp #$C0
bcc !+
and #$7F
jmp chrout_screen_literal // not high char
!:
// Range $20-$3F is unchanged
cmp #$40
bcc chrout_screen_literal // not high char
// Unshifted letters and symbols from $40-$5F
// all end up being -$40
// (C64 PRG p376)
// But anything >= $80 needs to be -$40
// (C64 PRG p380-381)
// And bit 7 should be cleared, only to be
// set by reverse video
sec
sbc #$40
// Fix shifted chars by adding $20 again
cmp #$20
bcc chrout_screen_literal // not high char
cmp #$40
bcs chrout_screen_literal // not high char
clc
adc #$20
jsr chrout_to_screen_code
// FALLTROUGH
chrout_screen_literal:
chrout_screen_literal: // entry point for chrout_screen_quote
// Write normal character on the screen
+44
View File
@@ -0,0 +1,44 @@
// #LAYOUT# STD * #TAKE
// #LAYOUT# * KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// CHROUT routine - convert PETSCII to screen code
//
chrout_to_screen_code:
// Codes $C0-$DF become $40-$5F
cmp #$E0
bcs !+
cmp #$C0
bcc !+
and #$7F
rts // not high char
!:
// Range $20-$3F is unchanged
cmp #$40
bcc !+ // not high char
// Unshifted letters and symbols from $40-$5F
// all end up being -$40
// (C64 PRG p376)
// But anything >= $80 needs to be -$40
// (C64 PRG p380-381)
// And bit 7 should be cleared, only to be
// set by reverse video
sec
sbc #$40
// Fix shifted chars by adding $20 again
cmp #$20
bcc !+ // not high char
cmp #$40
bcs !+ // not high char
clc
adc #$20
!:
rts
+32 -1
View File
@@ -1,9 +1,40 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// CHROUT routine - screen support (character output), MEGA65 native mode version
//
m65_chrout_screen:
// XXX provide implementation
// XXX hide cursor if visible
lda SCHAR
tax
// All the PETSCII control codes are within $0x, $1x, $8x, $9x, remaining
// ones are always printable characters; separate away control codes
and #$60
beq_16 m65_chrout_screen_control
txa
// Literals - first convert PETSCII to screen code
jsr chrout_to_screen_code
// FALLTROUGH
m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
// Write normal character on the screen
tax // store screen code, we need .A for calculations
// XXX continue the implementation
rts
@@ -0,0 +1,9 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_chrout_screen_control:
// XXX provide implementation
rts
+5 -1
View File
@@ -113,6 +113,10 @@ m65_clrscr_loop:
// Set screen variables
// XXX implement this, together with HOME
// XXX provide proper implementation, together with HOME
lda #$00
sta M65__TXTROW
sta M65__TXTCOL
rts