Switching to R43 frustration

Get technical support from the community & developers with specific X16 programs if you can't find the solution elsewhere
(for general non-support related chat about programs please comment directly under the program in the software library)
ch4rl3sb
Posts: 42
Joined: Fri May 12, 2023 10:22 am

Re: Switching to R43 frustration

Post 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?
Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

Re: Switching to R43 frustration

Post 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. :)
ch4rl3sb
Posts: 42
Joined: Fri May 12, 2023 10:22 am

Re: Switching to R43 frustration

Post 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.)
User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

Re: Switching to R43 frustration

Post 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.
Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
User avatar
desertfish
Posts: 1096
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: Switching to R43 frustration

Post 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.
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: Switching to R43 frustration

Post 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?
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: Switching to R43 frustration

Post 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 20899 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
Ender
Posts: 220
Joined: Sat May 09, 2020 9:32 pm

Re: Switching to R43 frustration

Post 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
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: Switching to R43 frustration

Post by Ed Minchau »

That's a file in a folder. I need a file in a subfolder in a folder.
DragWx
Posts: 342
Joined: Tue Mar 07, 2023 9:07 pm

Re: Switching to R43 frustration

Post 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.
Post Reply