ACID Verilog code release (http://www.octoate.de/wp/2011/04/15/acid-verilog-code-release/)
15 April 2011, 3:30 pmNilquader and I decided to release our Verilog code (based on Nocash's decryption of the algorithm (http://www.octoate.de/wp/2010/02/17/acid-protection-decrypted/)) to "emulate" the ACID protection chip of the Amstrad Plus. So, you can now find it in the ACID article (http://www.cpcwiki.eu/index.php/Amstrad%20Cartridge%20Identification%20Device) of the CPCWiki and right here in this posting:
Selec All (http://cpcwiki.eu/forum/javascript:;) Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | `timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: Octoate, Nilquader // ACID Reverse engineering by nocash // // Create Date : 00:45:53 09/03/2010 // Design Name : amsacid // Module Name : amsacid // Project Name : // Target Devices: Xilinx XC9572 // Tool versions : // Description : Reverse engineered Amstrad 40908 "ACID" Chip // // Revision: // Revision 0.05 // Additional Comments: // ////////////////////////////////////////////////////////////////////////////////// module amsacid(PinCLK, PinA, PinOE, PinCCLR, PinSIN); input PinCLK; input [7:0]PinA; input PinOE; input PinCCLR; output [7:0]PinSIN; wire PinCLK; reg [16:0]ShiftReg = 17'h1FFFF; wire [16:0]CmpVal; wire [16:0]XorVal; assign CmpVal = 17'h13596 ^ (PinA[0] ? 17'h0000c : 0) ^ (PinA[1] ? 17'h06000 : 0) ^ (PinA[2] ? 17'h000c0 : 0) ^ (PinA[3] ? 17'h00030 : 0) ^ (PinA[4] ? 17'h18000 : 0) ^ (PinA[5] ? 17'h00003 : 0) ^ (PinA[6] ? 17'h00600 : 0) ^ (PinA[7] ? 17'h01800 : 0); assign XorVal = 17'h0C820 ^ (PinA[0] ? 17'h00004 : 0) ^ (PinA[1] ? 17'h06000 : 0) ^ (PinA[2] ? 17'h00080 : 0) ^ (PinA[3] ? 17'h00020 : 0) ^ (PinA[4] ? 17'h08000 : 0) ^ (PinA[5] ? 17'h00000 : 0) ^ (PinA[6] ? 17'h00000 : 0) ^ (PinA[7] ? 17'h00800 : 0); always@(negedge PinCLK) begin if (PinCCLR) // not in reset state begin if (!PinOE && ((ShiftReg | 17'h00100) == CmpVal)) begin ShiftReg <= (ShiftReg ^ XorVal) >> 1; ShiftReg[16] <= ShiftReg[0] ^ ShiftReg[9] ^ ShiftReg[12] ^ ShiftReg[16] ^ XorVal[0]; // hier xorval mit berüchsichtigen end else begin ShiftReg <= ShiftReg >> 1; ShiftReg[16] <= ShiftReg[0] ^ ShiftReg[9] ^ ShiftReg[12] ^ ShiftReg[16]; end end else begin ShiftReg <= 17'h1FFFF; end end //assign PinSIN = ShiftReg[7:0] ^ 8'hff; assign PinSIN = ShiftReg[7:0]; //assign PinSIN[0] = PinCLK; endmodule |
But this isn't everything about the ACID. We also found a timing problem during the investigation with a logic analyzer, which you can see here:
(http://www.octoate.de/wp/wp-content/uploads/2011/04/ACID_Init_by_Grim-300x95.png) (http://www.octoate.de/wp/wp-content/uploads/2011/04/ACID_Init_by_Grim.png)ACID initialisation (by Grim) You will find glitches on the /CCLR line which show that the SIN contact should be changed... All in all it is possible to use a fast flip-flop to change the SIN signal when such a glitch occurs (see picture below).
(http://www.octoate.de/wp/wp-content/uploads/2011/04/NoAcid_sch-300x244.png) (http://www.octoate.de/wp/wp-content/uploads/2011/04/NoAcid_sch.png)Flip flop for ACID replacement You see, this is a very simple schematic, but it isn't much cheaper than a CPLD, which emulates the full ACID and comes with a disadvantage: it won't work with a reset, so you always have to switch the CPC off and on again.
So, have fun with it – maybe Bryce will change his cartridge design and support this solution in the future (http://www.octoate.de/wp/wp-includes/images/smilies/icon_smile.gif) .
Related posts:
- ACID protection decrypted (http://www.octoate.de/wp/2010/02/17/acid-protection-decrypted/)
- Another ACID implementation on the way (http://www.octoate.de/wp/2011/04/15/another-acid-implementation-on-the-way/)
- Analysation of the ACID protection (http://www.octoate.de/wp/2009/10/21/analysation-of-the-acid-protection/)
© Octoate for Octoate.de - The Amstrad CPC news portal (http://www.octoate.de/wp), 2011. | Permalink (http://www.octoate.de/wp/2011/04/15/acid-verilog-code-release/) | No comment (http://www.octoate.de/wp/2011/04/15/acid-verilog-code-release/#comments) | Add to del.icio.us (http://del.icio.us/post?url=http://www.octoate.de/wp/2011/04/15/acid-verilog-code-release/&title=ACID%20Verilog%20code%20release) Post tags: 2011 (http://www.octoate.de/wp/tag/2011/), ACID (http://www.octoate.de/wp/tag/acid/), Amstrad Cartridge Identification Device (http://www.octoate.de/wp/tag/amstrad-cartridge-identification-device/), cartridge (http://www.octoate.de/wp/tag/cartridge/), hardware (http://www.octoate.de/wp/tag/hardware/), nilquader (http://www.octoate.de/wp/tag/nilquader/), octoate (http://www.octoate.de/wp/tag/octoate/), plus (http://www.octoate.de/wp/tag/plus/)
(http://cpc-live.com/topsites/button.php?u=Octoate) (http://cpc-live.com/topsites/)
Feed enhanced by Better Feed (http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/) from Ozh (http://planetozh.com/blog/)
Source: Octoate.de - The Amstrad CPC news portal (http://www.octoate.de/wp)
---
This news item first appeared on Octoate's Blog and was aggregated through RSS for the forum.
WoW! Thank's for releasing!
I advice everybody to go to Octoates site and take a look at this. It's not hard to understand, but quite interesing!
Thanks for the deep insight into LSD err.... ACID ;-)
Is there a pinout for the cpld when used on a custom cartridge?
I would love to make a custom pcb for my gx4000 but i can't seem to find out how this is connected in the cart schematic :-/
If you care to share that info It'd be very much appreciated.
Thanks for your work on the clone, absolutely fascinating stuff though I find it very hard to get into it.
Great news! :)
Quote from: ArcadeTV on 00:24, 29 October 14
Is there a pinout for the cpld when used on a custom cartridge?
I would love to make a custom pcb for my gx4000 but i can't seem to find out how this is connected in the cart schematic :-/
If you care to share that info It'd be very much appreciated.
Thanks for your work on the clone, absolutely fascinating stuff though I find it very hard to get into it.
Contact Octoate at octoate.de
...or directly here via the forums :).
@ArcadeTV (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1214): You can nearly freely assign your pins to the CPLD with the IDE (e.g. Altera Quartus or Xilinx Webpack). We've used an Xilinx XC9536 CPLD, so maybe the best way to get into it is to download the Xilinx Webpack, create a new project for the CPLD which you want to use and then go through all the design steps of the IDE.
Here is an example from the Xilinx forums, how this could look like for a XC9536XL in the Xilinx Webpack:
(http://i.imgur.com/Xf0jLP0.png)
That's totally nice, thank you very much for explaining! Though Bryce already told me that the pins can be freely assigned ;-)
Thanks again!
Does this mean in nuts and bolts terms anyone can make a working Plus cartridge now?
Yes, but the Cart-Shells are still missing.
i have something planned for cartshells... ;)
Quote from: ArcadeTV on 18:48, 30 October 14
i have something planned for cartshells... ;)
Keep me updated please. I would need 100 if possible. So the price per unit will drop too. Already got 100 ACID chips and 100 Cart PCBs (for 512 KB ROM).
@TFM
did you get my email the other day? if not please contact me.
I would love to see SymbOS on a cartridge
@Octoate (http://www.cpcwiki.eu/forum/index.php?action=profile;u=12)
@Bryce (http://www.cpcwiki.eu/forum/index.php?action=profile;u=225)
I'm having difficulties here and need your advice, guys!
I can't make a decision for a package... I only know that I want one that works with 5V and is easily available. Also I don't want to use a socket in my pcb-layout.
If one of you could advise a package I'll use it.
Also I would like to leave the pin-configuration of the cpld to you. Would be extra-awesome if you'd tell me which pins to use and how to connect them.
This way I cound build the pcb and order it so we have something to play around with as a solid base for a all-in-one cart.
Thanks and happy Halloween!!
Quote from: ArcadeTV on 00:06, 31 October 14
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179)
did you get my email the other day? if not please contact me.
Gotta look it up! Been busy at work. Let me check at the weekend.
Happy Helloween!
Quote from: dcdrac on 12:04, 31 October 14I would love to see SymbOS on a cartridge
Right. Meanwhile you can use the Plus version of FutureOS on Cartridge. :P ;) :)
Quote from: ArcadeTV on 16:11, 31 October 14
@Octoate (http://www.cpcwiki.eu/forum/index.php?action=profile;u=12)
@Bryce (http://www.cpcwiki.eu/forum/index.php?action=profile;u=225)
I'm having difficulties here and need your advice, guys!
I can't make a decision for a package... I only know that I want one that works with 5V and is easily available. Also I don't want to use a socket in my pcb-layout.
If one of you could advise a package I'll use it.
Also I would like to leave the pin-configuration of the cpld to you. Would be extra-awesome if you'd tell me which pins to use and how to connect them.
This way I cound build the pcb and order it so we have something to play around with as a solid base for a all-in-one cart.
Thanks and happy Halloween!!
Hi ArcadeTV,
well, I decided to put the two projects, which I started in 2010, to my GitHub account (https://github.com/Octoate/CPCCartridge). Maybe they can help you a bit to get more into designing a cartridge by yourself or you can use them as a base for your own design. The GitHub page contains a
simple cartridge (schematic and board layout) for Amstrad Plus / Amstrad GX4000, which can be either equipped with a real ACID protection chip or with a XC9536 PLCC to emulate the ACID protection and a AT29F040 for flash storage.
The second project is a design for a
flash cartridge (only schematics), which uses an ATMega8 to connect to the PC to program it. For more information please refer to the README.md file in the repository in which I tried to explain the intended functionality.
Unfortunately I have not enough time to finish the projects soon, that's why I decided to release them publicly, so maybe someone is interested to take over :). Otherwise I will work on them from time to time :P.
wow! :o
That's so noble and generous, thank you very much for releasing this!!
I know that life sometimes gets in the way of such cool projects, I'll do my best to take this to the next step. Thanks again!
That's just awesome.
Thanks Octoate! That will help people doing great things for CPC. :) :) :)
No problem. I am currently cleaning up my unfinished projects and decided to release some of them to the public. It doesn't make sense to keep them in private because someone can learn from them or even take them over. I still can work on them if I want :).
great spirit and very much appreciated! I already played around with it and I will keep it open for others too. Thanks again!
Quote from: ArcadeTV on 00:06, 31 October 14
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179)
did you get my email the other day? if not please contact me.
Did you get mine actually? Or did time render it obsolete? :-X
@TFM
not that I knew... when did you send it??
Quote from: ArcadeTV on 07:39, 04 December 14
@TFM (http://www.cpcwiki.eu/forum/index.php?action=profile;u=179)
not that I knew... when did you send it??
Never mind, it's quit a bit ago, but it went to spam probably. If I look at Geralds project, which seems to be quite up and running (and a lot of people show interest) then we can be save time and just use it. Of course on the other hand it would be fun to make a multicart which can be programmed from CPC side. :)