Login
Back to forumSee the full topicGo to last reply

Posted By

Harry Potter
on 2022-06-12
16:53:02
 Re: cc65 Plus4 Cart bug...

The 16k version does not work. sad I get from WinVice a JAM instruction at $01FF. I really want this to work. The Plus4/C16 cartridge version of AdvSkelVic65 works, though. happy

The 16k cartridge crt0.s file follows:

---------------------------
;
; Startup code for cc65 (C64 version)
;

.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib, callirq
.import zerobss
.import _main, pushax
.import RESTOR, BSOUT, CLRCH
.import __INTERRUPTOR_COUNT__
.import __RAM_START__, __RAM_SIZE__ ; Linker generated

.import _cgetc, _puts, _memcpy

.import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__

.exportzp _i, _j, _Itm1, _CRoom, _CurPos, _CurItem, _s, _Vrb, _c
.exportzp _CRm, _CurRoomInv, _e, _ItemPtr, _s2

.include "zeropage.inc"
.include "plus4.inc"


.segment "STARTUP"
jmp startup ;Cold start
jmp $FEBC ;Warm start, default calls NMI exit.
.byt 1, $43,$42,$4d ;magic to identify cartridge

startup:
;Thi
sei
ldx #$ff
txs
lda $fb
pha
;ldx #$02 ; cartrige 1 lo, kernal
sta $FDD2
jsr $FF84 ; Initialize I/O devices
jsr $FF87 ; RAM Test
pla
sta $FB
jsr $FF8A ; Restore vectors to initial values
jsr $FF81 ; Initialize screen editor
cli

; Switch to second charset

lda #14
jsr BSOUT

; Clear the BSS data

jsr zerobss

lda #$00
sta sp
lda #$80
sta sp+1 ; Set argument stack ptr

lda #$03
sta $FF0C
lda #$FF
sta $FF0D

; If we have IRQ functions, chain our stub into the IRQ vector

; lda #<__INTERRUPTOR_COUNT__
; beq NoIRQ1
; lda IRQVec
; ldx IRQVec+1
; sta IRQInd+1
; stx IRQInd+2
; lda #; ldx #>IRQStub
; sei
; sta IRQVec
; stx IRQVec+1
; cli

; Call module constructors


NoIRQ1:
lda #<__DATA_RUN__
ldx #>__DATA_RUN__
jsr pushax
lda #<__DATA_LOAD__
ldx #>__DATA_LOAD__
jsr pushax
lda #<__DATA_SIZE__
ldx #>__DATA_SIZE__
jsr _memcpy


jsr initlib

; Push arguments and call main
;ra:
; inc $D021
; jmp ra


jsr _main

; Back from main (This is also the _exit entry). Run module destructors

_exit: jsr donelib


; Reset the IRQ vector if we chained it.

; ;pha ; Save the return code on stack
; lda #<__INTERRUPTOR_COUNT__
; beq NoIRQ2
; lda IRQInd+1
; ldx IRQInd+2
; sei
; sta IRQVec
; stx IRQVec+1
; cli


NoIRQ2:
jmp startup

.zeropage
_i: .res 1
_j: .res 1
_Itm1: .res 1
_CRoom: .res 1
_CurPos: .res 1
_CurItem: .res 1
_s: .res 2
_Vrb: .res 1
_c: .res 1
_CRm: .res 2
_CurRoomInv: .res 2
_e: .res 1
_ItemPtr: .res 2
_s2: .res 2
-------------------




Back to top


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