|
From: David E. <d.a...@du...> - 2002-09-13 18:37:32
|
Hi all. Things are slowly progressing, and I'm overcoming problems. I thought I would detail what I've been doing and how to compile and run the thing. So. In the last few weeks I've been working mainly on getting some coherent debugging information. That's just about complete. I've only got a couple of opcodes to update (some bit operations) and that will be finished. Debug information is a compile-time option so you don't have to have the overhead. I've updated the memory functions to work with the 3 modes of the H8/3292. Depending on the mode setting, requests to access certain addresses will be redirected elsewhere. This is important because it takes longer (for instance) to access external memory than it does internal. Anyway, this seems to work. I haven't come across any problems with it just yet. The code's still a mess, but it's becoming more coherent as time goes by. Whenever I return to a module already written, I am attempting to tidy it up. I've removed the 16-bit free running timer because it was firing too often (it generates an interrupt). I need to get the clock implementation done before then, and tables to work out how many CPU cycles each instruction takes. When that's done, I can re-enable the timer and it should fire off more regularly. I discovered that during the ROM initialisation routines, the value 0x0120 is written to 0x8000. Why is this significant? The firmware entry point is at 0x8000, meaning that even if the ROM routines got that far, it would go into sleep mode. So, I either need to reload the firmware or bite the bullet and write the serial port code. I have ascertained that when running the emulator, it gets to a certain point in the code and a sleep instruction is used. This sends the RCX into software shutdown mode. This can only be woken up by a reset or a high priority interrupt. One such interrupt is the on/off button. I plan on implementing this interrupt soon, so I can see what happens if the on/off button is pressed. Now, an interesting (but complicated problem). I want to be able to create a fake IR tower application that takes output from the firmware/program download applications (lejosfirmdl and lejos) and communicates it to the serial port of the RCX. The serial port is quite complex and it's going to take me some time to implement. Add to that the fact that I don't have a clue how to interface these things! It would be ideal if I could do it without having to modify the firmware download code too much (e.g. just set RCXTTY=fakeir or something). Also, I don't know the best way of interfacing. Some ideas: 1. Sockets. Cygwin does sockets similarly to Unix, so I could create a message-based protocol to transfer information to and from the emulator. This could also be used when updating the state of the emulator. It would enable a UI to run in another language (e.g. Java) and even on another machine. 2. Some other convoluted way such as pipes or shared memory. Shared memory wouldn't be too bad, but I don't have a clue about it and whether it's portable. That way I wouldn't have to deal with the overhead of processing messages. So, that's about where I am. Congratulations if you read this far! Now I'll tell you how to compile and run the thing! Step 1. Obtain latest code from CVS. Step 2. Put it all in a directory. Step 3. Compile it. a) gcc -o emul.exe *.c will do it. b) gcc -DRCX_DEBUG -o emul.exe *.c will give you a version with debug info (recommended). c) gcc -DRCX_DEBUG -DRCX_DEBUG_REGISTERS -o emul.exe *.c will give you a version with some registers output as well. Not all that useful. Step 4. Get a ROM and RAM image. a) ROM: Kekoa's page has info on how to get this. http://graphics.stanford.edu/~kekoa/rcx/. I don't know how safe it is to do this, but all it does is install a new firmware that reads the ROM and outputs it in S-record format. b) firmware (RAM): The file bin\lejos.srec in the lejos distribution should do it. It doesn't actually use the firmware, but it has to be there for the thing to work. Step 5. Run it! Type: emul -f lejos.srec -r rom.srec -d This assumes your firmware is called lejos.srec and your ROM is called rom.srec. The -d signifies that you want debug mode. There are 4 levels of output and the following flags control them: -d (or --debug): highest level - output most (recommended) -q (or --quiet): don't output very much -v (or --verbose): about half way If you don't put a flag it defaults to between -q and -v. Other flags: -f (or --ram): followed by the firmware image -r (or --rom): followed by the rom image -h (or --help): output some help info It compiles under my installation of cygwin using gcc. I don't know if it will compile for anyone else; it would be nice if someone lets me know if they can get it to run. In the actual application, pressing return will execute the next instruction. Pressing d (followed by return) will dump the memory to screen, and b will output it to a file (in binary format). Phew! That's about it for now... Dave. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.386 / Virus Database: 218 - Release Date: 09/09/2002 |
|
From: Brian B. <bba...@mt...> - 2002-09-13 21:44:33
|
Hi, David. Epic is right! That's quite complex stuff but it sounds like you're conquering it all. Is all this going to have a physical 3d/2d environment that the RCX emulator runs in? If so, do you have a plan on what it'll look like and how you'll develop it? > Now, an interesting (but complicated problem). I want to be able to > create a fake IR tower application that takes output from the > firmware/program download applications (lejosfirmdl and lejos) and > communicates it to the serial port of the RCX. The serial port is quite > complex and it's going to take me some time to implement. Add to that > the fact that I don't have a clue how to interface these things! It > would be ideal if I could do it without having to modify the firmware > download code too much (e.g. just set RCXTTY=fakeir or something). Also, > I don't know the best way of interfacing. Some ideas: > > 1. Sockets. Cygwin does sockets similarly to Unix, so I could create a > message-based protocol to transfer information to and from the emulator. > This could also be used when updating the state of the emulator. It > would enable a UI to run in another language (e.g. Java) and even on > another machine. > > 2. Some other convoluted way such as pipes or shared memory. Shared > memory wouldn't be too bad, but I don't have a clue about it and whether > it's portable. That way I wouldn't have to deal with the overhead of > processing messages. This will be really strange in a simulated environment. I don't envy having to create that. > So, that's about where I am. Congratulations if you read this far! Now > I'll tell you how to compile and run the thing! > > Step 1. Obtain latest code from CVS. > > Step 2. Put it all in a directory. > > Step 3. Compile it. > a) gcc -o emul.exe *.c will do it. > b) gcc -DRCX_DEBUG -o emul.exe *.c will give you a version > with debug info (recommended). > c) gcc -DRCX_DEBUG -DRCX_DEBUG_REGISTERS -o emul.exe *.c will > give you a version with some registers output as well. Not all that > useful. > > Step 4. Get a ROM and RAM image. > a) ROM: Kekoa's page has info on how to get this. > http://graphics.stanford.edu/~kekoa/rcx/. I don't know how safe it is to > do this, but all it does is install a new firmware that reads the ROM > and outputs it in S-record format. > b) firmware (RAM): The file bin\lejos.srec in the lejos > distribution should do it. It doesn't actually use the firmware, but it > has to be there for the thing to work. > > Step 5. Run it! Impressive. > Type: emul -f lejos.srec -r rom.srec -d > > This assumes your firmware is called lejos.srec and your ROM is called > rom.srec. The -d signifies that you want debug mode. There are 4 levels > of output and the following flags control them: > > -d (or --debug): highest level - output most (recommended) > -q (or --quiet): don't output very much > -v (or --verbose): about half way > > If you don't put a flag it defaults to between -q and -v. > > Other flags: > > -f (or --ram): followed by the firmware image > -r (or --rom): followed by the rom image > -h (or --help): output some help info > > It compiles under my installation of cygwin using gcc. I don't know if > it will compile for anyone else; it would be nice if someone lets me > know if they can get it to run. > > In the actual application, pressing return will execute the next > instruction. Pressing d (followed by return) will dump the memory to > screen, and b will output it to a file (in binary format). > > Phew! That's about it for now... > > Dave. > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.386 / Virus Database: 218 - Release Date: 09/09/2002 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Rcxemul-discussion mailing list > Rcx...@li... > https://lists.sourceforge.net/lists/listinfo/rcxemul-discussion |
|
From: David E. <d.a...@du...> - 2002-09-13 22:14:22
|
Hi Brian. > Hi, David. Epic is right! That's quite complex stuff but it > sounds like you're conquering it all. Is all this going to > have a physical 3d/2d environment that the RCX emulator runs > in? If so, do you have a plan on what it'll look like and how > you'll develop it? This could be *way* in the future, but I envision being able to interface it with something like Rossum. There would be a Java UI (which looks like the RCX) with clickable buttons and updating LCD. These will be read from the information generated by looking at certain registers (which function as I/O lines). The emulator would sit and run in its own little world, oblivious to the fact that it is being used as an RCX. I can't give any estimates on how fast this thing will run just yet... I am reckoning it will be pretty slow to start with! Once it works I'll start optimising. To be honest, I could have something running reasonably soon because most of the work is done by ROM using the H8's instruction set (which I have finished implementing). Some of the things (like serial communication) aren't entirely necessary. I just need to come up with a way of getting a program into the right place in memory without using the IR tower. I'm going to have a look at how lejos stores the program soon. The buttons simply trigger external interrupts which aren't difficult to simulate. All that happens when an interrupt is generated is that the program execution vectors to a location in memory. Interestingly, the interrupt vectors for the RCX are copied to external memory, so you can write your own interrupt handlers. The on/off button is the interesting one for me at the moment. I can't wait to see what happens when the RCX is in the powered on state. *snip discussion of communicating* > This will be really strange in a simulated environment. I > don't envy having to create that. The comms issue is a thorny one indeed. I need something that isn't too bulky otherwise it will become bogged down very quickly. If you imagine that over 100,000 instructions per second are being executed, it would be very costly to output all the output states each time. So I'm going to have to output them only when one changes. How to do this is going to require some thought. The best thing about this project for me is that I am enjoying it! Other projects I've worked on have gotten bogged down in tedium, but this one is constantly rewarding. You can't imagine the joy when I realised that my 16-bit free running timer had been set up to generate an interrupt every 1 millisecond! ;) I'll keep sending updates to the list whenever I do something significant. Dave (who needs to learn how to write shorter emails!) |