Leap Electronics WICE-4M ROM an SRAM EMULATOR
Source files on bitbucket.
Specification:
* Emulate 8 bit and 16 bit ROM's.
* DB25 Parallel interface.
1. Start with getting a schematic
Follow those traces to find out where they go.
Almost completed
2. Reverse original software MSDOS based.
Used IDA to go through the executable.
3. Write software to work on Windows and Linux via USB to LPT port.
This has kind of gone down a different path.
Look at a small micro with USB to do most of work.
Details
Make a device to communicate to the WICE-4M
Files
wice.factor
Factor code for testing code on WICE Interface PCB
Have been working on getting some routines I had running in spin to work in Propeller Assembly, So far so good, I basic read a byte write a byte, read and write a byte with increment. The speed is still not to my satisfaction as of yet. Might try to do 16 bit and 32 bit read and writes that will get some things moving.
I have knocked up some code on my Linux Mint machine to communicate with the my WICE interface. So far all look good.
But sorry folks, I did not use C code not even Assembly.
I did it in factor, I have been using this language for 5 years now, I like its forthy-ness, interactive interface and the library of functions.
First I need open serial, this took some time work, how to do this on linux environment. I use library "io.serial" use "termios" and "streams" libraries. I had some issue on read operation, transmission was the easiest, only thing to remember is use the "flush" function to send the data out after "write" function.
: wice-start ( -- )"/dev/ttyUSB0"115200 <serial-port>
[
break
wice-ack drop
wice-statusdrop
wice-resetdrop
wice-read-memorydrop
wice-read-minc drop
wice-read-saddress drop
wice-closedrop0 wice-opendrop
wice-resetdrop0 wice-write-memorydrop
wice-resetdrop0x55 wice-write-minc drop
wice-read-u30 drop
wice-read-u4 drop
wice-read-u5 drop
wice-read-u6 drop
wice-resetdrop16 wice-dump drop
] with-serial-port-fix ;
wice-start basically sets up a serial port tuple. The with-serial-port-fix opens the serial port into a stream namespace and then executes all function in the quotation [ ] .
I test each command and then I do a memory read function of 16 bytes x 16 lines.
! read memory addressed by address counter and increment
: wice-read-minc ( -- d )
41byte-array write flush
1read-partial ;
! dump one inline
: wice-read-marray ( n -- array )
<byte-array>
[
drop
wice-read-minc first
] map ;
: wice-dump ( n -- array )
f <array>
[
drop
16 wice-read-marray
] map ;
The result in an array of 16 byte arrays read from the WICE all values are in decimal, next I will do print that out as hex dump. Then I will try to do write array to memory.
Built a big loop that looks for the first data on serial port. This is the command byte, each command is put through case statement to run a function. Some commands will wait for 1 to 4 bytes for parameters. All commands must return something, this could be 1 to 4 bytes of data this may change if future.
List of current commands
Name
Command code
Parameter
Return Value
Description
NOP
$00
None
1 byte
Awake Command will always return $00 manly here to see we get some kind of response.
STATUS
$01
None
1 byte
Get status so far we $01 port A is open and $02 port B open for reading and writing.
RESET
$02
None
4 bytes
Reset the Address Counter. This should always return four $00 bytes 32 bits
READ
$03
None
1 byte
Reads the data in memory at the address of counter
READINC
$04
None
1 byte
Reads the data in memory at the address of counter then increment address counter.
ADDRESS
$05
None
4 bytes
Get the current address from the counter shadow 32 bits
OPEN
$06
1 byte
1 byte
$01 Open port A for reading and writing, $02 open port B for reading writing. Returns the status e.g. command $01
CLOSE
$07
None
1 byte
Closes access to all port and goes into ROM Emulation mode.
WRITE
$08
1 byte
1 byte
Write to memory addressed by counter, a read of memory is performed after write and read data is returned.
WRITEINC
$09
1 byte
1 byte
Write to memory addressed by counter, read of memory after write is returned and address counter is incremented.
READU30
$0A
None
1 byte
Get the shadow value of U30 latch output
READU4
$0B
None
1 byte
Get the shadow value of U4 latch output
READU5
$0C
None
1 byte
Get the shadow value of U5 latch output
READU6
$0D
None
1 byte
Get the shadow value of U6 latch output
WRITEU30
$0E
1 byte
1 byte
Write a value to U30 shadow latch and return the new shadow value
WRITEU4
$0F
1 byte
1 byte
Write a value to U4 shadow latch and return the new shadow value.
WRITEU5
$10
1 byte
1 byte
Write a value to U5 shadow latch and return the new shadow value
WRITEU6
$11
1 byte
1 byte
Write a value to U6 shadow latch and return the new shadow value
I was working way with c code "simple IDE" for the propeller and notice the memory space was getting smaller and smaller until I ran out, I must of had optimise setting wrong. I did spend sometime trying work out what when wrong.
I when back to my original spin code. I will get back the c code another time.
I have build basically a spin driver to handle all parallel hardware signals, created "wice" driver handle control of the parallel driver.
The wice driver handles the writing to latches and the reading and writing of wice memory and maintains a shadow memory of all the latches and the address counter.
So far the main code is only utilising one processor and no assembly. Another processor is running serial communication.
Will look at putting parallel driver into a separate processor to get some extra speed.
This is the new Parallel PCB all the level shifters have been changed for better drive of TTL IC for WICE-4M. So far all looks good no issue with talking to WICE-4M. Now time to write code to start communication.
I did not do much research on the TXB0108 series of level shifters, the output pins do not have enough drive to switch a Parallel port with pull up resistors with 1K on the WICE, My bad, a redesign is on the way.