From: "Payton Byrd"; on Friday, May 25, 2012; at 05:28 PM -0400 > > > On Fri, May 25, 2012 at 4:15 PM, Ullrich von Bassewitz > > > > On Fri, May 25, 2012 at 03:28:38PM -0500, Payton Byrd wrote: > > > Now, the cart compiles and loads into VICE; and, when it's loaded > > > as a Cart, the screen and border turn white, which is as expected > > > based on the code in the header. The compiled binary then drops > > > straight into the CC65 initialization code that is normally at > > > 2061, as you would expect. The problem is that somewhere during > > > initialization the system goes into an infinite loop of displaying > > > garbage on the screen. > > > > I don't know much about C64 carts, but aren't they enabled by > > modifying $01? If so, the startup code will probably disable > > the cart from where the code is loaded because it modifies $01 > > to switch off the BASIC ROM. > > Yes, this is my initial thought as well. I've added code before > the cc65 init to copy all of the memory from $8000 to $BFFF to RAM > before performing the init; so, when the cart is disabled, the correct > code still should be in place. However, that does not change the > behavior of the program. > > Here is my current header and config. ... > > . . . . The cart header can be written as: .segment "ROMLA" .addr cold_start .addr cold_start .byte "CBM80" cold_start: lda #$01 sta $d020 sta $d021 The signature text will be translated into proper PetSCII. > > DATA: load = RAM, type = rw, define = yes; As Groepaz said, that should be DATA: load = ROM1, run = RAM, type = rw, define = yes; OK, with those things out of the way, I can give you the bad news: The cartridge launcher doesn't initiate the computer -- the cart must do that job! Look at a disassembly of the Kernal. The reset-code, at $FCE2, sets the stack pointer, then looks for a cart. If it finds one, it immediately jumps to that cart. Only if there is no cart does the Kernal do a sequence of subroutine-calls that initiates the system. So, your cart header must duplicate that list of JSRs. Therefore, the header must look like this: CINT = $ff81 IOINIT = $ff84 RAMTAS = $ff87 RESTOR = $ff8a .segment "ROMLA" .addr cold_start .addr cold_start .byte "CBM80" cold_start: jsr IOINIT jsr RAMTAS jsr RESTOR jsr CINT cli lda #$01 sta $d020 sta $d021 ; memcpy code ... A companion problem is that BASIC doesn't start your code; therefore, the start-up module mustn't return to BASIC. So, instead of "jmp $8200", the header must do: warm_start: jsr startup jmp warm_start startup: .end ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Sat May 26 03:59:33 2012
This archive was generated by hypermail 2.1.8 : 2012-05-26 03:59:36 CEST