load81 wrote:
I found the culprit! CJS is indeed correct: petcat has the right linked-list value. My manually created BASIC header was wrong. I think it only worked because there wasn't a second for the bad linked-list pointer to have to deal with.
I have further confirmation of what was going on here.
After some examination of the
VICE autostart parameters I discovered that there are two modes of interest:
-autostartprgmode 1 (inject mode) loads the contents of the
.prg directly into RAM, and
-autostartprgmode 2 (disk image mode) creates an empty disk image and copies the
.prg into it. When not explicitly specified, the previously used mode for that type of file (
.prg or
.d64 image) will be used. I tested these with
-autoload file.prg to suppress the
RUN command.
In disk image mode, a
LOAD "*",8,1 command will be generated. In this case, loading an actual bad file with $801 = $C still produces
PEEK(2049) = 11 (i.e., $0B). However, in inject mode I have seen
PEEK(2049) = 12 and additional rubbish after the first line when doing
LIST, indicating that it was the program file loader that had fixed that address. (For some reason now when I try to replicate this instead I get odd errors, such as a clear screen and READY prompt from the PEEK and
UNCTIO/VER on the same line when I type
LIST; this is still clearly indicating that something is corrupt, but I don't know why the behaviour has changed. It may be something to do with another parameter I used when testing; VICE seems to change some of its default parameters based on command-line options you gave in previous runs.)
Quote:
(That's some excellent use of sed and xxd, BTW.)
Thanks! That I still use so much shell scripting even decades after we've had better scripting languages available is actually rather a source of shame for me, but it does on rare occasions produce a clean result. (It's also worth mentioning that if you're distributing things via Git, Bash 3.x or higher is the one scripting language virtually guaranteed to be on everyone's system because it's included in Git for Windows.)
Quote:
It seems I had a bug in my Makefile. I thought the two "good" and "bad" Makefiles were identical but they were not. I must have adjusted something in one and not the other while tired and the two went out of sync. Because they looked identical on casual inspection I got "tunnel vision" on the single byte difference. I'm a bit annoyed with myself.
Well, I can tell you from long experience that being annoyed with yourself by this sort of thing will not be productive; you need to accept that this kind of thing is common human error that cannot be fixed by telling anyone (including yourself), "be more careful." The solution is to set up systems that expect and mitigate this.
My strategies include careful naming of things at all stages (to minimze the chance of confusion), committing unmodified copies of code from elsewhere before committing changes (so I can use
git diff to verify what changes I've made, or whether I've even made them!), and automating procedures (e.g., as with my sed/Bash scripting above) both to avoid typing mistakes and to more clearly document and describe exactly what I am doing. (That sed/bash script above went through several versions in my local repo before I figured out how to do it correctly and in the clearest way.)
This requires a fair amount of discipline, but does not require heavyweight process; in fact the more discipline you can bring in (basically, always having an attitude that you develop everything with thought of human error in mind), the more casual your process can be. Though I put absolutely everything in Git and my commit messages always have a clear explanation of exactly
why the change does things the way it does, I also almost never use pull requests (just sort it by directly talking to your fellow developers), web-based code review (again, grab another developer and just do it via pairing), ticketing systems (just fix it now), and so on.
Quote:
Now I'm going to go see if I can get the .binary directive to work. Ideally, I'd prefer to import the tokenized BASIC loader instead of relying on cat and output redirection and file concatination.
Importing it is definitely the right idea. I take it that your current thinking is that one of your source files would be the petcat input, and you'd generate the binary from that before assembling the program that includes it? Another option, if you have difficulty there, is to post-process the petcat output with xxd/sed/etc. to produce a file in assembler source format (i.e., with
.byte statements) that you could bring in with a regular
.include.