Previous Thread
Next Thread
Print Thread
Electron WIP #93164
03/08/14 02:18 AM
03/08/14 02:18 AM
Joined: Apr 2012
Posts: 218
UK
Pernod Offline OP
Senior Member
Pernod  Offline OP
Senior Member
Joined: Apr 2012
Posts: 218
UK
The current Electron driver runs way too fast. The 6502 runs at 2MHz which is correct, but only when ROM is being accessed.

When RAM or peripheral devices are accessed, the timing will be highly dependent on the display mode. This is because twice as much data has to be removed from the RAM to produce the display in modes 0-3 as in modes 4-6.

Modes 4-6
The processor will normally be running at 2MHz when it first needs to access RAM or peripherals like the 6522. It has to slow down to 1MHz first. This slow down either consists of a PHI OUT low time of 250ns followed by a high time of 750ns, or a low of 250ns followed by a high of 1250ns. The particular type of transition which occurs will depend upon the relative phases of the 2MHz and 1MHz clocks. Both the 1MHz and 2MHz clocks are internal to the ULA, and are not available outside. They must be generated separately.

Modes 0-3
In these modes, the ULA must have access to the RAM for all the displayed part of a line (40s out of 64s in 256 lines out of 312). This doesnt matter provided that the CPU only wants to access peripherals and the ROM, which it is free to do in the normal way. However, if it tries to access RAM the ULA will hold its clock high for up to 40s. The overall effect is that the processor can be effectively disabled for up to 40s. The only way for the processor to obtain priority over the ULA is by an NMI being generated. This will automatically cause the ULA to release the 6502 (and the RAM), but inevitably creates snow on the screen.

This slow down of the 6502 is currently not implemented, and I have no idea how this should be handled. Can anyone give a little advice, or point me to a driver that does something similar for reference?


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Re: Electron WIP [Re: Pernod] #93165
03/08/14 02:34 AM
03/08/14 02:34 AM
Joined: Mar 2001
Posts: 16,058
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,058
USA
It is not possible to do that at present in the MAME/MESS framework, unfortunately. It's currently (poorly) simulated in some drivers by calling adjust_icount(some negative number) on the main CPU object inside read/write handlers to things that are supposed to slow down.

Re: Electron WIP [Re: Pernod] #93169
03/08/14 11:43 AM
03/08/14 11:43 AM
Joined: Apr 2012
Posts: 218
UK
Pernod Offline OP
Senior Member
Pernod  Offline OP
Senior Member
Joined: Apr 2012
Posts: 218
UK
Thanks, exactly what I needed to know. The only other decent Electron emulator, Elkulator, does something very similar and already has a method of counting the cycles to delay, so I'll see if I can implement that here.


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Re: Electron WIP [Re: Pernod] #106777
08/08/16 08:59 PM
08/08/16 08:59 PM
Joined: Apr 2012
Posts: 218
UK
Pernod Offline OP
Senior Member
Pernod  Offline OP
Senior Member
Joined: Apr 2012
Posts: 218
UK
I'm currently adding more bus devices to the electron driver. A device can contain multiple 16K ROMs that are in the device region "exp_rom". I want to assign each of these ROMs to a membank in the electron machine. This is currently done in electron_state::machine_start() by iterating through each "exp" device.

I'd prefer to do this in each device in device_start, which is where I also install memory handlers. The electron machine has membank("bank2") and in my device start I have:
Code:
machine().root_device().membank("bank2")->configure_entry(0xc, memregion("exp_rom")->base() + 0x0000);
machine().root_device().membank("bank2")->configure_entry(0xd, memregion("exp_rom")->base() + 0x4000);
machine().root_device().membank("bank2")->configure_entry(0x0, memregion("exp_rom")->base() + 0x8000);
machine().root_device().membank("bank2")->configure_entry(0x2, memregion("exp_rom")->base() + 0xc000);

This should assign 16K blocks from "exp_rom" to membank("bank2") entries 12,13,0,2. It doesn't complain but doesn't seem to work either. Any suggestions?

Edit: Problem solved, was inadvertently setting the membank entries to blank areas elsewhere.

Last edited by Pernod; 08/09/16 12:36 AM.

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Re: Electron WIP [Re: Pernod] #113006
03/30/18 12:23 PM
03/30/18 12:23 PM
Joined: Apr 2012
Posts: 218
UK
Pernod Offline OP
Senior Member
Pernod  Offline OP
Senior Member
Joined: Apr 2012
Posts: 218
UK
Just added a really cool modern Electron cartridge, the Mega Games Cartridge (details at http://stardot.org.uk/forums/viewtopic.php?f=1&t=8246). It's houses 4M FlashRAM containing a large selection of games. The 4M is banked in 16K blocks which are enabled depending on which game is selected from the menu.
Code
mame electron -exp plus1 -cart1 mgc
(plus1 or romboxp required for cartridge slots)
Then SHIFT+BREAK (F12) to boot to the menu from the ROM Filing System.
[Linked Image]

Last edited by Pernod; 03/30/18 12:26 PM.

BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Re: Electron WIP [Re: Pernod] #113007
03/30/18 12:34 PM
03/30/18 12:34 PM
Joined: Mar 2001
Posts: 16,058
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,058
USA
Very cool!

Re: Electron WIP [Re: Pernod] #113121
04/15/18 02:09 PM
04/15/18 02:09 PM
Joined: Apr 2012
Posts: 218
UK
Pernod Offline OP
Senior Member
Pernod  Offline OP
Senior Member
Joined: Apr 2012
Posts: 218
UK
I've been looking at improving video timing. Here's Flight Path 737, not a great game, but requires accurate timing to change screen modes and palette during the screen update.

The select screen uses MODE1 (4 colours) for the top and bottom rows, and MODE4 (2 colours) for the options, but manages to display 8 colours overall. After the initial title line the MODE is changed and palette changed for each option. The timing of these changes is critical to ensure the colour bands coincide with the options.
0.196
[Linked Image]
0.197 WIP
[Linked Image]
Similarly for the in-game screen the MODE is changed and improvements are obvious.
0.196
[Linked Image]
0.197 WIP
[Linked Image]


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Re: Electron WIP [Re: Pernod] #113123
04/15/18 04:17 PM
04/15/18 04:17 PM
Joined: Mar 2001
Posts: 16,058
USA
R
R. Belmont Offline
Very Senior Member
R. Belmont  Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 16,058
USA
Great improvements!


Who's Online Now
2 registered members (Dr.Zer0, 1 invisible), 24 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,600
Posts112,408
Members4,821
Most Online283
Oct 11th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.028s Queries: 14 (0.013s) Memory: 5.6459 MB (Peak: 5.8487 MB) Zlib enabled. Server Time: 2018-11-21 11:43:40 UTC