23
Apr
15

The big storm

This week here in Newcastle we’ve had a rather nasty storm, so bad in fact it has taken out power to about 200,000 homes initially, blown down many many trees and caused severe flooding. Fortunately I haven’t had any damage to anything, and myself and my family are in good health, although I did have to endure quite a long black-out.

I grew up in rural north-western NSW on a farm, so I have experienced many black-outs before as they were common during storms. As kids me and my brothers actually thought they were kinda fun, we’d play hide and seek around the house and play with our torches and other battery powered toys. The darkness made everything new and fun. As we got older it became a good time to study for school and catch up on books we were reading.

Consequently I was reasonably prepared for when the power went out initially, I just got out my candles, filled up some containers with water (just in case) and sat down with my collection of Footrot Flats comics to have a read and a chuckle. It was kinda nice to have a technology free evening.

My entire suburb lost power, it’s amazing how silent the place became, it felt like being back at home on the farm. I spent most of a day listening to the sounds of the wind and rain as they lashed the house, and silence in between.

During a lull in the storm I went shopping for some basics, pretty much just bread and matches. I noted many people rushing around trying to get some kind of lighting, unfortunately many places were simply sold out of candles and even battery powered lights because of the demand. I took the opportunity to get myself a good feed of take-away whilst out.

But the black-out continued, I got worried food in my fridge was going to get warm, so I went and got a bag of ice to pack in to keep the inside of the fridge cool. Normally you could expect food in your fridge to stay cold for about 12-24 hours as the ice melts, so usually you don’t need to worry, just don’t access the fridge much and it will stay cold.

Yesterday I went about getting a gas camping stove so I could cook, and a solar phone charger in case the power stayed off for longer, luckily, it came back on late yesterday afternoon for me, but the whole experience has made me think about what I should have in case just such a thing should happen again.

You should have:

  • Some means of storing fresh water, or fresh water should your supply fail.
  • Candles and torches so you can find your way around in the dark.
  • A means to Cook food that you have, a BBQ or camp stove would suffice.
  • A small emergency supply of food, usually canned or dehydrated stuff is good to have. I often have canned stuff in my house simply because it is easier to store and lasts longer. Just make sure that it’s in date.
  • A radio and batteries to hear emergency broadcasts.

Luckily I already kept most of this stuff on hand, I just didn’t have a gas stove before this time.

I’d imagine stuff like a generator would be handy to have, but I don’t have the storage space. I’m thinking of getting a few SLA batteries and setting up some electronics to charge them and make use of them for charging phones and lighting. I did buy a basic solar charger for phones, but it doesn’t have a battery, and it doesn’t seem to do a good job of charging even a small phone. I may review it when I get some better sunlight and maybe some measuring equipment for USB power.

18
Apr
15

Xsokoban on NetBSD

Having been busy and stressed out lately I haven’t had much time for tinkering or gaming. This is where smaller games that you can play as a quick distraction can help, as they are easy to squeeze in between other jobs, and todays game is one such game.

Xsokoban is obviously a clone of the old classic game sokoban. The original was made for the PC-8801 way back in 1982 by Thinking Rabbit. It has since been implemented and ported to pretty much every system, Xsokoban is one such port for Unix systems running X windows.

There isn’t anything really remarkable about this particular port. The quality of the graphics is quite reasonable, and it works well on pretty much any system I’ve tried it on including my older machines such as the Sparcstation 20. I’ve even played it over SSH via my comparatively slow ADSL2 connection, and it worked really quite well.

Interestingly the game has been studied in the field of computer science, it turns out it’s quite a difficult problem computationally, being PSPACE-complete. Lots of different researchers have worked on different algorithms for solving and producing optimal solutions. The complexity certainly makes me feel better about getting temporarily stuck on level 6!

As far as enjoyment goes, it’s really enjoyable for the puzzle solver in me, even when I’m stuck. It doesn’t take a huge commitment to play for a short while, and is quite challenging! This particular port isn’t any better or worse than any other, so don’t go out of your way, but NetBSD and FreeBSD users will find it easy to get running.

This slideshow requires JavaScript.

08
Apr
15

Motherboard: Gigabyte GA-6VM7-4E

Today’s main-board is from my person desktop PC from around 2000-2001. I bought it after my Pentium II machine started acting up. I didn’t have much money at the time being a student, so I bought a relatively cheap system from a friend who happened to work in the industry.

It’s a Gigabyte GA-6VM7-4E coupled with a Celeron 800Mhz (coppermine with FSB @100Mhz) which unfortunately since being in storage seems to no longer work. This is an unusual case where I suspect the CPU over the main-board that I’ll go into later. It could take up to a Pentium III at about 1.1Ghz with an 133Mhz FSB.

This board has a similar chip-set to the board I looked at last time, it has a Via Apollo Pro according to the manual and spec sheets. The south-bridge chip has almost exactly the same markings as those on the Asus board, the main difference being the date code. There is about 17 weeks between them in terms of manufacture date. Of course it makes sense that the south-bridge is likely an identical part, it’s the north-bridge under the heatsink that will be different.

Whilst it is certainly a lower end board, it has some features I didn’t expect such as the ability to use ECC SDRAM. Also interesting is the choice of a Creative CT5880 for on-board sound, these were usually (and often still are) Realtek chips instead.  Luckily it doesn’t stick you with on-board video, opting for an AGP 4x slot instead.

It seems this board has the facility for overclocking, allowing an FSB up to 150Mhz, which would have been good if your cards and RAM could accommodate the speed increase. The Coppermine Celeron I had was meant to be one good for overclocking although I never tried.

In service this board turned out to be quite reliable and performed reasonably well considering the lacklustre CPU I had in it. It worked for about 5 years as my desktop and a further 2 as a file server before being retired and stored. The silk-screen on the board isn’t as informative as I’d like, so the manual is a good thing to have when configuring the board. They probably didn’t have enough room because of the mATX form factor.

Here’s the reason I suspect the CPU is the reason this system doesn’t work anymore. It may be hard to see, but the CPU appears to have some damage around its edges. It was working before it was put into storage, so I’d say that the damage has probably occurred during a house move. This is rather unfortunate as this system was quite power efficient in service, but I have a few other coppermine processors that may get this board working again.

This would have to be the first CPU I’ve seen like this, I hope it’s the last! Most of them have been stored separate to the boards in padding, so they should be ok.

 

06
Apr
15

Creating a benchmark: Part 4

Last time I used the  in-line assembler to improve the speed of the sprite blitting functions with lots of success. Other functions such as line drawing however still suffered speed issues on systems with out a built-in FPU such as the 386sx.

The reason for the slow line drawing was simple, I had used a simple slope based algorithm that used floating point. On a system with a FPU this was quite fast, about as fast as anything else, but obviously it wasn’t going to cut the mustard when it came to the old processors I’m targeting. So I decided to give fixed point arithmetic a go.

Fixed point numbers are a variation on basic integers, using some of the bits to represent the fractional part. You can then use integer instructions to do some basic math that involves fractions. This is much faster for processors lacking hardware floating point support. Check out more details of fixed point here or at Wikipedia. It’s a very common technique for embedded systems, but was also used in games such as Doom for speed.

I however ran into a problem. Because the integer in turbo pascal is 16bits I didn’t have enough bits for addressing all the pixels and have enough precision to for the fractional part of the slope. For the integer part I needed to have a range of 0-319, requiring 9 bits unsigned. The fractional part was thus left with 7 bits, with the smallest representable fraction being 1/128th. The smallest conceivable slope in 320×200 is 1/320 which obviously is much smaller. I could have switched to using longints or storing the fractional part separately but this would have added extra overhead that would make line drawing slower.

I set the line drawing problem aside for the moment to look for a quick circle drawing algorithm. Something I hadn’t implemented yet. The SWAG archive came up with suitable options, but also had some algorithms for line drawing. In particular the Bresenham line drawing algorithm.

Not having coded my own low level line drawing routines before I hadn’t heard of it, but it uses all integer math in a clever way to produce the correct slope. I modified the algorithm I found to reduce the amount of calculations for the screen address when plotting points in the line. The resulting code was slightly faster than previous line drawing code, but not overwhelmingly so.

Returning to implementing circle drawing, the algorithms I found unfortunately used floating point math. They all use the basic formula for a circle, x^2 + y^2 = r^2, thus requiring the use of a square root function to calculate the co-ordinates. Unfortunately it is one of the more expensive floating point operations.

One algorithm I looked at used the square root function, but rounded it to an integer immediately. This got me thinking, if I could implement an approximation of square root using integer arithmetic I could draw circles quickly. So after a bit of research I wrote exactly that. Code follows.

function intSqrt(num: word):word;
var
   xo,xn:word;
begin
     {we're using Newtons method for approximating the sqrt}
     if (num=0) then
     begin
         intSqrt:=0;
         exit;
     end;
     xo := 0;
     xn := num;
     if xn=0 then xn:=1;
     while (abs(xo-xn) > 1) do
     begin
          xo := xn;
          xn := (xo + (num div xo)) shr 1;
     end;
     intSqrt := xn;
end;

As stated in the comment, I’ve used Newton’s method for calculating the root, mostly because it’s a simple method I know. I did a little testing, and it turns out this returns pretty much the same result as rounding the built-in sqrt function that uses floating point, only quicker. Once I finished the circle drawing code it drew around 36% more circles in the same time as the BGI code. That’s not bad, but I think there may be more room for optimisation here.

Next time I hope to have optimised the circle routine, and I’ll test the code on some hardware to see how all the different libraries compare to each other on different platforms.

24
Mar
15

Motherboard: Asus A7PRO

I’ve got a smallish collection of motherboards, so I thought I would start a series of short posts with photos and a short commentary on each board. So without any further ado, here is the first board.

This one was made by ASUS roughly around 2000. It is a earlier socket A with a VIA Apollo chipset. This came with the hardware donation I received a while ago and was fitted in the large chassis. There is a Duron 800Mhz processor installed, along with some SDRAM. This board could take a fast for the time Athlon processor.

I found the manual for this board here on the ASUS website, in it I found everything needed to set up the board. It supports the technologies you’d expect for the time, but also one I hadn’t heard of. VCM or Virtual Channel Memory was an open standard developed by NEC. It was supposed to increase the memory bandwidth. It’s quite complicated from what I read on Wikipedia, so I won’t go into details, but it clearly wasn’t popular.

This board has a few other unusual features such as an AGP Pro 4x slot and a VRM that usually only made it to more expensive boards. Yet it also has some features that cheaper boards had such as the utterly silly AMR slot and lack of ISA slots.

I’d say this board was probably a middle-of-the-range board, clearly it is better than the cheapest, but not as flash as the most expensive. Usually this is the sensible option, and that seems to be the case here. The choice of processor installed is a little bit of a mystery, as I expected to see something faster here.

From the perspective of a technician, this is a really nice board. It’s easy to set up because all the switches, headers and jumpers have a reference silk-screened on the board. You don’t really need the manual. It has plenty of features and supports faster hardware from the time period. The VRM module may have been a good feature, it could be replaced if it failed. Of course that is assuming you could easily get a replacement. The only downside is lack of legacy ISA support, so it wouldn’t suite upgrading when ISA slots were required.

Thus concludes the first of the Motherboard series, please let me know what you think.

18
Mar
15

Shaw’s Nightmare for DOS

Shaw's NightmareToday’s game is some-what unusual, it is a DOS game that was released relatively recently, at the end of 2013. It was mostly developed by one guy, Michael Muniko, which is quite impressive really given the scale of the game. It is an obviously Doom inspired FPS built using the Build engine. Unlike many others, who would produce a total conversion mod for something like Duke Nukem 3d, the developer has instead built their own DOS executable from source. This was certainly an ambitious project right from the get go.

I played today using Dosbox, and there are a few things you’ll need if you want to play. Firstly, whilst the game only requires 8Mb of RAM, it doesn’t recognise it correctly under Dosbox. To get around this you need to set the amount of memory to 24Mb or higher, I have mine set to 32Mb. I have no idea if this is true of an actual machine as I haven’t tried it on one yet. You also need to set a reasonably high cycle count, I tested the game at 60,000 cycles.

Lets start with the graphics. The game uses VGA graphics, which is no surprise as that is what most build engine games support. The art style of this game is what confuses me the most. It looks like it was drawn in 5 minutes per sprite with MS Paint to put it bluntly, but it kinda has a weird childish charm as well. I could imagine having drawn something like it when playing with paint as a kid. I’m not really sure what to make of it, either he was a bit lazy, or deliberately chose this style for artistic reasons which would be clever. After all the game is set with-in Shaw’s dream world.

Unfortunately some of the sprites will cause problems. Their size will sometimes cause them to clip into walls, which fortunately doesn’t happen often. The biggest problem is with the corpses being just as large, blocking your view, and looking not much different to the live creatures. Doom sometimes suffered a little from this when you encountered any number of certain enemies, but you could usually see over them to some degree, and they were obviously dead.

The sound design, like the graphics, is either lazy or very clever. The music sounds like random mashings on a keyboard, as if he threw a random number generator at the music. I can’t say it’s bad, it doesn’t hurt your ears, it’s just somewhat surreal. Sound effects for Shaw himself are much better, albeit a bit quiet, they sound like they are the straight recorded voice of an actor/friend. The creatures however sound somewhat deranged, for some reason he used cats yowling for many of the effects and other strange noises. Weapon noises are fairly run of the mill, but are too quiet to make much impact.

Game play wise, Shaw’s Nightmare is very much like Doom. The weapons, whilst sounding and looking a bit different are largely the same as the weapons in Doom. The creatures encountered in the first episode are much like the basic enemies found in shareware Doom. Although they are much more brain dead than even the zombies.

The level design is different, however I’m not sure how to describe it. They are elaborate in a way, but also simple in their design, not a bad thing by any stretch. There is some variety, some levels are more open and set outside, whilst others are closed and set in corridors and maze-like structures. Because the same simple textures are used repeatedly you may get lost, but I didn’t experience as much of this as I thought I would.

The controls are probably the part of the game which annoyed me the most. I used the keyboard as that’s what I would normally use for a vintage FPS such as Doom or Duke Nukem 3d.  I found it to be kind of like walking in treacle in the sense that it takes a while before you accelerate to normal speed, in turning as well as walking. Then when you release the key it takes much longer than you’d expect stop. This makes it really hard to aim and move with much precision. I would have had much more fun if this was set up more like Doom or other FPS games.

sn_028I don’t really know how to summarise Shaw’s Nightmare. It’s certainly feels surreal and strange, much like the dream world it is set in. But on the other hand the graphics and sound clearly could be much better. Neither are obstacles to it being fun, the controls are pretty much the main reason I found it frustrating sometimes. Should you play this? If you’re curious about an obscure FPS made by an individual, then yes. If you want to play something polished like Doom, then you should probably play that instead.

Update: The author has provided a link in the comments to a new version that controls better. It’s still not perfect but makes the game much more fun and easier to control.

This slideshow requires JavaScript.

12
Mar
15

Under-volting my CPU

It’s not often I tinker with modern hardware, but I decided recently to try and reduce the temperature and power consumption of my main PC. It is the most modern PC I own, yet is still probably about 7 years old. I have a AMD Phenom II 955 x4 @ ~3.2 Ghz which normally will reach over 50 degrees C when running a single thread at full load in warmish weather. Not really great sounding, but it usually idles around 44 degrees C.

People who are familiar with overclocking will know that as you increase the clock rate of a chip you frequently need to increase the voltage as well to maintain stability. This can also work in the reverse, a lower speed can utilise a lower voltage and be stable. I didn’t particularly want to make my machine slower, but I did want it to run cooler, so I went about lowering the voltage.

It’s a fairly simple process, lower the voltage by one setting in the BIOS, test with Prime95 using the maximum heat FFT, see if it fails after a while (best to test overnight) and repeat if the machine is still stable. The goal is to find the minimum voltage that the machine will be stable at.

My processor is so far stable at ~1.18v which is about 0.15 under voltage. Doesn’t sound like much, but it has had a profound effect on the temperature the machine runs at under load. Under the same conditions (one core fully loaded) the temperature dropped by 4-5 degrees, and had a larger decrease for full load. Idle temperatures remained about the same.

I’m still running Windows XP on the machine, which whilst old still suites me. I’m thinking about what to upgrade to, favouring Debian linux or FreeBSD. I’ll have to find out whether these support Cool-n-quiet for my processor, and how well that works. By default Windows XP doesn’t use it, so this is something I decided to rectify.

Enabling Cool-n-quiet wasn’t particularly hard fortunately as long as you’ve installed the processor driver from AMD. Turn it on in the BIOS and then set the power management plan to portable/laptop or minimal, the default desktop setting disables it again. Using a program like CPU-Z you can see the clock speed and voltage going up and down. Interestingly Cool-n-quiet maintains the under-volting I configured as the maximum voltage.

My only real issue with Cool-n-quiet is an interesting one. I play older games and use software that is sometimes single threaded, the windows XP scheduler will move the single process from one CPU to another to balance the load. This has an interesting effect with Cool-n-quiet. Basically it reduces the clock rate of each core (independently it seems) based on how much usage each core has. Because the scheduler is moving the single thread around, each individual core is not as busy and is then under-clocked by the Cool-n-quiet system. I haven’t yet measured the impact this has on a single thread, but from what I’ve observed it does appear to lose performance.

Ultimately this leads to the single thread not getting the maximum performance even if it uses an entire core worth of processor. Fortunately you can set the affinity in the task scheduler which stops the thread being migrated around, this means cool-n-quiet does it’s job better by being able to slow down the other cores until they are needed and the single thread gets the maximum performance from the single core.

Unfortunately this is a bit of a pain in the butt to do each time. So I’m not sure if I’ll continue to use the Cool-n-quiet technology. It does work exceptionally well in the sense that my processor is another 4 degrees cooler with a single core fully loaded. I will have to make some performance measurements and decide if it’s worth it.




Blogs I Follow

Enter your email address to follow this blog and receive notifications of new posts by email.


Mister G Kids

A daily comic about real stuff little kids say in school. By Matt Gajdoš

Random Battles: my life long level grind

completing every RPG, ever.

Gough's Tech Zone

Reversing the mindless enslavement of humans by technology.

Retrocosm - Vintage & Retro Computing Blog

Random mutterings on retro computing, old technology, some new, plus any other stuff that interests me

ancientelectronics

retro computing and gaming plus a little more

Retrocomputing with 90's SPARC

21st-Century computing, the hard way

lazygamereviews

MS-DOS game reviews, retro ramblings and more...

Follow

Get every new post delivered to your Inbox.