home *** CD-ROM | disk | FTP | other *** search
- u
-
-
-
- QUICKMAN PROGRAMMERS DELIGHT
- ----------------------------
-
- QUIKMAN: 1984 revisited
- Posted on October 27th, 2008 by Rob
- A couple of years ago, I was rejoined
- with my old Commodore VIC20 software
- library my brother had kept, some of
- which were programs I had written and
- saved using an ordinary audio cassette
- tape. I decided to try and resurrect
- the data, because I still have my old
- VIC20 and datasette drive. But if the
- data successfully loaded into the
- computer's memory, how could I then
- transfer it over to a modern PC? This
- problem cannot be new to me, so after
- a few google searches, I learned of a
- PC serial cable and some DOS software
- that would allow me to hook up and use
- a Commodore floppy drive but not tape.
-
- In steps ebay. I was able to purchase
- a new-in-the-box VIC 1540 diskette
- drive for $15 shipped. I then got
- pillaged another $10 for a box of
- 5-1/4 floppy disks. Fortunately back
- then, I practiced the good discipline
- of recording on both sides of each
- tape, as well as to keep a master copy
- of all things relevant on an
- additional tape. So with a freshly
- cleaned datasette head and a LOT of
- load attempts, I was able to retrieve
- all of my saved programs from the
- 22-year aged tapes.
-
- I forgot about the fun it was to
- format a 170kb floppy disk. Compared
- to cassette tape, floppies were
- amazingly faster. Today, you can
- download a copy of it faster than you
- can type RUN on the VIC@s keyboard.
- Seriously though, using the tapes and
- floppies was like experiencing it new
- all over again. And that was kind of
- fun, though I am glad not to be
- fussing over such clumsy media with
- severely limited storage capacity.
-
- I have been able to enjoy the result
- of this tape librarian nightmare
- through the use of machine emulation
- software, specifically from the VICE
- Team. But a funny thing struck me this
- past week one of my programs is a game
- I wrote in 1984 called QUIKMAN. I
- named it QUIK instead of you-know-who,
- because earlier that year I wrote my
- first fully machine language program
- dubbed QUIKVIC quick as in fast, which
- it really was on a 1mHz 8-bit 6502
- CPU. As it went for me back then, I
- had this one final week off during the
- last of my college days, and I decided
- to spend it writing this game. I
- believed then that there would never
- be another opportunity for me to
- create this game, because I was
- grooming to be a professional data
- processing programmer using mainframes
- my dream of being an arcade game
- programmer would die, but I needed to
- try and do this one last time.
-
- I abandoned both my girlfriend and
- bathing that week, and spent 20-hour
- days in front of the parlor@s Zenith
- color TV with my little VIC20 and
- machine language monitor cartridge.
- The result of the game came out just
- fine for something that ultimately
- loads & runs on a machine with only
- 3.5kb of memory and 8-colors. As a
- matter of opinion, my recreation of
- this arcade megahit is far, FAR
- superior than what the licensed owners
- produced for the home computer market
- of that day. Still, I have always felt
- I could have done better If only I had
- the time, and perhaps even the tools.
- And now after 24-years, that feeling
- of an incomplete job has resurfaced.
-
- What triggered that gut reaction was
- my accidental discovery of a software
- project on cc65.org. It stirred up
- fond memories of my first C compiler,
- as it was also for the 6502 CPU
- powering the mighty Commodore 128. But
- this was not that product of that day.
- However, it sports a nifty 6502
- assembler with preset configurations
- to compile for Commodore 8-bit
- computers, including the VIC20! I used
- to own Merlin 128, too, so I had some
- pretty high expectations from this
- tool.
-
- After some light reading of its
- documentation, I became convinced that
- I could resurrect my QUIKMAN code into
- an original assembler source format
- that could be recompiled back into its
- original binary format. Turning back
- to VICE, I loaded QUIKMAN, virtually
- attached the VICMON cartridge, and had
- it virtually print (to an ASCII text
- file) a disassembled listing of its
- machine code and data.
-
- Over the past 5 days, I have been
- massaging that listing into
- newly-formatted assembler source,
- worthy of today@s coding standards.
- The goal was to produce an assembler
- source version that would compile into
- a binary that was EXACTLY the same as
- the originally hand-coded machine
- language version. After my first
- successful pass at compiling, I simply
- could not wait to look for deltas I
- had to boot it up and see if the
- program ran. Naturally, I was
- disappointed when the screen turned
- blue and did nothing. I found the
- first bug and fixed it, and to my
- surprise and delight, a version of
- QUIKMAN was up and running. Way too
- cool!!
-
- I then had the chore to compare the
- new binary against the old one. It is
- really important to complete the first
- objective in making an assembler
- source that would compile exactly as
- the original. To accomplish this
- without too much effort, I turned to
- the use of two command-line tools:
- hexdump and meld. By issuing:
-
- hexdump -C quikman.p00 > quikman.old
- hexdump -C quikman.prg > quikman.new
-
- I could then compare the two outputs
- with this graphical diff view:
- meld quikman.old quikman.newIt
- highlighted just a few differences,
- which had no real adverse affects on
- the program functionality, but I
- wanted it to be precisely the same.
- After a few more edits, validated by a
- clean meld view, the assembler source
- is now complete.
-
- Now I wonder how many more days I'll
- go without bathing until I figure I am
- done with its next revision ?
-
-
- Programmer's Delight
- --------------------
- Posted on November 1st, 2008 by Rob
- Earlier this morning, I had the
- pleasure of scratching a 24-year old
- itch which resulted in the 2008
- completed version of Quikman for the
- venerable Commodore VIC20. It was just
- the other week I wrote about the feat
- of converting a disassembled listing
- of my old game, reformatting it into
- suitable assembler source code so that
- if compiled, it produces the exact
- same binary of the original program
- file.
-
- The days that followed was something I
- did not expect. With this new
- assembler, I found that I was able to
- recall what each part of the program
- did, reorganize the code and data in a
- manner that was much more memory
- efficient (a stock VIC20 only has 3583
- bytes for loading a program), and
- remove all unnecessary data and NOP
- (no operation) instructions that were
- useful then for reserving bytes for
- future machine code. This internal
- house-cleaning did not change any part
- of the game, but it did free up
- 88-bytes and assure me that the
- assembly process was in a manageable,
- relocatable address state. That was
- all I needed to get motivated to make
- the changes I could not do in 1984
- without these tools no excuses for me
- now not to get it done right! This is
- what got done:
-
- - fix the character cell-based
- graphics to reduce flickering and
- color noise
-
- - fix the number of lives remaining in
- the status bar
-
- - fix a software interrupt that can
- cause a joystick poll to occur
- during quikman's move
-
- - reverse monsters direction after
- swallowing a powerpill
-
- - any monster released from the cage
- remains aggressive, even during
- powerpill play
-
- - add a startup demo mode
-
- - improve quikman@s death sequence
-
- - improve completed level sequence
-
- = add a cheat key to advance to the
- next fruit level
-
- A bonus feature from all the above
- fixes and optimizations allowed me to
- integrate progressive playing speed as
- the fruit levels advance. The player
- will require teenager reflexes to
- exceed the apple level without the use
- of the cheat key (ESC). I decided to
- make the demo mode look like an old
- Atari VCS home video game a steady
- flicker from its player / missile
- graphics while cycling the screen@s
- color palette. This was quite
- intentional, because that look
- definitely invokes an authentic
- retro-arcade gaming feel about it.
-
- The final result of this program is
- that it completely uses not just
- occupies all 3583-bytes of available
- RAM. Fortunately, it was enough for my
- skill and determination to complete my
- objective in making a quality Pac-Man
- clone for a stock Commodore VIC20. Too
- bad it took 24-years to complete,
- because there was no other clone of
- that era that I ever played which came
- this close to the original.
-
- After playing a few rounds of my new
- found toy, an overwhelming mix of
- satisfaction and pride took hold of my
- senses which after a short time, I
- found myself a bit physically shaken
- as if I were nervous. Talk about a
- coding session hangover ha! The only
- other time I felt that, but it was
- more potent, was witnessing the birth
- of my daughter, Erin. It is that
- feeling from accomplishment in
- software invention that I describe as
- programmer@s delight.
-
- P.S., this program runs perfectly on
- another fine machine emulator, mess,
- and uses a joystick. It uses the PC@s
- F4 key for the VIC@s F7 key (which is
- accurate as the VIC only had four
- function keys, but used SHIFT to yield
- eight) and the HOME key as VIC's STOP
- key for cheating. From the
- command-line, simply:
-
- mess vic20 -quik quikman2k8.prgAnd you
- will need to type RUN after a few
- seconds from its READY prompt.
-
-
-