The EP2C5-DB has an external 128 KB SRAM but the design only uses 40KB. The 40KB limitation is due to the original address map which places BASIC in ROM starting at $A000. It might be possible to move the BASIC, but probably not worth the effort. I doubt there's any code out there that uses more than 40KB.
Open Memory Map Addresses
There's two open address ranges from $C000 to $CFFF and $E000 to $EFFF. When I tried putting SRAM into the $Cxxx range the board did not boot. But when I put SRAM into the $Exxx range the board booted fine. I wrote a little program to test the expansion SRAM and it worked well.
100 REM TEST UPPER MEMORY 110 REM UPPER MEMORY IS 4KB FROM $E000-$EFFF (57344-61439 DEC) 120 S=57344 130 E=61439 200 REM FILL MEMORY 210 P=0 220 FOR A=S TO E 230 POKE A,P 240 P=P+1 250 P=P AND 255 260 NEXT A 300 REM VERIFY FILLED MEMORY 310 X=0 320 FOR A=S TO E 330 P=PEEK(A) 340 IF P<>X GOTO 500 350 X=X+1 360 X=X AND 255 370 NEXT A 380 END 500 PRINT"ERROR" 510 END
Making a Banked RAM
I thought it might be interesting to use the unused 64KB of SRAM as a banked SRAM. The 4KB section at $Exxx would allow for 16 banks of 4KB each. Although BASIC doesn't support the RAM as program space it still could be used for storing data for the OSISDOS. And this was a nice diversion from being stuck with the SD card read problems (last log entry).
In the original design, the A16 line from the EP2C5 FPGA to the SRAM is always set to 0. To add banking the A16 line needs to get set to 1 when the CPU address starts with $Exxx. Address lines A15..A12 then come from a bank register for accesses to 0xE****. The bank register is mapped to the I/O space.
Wrote a simple test program to verify that different data is written into each bank:
100 REM TEST BANKS 110 REM UPPER MEMORY IS 4KB FROM $E000-$EFFF (57344-61439 DEC) 120 S=57344:REM START OF SRAM BANK 130 E=61439:REM END OF SRAM BANK 140 B=61445:REM BANK SELECT REGISTER 150 FOR V=0 TO 15:REM CHECK ALL 16 BANKS 160 POKE B,V:REM WRITE TO BANK REGISTER 170 POKE S,V:REM WRITE THE BANK NUMBER TO FIRST SRAM LOCATION 180 NEXT V 200 FOR V=0 TO 15:REM CHECK ALL 16 BANKS 210 POKE B,V:REM WRITE TO BANK REGISTER 220 R=PEEK(S):REM READ BACK THE SRAM 230 IF R<>V GOTO 300: COMPARE TO VALUE WRITTEN 230 NEXT V 240 PRINT "PASSED" 250 END 300 PRINT "ERROR"
Took a bit to get it working but it does now work. This much SRAM would have been unimaginable back in the day.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.