I've been working on a module load/linker in asm, and im sort of stumped. I store the filename in (a$), and while watching the program run, i see the LOADING"FILENAME" kernal message appear. Its a few lines of code (which is all intermingled into this new routine I dreamt-up.), first in basic (I know this isn't a BASIC forum.. ;/ ) my first line of the main body of code that remains in memory the entire duration the program runs does "fast:bank15:open5,2,0,chr$(6):a=peek(47)+256*peek(48):a=a-2:poke3670,(a and 255):poke3671,a/256"
i wrote that, and its assigning low/hi bytes for the module loading routine's parameters...
LOB = 3670 HIB = 3671 moddrv = 4009
is there some other BASIC i should use to accomplish this? I load a file from line 0 to 59999 and all of the modules are _numbered_ starting at 60000.
Heres a snippet of what I have already written..
mdload LDA $2F
Oq LDY #$00
sta mdlen ;start1 + 1 ;strlen
JSR fetch1 ;strptr low
JSR fetch1 ;strptr hi
Jsr $FFBA ;SETLFS
Jsr $FFBD ;SETNAM
jsr $ff68 ;SETBANK
Jmp $FFD5 ;load
[code] fetch1 LDA #$BB ;ZP pointer to use LDX #1 ;bank index 1 JMP $FF74 ;kernal
rt code here[/code]
anyone have an explanation with how im approaching this?
It looks like you are loading the data to the end of basic program - 2, which seems correct but I don’t know what you are doing in the beginning of the program. This 4f4f jump, does that relink the BASIC line pointers?
Have you checked in the monitor after the load that the data is in the right place and that the line pointers are relinked?
bjonte: Ive compiled 10x and have simply "list60000-" to see if the loaded module was imported. I will bring up the monitor and look deeper. In the beginning of the program, im finding the contents of (a$(filename)) i call this from BASIC.. a$="filename": then call this routine. Im setting the SETNAM correct. I'm not certain if im setting the correct BANK, or SETLFS is right. And yes, $4F4F links the basic lines.
that wasnt it. loading a basic module from basic with a ,dv,1 gives the same result as ,dv I've been messing with this for an hour now. If i play with the BANK values, it doesnt detect the variables name, just a LOAD"garage".. honestly, i don't know whats wrong? I'd REALLY appreciate some guidance...
Load the module normally and check the contents in the monitor so you can compare it later when you load the module at the end of the current program. The first two bytes in each line should differ due to relinking but the rest should be identical.