|
Post by stiggity on Nov 30, 2022 4:49:15 GMT
i asked this question 2 yrs ago, without many replies... well, I've stumbled upon it again. In my thread from 10/2020 i solved it, but didnt post the answer ad derived.......So.. any help is greatly appreciated.
lda #1 ; file#
ldx #8 ; SETLFS
ldy #0 ; secondary address (0=relocatable, 1=absolute)
jsr $ffbA ; set logical file parameters
above, i LDA #1, LDX #8, LDY #0.. ive tried to comment, does anyone know the correct, FILE#?? im loading a BASIC file.. that's being linked to the end of the master file that's always in memory. device 8, drive 0
ANY HELP is extremely appreciated,,,
|
|
|
Post by c128old on Nov 30, 2022 20:48:16 GMT
You ask what ‘file# to set’ The value for a “logical file nr” is just a handle It is effectively a table-entry. A spot to store things related to it. The value you choose for it isn’t too relevant to the rest of your description. Are trying to mimic a basic merge command?
|
|
|
Post by stiggity on Nov 30, 2022 22:44:09 GMT
Im attempting to take a variable (a$) and link it to the end of an everlasting program. I have it working in basic, and I HAD it working in ML. I posted on my previous (2yrs ago) thread that it was _solved_, and that i was using the wrong file #...I can see the file being retrieved, but even after re-linking the basic listing, the lines of the loaded module are not there. I use a tiny formula to set end of file into hi/low then, in the loading task, when i setup the hi/low and then finally $ffd5..at a loss. and i know the filename is right, and if it loads a larger file there is that short _wait_, (39blocks), compared to loading let's say (19) block file...im going to play with bits and see if i cannot find the error #..
|
|
|
Post by stiggity on Dec 1, 2022 2:47:34 GMT
Okay..i see the kernal message for the load. After the load, there is no added listing. And! (NTSC 128, Jiffy DOS, 1581) and load commands works, but no listing is shown. this is 100% outside of this prg. i mean... if i issue MY sys4864 i see "loading filename", and the only listing that's there is my test bed for the routine. prompt says READY. A "/filename" is ran, it seems to load, but there's nothing other than the test bed listing.. Jeez.. sorry to sound desperate, I've logged all day into this.
|
|
|
Post by c128old on Dec 1, 2022 20:52:19 GMT
Maybe I can follow step by step: You have a (valid) basic program, in memory. Now you add something to the basic program using ML. The ML routine is trying to load something from disk (so we are talking what BLOAD would do) into memory. When you say "to the end of a program" (I'm not sure what you mean with everlasting) are you expecting your data in bank0 or bank1 (did you set up the target banking config in your ML loader? So, as if you used the basic command BANK)
From your description I gather you would have expected to see extra basic text appear at the end of your program. Assuming you load to the correct location (end of basic).
In cases like these I heartily recommend a test environment like z64k for debugging. You can set a breakpoint (right click in the ML listing of the Monitor window) and step. That often helps a lot to understand this.
|
|
|
Post by stiggity on Dec 2, 2022 1:14:11 GMT
c128old: I load basic code from line 0 to 59999. Which stays in memory the entire duration the prg runs. then, I Link modules onto the tail end of that independent main body of code. Ive been doing all loads in basic, and want to sum-up the basic loading into Machine Code. no matter how i approach this task, i can see the basic interpreter send "loading filename" but once I'm returned to basic, the only code in memory is 0-59999. All linked progs beginat line 60000.. Grrrr..
|
|
|
Post by stiggity on Dec 7, 2022 9:35:19 GMT
Okay.. this is destroying my brain, and it's got to be something I'm overlooking. If anyone can spot the error, please let me know....
lob = $0e56 ;3670
hib = $0e57 ;3671
;** in basic, call to setup end of basic prg **
;a=(256*peek(4625)+peek(4624))-2:poke3070,(a and 255):poke3671,a/256
;a$="filename":sys4864, should load "filename, and link to the end of loader...
*=$1300
load1 LDA $2F
STA $BB
LDA $30
STA $BC
Oq LDY #$00
jsr fetch1
CMP #"a"
BNE O2q
INY
jsr fetch1
CMP #128
BEQ O3q
O2q CLC
LDA $BB
ADC #$07
STA $BB
LDA $BC
ADC #$00
STA $BC
JMP Oq
O3q INY
JSR fetch1
STA mdlen ;start1 + 1 ;strlen
INY
JSR fetch1 ;strptr lo
pha
INY
JSR fetch1 ;strptr hi
STA $BC
sta NAMhi
pla
sta $bb
sta NAMlo
lda #1 ; file#
ldx #8 ;moddrv ; SETLFS
ldy #15 ; secondary address (0=relocatable, 1=absolute)
jsr $ffbA ; set logical file parameters
lda mdlen ; length of filename
ldx NAMlo
ldy NAMhi
jsr $ffbd ; SETNAME
;lda #1 ; data in bank 1
ldx #1 ; filename in bank 0
jsr $ff68 ; SETBANK
lda #0 ; 0=load, <>0=verify
LDX lob
LDY hib
jSR $ffd5 ; LOAD
bcc +
brk
+ lda #0
sta $7f
JSR $9FC7
lda #128
sta $7f
rts
fetch1 LDA #$BB ;ZP pointer to use
LDX #1 ;bank index 1
JMP $FF74 ;kernal
NAMLO .BYTE 0
NAMHI .BYTE 0
MDLEN .BYTE 0
|
|
|
Post by c128old on Dec 9, 2022 16:49:33 GMT
I've not tried the code out. Here's my two cents' worth: - load your code into the z64k simulator - set a breakpoint in the monitor on 1300 and step to see if happens what you want to happen
According to the C= docs, you use a secondary address of "0" to load data absolute. You are using a secondary address of #15, which is the command channel. If I were a 15x1 disk-drive and would be asked over the command channel to load a file I would not be able to do so. That is, the filename is likely (hopefully) not a valid Commodore-Dos command. The string you are sending along to your drive is a filename and you want to load it, so I expect you would use a secondary address of either 0 or 1. In this case I would suggest you use the LDY #0 ; secondary address (0=relocatable, 1=absolute) And this should at least get you the data to the locations put into 'lob' and 'hib' with your poke commands. (poke3070,(a and 255):poke3671,a/256 The 3070 I expect is a typo not in your code) After that, since the basic-text does not stop with a 0 anymore (that is why you use the -2 in your peek) you expect basic to see the extra text.
Perhaps you can 'simply' increase the endofbasic text pointer as well, but maybe only needed if anything direct mode happens afterwards.
It appears you find a$ in your code. Any reason not to use the basic command POINTER(A$) and poke that into your NAMLO and NAMHI? Also, you can use the sys-arguments for this: sys 4864, pointer(a$)and255, pointer(a$)/256 to get the lo and hi in A and X. Or use 'USR(POINTER(A$))' and build some hate for the basic floating point accumulator ;-)
Finally, there are several hints on how to 'merge' basic programs. One claims it is as simple as: BLOAD "[filename]",B0,P(PEEK(4624)+256*PEEK(4625)-2):DELETE 2-1 I'm not sure why a 'delete 2-1' is needed. Maybe this has the effect of setting the basic-end-ptr?
|
|
|
Post by stiggity on Dec 10, 2022 2:27:50 GMT
c128old, I will see if there are typos, but i don't think there is because both locations 3070, and 3071 hold the correct address pointers...more likely a xfer typo, but i see the un-needed parenthesis.. I'm trying to use the least amount of BASIC in direct mode as possible.. I figure set filename in a$ shud be adequate... am I configuring the correct bank? a$ data is in bank1, it all looks good but nothing is being retrieved...i appreciate your reply, and please don't think im brushing you off, as in one point in time, i had this working... couple years ago, but cannot locate source. Not a terribly complicated routine, but i mess with it daily, and it's de-motivating each time its ran, and fails... if you get the chance to assemble it, simple a$="filename":sys4864 should do the trick.... or not!! :-)
|
|
|
Post by stiggity on Dec 10, 2022 3:38:24 GMT
that was the problem/error! I was poking 3070, and 3071, when all along, the correct address's were 3670, and 3671... omgosh, feeling like an idiot is Sooo lame..
c128old, Many thanks! and ithe lengthly response was the shoe to the rear I needed!! LOL! XD!!!!
Not that it was obvious to you, or it may have been??!! Now corrected and getting back on track..
-Regards!!!!!!!!!!!
|
|