Login
Back to forumReply to this topicGo to last reply

Posted By

Harry Potter
on 2024-08-26
19:35:32
 cc65/Plus4 Config: 32k ROM?

Hi! I I have two Plus4 ROM configs online at https://sourceforge.net/projects/cc65extra/files/memory%20cfgs/. They are Plus4Cart1 and Plus4Cart2. Plus4Cart1 supports 16k cartridges in C1, and Plus4Cart2 supports 32k cartridges at C1 and C2, keeps the upper 16k banked out by default and banks it in on access. Plus4Cart3 is supposed to keep all 32k banked in and banks out the upper 16k to access the kernal. However, it's buggy: the test program locks up while printing the start-up message to the screen. I suspect an IRQ problem. What do I need to do to get it to work?

Posted By

zzarko
on 2024-08-27
11:00:04
 Re: cc65/Plus4 Config: 32k ROM?

IIRC, Plus/4 IRQ routine turns off external ROM while executing. If you have some IRQ code in there, that is almost 100% the reason. I did not analyse your code, but it is worth checking if print function, if it uses kernel, turns off the ROM too. I would put write breakpoint to config register and check if it is triggered when your code executes.

Posted By

Harry Potter
on 2024-08-27
18:46:24
 Re: cc65/Plus4 Config: 32k ROM?

Well...I'm actually using my CBMSimpleIO library's printc() function to print each character and prints()/printscr() to print whole strings, and AFAIF, I modified printc() to enable the kernal ROM for access. Now, it usually works for the beginning of the printed message but not the end. I was wondering if maybe an IRQ was being issued at exactly the wrong time to cause the lockup.

Posted By

Harry Potter
on 2024-08-30
14:08:50
 Re: cc65/Plus4 Config: 32k ROM?

zzarko: I just realized one of the things you were saying: I'm not using custom IRQ code but may want to as an option in the future.

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 topReply to this topic


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