Jump to content
IGNORED

U1MB plugin development


TheMontezuma

Recommended Posts

Since there is no dedicated thread about the U1MB plugin development, I started a new one.

 

There is a nice introduction into this topic here:

http://atariage.com/forums/topic/272217-softs-that-take-advantage-of-sophia/page-2?do=findComment&comment=4010051

 

I understood that the plugin binary compatibility between the versions 1.25 and 2.00 of the U1MB firmware will be broken.

Unfortunately Jon was continuously updating the documentation on his web page, so the current version does not match the (still official) 1.25 release anymore. The 2.00RC firmware distributed to volontiers was only a binary.

I understand that version 2.00 will be released soon (together with updated docs and example plugin source code).

 

Until then the only way to play around with plugin development is to use version 1.25.

And so I did:

 

I have modified the HardwareSetup section:

    .local HardwareSetup
    lda #$00
    sta $D500
    rts
    .endl

compiled it and tested in Altirra only (since I already have the 2.00RC in my real U1MB).

 

It works as supposed. On every reset the memory bank containing a menu on the multicarts: Atarimax 1mb / 8mb, SIC, etc. is selected.

Since those carts do not have a reset button, you would need to power off the Atari to start a new game.

Now you just press RESET and voila the cart menu is displayed :)

 

In the next setp I wanted to make it configurable: to enable/disable this feature over U1MB menu.

I looked at the source code and I'm confused:

PluginMenu
    .local StereoToggle
@    dta Item[0] (1,CovoxToggle,Title,ItemType.OnOff,StereoPokey,Help,Cfg.Aux,$01)
Title
    .byte 'Stereo Pokey',0
Help
    .byte 'Enable/disable stereo audio',0
    .endl
    
    .local CovoxToggle
@    dta Item[0] (1,Device3Toggle,Title,ItemType.OnOff,CovoxFlag,Help,Cfg.Aux,$02)
Title
    .byte 'Covox',0
Help
    .byte 'Enable/disable Covox',0
    .endl

Menu item for Stereo uses CovoxToggle and menu item for Covox uses Device3Toggle ?

 

  • Like 2
Link to comment
Share on other sites

In the next setp I wanted to make it configurable: to enable/disable this feature over U1MB menu.

I looked at the source code and I'm confused:

PluginMenu
    .local StereoToggle
@    dta Item[0] (1,CovoxToggle,Title,ItemType.OnOff,StereoPokey,Help,Cfg.Aux,$01)
Title
    .byte 'Stereo Pokey',0
Help
    .byte 'Enable/disable stereo audio',0
    .endl
    
    .local CovoxToggle
@    dta Item[0] (1,Device3Toggle,Title,ItemType.OnOff,CovoxFlag,Help,Cfg.Aux,$02)
Title
    .byte 'Covox',0
Help
    .byte 'Enable/disable Covox',0
    .endl
Menu item for Stereo uses CovoxToggle and menu item for Covox uses Device3Toggle ?

 

The menu is structured as a forward linked list and in this case, CovoxToggle and Device3Toggle are the pointers to the next node. The final item in the list has a next pointer of zero. The first argument is the menu number in which the item is to appear.

Edited by flashjazzcat
  • Like 2
Link to comment
Share on other sites

Don't use Aux7 since it's reserved for internal use. The default plugin uses the lower nybble of Cfg.Aux because it's written directly to the U1MB Aux register (which controls the IO signals, etc). If you write a plugin which drives the IO pins, then you'd use Cfg.Aux and a bitmask of $01-$08.

 

For some value you want to store and retrieve for your own purposes, use a bit from one of the two Ext bytes which are intended for plugin use. Something like:

CartResetFlag	= Plugin1

    .local CartReset
@    dta Item[0] (1,0,Title,ItemType.OnOff,CartResetFlag,Help,Cfg.Ext1,$80)
Title
    .byte 'Reset cart',0
Help
    .byte 'Toggle cartridge reset',0
    .endl

This would store the option state in D7 of Ext1, corresponding to D0 of the internal variable CartResetFlag. Your hardware setup code just needs to check if CartResetFlag non-zero and take appropriate action.

 

Note, this is an approximate example since I don't have the docs for the prior plugin API in front of me. In the new version, the Help field has been completely dropped since more often than not it was just a slightly wordier repetition of the actual menu heading. You may have noticed that context-sensitive usage directions for the selected item type now automatically appear in the status area instead, and this is also true for plugin items.

 

In the forthcoming update, it's also possible to - for instance - code up a "Reset cartridge now" function which would do the same job as soon as you hit enter on it.

 

You should also change the plugin signature and name in the metadata area. In the latest firmware, the fact the 2-byte plugin signature is stored in NVRAM is exploited by the BIOS, which now compares the NVRAM signature with the actual signature in ROM and clears Ext1 and Ext2 in the configuration record if they don't match, before updating the signature in NVRAM. This ensures when you flash a new plugin, all its settings are zeroed out (and therefore not out of range) the first time you use it.

Edited by flashjazzcat
  • Like 3
Link to comment
Share on other sites

Jon,

Thank you for help :)

I have checked it out and I'm very happy with the results (I checked Atarimax 8mb, SIC and Megacart 4MB images)

In case somebody would like to try it out:

MulticartsMenu.zip

The file contains the source code of the modified defaultplugin, the plugin as a binary and the complete U1MB rom (512kB) with the updated plugin. Everything based on the version 1.25 of the U1MB firmware.

 

post-29824-0-18683900-1524507627.png

 

It would be great if you could merge it into the upcoming 2.00 delivery :)

  • Like 4
Link to comment
Share on other sites

The plugin I succesfully tested in Altirra didn't work with the real hardware :(

 

The funny thing is that as long as the PBI BIOS is active (or unlocked according to the documentation) you can not execute the following code:

    lda #$00
    sta $D500

Or actually you can, but it does not do what you want :(

 

The trick Jon has invented was to copy some parts of the plugin code to RAM, lock the U1MB BIOS, then write 0 to $D500 and jump to the OS :)

  • Like 1
Link to comment
Share on other sites

I'll submit my plugin change here as well if anyone with a Sophia wants to try it. As TheMontezuma mentioned in his initial post, this is geared toward the current release (1.25) and will need to be modified for the upcoming code release from FJC. I've reconfigured the placeholder for Device3Toggle to toggle V-Gate support on and off within the Sophia video upgrade. There is no way to detect the Sophia device or whether or not you are using a Sophia core that has V-Gate support, so this is simply writing the enable or disable values to the correct register. I have tested this in Altirra which doesn't really do anything since there's no Sophia (but I did learn how to use the debugger), as well as real hardware (1200XL with Sophia Rev.C) and it worked as expected. I've included the source and the assembled plugin which can be flashed with uflash.xex into the plugin area.

;Disable v-gate
	lda #$08
	sta $D01D
	lda #$00
	sta $D01D

;enable v-gate
	lda #$08
	sta $D01D
	lda #$20
	sta $D01D

defaultv.zip

Edited by jc13
  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
On 7/25/2018 at 12:41 AM, jc13 said:

Attached is an updated default plugin with the VGate toggle option for U1MB version 2.0 firmware along with a Sophia. Flashed into the plugin location on a 1200XL and appears to work fine.

 

 

defaultplugin-withVGate.s 5.94 kB · 16 downloads

vgate.rom 1 kB · 16 downloads

Hi,

has somebody an VGate Plugin for the actual U1MB Firmware 3.02? Have an 800XL (PAL) with U1MB, Stereo and Sophia DVI Rev.C @1600x900. I want to get rid of the ugly vertical artefacts on the right side of the image.

Edited by DonQuichote
Link to comment
Share on other sites

49 minutes ago, DonQuichote said:

Hi,

has somebody an VGate Plugin for the actual U1MB Firmware 3.02? Have an 800XL (PAL) with U1MB, Stereo and Sophia DVI Rev.C @1600x900. I want to get rid of the ugly vertical artefacts on the right side of the image.

I have it updated, but am traveling at the moment.  I’ll post it as soon as I get back to my computer.

Link to comment
Share on other sites

11 hours ago, DonQuichote said:

has somebody an VGate Plugin for the actual U1MB Firmware 3.02? Have an 800XL (PAL) with U1MB, Stereo and Sophia DVI Rev.C @1600x900. I want to get rid of the ugly vertical artefacts on the right side of the image.

Here's a VGate plugin for the v.3 firmware with source code:

 

VGate_Plugin_U1MB_v3.zip

 

Please note that since I don't own a Sophia, I can't test it on real hardware, but since the relevant changes are copied directly from the known working 1088XEL U1MB plugin, there should be no problems at all.

 

Note that public firmware equates are guaranteed not to change between major revision bumps from v.3.00 onwards, so as long as the major revision number of the firmware matches the host firmware major revision number in the plugin header, UFLASH considers the plugin compatible.

 

Of course the provided plugin is just an example; it may be modified to suit (I suggest testing in Altirra after making changes just to ensure the menu structure is not broken), and extraneous features can be removed. Perhaps jc13 has already cooked up other variations on the theme.

Edited by flashjazzcat
  • Like 3
Link to comment
Share on other sites

Hi Jon,

 

thank you very much for this plugin. It works fine under real PAL 800XL with Sophia DVI Rev.C @1600x900 ? 

The vertical artefacts at the right side of the screen disappear after enable plugin function in U1MB and appear again by disabling it. Very good!

 

I observed that in U1MB disappears under [Device Control] the "Device 3 (S0):" entry after flashing vGate plugin. I think it is not necessary to remove this, because Sophia don´t need the S0 control line from U1MB. So S0 can remain available for other things.

Only if you use the real VGATE Board it is logic to remove it, or i´m wrong? Maybe you can rename the menu entry "GTIA V-Gate:" to "SOPHIA V-Gate" and let the S0 entry remain in [Device control]?    

 

Just one more question - on U1MB plugin section can only one plugin be installed, right? I noticed that the "Multicartridge reset" plugin disappears from U1MB menu after flashing the vGate plugin. A bit of pity as the cartridge-reset plugin is very useful for example in combination with Sophia and Maxflash cartridges. Maybe my 800XL´s can live a little bit longer without constantly turning power off and on.

 

Is it an heavy work to combine both plugins in one, so that you have both functions, "Sophia-VGate" and "Multicartridge reset" available in U1MB menu?

 

(sorry for my bad english, i´m from Germany)

Link to comment
Share on other sites

3 hours ago, DonQuichote said:

I observed that in U1MB disappears under [Device Control] the "Device 3 (S0):" entry after flashing vGate plugin. I think it is not necessary to remove this, because Sophia don´t need the S0 control line from U1MB. So S0 can remain available for other things.

Only if you use the real VGATE Board it is logic to remove it, or i´m wrong? Maybe you can rename the menu entry "GTIA V-Gate:" to "SOPHIA V-Gate" and let the S0 entry remain in [Device control]?  

You're absolutely correct, of course. On a non-1088XEL/XLD machine, there is no need to replace Device 3 (S0). Here's a version with Device 3 reinstated:

 

VGate_Plugin_U1MB_v3.zip

3 hours ago, DonQuichote said:

Just one more question - on U1MB plugin section can only one plugin be installed, right?

Correct. There's only 1KB available for plugin code, and while one can fit a lot of functionality into 1KB, packing multiple plugins into the same amount of space would be tricky, not least because they'd need to be relocatable. I guess we'd need some kind of plugin compiler which could combine multiple relocatable plugin modules into a single 1K blob which could be flashed to the plugin space. Possibly something to consider for a future revision.

4 hours ago, DonQuichote said:

I noticed that the "Multicartridge reset" plugin disappears from U1MB menu after flashing the vGate plugin. A bit of pity as the cartridge-reset plugin is very useful for example in combination with Sophia and Maxflash cartridges. Maybe my 800XL´s can live a little bit longer without constantly turning power off and on.

Apologies: I didn't realise you were using the cartridge reset plugin to begin with.

4 hours ago, DonQuichote said:

Is it an heavy work to combine both plugins in one, so that you have both functions, "Sophia-VGate" and "Multicartridge reset" available in U1MB menu?

Not at all! Here's a plugin which does everything apart from boil the kettle and draw the curtains (it has both the features you ask for, as well as all facilities present in the default plugin):

 

U1MB_v3_Combo_Plugin.zip

 

I guess - not to use a sledgehammer to crack a nut - it wouldn't take too long to come up with a selection of plugins which cover most situations. My main reason for implementing plugins in the first place was in order to remove extraneous functionality (e.g. Covox and SoundBoard settings for those who don't need them), but the facility has proved a lot more useful than I initially imagined (especially once the firmware was deployed on the 1088XEL and XLD machines).

 

  • Like 4
Link to comment
Share on other sites

Hi Jon,

 

your Combo Plugin works wonderful!!! I´m very happy ?

Enable/disable VGate on Sophia works, reset on Multicartridge (Atarimax 8Mbit) works, S0 is available.

You are great! I´m very grateful for that. Respect.

 

Hope other guys with U1MB and Sopia on XL/XE find this thread.

 

Thank You very much!

(Look at your PayPal donation)

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

7 minutes ago, DonQuichote said:

Hope other guys with U1MB and Sopia on XL/XE find this thread.

I'll put all these plugins in the next firmware update package (which will be soon).

8 minutes ago, DonQuichote said:

Thank You very much!

(Look at your PayPal donation)

It's a pleasure: I'm so pleased it was useful. And many thanks for your donation: you are too generous. I will send you a personal message tomorrow (as I always do with donors); I just shut down for the evening but was polling the forum on my phone. ;)

 

Thanks again for the encouragement!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...