Brain Sprinkles‎ > ‎

Everything Else

iPhone X Max wireless + cable charging = faster !

posted 5 Nov 2019, 11:19 by Dom De Vitto

So, it doesn't look like anyone's done any actual science on wireless charging of iPhones, so here are my tests:

Setup is a Portapow USB power monitor, plugged into my Macbook Pro, so hopefully more than enough USB3 juice can be delivered.
Off that is a powered USB3 hub - powered from the Portapow monitor.
Off one port of the hub is a standard iphone cable.
Off the other port of the hub is a wireless charging pad.

1.00 watts = No iPhone connected
3.40 watts = iPhone X Max (at 50% battery) connected & charging. (and when disconnected again back to 0.95 watts)
5.90 watts = iPhone put on wireless charging pad

4.20 watts = Both wireless and wired charging!

Without hub, and going direct from 10W wall charger.
8.80 watts = cable only
5.00 watts = wireless only

Tough Mudder Tips

posted 14 Jul 2014, 17:38 by Dom De Vitto   [ updated 20 Jul 2016, 05:21 ]

This is The Mudder Pledge, it's recited by every Mudder before every event, and embodies the spirit of Tough Mudder:
  • I understand that Tough Mudder is not a race but a challenge.
  • I put teamwork and camaraderie before my course time.
  • I do not whine – kids whine.
  • I help my fellow mudders complete the course.
  • I overcome all fears.
These values are 99.99% voluntarily adhered to through the course, in my 125 hours of doing TM, I've heard one person moan, once - they really didn't 'get' what it was about (see above), and thought it was too hard/muddy/long/silly.  Don't get me wrong, when I ask mudders, half the first timers say they'd never do another - but they are resolute that they are going over that finish line today.  Yes, this means the other half go on to do more events - often doing the same local TM every year.  The Everest-like level of challenges, and the feeling of brother/sister-hood is powerfully addictive.  Expect lots of high-5s and fist-bumps.

There is no clock at the start/end of TM - because how long you took is irrelevant, more important is 'How many have you helped?'.

Teams work together, but nobody is ever 'outside' of a team - I've even been co-opted into teams on the way round.
Mudder Legionnaires (also called multi-mudders - people who's done it before) really do help others through - I've raised spirits of the weary, lifted countless people up Everest, shouted at those who lost confidence halfway through 'Just the Tip' ("You will not fall in the water!  I am not letting that happen!"), held someones hand through 'Dirty Ballerina' and shoved enough female posterior up high walls for it to be relegated to a duty, not a pleasure!

Afterward, the look of achievement on people's face (mine included) is amazing - they faced a fear, and they overcame it.

Above it all, I've laughed so hard I nearly cried....

I'd say you should be able to run 5 km (3 miles) , and probably be doing it at least once every couple of weeks, at a minimum.
If you can't do that, you'll probably be walking between obstacles, but more importantly, just walking the 10-13 miles over rough terrain requires your legs and feet to have stamina, and be able to operate - if you normally get a huge blister after 30 minutes of walking, then 4-5 hours will be hard.

You should be able to do at least 3 chin-ups.  There are obstacles that simply require you to pull yourself up or along (walls in particular), and even with someone pushing from below, you'll still need enough pull to finish the job.  Mudders will help, but you shouldn't rely on this - you should aim to help others more than you are helped !  If you can't achieve 3, you're 99.9% certain to get wet on Funky Monkey or Hanging Tough - but wet isn't too bad.

I recommend short, single-skinned, running socks.  Short so they don't soak up 10 kgs of water and weigh you down while you're in, or out, of the water.  Single-skinned because double-skinned ones tend to not let the water out - they are great for running without getting blisters, but they become like bags of water when submerged.  Do not expect your socks to survive.  I once washed a pair of socks 5 times by hand, and put them through the washing machine twice, and they were still gray and dirt was coming out - it was like a magic trick.  YMMV, but don't wear ANYTHING you really care about. as TM is not a garden picnic.

I recommend trainers designed for trail running - e.g. Adidas Kanadia TR5 (I lost somehow my pair of TR5, so now have the nearly-as-good TR6).  Road trainers are NOT a good idea, they don't expel mud from the tread, and quickly become smooth-bottomed and slippy.  I wouldn't recommend road trainers for even trail running, and a TM is 10x worse than that.
Remember that your trainers will be submerged in muddy water for up to 5 minutes, so 'waterproof' ones are silly - they will just fill up.  TEST your shoes by running through at least shallow water and churned-up mud.   Make sure you've run at least two lots of 5 km in the shoes before the TM, as if they aren't comfortable, you will really feel it after a few miles. 
Let them dry out near-naturally (e.g. in sunlight, or in a airing cupboard) and then 'bang-off' the dry dirt.  Washing machines are not kind to trainers, and these shoes will become your best friend.

People wear every kind of shorts imaginable - but really I'd go with whatever you're comforable running and crawling in.  You'd need to be an idiot to wear denim dungarees, but whatever you wear remember it's going to get very wet within 30 minutes of a 4+ hour event.  I cover my inner/upper legs in petrolium jelly and likewise the bottom edge of my dungarees, which are also completely soaked in a rug waterproofer solution.   'Short' shorts are probably best (I wear some underneath - 'just in case') but compression legwear can be good too.  Test whatever you wear on a 10k run after you've soaked yourself in water and check for chaffing, 'pockets filing with water' etc..

Really? People do, but unless your shorts are entirely see-through when wet, it's probably not worth the extra wet-weight.  Shorts should have liners to stop your junk falling out, so any extra garments is dead weight you'll probably be chucking away rather than washing.

Much of the same applies here, though obviously sports bras may be 'necessary' - again a 5 or 10 km run test is probably enough to see.  Remember it will get soaked through, so your nipples may show through - but nobody will care.  If you care, I'd recommend waterproof plasters instead of going for a bra with padding - as it can just soak up water and double the problem.  Petroleum jelly on the edge/straps is probably also a good idea.

I tend to wear a long-sleeved top, because it goes with my costume, however most just wear short-sleeves.  This does expose elbows and forearms to cuts and grazes, but it's less wet-weight, and probably warmer that long-sleeves when wet and the wind is blowing.  Whatever top you choose, remember it needs to breath, and will be getting filled with water.  I'd recommend a size larger than normal, as when things are wet they stick to skin and are uncomfortable.  Ideally test your top by swimming in it and doing a 5km run afterwards.

Want to wear something on your head?  Good luck!  It'll be fine when running, but remember you'll be diving under stuff, dodging electric wires, etc. etc. in particular with 'Cage Crawl' you only have maybe 6-9 inches (15-22cm) of head clearance for breathing.  I made the mistake of wearing 'minion' goggles, and this made the obstacle MUCH harder - same applies during Arctic Enema.  Now I move the goggles to around my neck, off my forehead, for this, and the other obstacles.  When jumping from 4m into muddy water, or being thrown through the air into water, expect anything that can be pulled off to disappear and not be seen again.

GoPro owners - there is a dedicated page as part of the TM 'lost and found' website for GoPros... ...why do you think that is ? :-)

The only thing that is normal headwear is your TM headband - though the same advice to wear it on your neck (or wrist) applies for some obstacles.

I recommend training with, and wearing, gloves, e.g. open tip cycling gloves with a sponge palm.  Something with more grip than skin has when wet (and you hands will be wet when you need that grip the most).  They also protect a bit when crawling over rocks on your belly, and the spongy palms makes that easier.  Same goes for knees and kneepads really, but I don't mind cut / scarred knees ! :-)  Most don't wear gloves, so but it's worth making a considered decision about it.


For the electric events, they say remove any metal studs etc.  Frankly, it's more of a risk that it'll get snagged and tear your skin, and/or lost - you're crawling on your belly, swimming through muddy water etc. for plenty enough time to loose just about anything.
A meditag is probably the important exception here.

The Week Before

A week before you should get a course map email and 'information packet' with where exactly to park, directions (they close lots of local roads!) and other stuff.   Maybe consider Carb starving & load - don't overload on carbs.  TM provide bananas or energy bars at a couple of the water stops.
There are no cash machines on site, and only a very few (clothing) places might accept cards, so bring enough cash for parking, bag drop, buying a food afterwards (Cheese Burger & Chips is around £10).

On the Day

If it all goes wrong, they will probably accept a credit card as ID, can look up your ticket online, and probably have copies of waivers you can sign.  There will be up to 40,000 people doing it, so every oddity has already happened, many times.

Your Ticket

This will come attached to an email with 'Registration Confirmation for Tough Mudder' in the title, but is also on the Eventbright site for download.
The ticket is either a single printed A4 sized sheet or you can used the Eventbright (in the UK) mobile phone app.
I've never used the app at the entry point, but it seems pretty straight forward: Download app and login to see your tickets, or prove to others that you have one.

Bring on the day your signed participant waiver (2 A4 sides, preferably on one sheet).
Spectators need Spectator Waivers too.
Extra waivers of both kinds are usually ('may') be available, but relying on that would be stupid.
No waiver, no entry - even spectators can trip on a clump of grass.

Your Number
Unlike many other events, you don't get your number until the day, after you're shown your ticket & handed in the waiver.

It will come in handy :-)


I'd eat 90 mins before you start - Brown bread toast, with peanut butter and honey is like a Nitrious boost. (Carbs+Fat+Protien+Sugar)

What to do when you arrive
Look to arrive 60 mins before your start time, that might seem like a long time, but it's not because you'll need to:

On entry you'll need to pay £10 per car.
Park your car usually a 10 minute walk from the entry/start center.
Show PHOTO ID, your ticket and waiver at the entrance.
Receive your number, pin it on (suggest bringing bigger/better pins) , attach a supplied 'bag tag' to your wrist (orange) and your bag (white).
Get your arms and face numbered.  It's optional, but recommended!  Especially if you want to see photos of your taken around the course),
Put bag in bag drop (costs £3, and takes at least 5 mins)
Pee (Artic Enema is often one of the first obstacles - you won't want a full bladder for this :-) )
Legionnaires (aka Multi-Mudders, basically folks that have done it before) need to additionally register as such and get a headband if they didn't bring their old one.
Join the formal warm-up/start - where you'll hear the Mudder pledge and lost of Hoo-Rah! -ing :-)

Going Around

There are plenty of water stops (don't bring a bottle round the course!) and free banana and/or energy bar chunks on the way round, plus at the end.  I usually grab a couple of these bars to use for my next TM in case a rookie needs some energy between stops.

At the finish you get a lovely orange headband, a pint of (really nice actually!) ginger beer, some energy bars and a TM shirt.


Obstacle Strategies
Between the obstacles
Though everyone runs at the start, the course will be designed to spread out the pack, usually using steep hills before the first obstacle.  The best do a very mild jog all the way round, but most walk for maybe half the 11-13 mile course.  I like to keep my cardio raised so use the time and space between obstacles as a 'active recovery' where it's a chance to get oxygen back into your body and flush out any lactic acid in your muscles.

Don't forget to talk to others, joke, take the Micky and generally laugh with your mudder comrades - everyone is a brother and sister on the course, and forever afterwards.  I like to ask people what they'll be doing the same time next weekend - the answer is often 'grocery shopping' or something else extremely dull.  I think it helps people realise they are achieving something amazing today, something they will never forget.

Arctic Enema
Go, Go, Go !
Speed is important here - don't hang about and expect you body to 'get used to' ice cold water - it's freezing your muscles with every second you're in there.  They now have a ramp to get out, but in 2013 you had to climb/lift yourself out.  That was really hard because your muscles had already contracted and were about 50% effective :-(

Electroshock Therapy

Protect your head with your hands, like a boxer would - shocks to the head may disorient you, anywhere else is just going to illicit a rude word :-)

.....more to come !

BPB-37 (Display BIOS Parameter Block, Version 37)

posted 25 Apr 2013, 06:46 by Dom De Vitto

I wrote this in 1989-1990 and published it on 11th November 1992 (!), and found it again, still on the U-Mich Atari ST Archive.

Here is the documentation file:

BPB-37.TOS by Domenico De Vitto <> (only till 1/7/1995)


Well this the first bit o' program that I am going to fling into the

big wide world, and I'm only doing it because I'm off ill and this is one

(the one ?) bit of program that works 100% and cannot be improved

(I think ...) that I have ever wrote.

  First it was written many years ago (1989-1990???), not based or idea

copied from anything, it simply tells you all about the boot sector details

of a drive and also gets the lower-screen-half from the TOS, in case you

need to compare the details.


As you all thought that was a copyright notice and naturally skipped it, I

needn't be embarresed further in the document so anwards & upways...


Running it ...

It should have a 'TOS' extention because of its nature but I haven't seen

any difference when it has a PRG or TTP extention so it can be changed.

 It is meant to be run from the desktop so don't moan about it clearing

you shell screen, anyway I think it looks nice.


Things it does...

I was going to enter a huge piece of text on its workings but that is

really boring for all the non-programmers, and they can read the source.


This is what it does:

If you're in medium-rez it changes down to low - perfectly legal this

 and it's clearer.


Drops the title on the top line.


Gets from the TOS the valid drive letters and displays them.


Gets a key from the keyboard & converts it to uppercase (if a letter!).


If the key is a valid drive letter (bit complex this check) it displays

 the drive you selected (now in uppercase).


Reads in the bootsector from the right drive, even if the disc has just

 been swapped.


If the read sector call returns non-zero - error - tell the user & skip

 the display of the boot sector info.



Displays all the info it can about the boot-sector :

Boot branch - 'system disks' & the like use this to load the operating

  system, games (can) use it for loading quickly, as do virii.

  - if this is 0 you cannie have a boot-sector virus on the disk.(theory?)

Volume serial - used by the system to tell if you swapped disks, every disk

 should have a random serial put here at format time for this purpose.

Bytes per sector - $200 (512 decimal) on most disks - if its not the same

 at the ACTUAL sector size system may(??) go mad as a sponge.

Sectors per cluster - 'cluster' being the smallest number of sectors one

 file can use on the disk, usually 2 (sectors).

Reseerved sectors - always at least one as the boot sector counts as the

 first. Used by system-loaders & VERY BIG virii (gulp).

File Allocation Tables (FATs) (number of) - FATs are used to keep track of

 all the places on the disk where your files are etc. 'Cause the're so

 important there are this many (usually 2) copies updated at the same time.

Max root dir entries - the largest number of files that you can have in

 the root dir, usually 128 for floppies. Folders are files and can grow

 in size if more file entries (=name,date modified,size in bytes etc)

 are needed, but the root dir is a set size and therfore can only hold

 a limited number of file entries.

Sectors - the total number of sectorson the media including

 reserved sectors, any hidden sectors, the FATs, the root dir and the

 'data area' where your files & folders are stored.

Media descripter - this is meant to describe the media type on PCs

 ie hard disk, 3.5" floppy etc, etc. should really be $F8, but the TOS

 ignores it completely, so it is whatever your formatter sets it to be!

Sectors per FAT - this is the size in sectors of EACH File Allocation


Sectors per track - The number of sectors per track usually 9 or 10.

 therefore TRACKS = (total sectors / sides on media) / sectors per track.

Sides on media - for floppies 1 or 2 is valid, but hard disk controllers

 can pull a few tricks on the TOS and pretend there are more 'sides'

 - 64 is not unusual.

Hidden sectors - this isn't very well documented anywhere, but I think

 these are like 'extra reserved sectors' - comments anyone ?

Calculated dir sector - worked out as :

  reserved sectors + hidden sectors + (number of FATs * sectors per FAT)

 this should be the first root dir sector.

 I have recently used this info to write zeros to this sector and then ran

 a file system checker (FCHK.TOS) to clean up the mess and leave me with a

 completely clean hard disk partition !  (I wanted this as well!)


Information from the TOS

This info I added to BPB-37 'cause it gives :

Total clusters - should be something like (you may need to +/- 1 ? to this)

 (total sectors - system sectors) / sectors per cluster

 where system sectors is

 calculated dir sector +

  ( number of root dir entries * 32 / bytes per sector )

Free clusters - the number of free clusters.

Sectors per cluster - a less trustable source of this value than direct

 from the boot sector, but what the TOS THINKS it is.

Bytes per sector - likewise.

'Therefore free space' - free space in bytes (using the TOS values) as

   free clusters * sectors per cluster * bytes per sector

 divided by 1024 to get Kb.


Phew ! After you have read all the info it waits for a keypress (any).


If it was originally in medium rez it changes back and resets the colours

so the system as it was - all legal calls !!!


Then...... it quits back to the calling desktop/shell etc.


Phew ! - all the equations & algos by the way are from the top of my head

so don't trust me, check them yourself.



It gives you a lot of info, it fits in 2K (the original version was less

than 1Kb). It was written in assembly using Genst 1.25 (Thanks ST-Format !)

and the book 'The conise atari st 68000 programmer's reference guide'

by Kathrine Peel (one really good book).


Copyrights & the disclaimers

I wrote this software but you use it at your own risk, so don't get me in

court is it causes earthquakes in El-Salvador or something.

You may copy, distribute, BUT NOT SELL IT, modest distribution costs may be

charged - but remember it's FREE.


If you do pass it on you should pass this doc file on with it so that it's

ease of use is not lost down the generations.


Please feel free to use the routines in the source code in your own

programs but bear in mind that once the program all fitted in less than 2K

I paid no attention to speed, effeciency or 'properness' of the code, but

I think that it all works properly !


This doc file is toooooo huge for the program now so just remember this:

If you believe this software to be worth paying for, then pay me 10%

of what it's worth - thats how much I'd get if I marketed it.

Course you could simply send me any tips/advice/good jokes and then we

can get on with the job of writing better software for the ST range.


Any problems/enquiries etc with the program please E-mail me at :




Domenico De Vitto.



And the source MC68000 assembler:

 bsr setscreen
 bsr getdrive
 bsr readboot
 bsr interpret
 bsr extrainfo
 bsr pressanykeytoexit
 bsr resetscreen
 clr.w -(sp)
 trap #1

 move.w #4,-(sp)
 trap #14        * get screen mode in d0
 addq.l #2,sp
 cmp.w #1,d0
 bne dontchgmode
 move.w d0,screenmode    * if med-res save 1 in screenmode
 move.w #0,-(sp)
 move.l #-1,-(sp)
 move.l #-1,-(sp)
 move.w #5,-(sp)
 trap #14        * change to mode 0
 add.l #12,sp
 move.l #colregs,-(sp)
 move.w #6,-(sp)
 trap #14
 addq.l #6,sp
 bsr print
 dc.b 27,"E","BPB-37 by Domenico De Vitto",0

 move.w #10,-(sp)
 trap #13
 addq.l #2,sp
 move.l d0,drivemap
 bsr showdrives
 bsr getdrv
 bsr print
 dc.b 10,13,"Drives Available :",0
 moveq #0,d7
 bsr checkdrive
 tst d0
 bne nextdrv
 moveq #65,d0
 add.b d7,d0
 bsr printchr
 addq #1,d7
 btst #5,d7
 beq drvloop

 bsr print
 dc.b 10,13,"Enter Drive Letter :",0
 bsr getkey
 bsr convertlu
 sub.b #65,d0
 bmi gdrvloop
 cmp #31,d0
 bpl gdrvloop
 exg d0,d7
 bsr checkdrive
 bne gdrvloop
 move.w d7,driveselect
 exg d0,d7
 add.b #65,d0
 bsr printchr

 move.w driveselect,-(sp)
 move.w #0,-(sp)
 move.w #1,-(sp)
 move.l #buffer,-(sp)
 move.w #2,-(sp) * must be read 2 in order to catch disk changes.
 move.w #4,-(sp)
 trap #13
 add.l #14,sp

 tst d0
 beq okdrive
 bsr print
 dc.b 10,13,"Error Reading Drive",0
 bsr print
 dc.b 10,13,27,"p","         From the Boot sector :         ",27,"q"
 dc.b 10,13,"Branch to boot code :$",0
 move.w buffer(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Volume Serial # :$",0
 move.w buffer+8(pc),d0
 bsr hexword86
 move.b buffer+10(pc),d0
 bsr hexprint
 bsr print
 dc.b 10,13,"Bytes per sector :$",0
 move.l buffer+10(pc),d0
 ror.l #8,d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Sectors per Cluster :$",0
 move.w buffer+12(pc),d0
 ror.w #8,d0
 bsr hexprint
 bsr print
 dc.b 10,13,"Reserved Sectors (inc. boot) :$",0
 move.w buffer+14(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"File Allocation Tables (FATs):$",0
 move.b buffer+16(pc),d0
 bsr hexprint
 bsr print
 dc.b 10,13,"Max Root Directory entries :$",0
 move.l buffer+16(pc),d0
 ror.l #8,d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Sectors (inc reserved) :$",0
 move.l buffer+18(pc),d0
 ror.l #8,d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Media Descripter (not used by TOS) :$",0
 move.b buffer+21(pc),d0
 bsr hexprint
 bsr print
 dc.b 10,13,"Sectors per FAT :$",0
 move.w buffer+22(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Sectors per Track :$",0
 move.w buffer+24(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Sides on media :$",0
 move.w buffer+26(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Hidden Sectors :$",0
 move.w buffer+28(pc),d0
 bsr hexword86
 bsr print
 dc.b 10,13,"Calculated dir sector :$",0

 moveq #0,d0
 move.b buffer+16(pc),d0
 move.w buffer+22(pc),d1
 ror.w #8,d1
 mulu d1,d0
 move.w buffer+14(pc),d1
 ror.w #8,d1
 add.l d1,d0
 rol.l #8,d0
 bsr hexprint
 rol.l #8,d0
 bsr hexprint        * print longword of start sect of dir
 rol.l #8,d0
 bsr hexprint
 rol.l #8,d0
 bsr hexprint

 move.w driveselect(pc),d0
 addq.w #1,d0
 move.w d0,-(sp)
 pea driveextra(pc)
 move.w #54,-(sp)
 trap #1
 addq.l #8,sp
 bsr print
 dc.b 10,13,27,"p","   From the Operating System (TOS) :    ",27,"q"
 dc.b 10,13,"Total Clusters :$",0
 move.l driveextra+4(pc),d0
 bsr hexlongst
 bsr print
 dc.b 10,13,"Free Clusters :$",0
 move.l driveextra(pc),d0
 bsr hexlongst
 bsr print
 dc.b 10,13,"Sectors per Cluster :$",0
 move.l driveextra+12(pc),d0
 bsr hexlongst
 bsr print
 dc.b 10,13,"Bytes per Sector :$",0
 move.l driveextra+8(pc),d0
 bsr hexlongst
 bsr freespace

 jsr print
 dc.b 10,13,"Therefore Free space = ",0

 move.l driveextra(pc),d0     * no free clusters
 move.l driveextra+12(pc),d6    * sects per cluster
 mulu driveextra+10(pc),d6
 mulu d6,d0
 divu #$400,d0        * mulu and print free space
 move.w d0,digibyte
 jsr digits
 jsr print
 dc.b "K of ",0

 move.l driveextra+4(pc),d0     * total no of clusters
 move.l driveextra+12(pc),d6    * sects per cluster
 mulu driveextra+10(pc),d6
 mulu d6,d0
 divu #$400,d0
 move.w d0,digibyte
 jsr digits
 jsr print
 dc.b " total",0

 bsr print
 dc.b 10,13,27,"p","         Press any key to exit          ",27,"q",0
 bsr getkey

 tst screenmode
 beq resetscreenexit
 move.w #1,-(sp)
 move.l #-1,-(sp)
 move.l #-1,-(sp)
 move.w #5,-(sp)
 trap #14
 add.l #12,sp
 move.l #colregs,-(sp)
 move.w #6,-(sp)
 trap #14
 addq.l #6,sp


*** digital word print ,word in digibyte bsr digits
 moveq.l #0,d7
 move.w digibyte,d7
 divu #10000,d7
 bsr digiprint
 moveq.l #0,d7
 move.w digibyte,d7
 divu #1000,d7
 bsr digiprint
 moveq.l #0,d7
 move.w digibyte,d7
 divu #100,d7
 bsr digiprint
 moveq.l #0,d7
 move.w digibyte,d7
 divu #10,d7
 bsr digiprint
 move.w #$ffff,digiflag
 move.w digibyte,d7
 swap d7
 bsr digiprint
 clr.w digiflag
 swap d7
 move.w d7,digibyte
 swap d7
 tst.b d7
 beq digizero
 move.w #$ffff,digiflag
 add.w #"0",d7
 move.w d7,-(sp)
 move.w #2,-(sp)
 trap #1
 addq.l #4,sp
 tst digiflag
 bne digiret1
 rts             * The end of VERY long digital print routine !
 dc.w 0
 dc.w 0
 move.l #$20002,-(SP)
 trap   #13
 add.l #4,SP

 move.l d0,-(sp)
 rol.l #8,d0
 bsr hexprint
 rol.l #8,d0
 bsr hexprint
 rol.l #8,d0
 bsr hexprint
 rol.l #8,d0
 bsr hexprint
 move.l (sp)+,d0

 move.l d0,-(sp)
 asr.l #4,d0
 bsr hpnext
 move.l (sp),d0
 bsr hpnext
 move.l (sp)+,d0
 andi.l #$f,d0
 cmpi.b #10,d0
 bmi hpnext2
 addq.b #7,d0
 addi.b #48,d0
 move.w d0,-(sp)
 move.w #2,-(sp)
 trap #1
 addq.l #4,sp

 move.l d0,-(sp)
 bsr hexprint
 ror.l #8,d0
 bsr hexprint
 move.l (sp)+,d0

 move.l (sp),-(sp)
 move.w #9,-(sp)
 trap #1
 addq.l #6,sp
 move.l (sp)+,a0
 move.w (a0),d0
 tst.b d0
 beq pend
 asr.w #8,d0
 tst.b d0
 beq pend
  adda #2,a0
 bra ploop
 adda #2,a0
 move.l a0,-(sp)

 move.l d0,-(sp)
 and.l #$ff,d0
 move.w d0,-(sp)
 move.w #2,-(sp)
 move.w #3,-(sp)
 trap #13
 add.l #6,sp
 move.l (sp)+,d0

 move.l drivemap,d6
 btst d7,d6        * drv to check = d7
 beq checkdrivexit
 moveq #0,d0        * ret code in d0
 rts            * -1 = not there, 0=ok
 moveq #-1,d0

 cmp.b #"a",d0        * if d0>=asc "a" subtract 32 from it
 bmi convertexit    * eg a => A , z => Z
 sub.b #32,d0

 ds.l 4

 dc.l 0
 dc.w 0
 dc.w 16
 dc.w 0
 dc.l $ffff3f00
 dc.l $f8f80000
 ds.l 6


(the end)


posted 19 Nov 2012, 05:28 by Dom De Vitto

I love this post by Scott Cassell, it's both scarey and wonderful.

Golf balls, marbles, sand and beer.

posted 7 Nov 2012, 04:25 by Dom De Vitto   [ updated 7 Nov 2012, 04:35 ]

Remember your Mayonnaise Jar ...
A professor was teaching his philosophy class full of new students.  First he picked up a large empty mayonnaise jar and filled it to the top with golf balls.
He asked the students "Is the jar full?", the students noddled and agreed it was.

He then picked up a handful of marbles and poured them into the jar, shaking it until the marbles filled the gaps between the golf balls
He asked again "Is the jar full?", the students looked at each other, then noddled and agreed it was.

Next, he picked up a glass of sand and poured that into the jar.  The sand fell between the gaps and leveled off at the top of the jar.
He asked again "Is the jar full NOW?", the students again looked at each other, thought, then noddled and agreed again.

He then took out two cans of beer from under the table and poured these into the jar, with the sand soaking it all up.

 “Now, I want you to recognize that this jar represents your life. The golf balls are the important things: your family, children, health, friends, and favorite passions - things that if everything else was lost and only they remained, your life would still be full."

“The marbles are the other big things that matter: your job, house, car."

"The sand is everything else - the small stuff."

"If you put the sand into the jar first, there is no room for the golf balls or the marbles.  The same goes for your life.  If you spend all your time and energy on the small stuff, you will never have room for the things that are important.  Pay attention to the things that are critical to your happiness.  Play with your children.  Take time to get health checkups.  Take your partner out to dinner.  There will always be time to clean the house and do some DIY.  Take care of the golf balls first, the things that really matter.  Set your priorities based on this - the rest is just sand.”

One of the students raised their hand and inquired about the beer.  The professor smiled and said, “I’m glad you asked. It just goes to show you that no matter how full your life may seem, there’s always room for a couple of beers.”


New Car - KIA Rio

posted 27 Aug 2012, 05:43 by Dom De Vitto   [ updated 28 Aug 2012, 14:18 ]

After much number-crunching and comparison - in particular with the VW Golf bluemotion, I rcently bought a new KIA Rio '1+Air' 1.1 CRDI.

Following over 4,000 miles of driving, I can conclude:
  • For mostly motorway ('freeway') driving @ 70 mph, I get 60-65 MPG.
  • For town driving (I love ISG - Idle Stop & Go), it's closer to 65 MPG.
  • If you're on a flat road, you can put it in 6th gear, and it will trundle along at 1,000-1,500 revs and registers 99.9 MPG ! (the most it can display)
  • If you race about, don't change up the gears, or change gears too frequently, it can get as low as 52 MPG.
  • My best MPG for the 1.5 miles from the local garage (full tank) to home (and this is mostly uphill) is 72.1 MPG - including 2 traffic lights.
  • I just filled the tank (40L) and got an average of  84  MPG over a  42 mile  trip !

Basically, if you keep the top speed to 60-70, rather than 70, and just use the highest gear possible (keeping the revs below 2,000), you can really push up the MPG.  Idle Stop & Go is really good for saving fuel.  It works by turning off the engine when you put it in neutral, and then take your foot fully off the clutch.  It immediately starts the engine when you halfway depress the clutch again.  The engine startes so quickly, that it's running before the clutch is fully depressed, and always before you're even moved the gearstick - it's pretty awesome.  If you consider that the engine idles at 1,000 revs/minute, waiting for the normal 60 seconds is the same as driving around an extra half mile, so on a 5 mile (10 minute-ish) drive, that's a 10% saving.
ISG does have it's qwerks though - if the battery isn't charged enough it doesn't engage (a little light shows it's disabled), and will actually restart the engine in ISG mode if the battery charge drops to low (e.g. the air con or lights drain the battery) - as you're in neutral, this isn't ever a problem.  It also (cleverly) restarts if you start to roll the car, presumebly so you've full power for the power steering etc.

All in all, I've found it a really good car, it handles well, is 'quick' (though not blindingly so), looks good, and is what I'd have hoped for in a car.  I got 5 years of servicing (for £500), and combined with the 7 year / 100,000 mile warranty, ZERO rated car tax, and ZERO congestion charge band, I pretty much only have to fill it up once every 500+ miles (tank is 40 litres) and forget about it. 

The only minor point is that they dealer only pumped the tyres up to 32 PSI, which is correct for the non-ECO tyres, but the ECO tyres are meant to be 38 PSI - when I did this my MPG jumped up by 5 MPG, so this really makes a difference.

The only thing I would change would be the fact I got steel wheels, because the '1' model has these, and it also has the best combined MPG.  If I knew the MPG impact (positive or negative) of having their alloys, I would have almost certainly got their georgous sporty ones !

If anyone from KIA is reading this, I'd gladly trial alloys and publish the results here !

Moving, Buying, Selling Your House / Home....

posted 21 Dec 2011, 05:14 by Dom De Vitto   [ updated 13 Nov 2012, 08:47 ]

Ok, inspired by a friends FB post, so this is a little rough:

Buying a house is not like anything else - nothing is confirmed until the ink is dry on the contract, and you've actually moved in.

I really recommend getting "The Which? Guide to Doing Your Own Conveyancing" :

You almost certainly DON'T want to do the conveyancing yourself - but you do:
  • Want to know exactly what everyone else needs to do for you
  • Want to know how long each of those steps would normally take.
From experience, the "professionals" are often massively incompetent in every way - though they may seem fine at first.  I've heard of solicitors that put in the 'searches' to the wrong authority - delaying the contract signing by 5 weeks, and requiring a mortgage offer renewal, and re-assessment.
It's up to YOU to make sure THEY don't make mistakes, which are always at YOUR expense (time+money).

This goes for the people you're paying directly (solicitors, bank/lender) and the people paid by the people you're buying/selling from (estate agents, surveyors, their solicitors).  I've seen exchange of contracts not happen on a Friday because (it turns out) the sellers solicitor goes golfing at 11am on Friday - but his clerks were still telling estate agents "it may be signed today" at 3pm.

I don't know anyone without a nightmare story, but I know the Which? Guide helped me massively with my last purchase, and every problem I've ever heard of would have been avoided using this book.  It does need a (minor, IMO) update to cover 'HIPs' etc.

My "nightmare" was the vendor's friendly estate agent saying "I spoke to the sellers, and sorry, they can't possibly move out early.", so we agreed a date, and my family lived in a holiday home for two weeks (which was ace, but not the point).  When we spoke to the sellers face-to-face just before moving in, it turns out the ******* agent never bothered to ask them anything, and moving out early wouldn't have been any problem at all !  We could have even moved in over a few days, saving the cost to us of storage/removers!

So the agent preferring to lie to me, rather than bothering to pick up the phone to ask their own customer a single question - which would have speed up the sale by two weeks and got the agent their commission two weeks earlier as well - this lie cost me around £1,500 !

This includes any banks, solicitors, estate agents, surveyors, drain inspectors, sellers.  Basically these professions attract liars.  Don't get me wrong, there are some fantastic people out there (Leighton's Solicitors of Bournemouth are great and my sister was a credible 'Sales Negotiator', but error on the side of caution and pessimism.

Talk to the seller (and your buyer) directly and frequently.
An 'update' once a week isn't unreasonable, and more often if you're working through niggly details, like building/drain surveys (I've had a surveyor say "the seller wasn't in", but the seller said the whole family was on the drive loading up a van all morning).  Look at it this way, if you were buying anything else for hundreds of thousands of pounds - you'd expect the seller to be very keen, helpful and answer questions willingly.  Also it's a two-way street - are they having problems getting a mortgage/removals/whatever? Can you give them any suggestions as someone in the same "boat" ?  I've had a solicitor say "the searches are delayed as council has a 3 week backlog", but my buyers got theirs back in 5 days, from the same council.  A quick call to the council showed they were turning them around in 3 days, plus posting time, but my solicitor was too busy to submit the form - preferring to lie to me!

Questions like "If the seller's purchase might not happen is this a problem for you? or is that more convenient for you?" are important.
I've been in the position where my buyers would have happily paid £1,000 cash up the chain to the people we were buying from, as long as we could all complete before the end of the month (they were renting and £1,000 was the cost of the rental extension).  So often the chain can "work things out" as a group and everyone else is just trying to minimise their 9-5 work.

Before you put in an offer, knock on the neighbours doors.
They are going to be your neighbours soon, so are they friendly, or freaky? (or both!)
Check what the street is like late on a weekday and weekend night, is it all house-parties and kids with hoodies street racing stolen Citron Saxos?
I lived in a street where one person liked to double-park their lorry on the street every night, making it impossible to get larger vehicles past.  I'm sure someone affected could have complained, but doubt that would have changed much.

The Worst Code I Ever Encountered

posted 19 Dec 2011, 07:51 by Dom De Vitto   [ updated 20 Dec 2011, 04:02 ]

This is the worst code I've ever encountered.  It's fantastic - I can only fault it as an exercise in confusion in that it doesn't name it's variables after operators - but they are named in a way that's misleading, nonsensical, and prone to typo-error - so it's still awesome.

I should say that I've reformatted the code, because otherwise it makes my eyes bleed, and I'm lawsuit-adverse - just imagine the code with funky wrapping, inconsistent indenting and sneaky brace placement that infers the wrong code blocks, and you're at the right place in your mind.

Off the top of my head, the tactical comment a) describes another function (or missed the '2'), b) makes no sense - in English at least, c) describes a looping/tree-walk process, when the code is entirely linear, d) makes no sense even applying the 'telephone test', e) uses terms 'step', 'parent', 'level' etc. that are either the same, or different, to each other, or common algorithmic terms, f) the term 'withoutany problem' means something, to someone, once.

I just love the effort put in to do a tactical comment (though the coding standard mandated it!) but then the lack of grammatical sense, programmatic sense, or good spelling just undermines the whole thing.  I can read code, but theis author sets a trap for the naive by in providing documentation that entirely throws you off course and messes with your initial perception of what going to happen in the code.

I really like that the last line (the 'punch-line') is entirely readible and makes complete sense, in isolation, leaving the reader dazed when they try to link it to the previous statements.  Brilliance.

The very best thing about this code is that it came from the place with incredibly high standards of software engineering - in every respect, the place really did do things 'right', without exception.  However this code was inherited, and came from another company division - and here, obviously, be dragons....

int *step;
/* *******************************************************************
   * Schedule_com schedules follows following algorithm to schedule  *
   * jobs :                                                          *
   * 1) At a particular level 1, say there are m steps ( m >= 1)     *
   *    -scheudle all he jobs in steps m-1 to the machines withoutany*
   *     problem.                                                    *
   *    -for the last step, schedule job if its parent has been done.*
   * 2) Once all the jobs have been done, move over to the next level*
   ******************************************************************* */
  if (*step != *stepsAtLevel) { /* Just submit as many jobs as
                                 * possible */

    (void) scheduleJobInMask(step);
  else if (*step == *stepsAtLevel) {
    (void) scheduleJobInMask(step);

A collegue of mine (Keith Robichaud, a great S/W Eng, and not the original author of this code!) first brought the code of build_set/build_server.c to my attention around June 29th 1994.  Keith noticed that the second 'if' test was redundant, and asked me to rubber-stamp review his check-in back to the source-code control system - however I spotted that this function, a testament to amazingly bad coding, was entirely redundant, and was in fact only called from one place in the entire codebase.  Consequently, the only call to schedule_com2()' was replaced with 'scheduleJobInMask()' and all the this code above was deleted.

We never confirmed the original author, and SCCS records were pruned at a major permanent fork some years before, but I have my suspicions. though I went on to become a good and wise Software Engineer, this code lives now, only in my mind......[and here!]

The Giant Claw (1957) - I love this film.

posted 6 Nov 2011, 05:44 by Dom De Vitto   [ updated 6 Nov 2011, 05:45 ]


  • Seen from space, the nations really are different colors.
  • The French Canadians are deathly afraid of Mexican food.
  • Battleships are quite large and often the target of hyperbole.
  • When is a pattern not a pattern? When it is a spiral.
  • The Pentagon is located across the street from the Capitol building.
  • Osmosis: os·mo·sis (oz-mo'sis, os-) n., 1. When a bird eats something.
  • Residents of Montana must be crack shots. It's the law.
  • Scientific instruments explode when they do not work.
IMDB has the inside track:

YouTube gets you most of the entire film but the French Canadian version, "La Garra Gigante", must be particularily awesome.

Top Tips for Keeping Your Dog in Tip Top Condition

posted 25 Sept 2011, 08:12 by Dom De Vitto   [ updated 7 Oct 2011, 15:06 ]

Over the years I've had a few dogs, here are some of my top-tips that may be a use, especially if you have a Yorkshire Terrier.


Dogs eat food, along with other things.  Always remember that your dog is basically a wolf - wolves eat other animals, including skin, fur, bones, and whatever else - 'yuk', yes, but natural, yes.  Dogs have slow digestive systems for exactly this reason, and one good feed a day (20 mins of eating) should suffice.  Never cook bones (especially chicken) as this makes them splinter and be dangerous to eat!
We give our Yorkie raw chicken carcasses 4 times a week (he only eats about half a carcass eat time), and two days a week we blend up some vegetables (carrots, swede, parsnip, etc.) with the same amount of minced meat (beef, lamp, whatever) and he woofs this down.  One day a week we don't feed him - as dogs have a slow metabolism this isn't a problem (in the wild wolves may go days without a feed) and dogs are easily overfed, so this keeps there weight in check, especially as they get older and less active.  We get around 15-20 carcasses from a local butcher, bag them up individually and defrost them (still in the bag) before giving them to our dog.  Gob-smackingly, this only costs £10 (it's basically 'waist' from the butchers point of view), so we usually get a few 'recreational bones' too, for the dog to gnaw at and lick the raw marrowbone from the core. has some more detail on why raw food is so much better, and cooked bones are dangerous.  Wikipedia's raw_feeding page, has more details including the problems of both processed (supermarket) food and raw feeding.

Flaps and Free Roaming

If you've an area that's safe for him to go in/out of, I'd recommend a dog flap or pet flap - out dog goes in/out whenever he wants, and he really appreciates the extra freedom.  If you think about it, if you couldn't go in and out when you wanted, you'd feel 'cooped up' pretty quickly, and dogs are pack animals that like to patrol the area around their 'den'.


I don't know why, but dogs LOVE cheese.  Unfortunately, like people, too much cheese tends to 'bung' them up.  The solution to this is cheese-in-a-tube - especially Primula Cheese (  It's low salt, easy to carry around, doesn't dry out (it's in a tube!) and ALL the profits go to charity!  It's a little harder to initially train a puppy with this kind of cheese/treat, as little solid treats (like small chedder cheese cubes) are easier to hand out and teach them to 'paw' at etc. but once they get the idea that doing the right thing gets them a treat, this kind of treat is brilliant.  Our dog won 'best trick' at a local dog show before he was even a year old, so it's highly effective.

Pack Order

Dogs are pack animals - it doesn't matter if it's a wolfhound or a chiuaua - get a few together and they will happily chase a toy or treat all day.  The important thing is to remember that you're the top dog in the pack - 'Alpha', and they don't do anything (in the wild or in your home) without the permission of the Alpha.  Not only is there an alpha, but everyone in the family has a pack order - and it's vital that your dog knows it's not the boss of any humans in the house - otherwise it will refuse to obey that human and may boss that human about - through growling and biting.


Leads are tricky - not the kind, but the restriction.  Some dogs need to know they are not in charge, but smaller dogs it just limits their ability to flee from an attacker.  For our yorkie, when he's on a lead he is more aggressive because his normal 'fight or flight' instinct is curtailed - his only option is fight.  Once off the lead, he knows he can 'escape' and he's much more friendly.

1-10 of 13