 I have a new computer. This is a Casio FX850P pocket computer. It's from 1987. It's a very early ultra-portable, I suppose you'd say. It's got 8K of RAM, an 8-bit processor and it runs basic. It even works, although actually getting the screen on camera is surprisingly hard. I've been looking for one of these for a while. I remember these from my childhood as interesting and weird and surprisingly useful. The screen here, which I'll show later, has got two lines of text on it and you can actually write some pretty decent programs. It's got a huge library of mathematical functions all as go-subbable routines from your basic program. It also operates as a pretty decent standalone calculator and even has a little word processor on it. You may notice I'm touching this rather gingerly. That's because this thing is absolutely disgustingly filthy, so I am going to have to take it apart to clean it and then go and wash my hands. Really, it's got caked on sweaty dirt everywhere, but that will also give me a good opportunity to take the lid off. Once that's done and I'm capable of using the keyboard without wincing, I will attempt to demonstrate how it works and why I'm interested in it. The first thing is to open it up. It is missing its vital screws, so it is in fact taped together. Now I notice it's actually also a little bit bent, which isn't so great, so hopefully that will do it. I should have some screws for about the right size, which I can replace it with. There we go. The back comes off reasonably neatly. Yes, it is bent and it's also covered in gunk and now tape adhesive. This is going to get a scrub down and washed with IPA or WD-40 or something to take the gunk off. It gets a lot of paint. Inside we have the back chassis, revealing the memory upgrade port here. A expandable memory card screws on these three screw points and presses down these terminals. This is one of the things I'm interested in. I want to explore the bus. There's very little known about this CPU and I'm hoping that I can build something that will snoop the bus and hopefully reveal the contents of the ROM. The CPU is known to be a Harvard architecture device, so ROM and RAM occupy different address spaces. In some ways that's good because it means you get like 64k of available RAM plus 64k probably of ROM space. In others it's difficult because you can't easily upload code onto it. So it runs off to standard button cells and this is the backup battery for the RAM. So that has now factory reset the device. There was one very large text file on it that compared to contain gibberish, so no great loss there. I want to take the front panel off so that I can take the keys off because they're horrible too. I might be able to see the brown gunge everywhere. I believe I need to take the... To do that I need to take the back chassis off. Let's find a better screwdriver. Okay that's the... that does fit just. There's an expansion port on the side, which is here, which is in fact the only port on the machine, which is a combined parallel interface, serial interface and power input. There's a plug-on interface module that will allow you to use a cassette recorder to load and save programs and print to a real printer and power it from the mains, etc. These things are like Hen's teeth. I found one on eBay for a hundred plus pounds, so I don't think I'll be getting one of them. It's all standard 5 volt ETLs, so it should be easy enough to bodge something up. Being a 5 volt device, I'm hoping that it should be fairly straightforward to use a DIY signal analyzer to talk to the bus. I will show you the actual works once this comes off. There's a lot of screws into this one. All right and that removes this panel, which exposes the works. So what we've got here are probably two RAM chips. They are different. This is for an additional internal RAM expansion. They produce a couple of models of this with different amounts of RAM and I found homebrew instructions for taking a perfectly standard surface mount SRAM chip and soldering it on there. That means that you don't need the expansion port anymore, which if I'm going to be doing horrible things with it is probably a good thing. I will actually let's have a quick look with this. This connector is standard 10th of an inch pitch, so these, yeah that doesn't fit at all, which means this is not 10th of an inch pitch, so I will probably need something bodged to connect to that. Here is the expansion port. These are all test pads. That might be something of interest there, but the bulk of the work are in these three chips. This one is a HD6002 and it is the CPU and this is the thing that nobody really knows anything about. It's probably an 8-bit CPU. It runs at 1.228 megahertz, guess how I know, but other than that it's a bit of a mystery. These are LCD controllers and they each operate half of the LCD screen and here is the connector onto that and you can see the wires spreading out from each controller to the relevant halves of the display. Okay, so I think that was the last screw, so with luck this should just lift something here. Ah, there is a screw. This is the piezoelectric squeaker. Yes, it's got sound, very very thin wires, actually quite lucky. There we go, not to break it when I lifted the back off and this reveals the keyboard which is a not very well fastened in membrane. Oh yes, this piece, this all fits down like this, that's better. And when you press a key it pushes a carbon pad onto one of these tracks and the on-off switch is this which connects these pads here together. You notice that the camera is having a lot of difficulty with light. Let's move this slot out of the way, that's a bit better. Now you can see slightly that's the curse of auto exposure I'm afraid. So this is all going to need cleaning. I'll just wipe these over with contact cleaner but let's remove the keyboard membranes and the screen, just unscrew here. Now I've got to be really careful with the screen, the way that these connectors or the way that these ribbon cables connect to LCD screens like this is very dubious and I don't really want to make it come astray. Okay, so this can all push aside because I'm not interested in that anymore and we lift up the membrane and the rubber mats and they are also pretty grim and this mysterious copper sheet goes aside and then this reveals screws which are used for tensioning and electrical connection between the case halves. I shall take out, it's there to take out and that reveals firstly is the window which if I reflect the light off it you can see is also pretty grim. There is a way to polish these up using Brasso but I haven't tried that. I don't think I've got anything appropriate and the next thing is to take the keys out and wash everything. So the keys are actually quite uninteresting, they're just simple chunks of plastic. The tricky bit is the order. Luckily I have photographs of how this is supposed to look so I can go ahead and just turn the thing over. I hope and that's the switch popped out right and these are all the bits I need to clean. So let me go and get some warm water and then I think it's time for a cleaning montage. Yuck! Then I get to put it back together again and hope it works. Hot soap and water, sponge, paper towel, elderly tooth brush, we are ready to go. Right now it is all dry or at least dry enough so I get to put the keys back again and that will be exciting. Luckily I've got this key and unfortunately because the keys will just fall out if I put a key in at random it doesn't go in this way up. That's a letter key so it'll probably go there. There we go. So turning it over is going to be interesting so I have this piece of foam which should hopefully keep the keys in anyway we will see. Okay now let us start putting this all back together then. First thing is the screen. The screen did not clean up at all well. It's just horribly, horribly scratched. It really needs replacing completely. I will try and get some Brasso and give it a go and see what happens but I don't hold out too much hope. Now I'm not sure which way up it goes. That'll do. Get the fingerprints off the inside and of course, stray printer filament. Remove that. I've managed to flip some keys so we have to put these all back again. That's still more or less correct. Okay so now these go on. Two membranes. One goes there. One goes here. Now goes on the carbon mat followed by the not followed by the whole mat. So the way it works is you push a key that pushes the carbon pad up through one of these holes. This spacer piece keeps the carbon pads away from the PCB. The carbon pad then touches the PCB. However, we are not going to be able to put this on right now because this opaque piece is supposed to go behind the screen. So now we have to reattach the screen. So this screws down here. That does not look like it works because I've done this in the wrong order. That's why yes this screws down here and then the other mats go on top of it. Okay so we screw the screen on. Now with the right screws I think it was these small screws. There are only two of them and there's two screw holes. There isn't a hole behind that part of the screen. No that's just wrong. So we've got the one small screw for the PCB. So this actually goes here. Just take a brief moment to wipe it. Ah there we go. All right just wasn't in properly. Now the rubber mat goes on. It's got these cutouts here for the screw piece. So now this goes on. This goes on. Here I have gotten this extra copper piece which looking at the position of the screws goes on under the screen. Fantastic. So this is copper coated mylar I think. So that goes into place here. Now does this. Yes this doesn't have cutouts for the screen. Therefore it goes above the screws. In fact I think if I can get this off again that this goes on under the screen screws. All right so let's now do these up again. So what this probably is is a conductive sheet that grounds one side of the keyboard. Okay so this piece goes on. Could be wrong. So these the layout does seem a bit weird. I am going to have to go and check the footage but I would expect the copper piece to be on top of this to provide extra holes to move the carbon pads through. So this would then go on here and then the PCB would go on. I will go and check the footage and come back. Now this is actually correct. It's a bit odd but there you go. So before I do anything else I'm going to clean these contacts. I've got some contact cleaner. Just go over them. Especially the on off switch which is looking kind of grim. A strong smell of solvent. If I start behaving more oddly than usual let me know. Okay so now oh yes just give it a moment to let the solvent dry a bit more but while I'm at it you notice this key is different. That corresponds to this one. So what these keys do is they press the carbon pad against one of these contacts and that makes an electrical circuit. This one is different. This one shorts together these two sets of filaments. That is because that key is break which is an interrupt key. So all the rest of the keys will be scanned by the processor using a standard row column probe thing. The keys are divided into a matrix an x y grid and it'll energize one entire column of keys and then sense each one to see if contact's made and it will scan one column at a time or one row at a time. This key is different as this will is probably connected to an interrupt line so that even if the machine is busy and you press break and it's not scanning the keyboard it will get the CPU's attention and something will happen. Okay so now I want the small screw which goes on here. Now when it comes to while I'm here again let's just just do those. I don't think there's anything else that needs cleaning. So in order to snoop the bus I think I will need access to these terminals and possibly some of these. It does say under here somewhere on the PCB what the various pads do and these chips are well understood so you can identify what the various pads do from the data sheet. The actual ROM containing the code is built into the CPU so it's completely inaccessible. What I'm hoping to do is assuming the CPU when it's doing a ROM access still has the address and data lines hooked up which seems pretty plausible for a simple processor. Then I should be able to watch the chip select lines and the data lines and the address lines. There we go I don't want that but I do want to clean the gunk off again so more contact cleaner. So what we've got here is clock voltage AD address data multiplex but we also have IO12354678 the address lines 0 to 7 8 9 10 11 12 just 12 and multiple chip select lines. That seems doable. These pads are big enough to solder on to if necessary. I'd rather find a connector but I don't think I will. I'm not going to do that now. It's also worth exploring these test pads to see if they hooked up to anything useful. I don't know what SPI says. It probably does not mean standard peripheral interface like they do for other for more modern systems. Okay anyway now these springs go in there and there. This little spring did that go under the board? I thought it went there. I think it goes under the board. Here's the wrong screwdriver. Yes that went there. So it'll very soon be moment of truth time when I find out whether this thing still works. Okay so now the chassis goes back on. Here's these two springs poking through. I think I may have put these on upside down. Yes that's better. Now all the screws do up again. Start with the one in the middle. So you see this has now exposed lots of useful test pads. It would help if I had a wide logic analyzer so I could hook it up to all these pads simultaneously and get a trace. However my only logic analyzer is a 8-bit wide one so that's not very helpful. It'll be instructive to connect it to the address lines. If I see the address counting up in small increments of one or two bytes that will be fetching opcodes from the ROM and I can probably rely on the data lines showing me the bytes being read from ROM. The other thing I need to hook up to is the chip select lines because with luck when reading from the ROM it will not be asserting any of the chip select lines because the chip select lines will be there to access RAM. That way I'll be able to easily distinguish between ROM and RAM. If I can decode the ROM then ideally this would then lead to reverse engineering the instruction set. That's getting pretty hard but one possibility is to try and find an area of ROM that's unpopulated and then force the machine to jump to a location there. I could potentially using a microcontroller connected to this interface then simulate ROM and run my own machine code on it. I mean this is not useful in any sense of the word but it would be cool. Okay we're now powered on by the way. Okay and I'll just put this back on to just cover up those two slightly delicate springs. Whoa and we have something on the screen. It's not responding to anything in the keyboard. It's printed some gibberish. It's not even responding to the on-off switch. There's a reset button here. Right let's turn itself off and we have a flashing cursor and it's responding to key presses and now it's clean so I don't feel dirty for pressing keys. Hopefully they're all in the right place. It looks like it. It's frozen again. That's very interesting. When I press the X key to actually execute something it crashes. Well I'm going to try putting it into basic. That's crashed again. Something's not right. Probably a short somewhere. One for basic. All right that has gone into basic and it says there's 12k free. It seems odd given this is probably an 8k device. I'm going to try new all for wiping all memory. PR error not printed on the help card. Okay I'm going to have to look up what that there we go. PR PR PR error protected error. Interesting. I think when I took the backup battery out memory got corrupted and I need to do a full reset somehow. Let's try all reset back into calculator mode. Yeah okay it's working. Good right I'll take a break and look up some programs and also go and try and find some screws to hold the back on. See if I can forgot anything in the junk drawers that will fit and then I'll come back and make it a bit more visible on camera and try and demonstrate why this is such a cool device. So here we are. I will now demonstrate the machine now it's clean enough I can bear to touch it. So there is one problem which is that these LCD screens are they have a notorious Celine narrow angle of view which means that either the camera can see it which is up here or I can see it which I am over here but not really both at once so I've adjusted it to be visible on the camera so I'm actually having a bit of trouble seeing what's on the screen but we'll see what we can do. So this is a pocket computer it's designed for mobile use you take it out of your pocket you do something you put it back again it comes on instantly like genuinely instantly it's got a surprising battery life of 100 to 150 hours on those two little button cells it's a surprisingly nice machine to use it's got three main modes of operation the default one and the one which is in which it is in now it says cal up there is calculator mode where it will execute evaluate a expression and this is just using the standard basic expression parser with a few extensions and it's surprisingly decent you've got no power operators the usual sign cosine operators arc sign meaningless error messages that you have to look up here so m a error means mathematical error because arc sign of eight doesn't make any sense you get variables I'll just stick the thing into lower case to make it a bit easier to read so I can say x equals five now I can say x and it'll evaluate it x the power of 2.1 you know usual things it's got a bunch of useful mathematical functions including factorial you get that using the fact keyword that's the wrong key and you can either use the shortcuts which you probably won't be able to read because the paint's faded which you get at using shift and one of the keys so shift up arrow produces fact or I can just type fact it's all case intensive done that again so factorial five it's got polar and rectangular coordinate conversion it's got a few basic permutation and combination functions degrees minutes and seconds conversion using dms string so I can say dms string 1.5 and out will come is a string value which is 1.5 degrees in base 16 notation you can do string variables just like in basic so a string you can't you can't obviously you can't do mathematical operations on them tm error is type mismatch it's got a rather interesting formula evaluation function so if I enter a formula using any variables and then press in that will store it into function memory and I can press out to reproduce that at any moment you can use it as a simple clipboard but if you press the calc button it will analyze the expression you gave it to find the free variables and then allow you to enter numbers for them and then calculate the result and you can do x times y colon b equals x divided by y that is two function two expressions functions one after the other with a colon put that in now if I press calc it will actually ask me for both so I can see two three and give me both results simultaneously which is actually quite useful and that is about it for the calculator mode the main other feature that you get out from here doesn't really have anything to do with calculator mode but that's the standard library which is a huge library of useful routines this is the list of them each of which is identified by number you there is a browser so I can press menu and then page through them one at a time quite slowly but it's much easier to look them up here so for example uh library routine 5050 quadratic equation I saw it 5050 press lib and this is the quadratic equation solver it will prompt me for the three values of a b and c and outcomes the two roots uh minus one plus that isn't quite how I expect quadratic ah ah that's a negative that's uh that's an i that's a complex root I gave it a quadratic equation that cannot be trivially sold but it solved it which is nice there's a lot of these there's a bunch of mathematical ones there's a bunch of statistical ones I just don't understand there are also some routines that just provide cheat sheets so for example 5910 scientific constants uh is just a library of useful scientific constants which you can page through and find I recognize some of them that's that one's the speed of light I can't quite read that oh charge of the electron earth's gravitational acceleration average um fine number constant yeah let's move on it's been a long time so I've done any of these um all these library routines are written in basic you can write a program on this machine that will pull them out of rom and print them which will then allow you to type them in again and modify them they are pretty spaghetti code I have to say and that brings me to the second main mode which is programming mode to get at that I do mode one that takes me into basic programming mode there are 10 program slots you can use and you can switch between these at any point and each one of these is a is its own basic interpreter so I can type in a basic statement and it'll execute it immediately or I can put it in a program and run it and if I go back to the program mode menu star here indicates there is a program in this slot this is how much memory is free I don't have any of the memory expansion packs on that I can go to program slot one is empty program slot zero has something in it it's a fairly basic basic if you're used to Microsoft basic there will be no surprises here it's got numbered lines subroutines are called with go sub it's got arbitrary lengths variables it's got string variables it's got multi-dimensional arrays that's about it there's nothing particularly exciting there's a lot of undocumented features which are quite useful so I can say print peak zero and that will read the bytes at memory location zero in the data RAM not the code ROM Harvard architecture machine remember because the ROM is bigger than 64k you can only access 64k at a time but there's actually a neat thing called def seg that allows you to change the base address of what you're reading so that will now produce a different number because I'm referring to a different part of the ROM the ROM is largely been reverse engineered it mostly contains the library functions the interesting bit which is the basic interpreter is in the code ROM which is currently inaccessible what else has this got this interesting it's the screen is actually eight lines high and you can steer the cursor around just like you can on the Commodore 64 you can list the program and then go up to the listing and let's put some punctuation in like so and when you press xc it will read the line off the screen and re-execute it so that has now entered that I do list here it won't work because I was actually overwriting the ready prompt so there you see it's actually updated our program which is quite nice there isn't actually an editor using the edit keyword but I tried it a bit and it doesn't seem to be much so let's write a little game very very simple game so let's go from new to clear this program slot and this is just going to be a guess and number game so number equals we want to going to use the ran function to actually produce a random number multiply it by 100 and then take the integer value of that that will produce a integer random number from 0 to 99 uh count equals 1 because we're on our first guess 30 is going to be where we're starting we're actually going to prompt the user for a guess so in real life you wouldn't actually use long function or long variable names because they use up a ton of RAM and this thing only has like three and a half k of available RAM anyway so if guess is less than number then print low for line 50 this is going to be very similar so we're just going to steal which is going to copy line 40 and you see that it's tokenized the the code that I gave it and has capitalized the keywords which is nice you don't have to supply spaces between keywords unlike a lot of other basics if you emit the space between if and guess it will still treat if as a keyword uh so we're at line 70 yeah okay 70 if guess is not number then go to 30 so when we reach line 80 we have actually finished so yeah annoying feature the shift key is a toggle you can see the indicator there going on and off and you can't press two keys at once so and also it doesn't capitalize letters you have to use caps to do that which is also a toggle so I prefer typing in lower case so in order to get the capital G here or the capital Y here I have to do caps Y caps so you've got it in count goes right that should actually work guess the number 50 too low it tried to scroll the screen it has paused with the stop indicator on for me to press X to continue so 75 too high 60 too high 55 too low d8 too high it must be 57 you got it in one goes that's not right uh that's because I forgot to increment the guess counter which happens here uh count equals count plus one go to 30 there's a clear screen somewhere you go shift B s right run guess the number 50 that's happened before I think that's because I started typing when it was in the stopped mode I don't actually know where the in the text entry goes there which is odd so 50 was too low let's go for 75 too high 60 too low 65 too low too high too high really so I tried 75 65 there we go you got it in 13 goes well there we have our program uh if I go back to mode one we still have 3300 bytes left bytes seem to go a long way on this which is quite nice uh yes there is a third mode and that is the memo which is here under memo this is a single text file that you can keep in memory so if I'd go to mode nine memo in I can do you know random text random text up here there's a little display that tells you which field you're on uh oddly it only updates after you start entering something but anyway we now have three lines of text in the memo pad you can see the field number changing you can browse it and edit it by using the memo key although the interaction between memo and mode memo in is a bit strange right now I've entered some text if I go to program one and I say read a string and data like that now this is a basic feature where you can embed data into your program there's a data pointer which starts at the beginning of the program whenever you do a read statement it will advance to the next data statement and read the value attached to it in a copper comma separated value way so I actually forgot a line here so we do print a string this is relevant trust me like so so if you run that it has read the one line of data that's embedded into the program now where this relates to the memo pad is if I instead of read I do read hash and I erase line 20 so now we just have read and print that has actually read the first record from the memo pad if I do 20 go to 10 so it turns into a loop so this there's now reading one record at a time from the memo pad and you notice a da error means out of data it's here and if I press if I go to mode in and press memo you can see that it has read text as one record more random text as another record and each of one comma two comma three become three more records so a new line or comma separated values so this allows you to write a program that operates on data in a file put that data into the memo pad and it will iterate through this is surprisingly useful the the basic decompiler which will run on this actually operates by having a memo pad table of where all the the routines are in the ROM it's certainly easier to enter stuff into the memo pad is to put it into data statements now there are more features I mentioned peak and poke I can load and save so I can just save the program to cassette and this is now actually doing it but I don't have a cassette attached so it's not going to do anything it's just going to push it out to the peripheral port and will eventually there we go finish you can also save the memo pad and you can save all data but it's all 10 program segments plus the memo pad you can open and close files on tape to do sequential access it supports two different cassette devices so you can have one for input and one for output don't have any of that hardware apparently it's quite easy to emulate with a microcontroller so that might be worth a try it's got a RS232 port I think it's actually a TTL RS232 port but there you go and you can open streams and read and write from that you could use this thing as a simple serial terminal if you wanted to it's got a printer and you can either use you can open an output stream or you can use the L print statement I don't know what that'll do it's hanging because it's waiting for an acknowledgement for the printer that's not attached so despite being so small this is actually a pretty capable and fully fledged computer it is not the quickest I have yet to find any time functions which is unfortunate so I can't run a benchmark I'm used to I wasn't expecting that to do anything okay uninitialized variables apparently become default to zero which is surprising there's a bunch of other things which you can see on the on the screen there's a couple of letters of Japanese on the left we've got def m prutt and tr prutt is probably for printer output you can actually oh I can do mode seven yes that's lit up so now everything that comes out will go to the printer or not because I don't have a printer right and it's now hung waiting for the printer to respond it's filled up the printer buffer so let's turn that off shall we that's mode eight yep I don't know what def m is tr is trace so if I go back to program zero which has got our game in it I can do tron trace on and now every time it hits a line it will log the line number this is the only debugging feature let's turn that off again there is more stuff tucked away oh yeah you can define it doesn't do graphics but the character set is user definable well some of the character set is user definable so you can create your own graphics characters um there is actually a there is an undocumented library function which doesn't appear in the chart should we go back to calculator mode it is 0400 lib and this is the self-test routine so that has just detected 8k of onboard ram no add-on ram it's done a simple memory test it's detected one megabyte of rom these are selected bytes from the rom probably some sort of rom id a screen test all pixels on all pixels off only odd pixels only even pixels this user's user define characters and now it dumps everything to the printer that's not going to work so break out of that there are some others including a undocumented routine that will import basic programs from a different version of the calculator if you happen to have one of them so that's the fx850 one of the more seminal pocket computers that ran basic there were others castio made a whole range of these the early basic pocket computers actually ran of two four-bit processors using video ram to store the program you were running which is extremely weird but making effective use of the bespoke hardware they had later ones converged on the z80 along with the texas instrument line there was a line of trs80 branded pocket computers that were z80 based ran basic very very similar to this but different they gradually fell out of fashion as graphic calculators got more sophisticated and i actually have somewhere a voyage 200 here it is my voyage 200 late era graphic calculator uh on the batteries have gone flat uh this thing has a 68 000 processor lots of ram a monster rom a huge library of software most of which i can't use and a programming language that isn't really basic the keyboard is actually slightly better it's a bit more tactile and the keys are a bit bigger than on this but it's still not brilliant um but that is very much a graphic calculator and programming is a bit of an afterthought i really like these devices which are front and center pocket computers the calculator mode is uh just an extension to the basic interpreter the entire library is written in basic the basic interpreter is the heart of everything that makes it work and i like that i like the fact that it's a real computer that you can connect peripherals to and do things with and you can add on to and the form factor the fact that it's designed to be pocketable the find that it's designed to be programmed is some things i feel is rather missing even though everyone these days has a smartphone with a billion times the power of one of these the smartphones are consumer oriented devices you do what the smartphone tells you you can do this gives you a basic prompt and some uh functionality and you know it'll do whatever you tell it to do which i like i think i will actually get use out of this i haven't found myself using either the voyage or the hp 48 simply because the learning curve is too high and well the learning curve is too high if these both ran basic i would use them constantly it's a bit of a shame that the basic dialect is kind of bad but that's what it was in those days anyway that is my casio fx 850p i hope you enjoyed this video please let me know what you think in the comments