Re: Use GAL as a small eprom
Posted: Mon Jul 27, 2015 7:46 am
Here the result of my "investigations". As proposed by bogax only IRQ is used for the data input, A is intialised with 1 to get the carry as the done status for a byte and NMI starts the bootloader. And as I suggested I use an additional input (I call it A5 although it is not connected to the address A5 but to the data input). That selects one of two code options for the IRQ routine (one using SEC and one using CLC). The code itself is position independent so it does not matter that I use $FFC0 as the first starting address for the first incarnation (a macro would do the job much nicer in case you need to change the code, but I was lazy). You need to duplicate the vectors, to make sure they are the same regardless of the state of A5 (data). And also it saves product terms.
I use 64TASS to assemble the code and use hexdump to convert it to the table I then use in WinCUPL
If someone could tell me the trick to produce ' instead of using the < and then change them all in the editor I would appreciate. But that's only a minor production step. Then I take this output and create the following PLD for WinCUPL
This is successfully converted to a JED file. Assuming no WinCUPL bug that's it. You can consult the DOC file to see the resulting equations. In other words, yes you can use a GAL as a bootstrap PROM and a GAL16V8 does the job. And as I don't need the SO this will work using either a 6502 or a W65C816. One could even try to use a different bootloader address, there is room enough for another byte for the STA absolute,X instruction and by carefully select the address only a few additional PTs will be used.
Cheers
Peter
Code: Select all
BOOTLOADER = $00
*=$FFC0
RESETROUTINE0
LDX #$00 ; Init byte storing index
LDA #$01 ; Init bit counting
BNE *
IRQROUTINE0
CLC
ROL
BCC FINISH
STA BOOTLOADER, X ; Finish one byte of transfer
INX
FINISH0
RTI
*=$FFDA
.word BOOTLOADER
.word RESETROUTINE
.word IRQROUTINE
*=$FFE0
RESETROUTINE
LDX #$00 ; Init byte storing index
LDA #$01 ; Init bit counting
BNE *
IRQROUTINE
SEC
ROL
BCC FINISH
STA BOOTLOADER, X ; Finish one byte of transfer
INX
FINISH
RTI
*=$FFFA
.word BOOTLOADER
.word RESETROUTINE
.word IRQROUTINE
Code: Select all
64tass -c -b bootloader.asm -o bootloader.bin
hexdump -e '"[%02.2_ax] => "' -e '1/1 "<h<%02X;" "\n"' -v bootloader.bin
Code: Select all
Name bootloader ;
PartNo 00 ;
Date 26.07.2015 ;
Revision 01 ;
Designer cbscpe ;
Company none;
Assembly None ;
Location ;
Device g16v8;
/* *************** INPUT PINS *********************/
PIN 2 = A0 ; /* */
PIN 3 = A1 ; /* */
PIN 4 = A2 ; /* */
PIN 5 = A3 ; /* */
PIN 6 = A4 ; /* */
PIN 7 = A5 ; /* */
PIN 11 = !OE ; /* */
/* *************** OUTPUT PINS *********************/
PIN 12 = D0 ; /* */
PIN 13 = D1 ; /* */
PIN 14 = D2 ; /* */
PIN 15 = D3 ; /* */
PIN 16 = D4 ; /* */
PIN 17 = D5 ; /* */
PIN 18 = D6 ; /* */
PIN 19 = D7 ; /* */
FIELD ADDR = [A5..0];
FIELD DATA = [D7..0];
[D7..0].oe = OE;
TABLE ADDR => DATA {
[00] => 'h'A2;
[01] => 'h'00;
[02] => 'h'A9;
[03] => 'h'01;
[04] => 'h'D0;
[05] => 'h'FE;
[06] => 'h'18;
[07] => 'h'2A;
[08] => 'h'90;
[09] => 'h'23;
[0a] => 'h'95;
[0b] => 'h'00;
[0c] => 'h'E8;
[0d] => 'h'40;
[0e] => 'h'00;
[0f] => 'h'00;
[10] => 'h'00;
[11] => 'h'00;
[12] => 'h'00;
[13] => 'h'00;
[14] => 'h'00;
[15] => 'h'00;
[16] => 'h'00;
[17] => 'h'00;
[18] => 'h'00;
[19] => 'h'00;
[1a] => 'h'00;
[1b] => 'h'00;
[1c] => 'h'E0;
[1d] => 'h'FF;
[1e] => 'h'E6;
[1f] => 'h'FF;
[20] => 'h'A2;
[21] => 'h'00;
[22] => 'h'A9;
[23] => 'h'01;
[24] => 'h'D0;
[25] => 'h'FE;
[26] => 'h'38;
[27] => 'h'2A;
[28] => 'h'90;
[29] => 'h'03;
[2a] => 'h'95;
[2b] => 'h'00;
[2c] => 'h'E8;
[2d] => 'h'40;
[2e] => 'h'00;
[2f] => 'h'00;
[30] => 'h'00;
[31] => 'h'00;
[32] => 'h'00;
[33] => 'h'00;
[34] => 'h'00;
[35] => 'h'00;
[36] => 'h'00;
[37] => 'h'00;
[38] => 'h'00;
[39] => 'h'00;
[3a] => 'h'00;
[3b] => 'h'00;
[3c] => 'h'E0;
[3d] => 'h'FF;
[3e] => 'h'E6;
[3f] => 'h'FF;
}
Cheers
Peter