Login
Back to forumSee the full topicGo to last reply

Posted By

Harry Potter
on 2022-07-07
14:00:27
 Re: Plus4Cart3 bug

Maybe the bug is in the crt0.s file:

-----------------------------------
.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 $FFD2

; Clear the BSS data

jsr zerobss

;lda #<(__RAM_START__ + __RAM_SIZE__)
lda #$00
sta sp
;lda #>(__RAM_START__ + __RAM_SIZE__)
lda #$80
sta sp+1 ; Set argument stack ptr

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

sta $FDD2 ; Enable the ROM
; 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




Back to top


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