Do you think a bare PIC could do it? It needs only to pay attention to OE (and CS) and perform a lookup.
Potentially something like ..
Code: Select all
Inactive:
setf TRISD ; Tristate data bus
InactiveWait:
btfsc PORTE,CS ; Wait for /CS
bra InactiveWait
btfsc PORTE,OE ; And /OE
bra InactiveWait
Active:
movf PORTA,W ; Map address to ROM image
movwf TBLPTRL
movf PORTB,W
andlw h'1f' ; Mask on ROM size
addlw high(ROM_BASE)
movwf TBLPTRH
tblrd * ; Fetch data byte
movf TBLDAT,W
clrf TRISD ; Set output
movwf LATD
ActiveWait:
btfsc PORTE,CS ; Wait for /CS or /OE to change
bra Inactive
btfsc PORTE,OE
bra Inactive
bra ActiveWait
You could do the address mapping while waiting for CS and OE to go LO if the address is stable before these signals change.
Might work at 1Mhz.
It would be easier with a dsPIC 30F but you'd need to use a TQFP package with 64 pins or more. The port bit arrangement on the 40pin DIP 30Fs is not very convenient for mapping the data and address lines. The bigger packages, like 30F6012A, have a better port arrangement and using PSV memory makes the ROM lookup quicker.