tag:blogger.com,1999:blog-22210435946786915702024-02-06T22:06:52.408-08:00Worst.Console.EverPaul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-2221043594678691570.post-15312187808207990102013-01-30T11:53:00.001-08:002013-01-30T11:53:38.692-08:00Day 30 : First Release<div class="separator" style="clear: both; text-align: center;">
<a href="http://images.sodahead.com/profiles/0/0/2/1/8/0/2/1/7/console-gaming-65279630177.jpeg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="214" src="http://images.sodahead.com/profiles/0/0/2/1/8/0/2/1/7/console-gaming-65279630177.jpeg" width="320" /></a></div>
I'm finally letting the game out into the wild. You too can have <strike>hours of fun</strike> minutes of amazement that anyone would charge for such an awful piece of software.<br />
<br />
The game is mimiced as closely as I can figure out from the screenshots and instructions.<br />
<br />
You can download two extra files from the links on the right.<br />
<br />
build.zip is a zip of the whole build tree (it is about 0.6Mb in total), all the source, all the code, the whole lot, you can see at first hand how erratic a programmer I am :)<br />
<br />
release.zip is a much smaller archive which has the emulator (which requires Java 6 or better) and the game ROM, plus a couple of text files, i.e. just the bits you need to work.<br />
<br />
The emulator has been updated again, but I've just removed the sound emulation because the game doesn't use any sound at all, and I don't know how well it copes on other machines, so I've just removed the code.<br />
<br />
Given the minor detail that tomorrow is the last day in January it is unlikely that you will get the option to play these games on your TV. This is probably a blessing.<br />
<br />
<br />
<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com2tag:blogger.com,1999:blog-2221043594678691570.post-41334226055322400092013-01-28T23:07:00.003-08:002013-01-28T23:09:14.175-08:00Day 29 : Read the instructions.<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.krystalgrant.com/wp-content/uploads/2011/01/dentist8.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="229" src="http://www.krystalgrant.com/wp-content/uploads/2011/01/dentist8.jpg" width="320" /></a></div>
Woke up early so done some more testing and everything seems okay, so far.<br />
<br />
Just realised I have made a minor error which I should have spotted ages ago. In the instructions it says when you "Double" in Blackjack you take one more card from the deck and that's it.<br />
<br />
At the moment in my version if you double you play as normal except for the bet being doubled.<br />
<br />
The rules do make sense, otherwise you just automatically double if you have a good hand ; there's no risk involved.<br />
<br />
This fix should be fairly trivial though, but I will have to do it later on today.<br />
<br />
Doesn't look like I'm going to have time to get the hardware version up and running. Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-13964630069130754812013-01-28T03:26:00.001-08:002013-01-28T23:07:59.133-08:00Day 28 : ROM Completion Day<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.mastermagazine.info/termino/wp-content/uploads/EPROM.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="278" src="http://www.mastermagazine.info/termino/wp-content/uploads/EPROM.jpg" width="320" /></a></div>
I have some time to work on this today. So my aim is to complete the ROM image so that the Blackjack game will actually run. I hope to release a working game at the end of today.<br />
<br />
Update 1 : So far : fixed a bug in the assembler (duplicate labels.... must've been asleep) and completed the gameplay core. Apart from testing, I only need the code for the special bets (doubling and insurance) and bet selection / player selection / bankroll selection / game selection code, all of which is hardcoded at present.<br />
<br />
Update 2 : All the special bets are now coded and tested briefly. Just the selectors to do now. The ROM size is 1724 bytes, comfortably within the 2k limit. Might even have space for a title page.<br />
<br />
Update 3 : Now code complete. Chased down a couple of bugs (not fun without a proper debugger for the RISC Machine), so not yet releasable, want to test it a bit more yet. But it is complete at 2,026 bytes, just enough to fit into a 2k ROM.<br />
<br />
Mind you the debug time is my own fault. I was calculating the offset in ROM as $1000 whereas it was actually $1200 so all the tracking was 512 out. <br />
<br />
Actually I could trim quite a few bytes. There are quite a few examples of code that ends something like,<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">bl someroutine</span><br />
<span style="font-family: "Courier New",Courier,monospace;">ret</span><br />
<br />
which I could just shortcut into 'b someroutine' but I just don't like that sort of coding. There are quite a few subroutines which are really broken down for clarity, things like that. I'm not using the Executive sound routines at all.<br />
<br />
However, I will uploaded the latest Executive (1.3) and Blackjack (0.91) sources if anyone wants to have a look.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-2097561363338304652013-01-25T15:26:00.002-08:002013-01-28T23:14:14.789-08:00Day 25,26,27 : Nothing<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.angustheitchap.com/blog/wp-content/images/asleep.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="212" src="http://www.angustheitchap.com/blog/wp-content/images/asleep.jpg" width="320" /></a></div>
I have done nothing this weekend. I hope to finish the Blackjack/Executive ROM image on Monday.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-6263029067495367102013-01-24T08:06:00.000-08:002013-01-24T08:06:51.574-08:00Day 24 : Not much Game Development (cont)<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnTRIo2A7aV0NYpO99bMm9sZLcJboHWL6bj_cOIHw66PW0AW83DXRha8FLQUAuqgCGUQMg-3yl7ARMbQVCPYjUtSTNNrhObWuXZWX1Jlgb5YsW1mW1NRM_3bD1pdawIW_dyJMvIBeyAmgD/s1600/Screenshot+from+2013-01-24+16:02:57.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="345" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnTRIo2A7aV0NYpO99bMm9sZLcJboHWL6bj_cOIHw66PW0AW83DXRha8FLQUAuqgCGUQMg-3yl7ARMbQVCPYjUtSTNNrhObWuXZWX1Jlgb5YsW1mW1NRM_3bD1pdawIW_dyJMvIBeyAmgD/s400/Screenshot+from+2013-01-24+16:02:57.png" width="400" /></a></div>
Not much coding done today at all (had a tooth out at the Dentists), so for a picture this post I've created a diagram showing the 'stack' that is running.<br />
<br />
At the bottom, the JVM. On top of this, a Java Unisonic Champion Emulator in Java.<br />
<br />
The next level up is in CP1610 Assembler Code, assembled via the Intellivision SDK, and that is an emulator for the RISC VM that runs on the emulator.<br />
<br />
The last two levels are the Executive ROM, containing standard routines, and finally on top of that the actual game code. Both of these are written in RISC Assembler and assembled using the Java program urmasm.jar.<br />
<br />
Tomorrow, I hope to finish the game. In beta , anyway.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-47273055204463980292013-01-23T07:14:00.002-08:002013-01-23T07:41:19.686-08:00Day 23 : Game Development (cont.)<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6vZt0ENhWotyko5DsqElbUM16th2QxQgXMDWDS_aOcE-BKunmyLP1ykE8g-4RLzvpM_6W4vdp3t1jMvGm1hPLi2pNIsDw9i9TF4PAseR_hWjBOKmw1UJKd7mlpQ8wY7qpM48csij5DcPo/s1600/Screenshot+from+2013-01-23+15:37:00.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6vZt0ENhWotyko5DsqElbUM16th2QxQgXMDWDS_aOcE-BKunmyLP1ykE8g-4RLzvpM_6W4vdp3t1jMvGm1hPLi2pNIsDw9i9TF4PAseR_hWjBOKmw1UJKd7mlpQ8wY7qpM48csij5DcPo/s320/Screenshot+from+2013-01-23+15:37:00.png" width="320" /></a></div>
So, a little bit more development today. You can see I now have code dealing cards and counting their best totals, BlackJack style. Player 2 has gone bust, Player 2 has 21 through sheer dumb luck :)<br />
<br />
Baccarat is really a simpler variant with just one round of 'hits' and a different scoring system, so tweaking the code for this is pretty simple.<br />
<br />
At present the game, bankroll, #players and bet selection code are all dummies, though this is easy enough to write, as I've already written the menuing code and that works fine.<br />
<br />
The bottom right white square is just a note to let me know the code has completed running. I don't have a debugger for this code, other than that in the CP1610 Emulator, so old style debugging methods are in use here.<br />
<br />
The running is still slow - which is not unreasonable as it's a fairly slow processor (CP1610) which only runs when the vertical blank is on (25% of the time), and the processor itself is running a virtual machine emulator. It's fast enough for this sort of game. It would (like Chip 8 which on a 1802 system has all the same problems) struggle a bit with Space Invaders, but then that's near impossible on this system anyway.<br />
<br />
I suppose I could have just written it in CP1610 machine code in the first place, but I do quite like coding in this RISC VM, and if I have time to port it to Arduino, which might be a bit of a stretch in the week remaining, it will make it much easier as I only have to port the VM, not the 1610 - this also solves problems such as an Arduino having seperate code and data and a 1610 not - the VM has ROM code and small RAM data so it's a pretty good match for an MCU.<br />
<br />
I actually have got, somewhere, an Arduino screen display that does something like 24 x 20 with a 6 bit character set which would work fine so maybe the Arduino version wouldn't take long to code up, given that I already have a 'C' core.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-60234246640690009692013-01-22T10:34:00.001-08:002013-01-22T10:34:38.427-08:00Day 22 : Blackjack/Baccarat Development<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpYhm_J8Ls6eDxQvn0JfUEwic7bRuF-6y6r8MD9JVW7mFbyxDYglAoF0wZQ1rZM6iR69EEVfUoRz4ur3pRJhnCmvvCm3OHdwhdDuVUWu7Uuu4QqiuYFilsJj5P0DasiKmctW6Pn0kjLqhC/s1600/Screenshot+from+2013-01-22+18:32:13.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpYhm_J8Ls6eDxQvn0JfUEwic7bRuF-6y6r8MD9JVW7mFbyxDYglAoF0wZQ1rZM6iR69EEVfUoRz4ur3pRJhnCmvvCm3OHdwhdDuVUWu7Uuu4QqiuYFilsJj5P0DasiKmctW6Pn0kjLqhC/s320/Screenshot+from+2013-01-22+18:32:13.png" width="320" /></a></div>
Started today on developing the actual game that is part of the System ROM.<br />
<br />
Lots of skeleton work and basic design work and starting the coding, not done a lot really, half an hour or so on it.<br />
<br />
I think it will work but it will have that Chip-8 sort of feel where games sort of slide on slowly rather than just appear.<br />
<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-45230314269290778252013-01-21T09:10:00.001-08:002013-01-21T11:00:18.890-08:00Day 21 : Bug Fix time.<div class="separator" style="clear: both; text-align: center;">
<a href="http://upload.wikimedia.org/wikipedia/commons/7/70/Computer_bug.svg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="http://upload.wikimedia.org/wikipedia/commons/7/70/Computer_bug.svg" width="173" /></a></div>
When developing more OS Routines for the ROM I came across a couple of bugs in the display.<br />
<br />
Firstly - and how I didn't notice this before I don't know, in the right hand side the ASCII text was on the top half of the character area not the bottom half.<br />
<br />
Secondly - and more embarrassingly, when I write to RAM I only write to the hardware device (via an Interface) if the address is <= 150 (i.e. display RAM or the sound byte).<br />
<br />
However, I was <i>testing the data</i> so when I wrote a value of 150-255 to the display, nothing happened.<br />
<br />
This didn't show up mainly because you don't write these values to the display normally, the values $80-$FF in display RAM all mean the same thing, a solid white block, and the hardware writes to values $97-$FF were ignored because there is no hardware there.<br />
<br />
Anyway, I have fixed these and the emulator zip on the right has been updated.<br />
<br />
L8R: I have added some extra functionality to the executive ROM, which has also been updated.<br />
Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-3246779807545073842013-01-20T07:46:00.001-08:002013-01-20T07:50:47.532-08:00Day 20 : Unisonic Executive ROM (Part 3)Done a bit more today, finished off the printing and menu options in the Executive part of the ROM. It's a bit like the old home computers, the ROM provides a set of utility functions and also some code using them - in this case, the game itself.<br />
<br />
I have uploaded the unfinished ROM assembler code if anyone is interested - it's on the links on the right.<br />
<br />
It can all be made to work - download the CP1610 interpreter, assemble that with AS1600, download the exec ROM assembler, assemble that with urmasm.jar, concatenate the two binary files together, call that file code.bin then run it with gimini.jar. If you do this you get a rotating menu of the type used in Unisonic games (the options change sequentially and you push 'Yes' when you see the one you want).<br />
<br />
I will make a more releasable one when there is something to see.<br />
<br />
Anyway, I will review this ROM code and then once that is done, start work on the Blackjack / Baccarat game. Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-65361003817828877372013-01-19T14:45:00.002-08:002013-01-19T14:46:50.885-08:00Day 19 : Unisonic Executive ROM (Part 2)<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKe3Nx-UfY5RxS11XH2JNeh4hIgFVXm8AZ0FvGuYzNom9RScwIpCcHPVc9roZXDlKeagQTF8elBhrk9orZuMMMtE8Sn6dohiQWmiEbdIJjkXamFfUPHE2vC6FHp17LLU7drkBe-LVfO4j-/s1600/Screenshot+from+2013-01-19+22:43:04.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKe3Nx-UfY5RxS11XH2JNeh4hIgFVXm8AZ0FvGuYzNom9RScwIpCcHPVc9roZXDlKeagQTF8elBhrk9orZuMMMtE8Sn6dohiQWmiEbdIJjkXamFfUPHE2vC6FHp17LLU7drkBe-LVfO4j-/s320/Screenshot+from+2013-01-19+22:43:04.png" width="320" /></a></div>
Done very little today. Tinkered with ideas and designs for the Exec. ROM.<br />
<br />
I did rewrite the Card-Deck handling part of the executive ROM entirely, and started on the 'printf()' method - this is the base of the menuing system as well.<br />
<br />
Hopefully the Exec ROM will be done tomorrow, more or less, and then I can actually focus on the Game part of the Exec ROM - the system comes with a built in game.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-26457097866123636372013-01-18T08:54:00.000-08:002013-01-18T08:54:57.307-08:00Day 18 : Unisonic Executive ROM (Part 1)<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6jbpHRp5cgsq2fN1XIRgARWyGMrqli8HMMpC_J4NOJWOZaPxuM-4rEYxLy5xHErrVksNuDXn368NMM_X5akScjLOOli5NzN0jOHy1aEP4Bxz2tiVCLLgC2IsfCeC-UiOVsp8eUCTke8Ei/s1600/Screenshot+from+2013-01-18+16:51:00.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6jbpHRp5cgsq2fN1XIRgARWyGMrqli8HMMpC_J4NOJWOZaPxuM-4rEYxLy5xHErrVksNuDXn368NMM_X5akScjLOOli5NzN0jOHy1aEP4Bxz2tiVCLLgC2IsfCeC-UiOVsp8eUCTke8Ei/s320/Screenshot+from+2013-01-18+16:51:00.png" width="320" /></a></div>
Today I have done some work on the Unisonic ROM - the utility routines.<br />
<br />
The screen on the right shows the Card Dealing executive routine having dealt a 52 card deck.<br />
<br />
Tomorrow I will write the display routines - the ROMs equivalent to printf() and also the menu routines.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-69305217711881759352013-01-17T02:39:00.001-08:002013-01-17T02:39:13.816-08:00Day 17 : URM Interpreter complete and tested.Yet another snowy day.<br />
<br />
I have completed and tested the CP1610 Assembler URM Interpreter (the source code is uploaded on the side bar - I will eventually upload everything). It ended up about 300 decles (the GI version of bytes, 10 bits long) which isn't too bad.<br />
<br />
It passed the fairly simple processor test code I wrote and some other tests written to check the system functions.<br />
<br />
I can now get away from CP1610 mostly. It's confusing because the CP1610 and URM are backwards - the CP1610 does mvii #42,r0 to put 42 in r0 and the URM does it the more usual way around, mov r0,#42 and I keep getting them mixed up.<br />
<br />
So, I next need to think about utility functions. There are two that spring to mind immediately ; the first one is to maintain a sorted deck of cards, and the second one a sort of 'printf' function. The sound setting probably wants to go through a function itself. The controllers are effectively virtualised by the sys operation.<br />
<br />
Utility functions need to be thought out because the Unisonic comes in with 2k x 10 bit ROM which is always available, so it makes sense to write routines that can be reused in other cartridges.<br />
<br />
If I ever write any. Which given this is day 17 of 31, is not that likely.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-638609721425050452013-01-16T05:33:00.001-08:002013-01-16T07:57:15.666-08:00Day 16 : CPU Test Code runs okay<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.rix.co.uk/pictures/content/images/why-does-it-snow.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="228" src="http://www.rix.co.uk/pictures/content/images/why-does-it-snow.jpg" width="320" /></a></div>
Snow day today. So the UK grinds to a complete halt :)<br />
<br />
I've been tinkering with the completed CP1610 version of the interpreter, and it has passed the test code I wrote for the reference implementation - it tests every instruction as far as is possible.<br />
<br />
Initial tests show a speed of about 1,000 instructions per second, which is not blazingly fast but fast enough to write some code for this system.<br />
<br />
Annoyingly the CP1610 assembler keeps arbitrarily plonking zeros on the end of the binary file, padding it out to the nearest page, so I might have to find a work round for that.<br />
<br />
So, next thing is to write the CP1610 for the system functions - nearest thing I have to an "operating system".<br />
<br />
Once that is complete the CP1610 coding is more or less over except for bug fixing - the next part is to start writing game code for the URM to run on the CP1610 virtual machine.<br />
<br />
<u>Later on</u><br />
<br />
I've written and tested the first three system functions - they scan the player 1 and player 2 keypads and generate a pseudo random number. The last three allow program data to be accessed as code (Harvard machine) and have a fixed delay.<br />
<br />
It also produced another problem, sort of. The constant $7F. I'm using 7 bit constants sign extended in this system. so constants can only be directly coded in the range $00-$3F to $C0-$FF. All other constants can be implemented as the sum of two constants - it's a bit long winded but I don't think it is too important. The exception to this is $7F which has to be calculated I think as $3F+$3F+$01. How important this constant will be I do not know :)<br />
<br />
<u>Later on again</u><br />
<br />
Actually not a problem. I forgot about exclusive-or $7F = $40 ^ $3F :)<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-54843344639905286182013-01-15T09:35:00.001-08:002013-01-16T08:24:01.131-08:00Day 15 : Finished CP1610 InterpreterActually I haven't had much time today , either, but I have finished the CP1610 version of the URM Interpreter - the advantage of a RISC type machine which only has two instruction formats is that it's fairly easy to code - 100 lines of C or Java, 2-300 of Assembler.<br />
<br />
Initial tests of the most simple instructions (mov r0,#0) suggests it executes in 26 machine instruction cycles, about 1,000 instructions per second.<br />
<br />
The slowest (outside things like delay instructions !) would be addpl 1(r0),2(r0). This is (in C) if (lastResult >= 0) Memory[Memory[0]+1] = Memory[Memory[0]+2] with tracking of carry, sign and zero of the result.<br />
<br />
I haven't single stepped it but on current code takes 15 more instructions to evaluate the pl condition, 10 more instructions to calculate the RHS (2(r0)) and 8 more instructions to calculate the indexed indirection on the left hand side, i.e. 33 instructions, about 450 instructions per second. Though this is an unusual case, the worst case scenario on everything.<br />
<br />
Branch/Branch Link and their psuedo operations ret and sys are quicker because the address decoding is much simpler.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com2tag:blogger.com,1999:blog-2221043594678691570.post-56976613443523723912013-01-14T12:00:00.002-08:002013-01-14T12:00:39.268-08:00Day 14 : Started CP1610 InterpreterWell, tbh, I haven't done a lot today, I've written a little bit of the URM Interpreter for the CP1610, and tweaked the specification slightly.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-26581000213078649312013-01-13T03:43:00.002-08:002013-01-13T07:40:40.189-08:00Day 13 : Reference Implementation & Test ProgramThe assembler in the urmasm.zip archive (see link on right) has been updated to fix the following bugs :<br />
<br />
<ol>
<li>couldn't cope with upper case identifiers. Not quite sure how I missed this one :)</li>
<li>outputting string data in 7 bit ASCII not 6 bit ASCII (e.g. 'A' was output as 65 rather than 1), the Gimini is a 6 bit ASCII machine.</li>
<li>incorrectly handled hexadecimal constants beginning with A-F (e.g. $A7) . Careless :(</li>
</ol>
To be fair to me :) I only really started testing it when I started writing code in it. Yes, I know, bad practice.<br />
<br />
I have also finished the 'C' reference implementation of the URM Virtual Machine, and the program used to test the implementation works, and it is downloadable from the links area.<br />
<br />
'C' code is for Code::Blocks, the executables included are 64 bit Arch Linux 'cos that's my machine.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-14558918837338732872013-01-12T08:08:00.002-08:002013-01-12T14:47:19.385-08:00Day 12 : Reference Implementation<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.bbc.co.uk/comedy/fastshow/characters/images/jesse2.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="http://www.bbc.co.uk/comedy/fastshow/characters/images/jesse2.jpg" width="183" /></a></div>
Today, I 'ave been mostly .... writing the 'C' reference implementation.<br />
<br />
This isn't an actual working emulator version - none of the system calls or the hardware will be there, it's a working emulation core. That's about 90% done. L8R: Finished it.<br />
<br />
Once I've done that, I'll write reference program which runs code and checks it actually works, using a system call #255 (which won't normally exist) as a sort of assert-false. This I can then run on the CP1610 based interpreter and any others to check they actually <i>work</i>.<br />
<br />
The assert code will be something like this.<br />
<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;"> mov r0,#-1 ; put $FF in R0 (e.g. system call 255, $FF)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">.</span><br />
<span style="font-family: "Courier New",Courier,monospace;">. (later on - this code checks the indexed indirection and the</span><br />
<span style="font-family: "Courier New",Courier,monospace;">. add instruction, partially)</span><br />
<span style="font-family: "Courier New",Courier,monospace;">. </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mov r14,#5 ; put +5 in r14</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mov r3,#10 ; put 10 in r3 (so r(r3+4) == r14) holds 5</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> mov r1,#-5 ; load r1 with -5</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> add r1,4(r3) ; add the contents of r3+4 to r1 e.g. r14 or 5 </span><br />
<span style="font-family: "Courier New",Courier,monospace;"> sysnz ; fail if zero flag clear(+5 + -5 == 0)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> syscc ; fail if carry clear (carry set in 8 bit)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"> sysmi ; fail if sign flag set (result is zero)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: inherit;">Just for clarity the 4(r3) notation means take the contents of r3 (e.g. 10), add 4 to them, making 14 and use that register. It's a long winded way of pointing to r14 (add r1,r14 would do the same thing)</span><br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
The failure works as follows<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;"> mov r0,#-1 ; puts -1 (e.g. 255 in 8 bit) into R0</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> xor r1,r1 ; clear r1 - xor updates S and Z flags</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> sysnz ; that will clear Z so this condition will </span><br />
<span style="font-family: "Courier New", Courier, monospace;"> ; succeed causing the system function 255 to</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> ; be called which will report a failure </span>Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-68699285861385302122013-01-11T09:58:00.000-08:002013-01-11T09:58:05.936-08:00Day 11 : Errrrr....I've actually done nothing today. Except install Code::Blocks. Which involves pacman -S codeblocks ......<br />
<br />
Ah well :)<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-71615067180443934292013-01-10T08:57:00.001-08:002013-01-10T09:00:59.023-08:00Day 10 : Assembler available<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.mikroe.com/img/publication/8051-books/programming-8051-mcu/chapter/ch5/01.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="292" src="http://www.mikroe.com/img/publication/8051-books/programming-8051-mcu/chapter/ch5/01.gif" width="320" /></a></div>
So, today I've finished the assembler without managing to irritate Stalin.<br />
<br />
It's now available from here <a href="http://www.robsons.org.uk/Gimini/urmasm.zip" target="_blank">www.robsons.org.uk/Gimini/urmasm.zip</a> It isn't much use yet because there isn't anything to run this code on, but to run it you run java -jar urmasm.jar demo.asm data.asm which assembles those two source files producing a binary file code.bin which is layout compatible with the CP1610 and code.lst which is a disassembled version of that binary code.<br />
<br />
Basic, but it appears to work.<br />
<br />
Next up - a reference implementation in 'C' , which will, conveniently, work in an Arduino, and following that a processor verification program in URM Assembler so any implementation can be tested.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-107691856332201832013-01-09T07:05:00.002-08:002013-01-09T07:05:58.140-08:00Day 9 : Writing an AssemblerI've now got the guts of a simple assembler working. Just need to tidy up and wrap the worker classes so the assembler is in a fairly easy to use form.<br />
<br />
Release tomorrow. Probably.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-41601432293471222782013-01-08T04:00:00.003-08:002013-01-08T04:00:33.706-08:00Day 8 : Virtual Machine DesignI always quite fancied the idea of having a Virtual Machine in here, a bit like the old Chip 8. I do like the CP1610 and it's fun to code for, but the defects described elsewhere in respect to the RAM system spoil it really.<br />
<br />
So I came up with this design. It's a RISC system with a 20 bit instruction word. Every instructional is conditional on simple status bits (Carry Out, Sign and Zero). It is designed for 8 bit usage without much memory - what I've done is shifted the memory map slightly so the display is now at $40 (rather than $00), so the last 64 bytes of RAM at $C0-$FF are now at $00-$3F in the virtual machine and become R0-R63, rather like on an 8048 Microcontroller. The sound byte shifts from $96 to $D6 - every address goes $40 forward.<br />
<br />
This is of course in the RISC interpreter - I'm not cheating by changing the actual target machine - to keep me honest it has to run as if it ran on the real machine.<br />
<br />
There are, arguably, 8 instructions. The four data instructions, add, and, xor and mov which have two operands - the left one can either be a direct register (e.g. r2) or an indirect offset (e.g. 4(r3)). The right one can either be a similar register address, or it can be a 7 bit constant which is sign extended to 8 bits (I don't have many bits to work with !)<br />
<br />
There are 2 branch instructions, branch and branch link which are jump and subroutine call respectively, they take a 15 bit operand (every instruction is 2 decles so is on an even address) which is relative, which makes all the code relative (there is no option to do indirect jumps)<br />
<br />
The two left are fiddles. branch link 0 , e.g. a subroutine call to the next address is used for return, and branch 0, e.g. branch to the next address is used to access some basic system functions (e.g. a random number generator). Both of these are effectively useless (you could actually have branch-link 0 in some rare cases) so are coopted to do other things.<br />
<br />
This gives me two options for producing a hardware version. My calculations suggest a typical Arduino Uno can actually keep up with generating the video and emulating a CP1610 in real time on this machine, remarkably. Alternatively the hardware version could just dump the CP1610 and use a 'C' based RISC interpreter.<br />
<br />
Haven't really decided yet :)<br />
<br />
Anyway, <a href="http://www.robsons.org.uk/Gimini/URMSpecification.pdf" target="_blank">this is the specification document (pdf)</a><br />
<br />
Next task is to write an assembler for it.<br />
<br />
Because almost every instruction is basically the same, this isn't too difficult.<br />
<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-51877683580838290892013-01-07T09:18:00.002-08:002013-01-07T09:18:35.306-08:00Day 7 : I win another compo !<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.weebly.com/uploads/5/6/9/8/5698637/8502881_orig.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="277" src="http://www.weebly.com/uploads/5/6/9/8/5698637/8502881_orig.jpg" width="400" /></a></div>
I won for my game "Base Attack" - this is it running on the left (using the same debugger framework as the Unisonic emulator).<br />
<br />
I'm genuinely amazed. Whilst it was a fun thing to do producing a game on a rather limited platform (it's a new game for the MB Simon toy) does make the game a bit limited. (And the idea is completely bonkers anyway).<br />
<br />
Next time I do one of these things I'll probably do it for the Microvision, or possibly the Entex Select-a-Game if I can find out how it's wired up.<br />
<br />
<a href="http://minigamecompo.weebly.com/results.html" target="_blank">http://minigamecompo.weebly.com/results.html</a><br />
<br />
No prize for this one though :(<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-9633668210772807842013-01-06T05:39:00.002-08:002013-01-06T07:41:47.951-08:00Day 6 : First Release<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUBorC1zj5kCOt8JgJ6RBv8hsK6szlSToQn1s6v5TbWXsVLzuBWqdzYnWwgSwC1sG9xVzPVzvo7IrlnTXXKjppgaQxigWEVUQyPML_mOhqv2gFHNNARMSEOp_aduJZKsmqmOhJR3JgEq4h/s1600/Screenshot+from+2013-01-06+13:32:47.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUBorC1zj5kCOt8JgJ6RBv8hsK6szlSToQn1s6v5TbWXsVLzuBWqdzYnWwgSwC1sG9xVzPVzvo7IrlnTXXKjppgaQxigWEVUQyPML_mOhqv2gFHNNARMSEOp_aduJZKsmqmOhJR3JgEq4h/s400/Screenshot+from+2013-01-06+13:32:47.png" width="400" /></a></div>
Here is something you can actually download and play with. It is very dull but then again it's only a 50k download. It requires Java 6 or better. I've only run it on Linux, but the bit that might give problems (the sound generation) has been tested on a Windows platform and appears to work fine).<br />
<br />
The download (<a href="http://www.robsons.org.uk/Gimini/gimini1.zip" target="_blank">http://www.robsons.org.uk/Gimini/gimini1.zip</a>) contains three files - a jar file, an object file and and assembly source file of the demo program. If you run the jar file (java -jar gimini.jar) it displays the screen(s) you see above.<br />
<br />
If you then run it (either press F11, or Run from the Debug menu) it will show the screen on the left, and play the three tones one after the other , changing about every second. If you press one of the control keys (QW for Player 1, OP for player 2) a white block will appear in the gap on the screen at the top in the middle. <br />
<br />
Only one catch-ette - for those keys to work the Display window needs to have the focus, not the debugger window. The program will still run with the display window not having the focus, but it doesn't handle the keyboard.<br />
<br />
PS: Creativision as the worst console ? How can something with a 6502, a TMS9918 and a 76489 be a bad machine - sure the <i>games</i> might not have been that great, but the potential's there.........<br />
<br />
L8R: Tested on Windows XP/Java 7 on VirtualBox, seems to work fine. Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com2tag:blogger.com,1999:blog-2221043594678691570.post-78115421611283140792013-01-05T09:46:00.002-08:002013-01-05T09:47:31.759-08:00Day 5 : Life interferes.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0MnX6PgFmXJ1SngelsWKrhiPQpXGHXqJULXPuRZzn81hAygA1NRHkSJXPeVRXWFRyt8VSWCyXltD1H7_zaJUvZJjHaP4jYFAJ4Xu9_3muWmUkQRbExbAch1pTDxVy-mr6sfaoESykeSGg/s1600/Screenshot+from+2013-01-05+17:44:02.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0MnX6PgFmXJ1SngelsWKrhiPQpXGHXqJULXPuRZzn81hAygA1NRHkSJXPeVRXWFRyt8VSWCyXltD1H7_zaJUvZJjHaP4jYFAJ4Xu9_3muWmUkQRbExbAch1pTDxVy-mr6sfaoESykeSGg/s320/Screenshot+from+2013-01-05+17:44:02.png" width="294" /></a></div>
Life, well Mrs R really, has got in the way of doing anything much with the code today. However, I do have a working .jar file and a CP1610 binary file which is a demo which displays characters on the screen, beeps, and responds to the keyboard.<br />
<br />
However, it does not have the sound yet, so those demanding tweets ...... will have to wait a little while (probably till tomorrow morning).<br />
<br />
This shows it running. There are four windows visible here on my Gnome Desktop. Top Left is the Gimini display windows. Bottom Left is the code in the editor (rubbish bodge code for testing but it works). Top right you can see the blogger window where I'm writing this post. Bottom left is the debugger.<br />
<br />
Currently as you press the four keys a 'Y' appears where one of the four dots are. And it beeps, or will fairly soon.Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0tag:blogger.com,1999:blog-2221043594678691570.post-3164874355048331722013-01-04T08:33:00.003-08:002013-01-04T08:33:37.070-08:00Day 4 : Sticking all the bits together<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3bqVOr5AgHhNVeyQnET1qZ5KKysWGazIMpqffSQluZO-RH7RWILOm7eV7N3yOqF51xXGFIEf1lhwsEmnks1syGIxq4x04pSaSLZiYaHhyFKVbrUNAXIujMcpaMI-keL1beJoWW7Rbrr9r/s1600/Screenshot+from+2013-01-04+16:26:40.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3bqVOr5AgHhNVeyQnET1qZ5KKysWGazIMpqffSQluZO-RH7RWILOm7eV7N3yOqF51xXGFIEf1lhwsEmnks1syGIxq4x04pSaSLZiYaHhyFKVbrUNAXIujMcpaMI-keL1beJoWW7Rbrr9r/s320/Screenshot+from+2013-01-04+16:26:40.png" width="270" /></a></div>
As I wrote before, I do have a simple Debugger Framework that you can just plug an emulator class into.<br />
<br />
This (on the left) is the result. It is pretty basic, but it does work. The debugger window is in three bits - the top bit is the registers R0-R7 and the flag bits, the middle bit the disassembled code and the bottom bit the memory display.<br />
<br />
It's a bit scruffy (it's actually the first piece of Java Swing code I've ever written beyond hello world stuff .....) but it does work. You can single step, set breakpoints, all that sort of thing. The display of the emulator consists of two windows, this one and the display screen shown in a previous post.<br />
<br />
As you can see there is no actual code loaded yet. The next thing I want to do is to write a little demo program that tests the display, the game control keys, the beeper and so on, and also tests the emulator.<br />
<br />
I might do that tomorrow, or maybe the day after, depends (real life interfering with important things again .....) but once that is done, I'll release a first working version so people can play with it if they like.<br />
<br />Paul Robsonhttp://www.blogger.com/profile/12278875872815047472noreply@blogger.com0