Login
Back to forumSee the full topicGo to last reply

Posted By

Harry Potter
on 2024-09-05
17:39:52
 Re: cc65/Plus4 Config: 32k ROM?

I'm posting here the printc() and prints() function sources in the hopes that somebody here can see what I'm doing wrong.

_printc:
--------------------------
.export _printc, _printcr, _printscr
;Address of kernal output routine for direct calls. The character is
;already in .A.
.import _prints
.importzp tmp4
.include "plus4.inc"

.segment "LOWCODE"

;_printc=$ffd2

;Print return.
_printscr:
jsr _prints
_printcr:
lda #13
;jmp _printc
_printc:
;sta tmp4
;lda #$D2
;jmp callkernal
sta $FDD2 ; Enable the ROM
jsr $FFD2
sta $FDDA ; Enable the ROM
rts
-----------------
_prints:
-----------------
.segment "LOWCODE"
.importzp ptr1

.export _prints
.import _printc

;Print a string of no more than 256 bytes using the kernal.
;As the routine is __fastcall__, the pointer already is in .X.A.
.proc _prints
sta ptr1 ;Store pointer.
stx ptr1+1
ldy #0 ;Start at offset 0.
@a:
lda (ptr1),y ;Load current char.
beq @exit ;Exit if null/EOS.
jsr _printc ;Print.
iny ;Advance until end of 256 bytes.
bne @a
@exit:
rts
.endproc
--------------------------------------
I want to apologize for the sloppy code. I was a long time ago an elegant coder, but that was a lifetime ago. sad



Back to top


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon