Saturday, December 31, 2011

Happy New Year

  Having come back from wonderful Christmas holiday with my family in Poland I'd like to take opportunity and wish everyone  a wonderful new year filled with abundance, joy, and treasured moments. May 2012 be your best year yet!
  Also, from that holiday I have brought some files restored from my old Amiga. That includes games and other programs which I wrote many years ago in Basic, also some music (yes, I attempted that once upon a time), and graphics. One example can be seen below, all others I'll run in emulator and see what I can do with it. Some results of that process will be published here.

"Porthland"

Friday, November 4, 2011

The story goes on - Amiga 500

  I had pleasure to use turbo system on the little Atari only for about six months, and fortunately I didn't have to suffer from all those tape related problems too long. Soon, in early 1991 my Dad has bought me an Amiga 500. As a matter of fact we had to sacrifice the little Atari (just to get enough money), but it was well worth it. Amiga had brilliant specs:

  • CPU: 16-bit Motorola MC68000, with 7.09 MHz clock
  • memory: 512 KB RAM!!! which later we expanded to 1 MB
  • wonderful sound: 4 × 8-bit channels (digital sound!) at max 28 kHz with 6-bit volume in stereo
  • text: 80 columns x 32 lines
  • unbelievable graphics: 640 × 512 resolution or 640 × 256 in maximum 16 colours, 320 x 256 or 320 x 512 in up to 32 colours, or 64 colours in EHB mode and even 4096 colours in HAM mode. However displaying in vertical resolution of 512 was in interlace mode

  For those who don't have a clue what interlace is, it is a way of getting twice higher vertical resolution from the Amiga's custom chipset. But it came at a cost. Instead of scanning the whole screen at once, all the odd scanlines were "drawn" first, then all the even ones. That caused a horrible flickering effect and screens were usually far too shaky to be usable on a TV or even a monitor. To eliminate that effect completely so called Flicker Fixer needed to be used.
EHB (Extra Half-Brite) uses six bitplanes, or in other words six bits per pixel. The first five bitplanes index 32 colours selected from the full 4096 palette, and the sixth bitplane  causes display hardware to half the brightness of the corresponding colour component. Thus EHB allows 32 colours out of 4096 plus their half-bright counterparts.
  HAM (Hold-And-Modify) uses a very unusual technique to code the colour of pixels, allowing many more colours to appear on screen than would otherwise be possible. Yet, it has significant technical limitations and therefore cannot be used as a general purpose display mode. It could be used for the display and manipulation of static images. This is how it works: pixels are represented using 6 bits each; 2 bits are used as decision-making "control" bits, and 4 bits are used as "data" bits. The actual colour for a pixel would be the result of following the instruction of the control bits. The 2 control bits allow for four possibilities, which are as follows:

  • Set: Use the 4 bits of data as an index into the first 16 colors in the color palette. Use that color for this pixel
  • Modify Red: Hold the green and blue color components of the previous pixel. Use the 4 bits of data as the new red color component of this pixel
  • Modify Green: Hold the red and blue color components of the previous pixel. Use the 4 bits of data as the new green color component of this pixel
  • Modify Blue: Hold the red and green color components of the previous pixel. Use the 4 bits of data as the new blue color component of this pixel
HAM6 graphics mode
A parrot in HAM6 mode
  Now it is clear why HAM mode couldn't be used for things like games or animation. The same trick that makes it possible to display all 4096 colours at a time, also doesn't allow to instantly change neighbouring pixels from one colour to another, and may cause "smudges" on the edges of objects. One can see it in the image above, the picture simply isn't very sharp. Fortunately, it was perfectly sharp in all other modes. So, let's have a look at this great "computing machine":

Amiga 500 with a colour monitor and external floppy drive 
  I possessed (and still do) a slightly different configuration, with a TV instead of a proper computer monitor, TV modulator and a slim external floppy disk drive (which I acquired some time after buying the computer for money I made collecting mushrooms in local forest; another great, ecological and profitable activity). I've had the TV screen (for which cable I made on my own) for about 20 years already and it still works, although the picture it displays isn't great. And it's monochromatic. I guess I'm going to replace it with some small LCD TV at some point (colour !!!). Until today I've kept the original box in which came my first Amiga 500.

My Amiga 500 original box
  The computer itself still works and is placed in the same location I used it 20 years ago.

My good old Amiga 500
  As you can see that computer was armed with a 3.5" floppy drive (built-in) and I loved it from the first sight. For those who have never encountered one, I have pictures of both sides of a 3.5" floppy disk (my great game "Robot-R29 is on this particular one). Those used in Amiga had a 880 KB capacity, and back then I thought it was a lot. However some newer models, starting with later models of Amiga 3000 were fitted with the 1.76Mb Hi-Density disk (special Hi-Density floppies needed to be used).

Double-Density 3.5" floppy disk (top side)
Double-Density 3.5" floppy disk (bottom side)
  I mentioned TV modulator. Yes, Amiga 500 didn't feature that interface, and if one wanted to connect their computer to a regular TV through an antenna port (I guess most people did) they needed to purchase a TV modulator. That could be also done through the composite video output, however this model of Amiga generated only black & white signal through that output, which was rather impractical if one wanted to play and enjoy games with beautiful colour graphics. Therefore people spent money on that adapter, which was rather a bulky thing stinking out in the back of the computer, with two audio leads connected to stereo output and one input in the modulator. Yes, it turned the stereo signal into a dull mono. But it was an acceptable trade-off if one didn't have enough money to buy a proper monitor.

TV modulator...
...and a box it came in
  My computer came with a mouse, too. And as a matter of fact, it was the very first mouse I have ever touched in my life (at least a computer one). Also, it wasn't optical mouse like all those we see nowadays. It was a proper old school mechanical mouse, which you can in the second picture below. It's that little thing slightly sticking out from the little hole in the bottom of the mouse (sounds a little funny, that computer science is all fun, I'm telling you). That type of mouse was little harder to work with, and more demanding in terms on the surface (it couldn't be too smooth) on which it was used than present days mice, but at those times it was what everyone had.

Top side of my mouse which still works after so many years
And its bottom side (notice ball in the whole on the right)
  But mouse wasn't just an optional gadget like it could've been in case of the little Atari. It was a necessary device used to interact with GUI (graphical user interface), and that was completely new to me! Before that I might have seen a computer with GUI on the TV, but I don't recall I had encountered it. The first time I had a go at GUI on Amiga I was blown away. The difference between obsolete editor and direct mode on Atari XE where everything had to be typed in, and GUI on Amiga (which was called Workbench by the way) was so huge it could never be forgotten. Although in a way Amiga also had a similar feature, called CLI (command- line interface) in which user also typed in commands in order to perform disk operations, it was rather for advanced users and wasn't vital to be able to use computer. As you can see, everything was represented in form of little pictures (yes, they're called icons) which user could point with the mouse cursor and simply click it to make something happen. That simple!

The main window of Workbench 1.3 (the orange bar in the right part of the windows shows disk usage)
Some example applications open in Workbench 1.0 (main screen worked in 4 colours in 640x256 pixels by default)
  Mouse wasn't the only controller for the Amiga. The computer also was a great game platform with countless number of different titles released over its lifespan. Therefore pretty much every Amiga user had at least one joystick. I was no different, although I didn't play games too often. Rather my younger sisters enjoyed that kind of computer entertainment. One of these joysticks (the one on the right) is older than my Amiga. I actually started using it with my Atari, some time before I even got my Amiga. Joysticks were a sort of ancestors of nowadays game controllers.

Amiga joysticks
  Amiga Workbench itself came on a floppy disk, plus another disk in the set:
  • Workbench 1.3 Disk containing programs like Calculator, Clock, Notepad, Say, Prefs (system preferences) and CLI
  • Extras Disk with Amiga Basic, but also some tools: Fed (bitmap font editor), IconEd (icon editor), Palette allowing to change colours in Workbench, and Terminal which could be used to connect to other computers
My copies of Amiga Workbench didn't happen to be original, but I still posses them
  As you can see the Amiga was quite capable computer for the early 90s and Amiga 500 was actually computer that was first released in 1987. Soon after I got my first Amiga another model was released in 1992, it was Amiga 1200 which had lot better graphics and of course it was faster, although sound capabilities remained pretty much unchanged. Nonetheless, both Amiga's graphics and sound were pretty impressive at that time and actually no other computer at that price tag could boast it. For that reason most Amiga users had these two programs: Deluxe Paint (bitmap graphics editor) and ProTracker (music tracker).

Deluxe Paint
ProTracker
  As you can see it was a huge progress and a great upgrade from the little 8-bit Atari. First of all Amiga was a 16-bit computer which combined with the faster clock to the user meant much more speed as the result. 16-but technology also allowed to address much more memory. Superb graphics and digital sound were extremely impressive for that time, too. All that combined with Amiga's GUI based operating system made it first choice for several people in the late 80s and early 90s. To me it will always be a wonderful unforgotten experience.

Monday, September 26, 2011

A little history of my coding adventure

  It was so long time ago, more than 20 years. I was only 12 then, but I still remember the very moment when on a quiet summer holiday day, I was a little bored so I started browsing my Dad's bookshelves. Especially two books have caught my eye, and they were both on ZX Spectrum programming. Both books written in the early 80s, were mostly about programming in Basic.

The very first programming books I've read.
  I've read them pretty quickly and I liked what I read so much I started craving for more. Dad bought me some other books, few were about computers in general, and few others were on ZX Spectrum Logo programming language. 

"Microprocessors, Microcomputers, Microsystems"
"Personal Computers"
  I remember that once I was caught by my teacher reading one of these books during a Polish language lesson. I had to beg my my teacher to give that book back to me. I think it was "Personal Computers". I just couldn't stop reading.

"Microcomputer at home and in the school" & "Microcomputer Meritum" 
  "Microcomputer at home and in the school" was written for ZX Spectrum which was very popular in Poland in the early 80s. It contained some interesting examples. Whereas "Microcomputer Meritum" was special in a way. Meritum was actually the only Polish computer that achieved any commercial success. Apparently there has been Meritum 1 and then Meritum 2, both with monochromatic graphics. And also there were some plans and project for Meritum 3 which was going to feature colour graphics but for some reason that computer has never happened. This book was quite extensive and included even electronic circuit diagram of the entire computer, probably in case if someone who's brave enough wanted to try and fix it.


Sinclair Spectrum Logo, part 1 - for the beginners
Sinclair Spectrum Logo, part 2 - for the advanced
  The Spectrum Logo and other programming books were quite interesting, but neither those nor the others I mentioned earlier could substitute for real programming and I started asking my Dad for a real computer. Finally it has happened and in Christmas 1989 I got my very first own computer, Atari 65XE.



  Let me give you just a brief overview of little Atari's specifications:
  • CPU: 8-bit 6502C at 1.77 MHz clock
  • RAM: 64 KB (that seemed to be a lot in comparison to 48 KB in ZX Spectrum)
  • ROM: 24 KB
  • Graphics: 40 × 24 max in text mode, 320 × 192 pixels in 2 colours, 160 × 192 pixels in 4 colours (and several other modes, 16 altogether), 256 maximum number of colours (16 colors with 16 intensity levels each)
  • Sound: 4 channels (mono), 3.5 octaves (4 × oscillators with noise mixing, or 2 × amplitude modulation digital)
  • Operating system: Atari 8-bit OS / Atari Basic



  My Atari looked a lot like the one you can see above, and was in exactly the same configuration, the computer itself, tape recorder, power supply, and joystick. I also got a few tapes (oh yes, tapes) with it so we could play games. We got it all set up, connected to a TV set and here came the first disappointment. Those tapes wouldn't load! Fortunately we found a friend who helped us with his tapes. But those were games, and mostly my sister enjoyed them. I needed something different, something more complex, challenging and absorbing. Soon I'd learnt one of my classmates had an Atari, too, and also a great textbook on programming in Atari basic. For several months that was hour programming "bible" and I often came to my classmate's place to copy some information from that book, which I later could try and practise at home. Some of those examples were quite practical, like for example title screens for my Dad's VHS tapes.


  Those were magic times. When I close my eyes I still can see and hear that simple software in action. Editors were not as sophisticated as nowadays (I would say they weren't sophisticated at all, and simply allowed to type in and run your code) and it was easy to make errors while typing in programs from magazines. The first screenshot looks pretty simple, but it also doesn't do a lot. Look at the other one and you'll see that it's mot easy to read or type in at all.





  Computer magazines at that time were a great source of practical knowledge. They provided young coders with working example programs along with explanations how they work. What one could want more? I only show you front pages of two titles, but there were several available at that time, some dedicated to particular platforms, and some were more general.


  At certain time (I cannot remember exactly when) someone came up with a clever idea how to make that typing in code a little easier and error free. It was quite simple, but great at the same time. A program which ran in the background (there was no multitasking on little Atari) summed up ASCII codes of all characters in each line of program and generated a unique two-capital-letters code, which was printed in front of that line. What needed to be done was to check whether the generated code was identical with that printed in the magazine from which program was taken. Look at those codes in front of each line number in the picture below.


  That was a great help. But little Atari (like all other 8-bit computers in the 80s) had tape recorder as standard storage and it was really slow, even considering the small amount of data being loaded into those machines. Often it took several minutes to load up a game (10 or even more minutes, sometimes even the length of the whole side of a tape, which is around 30 minutes). One needed to be very patient. It was absolutely forbidden to move during that process so not to shake the table on which the tape recorder was placed or the awaiting would start from the beginning.
  Finally I followed my friend's advice and "upgraded" my computer. My Dad took me to a company which installs turbo systems in Atari tape recorders. After all process the tape recorder itself looked actually unchanged, apart from an extra wire wound around the main cable and a cartridge with software supporting the turbo system. And, I think, there was also a switch on the back of the recorder allowing to turn the turbo on and off.



  That happened around 1991 and when I started using the turbo loader I thought it was the best upgrade I could ever dream of. Programs loaded up so much faster, it seemed like in no time. And no wonder. The transfer speed increased from about 600 bauds to, I guess, some 6000 bauds, which made it some 10 times faster. The difference in loading times could be felt right away, and the system also showed up to the end user on the screen in the form of specific menu.


  And then the screen also looked different (a little scary at first) when the programs were loading up. It resembled a little bit what could appear on a TV screen when a damaged VHS tape was played.


  For those who've never seen or heard any real 8-bit computer I've found some video on YouTube. It shows game "River Raid" by the legendary ActiVision being loaded with a standard speed on a real Atari 65XE. Enjoy!


  This video has been uploaded by FarEastOfTheBlues and this is the link where it can be watched in a better quality on YouTube:

http://www.youtube.com/watch?v=QyC1Ld19pq8


  Turbo system in Atari 65XE was a great thing and I did enjoy it. Although it featured much faster transfer in comparison to standard system, it still had the disadvantages of a tape cassette. Namely the tape itself needed to be manually rewinded, fast forwarded and so on, in order to find required program. A good help, practised by probably every single user, was writing down counter readings for each program (so called cassette index). That wasn't so bad, but what if one lost that piece of paper with contents of the cassette? And still, there was no real (logical or electronic) connection between contents of a cassette and what was written on the inlet. This is an example Atari tape cassette:


  My cassettes looked a little bit like this one, with a handwritten index of programs:


  That brings back old memories. Good times when people had lots of time to wait for their programs to be loaded up. Rewind... fast forward... little bit farther... too far. Let's rewind a little bit again...
...and finally load that "River Raid". Oops! Title screen. At last.

Thursday, September 8, 2011

Welcome everyone!

Hi! This is my new blog on computer science. In this place I'm going to publish results of my experiments, projects, and new experience. Or anything I manage to learn, which is related to computer programming. Few months ago I have completed a computer science course. I must admit I did quite well and have got 2:1 Bachelors of Science from Lancaster University, which is one of the best in the country. Although all programming we did on that course was almost solely in C# for general programming and XNA for game programming (maybe with the exception of Prolog in which we only wrote a couple of exercises for one module, Artificial Intelligence), I have already started learning Objective-C and intend to start writing my own apps for the iPhone and iPad in the near future. So, I've bought myself some books and will exercise thoroughly. And when I'm not doing that I'll publish a post here every now and then.