Loci - my Oric storage emulation project

This is the right place to discuss on how to implement hardware vsync, adding a VIA or AY chipset, puting multiple roms, or how to design a new flash expansion card.
User avatar
Dbug
Site Admin
Posts: 4564
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Loci - my Oric storage emulation project

Post by Dbug »

I'm not going to look at anything code related until I'm done with Encounter, my testing is basically going to be:
- Usability (with disks and tapes)
- Compatibility with software (what does not load properly)
- Hardware compatibility (does it run on the Nova 64, the Pravetz 8D, plus the Oric 1s and Atmoses)
User avatar
ibisum
Wing Commander
Posts: 1695
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Loci - my Oric storage emulation project

Post by ibisum »

Sodiumlightbaby wrote: Wed Jul 03, 2024 6:35 pm Again, this is pure, in mid-development snaps of code currently and by no means production ready.
https://github.com/sodiumlb/loci-rom
Good stuff, as soon I get a good connection, I'll build this too .. fun to read mia.c ..
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

ibisum wrote: Wed Jul 03, 2024 7:50 pm Good stuff, as soon I get a good connection, I'll build this too .. fun to read mia.c ..
Yeah, loads of the action is there. sys/mia.pio is the real hard-core low-level stuff. Needs to be read together with a copy of the RP2040 datasheet. The dsk and tap stuff is under oric/
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Dbug wrote: Wed Jul 03, 2024 7:15 pm I'm not going to look at anything code related until I'm done with Encounter, my testing is basically going to be:
- Usability (with disks and tapes)
- Compatibility with software (what does not load properly)
- Hardware compatibility (does it run on the Nova 64, the Pravetz 8D, plus the Oric 1s and Atmoses)
That testing will be a great contribution. Thank you! Having the code up primarily means we can get SW fixes out quickly and openly.
User avatar
ibisum
Wing Commander
Posts: 1695
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Loci - my Oric storage emulation project

Post by ibisum »

Studying mia.pio .. am I reading this correctly - could the RP2040''s PIO be used to provide a kind of sprite processor - i.e. give it a sprite # and a location, then the RP2040 does the update of graphics memory .. ?
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

ibisum wrote: Wed Jul 03, 2024 9:23 pm Studying mia.pio .. am I reading this correctly - could the RP2040''s PIO be used to provide a kind of sprite processor - i.e. give it a sprite # and a location, then the RP2040 does the update of graphics memory .. ?
It's quite freaky what the PIOs are able to do. They are the secret sauce that makes LOCI work without an FPGA, CPLD or similar. For making a sprite processor you would want to have direct access to the graphics memory, and on the Oric that is owned by the ULA and the 6502. Only those two are able to read or write the graphics memory. What we can do on LOCI is dynamically pretend to be different parts of the memory system and quickly move things around there presenting LOCI internal RAM as DRAM, but since the ULA has the hardwired access to the DRAM graphics memory, we can never fool the ULA.

Now if we were to talk an RP2040 based ULA implementation, yeah we could probably extend it with sprites etc quite easily if we managed to get a compatible implementation. The SpatULA! :lol: But first LOCI LOCI LOCI 8)
User avatar
Dbug
Site Admin
Posts: 4564
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Loci - my Oric storage emulation project

Post by Dbug »

This is definitely out of the current LOCI project, but we can noodle on that if we want, maybe on another thread?

If you wanted to do sprites on the Oric, imo the way to go is to do what the "MultiColoric" card was doing:
- Read the RGB+SYNC signal from the SCART output
- Convert that back to digital/TTL level (easy since it's 1 bit true color)
- Do whatever you want (in the case of MultiColoric it was to remap each of the 8 colors into a color lookup index into a programmable palette)
- Regenerate the video signal

With modern hardware the same thing could be done, an example could be to have for example 256 virtual hardware registers map in page 3 and do something like the AY chip where you first select which register to set (for example "10" for the "Channel A Volume") and then write the data to put to this register.

So you could for example have something where:
- Set of registers to enable/disable the extended graphical features, so old games and demos look the same
- Set of registers to remap the color palette, could even have multiple palettes per screen, so for example a game could have a different set of colors for the control panel, menu and the actual game itself.
- Set of registers to enable/disable sprites, set their screen coordinates, graphical definition data, etc...
- Could even have an output register to report collision status between sprites
- Obviously also possible to report in some registers the VSYNC/HSYNC information.

A good example of sprite usage would be to have a hardware mouse cursor for example, but yes, that's not really an Oric anymore.

Now, when you capture the video input, you have benefits like the possibility to have the device show a HUD directly on the Oric screen, allow to change the border color, possibly even resize/scale the Oric screen to be on the entire screen, remap it to be widescreen friendly, and even output the result to HDMI instead of SCART

Other possibilities would be to have debugging information for development purpose printed out in the Oric screen borders, etc... and being able to change the border color would allow for an easy profiling of the code by just changing the color value now and then.

Heck, if you have the full framebuffer capture, you can even implement double buffering: Have the device show the previously captured frame instead of the one being drawn by the Oric, with some "flip now" register you can even have double buffering working over multiple frame if you are doing something which is quite slow.

The sky the limit :D
User avatar
Dbug
Site Admin
Posts: 4564
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Loci - my Oric storage emulation project

Post by Dbug »

I received the package, I'm going to play with it when I'm in holidays next week!
image_2024-07-05_153520417.png
User avatar
ibisum
Wing Commander
Posts: 1695
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Loci - my Oric storage emulation project

Post by ibisum »

Thrilling times!

:)
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Dbug wrote: Fri Jul 05, 2024 2:35 pm I received the package, I'm going to play with it when I'm in holidays next week!
That's good news! Thank you for the update!
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Small update - I've squashed the issue with back traversing directories being broken after device navigation got introduced. I've also figured out the issue with fast booting from the LOCI ROM (jumping to the freshly mapped ROMs and config etc instead of pulling the reset line), and it seems to be working really well so is now default behaviour on trunk. Getting progress in this area is of interest for later possibly being able to jump in and out of LOCI ROM during execution :D

There are a few usability quirks to iron out when it comes to updating firmware and ROM - as the name change is only partly complete on trunk. If you are a tester and want to get running with the latest before I get that sorted, feel free to ping me.
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Another issue fixed! For a while I've known that Space 1999 wasn't working, but since it was deterministic and only that known DSK, I put it lower on the priority list while getting ROM and API more stable.

This evening I got back to it. The issue was: loading stops after the game has loaded the HUD/GUI element, but before the music and introduction text scroller is started. Since it happened at a transition point in the loading, I suspected it was either missing functionality in the WD1793 emulation or a bug there so enabled some debug output of the FDC emulation. That worked like a charm. Interestingly, the stop was not a crash but a FDC operations loop. I could see it calling RESTORE commands to the FDC so some kind of error handling loop. Status showed the FDC was reporting a seek error.

Turns out the program was calling FDC SEEK to track 99 but the DSK file of course only has 30 tracks. I guess it's a way of getting to the last track, but it sounds a bit fishy if put on actual floppy media with e.g. 40 or 80 tracks. This wasn't accounted for in the code, so when asked to verify the track, the code reported track number mismatch and a seek error which then triggered the DOS reinitialization of the FDC. Easy fix, which matches Oricutron, was to limit seeks to the DSK file max track number, even if it may be more forgiving than real hardware.

Now LOCI loves Space 1999 :lol:
loci_fdc_space1999.jpg
User avatar
Dbug
Site Admin
Posts: 4564
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Loci - my Oric storage emulation project

Post by Dbug »

Sodiumlightbaby wrote: Wed Jul 10, 2024 5:17 pm Turns out the program was calling FDC SEEK to track 99 but the DSK file of course only has 30 tracks. I guess it's a way of getting to the last track, but it sounds a bit fishy if put on actual floppy media with e.g. 40 or 80 tracks.
Yeah, that sounds weird, I'm pretty sure I did test Space 1999 on a real floppy and did not notice any weird noise from the disk drive, also I believe the games uses Sedoric to boot, so the OS is supposed to know the disk structure and should not allow for that.
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Interesting. I haven't seen the Space 1999 source out there, but Sedoric should be possible to have a peek at.
User avatar
Sodiumlightbaby
Flying Officer
Posts: 137
Joined: Thu Feb 22, 2024 11:38 am

Re: Loci - my Oric storage emulation project

Post by Sodiumlightbaby »

Oh, my bad. It's not doing a SEEK 99. It's calling RESTORE with 99 in the data register and the LOCI FDC emulator is is executing it as SEEK instead of RESTORE. Why? Because I managed to do this:

Code: Select all

               if(cmd_flags && DSK_FLAG_IS_SEEK){
instead of

Code: Select all

              if(cmd_flags & DSK_FLAG_IS_SEEK){
:oops:
Post Reply