Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Mazn ! (Registered 2021-10-24) You are not logged in 
CSDb User Forums


Forums > C64 Coding > Problems overloading LOAD vector
2005-08-30 11:15
Sasq

Registered: Apr 2004
Posts: 149
Problems overloading LOAD vector


I want to replace kernal LOAD to jump into the mmc64 bios. I have two problems;

- The mmc64 doesnt have any RAM like AR/RR so I need to use 6 bytes in main ram to switch in the mmc rom. I've been looking for a reasonably safe place and I' currently thinking about using the upper 6 bytes of the file number tables at 259. Can anyone think of safer places?

- My RR cart replaces LOAD per default as expected, but when I try to change it is instantly restored to the RR vector again. Why is this and how do you avoid it?

Also I wonder if there are any examples on using parts of the original kernal routines to do stuff like print error messages, print LOADING or generate basic listings for LOAD "$".
2005-08-30 12:34
iAN CooG

Registered: May 2002
Posts: 2921
Here are some code snippets I'm using sometimes.
The 1st send "I" and print status msg.
Is taken and adapted from some IDE64 examples
         *= $c000
         ;callable from basic
         jmp initdrv

         jmp printstatus

initdrv
         jsr openchan
         lda $ba
         jsr $ed0c ;listen
         lda $b9
         jsr $edb9 ;second
         lda #$49  ;"I"
         jsr $eddd ;send
         jsr $edfe ;unlisten
         jmp status

printstatus
         ;only print error/status
         jsr openchan
status
         lda $ba
         jsr $ed09 ;talk
         lda $b9
         jsr $edc7 ;tksa
         jsr $ee13 ;read
         jsr $ffd2 ;print
         bit $90
         bvc *-8

         jsr $edef ;untalk
         jsr $f642 ;close
         jsr $ffc3 ;close
         rts

openchan
         lda #0
         sta $90
         lda #8 ;drive 8
         sta $ba
         lda #$6f ;channel
         sta $b9
         lda #0
         jsr $ffbd ;setname
         jmp $f3d5 ;open


This one prints directory, wait for a key, exits.
Disassembled from a packer and commented by me.
        *= $0334

        JSR $E544      ;clear screen
        LDA #$01
        LDX #<dirname
        LDY #>dirname
        JSR $FFBD      ; set filename "$"
        LDA #$08
        STA $BA        ; device #8
        LDA #$60
        STA $B9        ; secondary chn
        JSR $F3D5      ; open for serial bus devices
        JSR $F219      ; set input device
        LDY #$04
labl1   JSR $EE13      ; input byte on serial bus
        DEY
        BNE labl1      ; get rid of Y bytes
        LDA $C6        ; key pressed?
        ORA $90        ; or EOF?
        BNE labl2      ; if yes exit
        JSR $EE13      ; now get in AX the dimension
        TAX            ; of the file
        JSR $EE13
        JSR $BDCD      ; print number from AX
labl3   JSR $EE13      ; now the filename
        JSR $E716      ; put a character to screen
        BNE labl3      ; while not 0 encountered
        JSR $AAD7      ; put a CR , end line
        LDY #$02       ; set 2 bytes to skip
        BNE labl1      ; repeat
labl2   JSR $F642      ; close serial bus device
        JSR $F6F3      ; restore I/O devices to default
labl4   JSR $F142      ; w8 a key
        BEQ labl4
        RTS

dirname .byte "$"

Hope it helps.
2005-08-31 19:13
TNT
Account closed

Registered: Oct 2004
Posts: 189
Plenty of good messages at $f0bd, printing routine at $f12b
To print "loading" ldy #$49;jsr $f12b

If you update $93 for load/verify you can print appropriate message with jsr $f5d2

jsr $f5af is "searching" + filename

ldx #01..1e; jsr $a43a for some more errors

What code you use to jump into MMC64 Flash? inc $df11;jmp?
2005-09-01 07:00
Sasq

Registered: Apr 2004
Posts: 149
Quote:
What code you use to jump into MMC64 Flash? inc $df11;jmp?


This is wat I use (by saving carry at destination I can preserve $01 too). It assumes no program maps char rom while loading (which I think is pretty safe).

dec  $df11
lsr  $01
jmp  $8xxx

2005-09-01 18:48
TNT
Account closed

Registered: Oct 2004
Posts: 189
That's eight bytes and causes side effects (tape control). I would try splitting code into three parts and use all three file tables.

*=$25e
dec $df11
bpl $267

*=$267
ldx $01
ldy #$37
bne $272

*=$272
sty $01
jmp $8xxx

That way you can have four open files without overwriting switching code.
2005-09-02 07:18
Sasq

Registered: Apr 2004
Posts: 149
I use the rest of the space to LDA different values and some BIT trickery to be able to overload 6 vectors, which takes all 3 * 8 bytes. I doubt a typical game has more than two open files though, and the tape motor thing is unfortunate but not that big a deal IMO since I wont be using tape.

There might be other problems, I wont know until I try it properly (havent had time thse last couple of days).

RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Mike
Spinball/Excess
Didi/Laxity
Quetzal/Chrome
Nith/TRIÉ…D
SLC
skull
That8BitChiptuneGuy
Mazn
JEZ
Andy/AEG Soft
Guests online: 69
Top Demos
1 Edge of Disgrace  (9.6)
2 Coma Light 13  (9.6)
3 Bromance  (9.6)
4 Uncensored  (9.6)
5 Memento Mori  (9.5)
6 Lunatico  (9.5)
7 Unboxed  (9.5)
8 Comaland 100%  (9.5)
9 Wonderland XII  (9.5)
10 Christmas Megademo  (9.5)
Top onefile Demos
1 Copper Booze  (9.6)
2 Daah, Those Acid Pil..  (9.5)
3 Dawnfall V1.1  (9.5)
4 Cityscape 2730  (9.5)
5 To Norah  (9.5)
6 Lovecats  (9.5)
7 Elite Code Mechanics  (9.4)
8 Barry Boomer - Trapp..  (9.4)
9 FMX Music Demo  (9.4)
10 For Your Sprites Only  (9.4)
Top Groups
1 Booze Design  (9.4)
2 Crest  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Fossil  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Pal  (9.4)
3 Mermaid  (9.4)
4 Shine  (9.2)
5 Jailbird  (9.0)

Home - Disclaimer
Copyright © No Name 2001-2021
Page generated in: 0.032 sec.