Page 3 of 7

Re: Switching to R43 frustration

Posted: Thu Jun 01, 2023 7:13 pm
by ch4rl3sb
Another thing I've been meaning to ask:
Does a line interrupt trigger at the beginning or end of the line in question? When the line starts or when it hits the horizontal blank?

Re: Switching to R43 frustration

Posted: Thu Jun 01, 2023 7:32 pm
by Johan Kårlin
StephenHorn wrote: Thu Jun 01, 2023 4:58 pm I dimly recall there being some PRs having to do with VERA IRQ triggering and line IRQs... ah, yeah, found the change that matters in the emulation code. In January this year (2023 for time travelers from the future), a change went in to match emulation behavior with hardware behavior. On VERA hardware, the ISR bits are set regardless of the state of the IEN bits -- IEN only controls whether VERA generates an interrupt request to the CPU when certain ISR bits are set.

Previous to that change, the relationship in the emulator was the other way around, and IEN bits would control whether ISR bits could ever get set, and VERA would generate interrupt requests if any bits in ISR were set. This means the line interrupt bit is pretty much guaranteed to be set most of the time -- it just doesn't generate interrupts anymore unless the appropriate IEN bit is set.
Thanks for making this clear! I have been confused by this too. I had code that stopped working and I didn’t understand why. I made some changes and got it working again without really knowing what I was doing. But now I get it. :)

Re: Switching to R43 frustration

Posted: Thu Jun 01, 2023 7:44 pm
by ch4rl3sb
Well, that does work! Thank you so much.

Now it just has some sprite position anomalies at the beginning of the game that weren't there before. Maybe to do with the randomized ram? (Your spaceship changes position then fires bullets that come out of a different position out of thin air for a few seconds, then everything settles into normal. But that's a new problem.)

Re: Switching to R43 frustration

Posted: Thu Jun 01, 2023 7:47 pm
by StephenHorn
ch4rl3sb wrote: Thu Jun 01, 2023 7:13 pm Another thing I've been meaning to ask:
Does a line interrupt trigger at the beginning or end of the line in question? When the line starts or when it hits the horizontal blank?
The emulator is setting the bit in VERA ISR at the start of the visible line. That said, there are several possible places where a change to VERA state will take effect. I don't remember the exact list off the top of my head, but in general the background layer settings are applied 2 scanlines after they are set, I think VSTART is applied on the next line (please don't hold me to that), and other state changes are applied immediately (i.e. are visible mid-scanline and can benefit/suffer from "racing the beam" techniques).

Someone please correct me if I'm getting this wrong.

Re: Switching to R43 frustration

Posted: Thu Jun 01, 2023 8:03 pm
by desertfish
ch4rl3sb wrote: Thu Jun 01, 2023 7:44 pm Well, that does work! Thank you so much.

Now it just has some sprite position anomalies at the beginning of the game that weren't there before. Maybe to do with the randomized ram? (Your spaceship changes position then fires bullets that come out of a different position out of thin air for a few seconds, then everything settles into normal. But that's a new problem.)
You can easily check if this is the case by running the emulator with the -zeroram command line option. That will clear the ram to zero again which was the old behavior, but it is not what the hardware is doing.

Re: Switching to R43 frustration

Posted: Thu Jul 13, 2023 11:48 pm
by Ed Minchau
I have similar frustrations with the way files are handled now, particularly with subfolders. No matter what I do I can't seem to load a file if it's in a subfolder.

I wrote some code to save a file with the following filename:

Code: Select all

@:DEMO/IMG/PIX40.DAT
And that saved PIX40.DAT properly in the IMG subfolder in the DEMO folder.

But no matter what filename I try I cannot load that file back into memory. Here's some of the filenames I tried:

Code: Select all

DEMO/IMG/PIX40.DAT
/DEMO/IMG/PIX40.DAT
DEMO:/IMG:/PIX40.DAT
DEMO/IMG/:PIX40.DAT
DEMO/:IMG/:PIX40.DAT
DEMO/IMG:/PIX40.DAT
:/DEMO/IMG:/PIX40.DAT
and so on and so on.
So what am I missing? And why not simply leave it the way it was in r41, the way every other computer system that has used subfolders for the last 40 years? Why make it a unique syntax?

Re: Switching to R43 frustration

Posted: Fri Jul 14, 2023 12:12 am
by TomXP411
Ed Minchau wrote: Thu Jul 13, 2023 11:48 pm I have similar frustrations with the way files are handled now, particularly with subfolders. No matter what I do I can't seem to load a file if it's in a subfolder.

I wrote some code to save a file with the following filename:

Code: Select all

@:DEMO/IMG/PIX40.DAT
And that saved PIX40.DAT properly in the IMG subfolder in the DEMO folder.

But no matter what filename I try I cannot load that file back into memory. Here's some of the filenames I tried:

Code: Select all

DEMO/IMG/PIX40.DAT
/DEMO/IMG/PIX40.DAT
DEMO:/IMG:/PIX40.DAT
DEMO/IMG/:PIX40.DAT
DEMO/:IMG/:PIX40.DAT
DEMO/IMG:/PIX40.DAT
:/DEMO/IMG:/PIX40.DAT
and so on and so on.
So what am I missing? And why not simply leave it the way it was in r41, the way every other computer system that has used subfolders for the last 40 years? Why make it a unique syntax?
This sounds like a bug. I'll ping MooingLemur on this and see if he has any insight.

update: I can save and load from subdirectories with the usual syntax:
Screenshot 2023-07-13 171543.png
Screenshot 2023-07-13 171543.png (10.81 KiB) Viewed 20728 times
Make sure you're using the -fsroot parameter when starting the emulator and point that to a directory with your files. I have a "root" directory parallel to my emu directory, like this:

C:\CX16\Emulator
C:\CX16\root

and I start the emu with .\emulator\x16emu.exe -scale 2 -echo -rtc -fsroot .\root

Re: Switching to R43 frustration

Posted: Fri Jul 14, 2023 12:24 am
by Ender
Ed Minchau wrote: Thu Jul 13, 2023 11:48 pm I have similar frustrations with the way files are handled now, particularly with subfolders. No matter what I do I can't seem to load a file if it's in a subfolder.

I wrote some code to save a file with the following filename:

Code: Select all

@:DEMO/IMG/PIX40.DAT
And that saved PIX40.DAT properly in the IMG subfolder in the DEMO folder.

But no matter what filename I try I cannot load that file back into memory. Here's some of the filenames I tried:

Code: Select all

DEMO/IMG/PIX40.DAT
/DEMO/IMG/PIX40.DAT
DEMO:/IMG:/PIX40.DAT
DEMO/IMG/:PIX40.DAT
DEMO/:IMG/:PIX40.DAT
DEMO/IMG:/PIX40.DAT
:/DEMO/IMG:/PIX40.DAT
and so on and so on.
So what am I missing? And why not simply leave it the way it was in r41, the way every other computer system that has used subfolders for the last 40 years? Why make it a unique syntax?
What is the exact command you are using? The first format seems to work fine for me.

Code: Select all

BLOAD "TETRADS/SOUNDS.BIN",8,1,$A000

SEARCHING FOR TETRADS/SOUNDS.BIN
LOADING FROM $01:A000 TO $05:B3EB
READY.
EDIT: Nevermind, Tom beat me to it :D

Re: Switching to R43 frustration

Posted: Fri Jul 14, 2023 12:27 am
by Ed Minchau
That's a file in a folder. I need a file in a subfolder in a folder.

Re: Switching to R43 frustration

Posted: Fri Jul 14, 2023 12:41 am
by DragWx
I did a quick look at the kernal rom, and the parser wants something like this:
"@0/HERES/MY/PATH/:FILE.PRG"
I think you can omit the leading number (it's the "medium" and it defaults to zero). The path part must begin and end with a slash, and the part directly after the colon is the filename plus options like usual.
I can't test right now to confirm, sorry.