About Me
Michael Zucchi
B.E. (Comp. Sys. Eng.)
also known as Zed
to his mates & enemies!
< notzed at gmail >
< fosstodon.org/@notzed >
You'll be censored!
If I did it right, hopefully you got a (at least) slightly alarming popup box about the planned government censorship during this week. See more details at The Great Australian Internet Blackout site.
I guess 66% of my visitors are from overseas and the other one knows about it already, but I thought it was an interesting form of protest ...
Bumbling along like a ...
Well, A/C supposed to be fixed today. Finally a service tech was called and came yesterday, and a couple of minutes on the roof and he was ordering a new control unit. Dodgy caps not too uncommon apparently. But because of the increased demand they don't have any spares ... hopefully that's all it is, as it's just in the nick of time - weather starting to turn hot.
Kept bumbling along with my FORTH attempt. Would really help if I concentrated a bit better, but lack of sleep and so on. Not entirely switched on. Still, making some progress.
I decided to standardise some of the basic words, which meant a lot of breakage. But I more or less have that going, and implemented DOES>, which jonesforth didn't implement. These changes mean I wont be able to use much of the bootstrap for jonesforth either - but I guess that will just make it a better learning exercise, wont it.
I'm still sticking with assembly where possible, although considering just using c for call-outs to significant processing steps; that's basically how the assembly is written anyway. I'm finding reading the standard a bit tough going - understandably it's target audience is really people who have a lot of experience with FORTH implementations already.
It's a huge mess though, but perhaps now some of the basics are starting to work I can think about cleaning it up a bit. Then add a few bits and pieces and then start trying to use it. I want to add some hardware exception handling at least, so crashes aren't fatal. And I need to be able to input from memory to bootstrap the code. Well something to keep poking at I guess.
The saga continues ...
Well to answer the question posed two articles ago - nobody uses those old things anymore. Just had the sparkie around and he wired the a/c on a separate breaker (probably as it should have been in the first place) and moved the kitchen/laundry to a breaker too. He said they only come across those fuses when dismantling old fuse boxes.
So all that done, time for a hot coffee.
But the a/c didn't work either - panel did all the right things, pump too, just no air being pushed ... then it blew the breaker. So another visit from the installation guys basically just to confirm it's just broken and now a call's been lodged with the manufacturer for a 'service call'. Hopefully it's just a bung controller.
The insulation guy eventually rocked up yesterday too - and I had it installed by the end of the day. I suspect there's an awful lot of roofs in Adelaide that fall within the 100sqm limit of the 'average house' (hah, asif). Quite painless, although who knows how effective it is - they split some of the bats up to lay over the old stuff.
FORTH
Mucked about with the FORTH some more, with all the interruptions and comings and goings that didn't happen till the evening - and then about 9pm I noticed it was dark. Not sure if that's a good thing or a bad thing (I definitely know that the 2 packets of chips and beer I had for lunchdinner[sic] was a bad thing though!). But as you'd expect given that it was a new processor to me, and that I was too tired and interrupted most of the time I was working on it - almost everything was wrong. Wrong registers in places, wrong order of registers, incorrect memory calculations and so on and so forth. But after many many iterations of fixing one function at a time I finally got something that compiled basic functions ok.: a 42 EMIT ;a
*
Well, "yay".
The current INTERPRET loop processes every character as it receives it - with no line editing and so on, so I thought about improving that. Didn't feel like writing that in assembly, so I fell back to C (TBH the compiler does a very good job with ARM code for the most part - but the core FORTH works better in assembly). I wrote a simple little 'readline' function with basic editing for single line input (cursor keys, delete, backspace etc) using terminal escape codes. That should do the job to start with once I hook it in.
As an exercise I thought i'd port it to FORTH instead. I was quite surprised - it (well, on paper - I don't have enough bootstrapped to build it yet) came out smaller (well no surprise there) and easier to read than the C equivalent. There's a few ugly bits but they can be hidden (or written better - no expert here). That's really what makes FORTH an interesting language, because you actively extend the language or add trivial functions to hide details without any penalty (in runtime or source baggage) for doing so. And it is real language extension including syntax, not just the run-time library. In-fact, since a threaded-interpreted run-time is so small I imagine the original powerful concept was that you could even radically alter that if need-be, although I think standardisation efforts muted the use of that `feature' to some extent.
I do think it falls down a bit on the variable front - they all work as explicit pointers, although I noticed there are now 'newer' concepts like 'values' that abstract some of messiness (and inefficiencies) away. And generally this stuff can be hidden away from most of the code.
Anyway, I'm quite enjoying this, so I'll see where it takes me, i've already got some ideas for tweaking the implementation and so on. Tho I'd better get outside and fill the bin with rubbish today as well, or it'll never get moved.
Freshly Picked
Blah
I knew the day was going to go wrong when I forgot to put coffee in the espresso maker before putting it on the stove.
- Aforementioned extra-light coffee. Well I guess it needed a bit of a clean anyway.
- The government is running a silly middle-class welfare effort to upgrade or add insulation to homes. Someone rang about it yesterday and was supposed to rock up at 8 (this early rise is almost certainly the cause of the coffee incident). They did call just after 8 to say they'd be late - 10. It's now nigh on 12.
- I called the A/C people about my dead A/C. Ok no problem, we'll have a look.
- Did 'one last check' before I embarrassed myself, not expecting anything. Lo and behold - it worked.
- Called to let them know, but still wanted to talk with a tech. He was busy so they'd call back.
- Left it running. Went to make my coffee (coffee in espresso maker this time), I use a microwave to heat the milk. Ahh dead microwave. Threw me - rest of house is working. Ahh blown fuse.
- So ... back on the blower. Ok they'll try to get someone out today.
- Couldn't work out which fuse it was, so ended up rebooting the whole house one circuit at a time as I checked. No replacement fuses, and the thing doesn't use a wire either. 5km to the nearest hardware store. Might be time for a ride.
Between me and a hot coffee or a cold house. Who the hell still uses these old things anyway?
Now I'm Just Tired.
*yawn* wow i'm tired. Although I bet it's not a patch on friends whose family just grew by two today! Congrats to Jon and Kate on the twin girls.
Just sat around hacking all day - that wouldn't help. And eating too much pizza - trying to use up the sauce i defrosted! And I had a long day yesterday, ending with a 1st birthday party for another(!) set of twins in my circle of mates.
As it happened, whilst I was was writing the last post my brand spanking new A/C died! Feck! I thought the 'new pad' smell smelt a bit more 'blue smoke' than it had the day before, but didn't take much notice till a few hours later when nothing was working (I was in another room without vents). Ahh well, just as long as it's fixed promptly, at least it's cool for the next few days.
Well I thought i'd take a break from the interrupt stuff and had the notion of playing with FORTH for a change of pace. I never was much of a FORTH hacker but was always intrigued by it from when I was a kid with a Commodore 64 and somehow ended up with a copy. Even the local country-town library had 'Starting Forth', which is a rather novel programming book (and even if you don't like it, you'd never forget it). I think I even wrote a 'parallel cable' loader for the version I had! For my uni computer hardware class I wrote a type of FORTH as a shell on our hand wire-wrapped 68000 based computer so I could interactively write a program to blink the LED rather than having to re-write the EPROM every time I had a bug (yeah an EPROM! The ones you have to erase with strong UV light!). Although FORTH has been used repeatedly as a bootstrap/bios system for many years had no bearing on wanting to try it, it just seemed like a 'fun' thing to look at again.
Thought it'd be a good opportunity to learn a bit more about ARM assembly too. I found a simple forth implementation written in x86 ('jones forth') and so set about porting that (seemed easiest - it's been so long I couldn't remember much, and I know my implementation did a few things wrong). I was making really good progress until I hit some of the larger functions, but that was because I was trying to write reasonably decent code and learn some of the ins and outs of assembly language.
ARM assembly is more powerful than I thought it would be - in every case the code is cleaner and simpler than the x86 equivalent (excepting /mod - no divide instruction) - although x86 is particularly arcane (to be atypically polite of me - in reality, I think it's shithouse), so that is probably to be expected (and given that every instruction is always 32 bits long, it gives a lot of bits to play with). At first having a condition code check on almost every instruction, condition code updates optional, and a 'shift' operation seemed quite obtuse. But it has a sort of synergistic effect, practically giving you all sorts of extra base instructions let alone super-instructions that do two or three things in one. It's probably more compiler friendly than hacker friendly, but the assembler has some support to aid humans, like automatically choosing the best way to load a 32-bit constant (immediate constants are only shifted versions of 8 bits, so often you need a register/pc-relative load).
So far I have managed to get pretty much all of it typed in and assembling at this point, but then I was too tired to try booting it up and fixing all the bugs. It's only 1000 lines of assembly - most of which is 2-3 line functions, comments and meta-data, so it shouldn't too bad.
Interrupted train of thought
So i've been trying to get interrupts working on my beagleboard since yesterday ... bloody hell what a hassle. First I was trying to get a 1Khz clock going but not having any luck I switched to getting the vblank interrupt going. Of course, writing to the registers properly rather than using the offset as an index to an int * went a long way to making progress there. Damnit I keep doing that, envisioning each array access as register indirect with offset, when it isn't quite that. Yesterday I didn't make much progress - the busy workers, the noise, and the ungodly early start to the morning kept me from being able to concentrate on anything too much.
But even after working in it most of today ... it still isn't there. I (finally) get the interrupt ok, but then it never turns off and instantly returns once it's finished. Well either that or causing random crashes in the non-interrupt code. So some problems with the interrupt handler somewhere itself - like clobbering registers - as well as the way it's talking to the hardware (I'm clearing the interrupt everywhere i've discovered it needs clearing - the DISPC and the INTC). Might leave it for the weekend and see if a fresh mind doesn't help.
Oh, I also ran across some curious behaviour with the assembler and/or linker. I had some code intermixed with some constant strings. The code following the strings was all messed up, it was being written to non-aligned addresses (which is wrong for ARM). And even when I fixed that up with a .balign pseudo-op, the memory references within the code were wrong. e.g. a function call jumped to the wrong address - out by 2 bytes. Moving the strings after all the code segments fixed everything up. *shrug*
The A/C got installed ok yesterday - well eventually. The ceilings turned a 3 hour job into a 7.5 hour one. Although I think some of that was just throwing the installation guys off balance a bit. Well, it's all done now. Nice too - managed to sweep away all the stale smelly air in a matter of minutes, which was a nice bonus ontop of the cooling. Now I just need a good stretch of hot weather to test it properly. February is always guaranteed to oblige with that, and is just around the corner. Also cleaned up some of the wood in the yard from the photo in the last post. Not that you'd tell if I took another picture now.
Just went out for a few drinks and was hankering for a pizza on the way home. Nearly dropped by the local joint but needed a wee more than some baked fat. So being the tight-arse hermit I am, I thought i'd make one up rather than venture back into the wilds of the night. I also wanted to try and use some chapati as the base. I've been too lazy to make yeasted bread lately, so chapati has been a bit of a staple when I felt the need for some bread. Had some frozen sauce left over from earlier efforts, chucked on some bacon, cheese, onion, capsicum, chillies and even some thinly sliced squash (i'm drowning in the damn things), bung it in a hot oven, and bob's a dead cousin.
So for something a bit different, here's the chapati recipe I use, although there's not much to it:
- 1.5 cups plain flour
- 1 cup wholemeal flour (adds a nice texture)
- 1 cup water (warm)
- 0.5 - 1 tbsp olive oil - vital, stops it sticking to everything like glue
Mix together till it forms a dough. Knead for 10 minutes. Rest for 10 minutes wrapped in glad wrap. Break off a 3-4cm ball and roll out flat with a rolling pin to about 2mm thick. Cook on a dry medium-to-hot frying pan or hot plate for 1-2 minutes per side - until it dries out on top and goes dark on the bottom and puffs up a bit. Dough can be kept in the fridge for a day or so until needed, so it's 'single friendly' - it gets a bit tougher which makes a stronger bread too. This will make 6, and they are very filling (each one is approximately equivalent to 2-3 slices of typical wholemeal bread).
The cooking and how thin you roll it is tricky to get right. I've had everything from crunchy `salada' biscuits (which gave me an idea, might try making crackers one day) to something very like naan bread (much preferable with a typical meal). If you cook with some oil it turns it into a sort of fried pastry/tough pancake - tastes great but just has to be bad for you. I've also tried using a pasta maker to roll the dough, if you don't mind it not being round. The layering you get if you keep doubling and running it through the machine also alters the result (don't go too thin of course). It's supposedly possible to have it puff up like a balloon if you finish over a hot flame, but I've never managed it.
For the pizza I undercooked it a bit since it was going in the oven as well, but cooking it a bit first made it a lot easier to handle and put on the pizza stone (something I never managed with bread dough without using baking paper).
Then a bomb went off.
Finally got out in the yard late yesterday, and this:
became this:
What a mess. Fortunately it was easier than I had anticipated, it only took a couple of hours for all that destruction. The posts were just sitting in the ground so they were pretty easy to remove.
Actually that first shot is from before I removed all the paving and dug the foundation trench for the retaining wall, so it's more like a weeks work between photos (or 6 weeks realtime ;-).
Getting a ducted evapourative a/c installed today - was originally penciled in for Monday so I would presume the guys are quite happy it is a nice 25 today rather than 42. Although they're not that pleased the ceiling is a very old style plaster type, which they didn't quote for, but I guess that's what the salesman gets for being too busy to visit the house first. Looking forward to getting some fresh air through the house, and during the last heatwave having the split system running all day was both expensive and dried the air out to an uncomfortable degree. And it'll be nice having the bedrooms all cooled too.
Copyright (C) 2019 Michael Zucchi, All Rights Reserved.
Powered by gcc & me!