Monster Decoding Logic
Re: Monster Decoding Logic
(Might be worth noting that Acorn's BBC Micro's banking register is write-only - the OS keeps a copy in zero page so it knows what's going on.)
Re: Monster Decoding Logic
Alarm Siren wrote:
I recognize it. I did very seriously consider using something like it, but I decided that it was important that the bank bits be readable as well as writable so that subroutines / interrupts can save and restore them.
I must say, the more I think about Jeff's "Ultra-fast Output" method, the more I like it. Being able to control those outputs from outside of I/O address space opens up some very interesting possibilities. Like a 64K memory map devoid of I/O address space, or, mapping any one of the three 16-byte I/O spaces into zero page "on demand". As a side note, writing code for I/O in zero page is kinda' fun. After studying the Acorn System-1 I re-assembled Sophie's 512-byte Monitor program for I/O in zero page and, IIRC, it shaved off something like 11 bytes.
Quote:
For your CLKGEN is that a PIC?
Have fun. Good luck on your project.
Cheerful regards, Mike
Last edited by Michael on Thu Jan 23, 2020 1:50 pm, edited 1 time in total.
Re: Monster Decoding Logic
Alarm Siren wrote:
I decided that it was important that the bank bits be readable as well as writable so that subroutines / interrupts can save and restore them.
The BBC Micro solution Ed mentioned requires twice as much writing, as everything written to the (write-only) bank register must also be written to the image in memory to keep it current.
One way to beat the double-write business is to change the fact the bank register is write-only. To read it back all you need is to attach it to some unused bits of a VIA -- much as you plan to do now, except the VIA would be for reading only.
Of course the ultimate solution is an '816, which, upon interrupt and RTI, manages the save/restore of the entire 24-bit address transparently. But I admit there's educational value in doing things the hard way.
Edit: Thanks, Michael, for your thoughts on non-memory-mapped I/O. The 'C02 is an obvious candidate, as there are so many unused opcodes. But the '816 is also eligible, thanks mainly to WDM -- a two-byte NOP whose 8-bit operand is completely up for grabs.
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: Monster Decoding Logic
Dr Jefyll wrote:
The BBC Micro solution Ed mentioned requires twice as much writing, as everything written to the (write-only) bank register must also be written to the image in memory to keep it current.
Re: Monster Decoding Logic
Druzyek wrote:
Did you run into any problems with interrupts triggering between the write to the bank register and to zero page?
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- BitWise
- In Memoriam
- Posts: 996
- Joined: 02 Mar 2004
- Location: Berkshire, UK
- Contact:
Re: Monster Decoding Logic
Dr Jefyll wrote:
I don't see a problem as long as the code always writes to the memory image first then the actual bank register second (not the other way around). If an interrupt intervenes then the save-restore code associated with the ISR and RTI will only harmlessly "restore" the value which is about to be written.
Code: Select all
******** Set up Sideways ROM latch and RAM copy *************************
;on entry X=ROM number
DC16 STX &F4 ;RAM copy of rom latch
DC18 STX &FE30 ;write to rom latch
DC1B RTS ;and return
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs
Re: Monster Decoding Logic
Dr Jefyll wrote:
Druzyek wrote:
Did you run into any problems with interrupts triggering between the write to the bank register and to zero page?
Re: Monster Decoding Logic
Citation needed! That would be a very interesting example.
Re: Monster Decoding Logic
BigEd wrote:
Citation needed! That would be a very interesting example.
On the Beeb, the established pattern is to always update the shadow first (&F4) before writing to the latch (&FE30).
If an interrupt does happen between the two instructions, all that happens is that the OS ends up restoring the "new" bank from &F4 before returning, making the write to the latch at &FE30 superfluous.
You'll find this pattern used in OS 1.20:
https://acorn.huininga.nl/pub/docs/sour ... 201629.asm
Just search for rom_select
Dave
Re: Monster Decoding Logic
BigEd wrote:
Citation needed! That would be a very interesting example.
E.g. interrupt routine relies on some data or code in some specific ROM X, and, for efficiency, only selects ROM X temporarily if it's not already selected. If the currently selected ROM is Y != X, and the foreground switches to X, then if the OS copy has been updated to X but not the register, or vice versa : kaboom.
Convoluted ? Yes. Impossible ? No. Don't assume what you don't need to. You're rarely in complete control of both foreground code and background code.
Re: Monster Decoding Logic
Thanks - that is an interesting example.
- Alarm Siren
- Posts: 363
- Joined: 25 Oct 2016
Re: Monster Decoding Logic
Well, another day, another computer design from Alsi....
This is the schematic of the system that all this decoding logic was in aid of. Its still called the Nimbot, and is derived from what you have seen previously, but I decided that I wanted to go for something a bit simpler (in the sense of easier to route) but also more general purpose. I still plan to make a games machine at some point, but I think it'll probably be based on this design rather than the previous one. I am much happier with this one overall.
I am unsure whether to expand the I/O Board header (P3) so that I can use this same logic board for both a games machine and a general purpose one, swapping out only the I/O board (the I/O board would have the gamepad, screen, and sound generation circuitry on it for a games device and a character LCD, keypad and buzzer for a non-games device) or whether to KISS as it is and make the games device have modified logic board.
This is the schematic of the system that all this decoding logic was in aid of. Its still called the Nimbot, and is derived from what you have seen previously, but I decided that I wanted to go for something a bit simpler (in the sense of easier to route) but also more general purpose. I still plan to make a games machine at some point, but I think it'll probably be based on this design rather than the previous one. I am much happier with this one overall.
I am unsure whether to expand the I/O Board header (P3) so that I can use this same logic board for both a games machine and a general purpose one, swapping out only the I/O board (the I/O board would have the gamepad, screen, and sound generation circuitry on it for a games device and a character LCD, keypad and buzzer for a non-games device) or whether to KISS as it is and make the games device have modified logic board.
Want to design a PCB for your project? I strongly recommend KiCad. Its free, its multiplatform, and its easy to learn!
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.
Also, I maintain KiCad libraries of Retro Computing and Arduino components you might find useful.