Entries Tagged as 'Technology'

An Old Trick for a New Game for an even Older Computer

During the Amiga heyday in the early 1990s, I wrote a standalone BBS program called ‘Hack & Slash’.  It was a port from an Apple ][ BASIC program, but heavily customized and enhanced using C and “modern” telecommunications and protocols for color, graphics, and sound.

I thought I was really clever at the time writing my random dungeon level generator — it was my first practical use outside of a classroom to implement a recursive function.  Because the dungeon ‘walls’ were probability driven, a function was needed to validate that every ’tile’ in the arbitrarily-sized dungeon floor was accessible by the hero.  Without this kind of validation, the hero would eventually find himself ‘trapped’ on a floor with no means to escape.

The recursive function was simply invoked as chkroom(0,0), whereas the 0,0 passed were parameters to the starting point in the dungeon map matrix.  Upon entering each tile, a flag is cleared for that element in the matrix.  Next, a condition is checked if the tile to its right is accessible.  If it is, call chkroom() with +1 added to X.  If not, do the same condition checks for down, left, and up directions calling chkroom() passing values Y+1, X-1, and Y-1 respectively.

And at the conclusion of all this recursion, do a loop through the dungeon matrix to check if ALL of the flags had been cleared.  If any persist, do the dungeon regeneration and this validation again until it has passed.  The higher the frequency of random walls generated increases the pattern complexity of the floor, which exponentially increases the probability that the floor will not pass with an ‘all clear’.

Today, I am working on a port of an old arcade favorite, Berzerk, for the Commodore VIC 20.  The playfield for the game is a fixed 3-row by 5-column matrix for each floor.  Given that the game needs to be written using 8-bit assembler, I quickly dismissed the idea that using my C algorithm to validate a floor could be feasible.  After all, VIC 20 is a relic machine running at 1mHz and limited memory of only a few thousand bytes available for the program, graphics, and sound all the while using a 256-byte system stack.  Ah, but the challenge by it all . . .

Generating the random walls for each floor is a simple matter, but validating that all its ‘rooms’ are accessible was turning out to be very problematic.  Every time I thought I could solve this puzzle using bit operators (OR, AND, XOR) to assure that its rooms and corridors could not trap the hero, I would only later stumble upon an instance where even my most elaborate of schemes failed.  This was getting a bit frustrating, pun intended.

So I wandered back to my dungeon floor validation and decided it was so simple of an algorithm that it may be possible to translate it to assembler and still keep it within reason of the machine’s constraints.  After some writing and whittling, the resulting code turned out perfect!  It is called by simply zero-ing the starting cell (R0) and invoking CRAWL.  Here is its listing:

CRAWL:
  LDX R0
  LDA MAZE,X
  CMP #$80
  BCC @fini        ; been here?
  AND #$7F         ; clear accessible bit
  STA MAZE,X

@right:
  LSR
  BCS @down        ; right wall?
  PHA              ;++ push walls
  LDA R0
  PHA              ;++ push cell
  INC R0
  JSR CRAWL        ; explore right cell
  PLA              ;-- pop cell
  STA R0
  PLA              ;-- pop walls

@down:
  LSR
  BCS @left        ; bottom wall?
  PHA              ;++ push walls
  LDA R0
  PHA              ;++ push cell
  CLC
  ADC #5
  STA R0
  JSR CRAWL        ; explore cell below
  PLA              ;-- pop cell
  STA R0
  PLA              ;-- pop walls

@left:
  LSR
  BCS @up
  PHA              ;++ push walls
  LDA R0
  PHA              ;++ push cell
  DEC R0
  JSR CRAWL        ; explore left cell
  PLA              ;-- pop cell
  STA R0
  PLA              ;-- pop walls

@up:
  LSR
  BCS @fini        ; top wall?
  PHA              ;++ push walls
  LDA R0
  PHA              ;++ push cell
  SEC
  SBC #5
  STA R0
  JSR CRAWL        ; explore cell above
  PLA              ;-- pop cell
  STA R0
  PLA              ;-- pop walls
@fini:
  RTS

This old dog is always happy to re-implement an old trick!

PS3 Media Server

I discovered a nifty project, PMS, written in JAVA that allows my Linux (or Windows) workstation stream multimedia (music, photos, movies) to my Sony Playstation 3, hooked-up for viewing in all of its 52″ HDTV glory.  It also includes several options to stream other multimedia content directly from the web, too, such as YouTube, Internet Radio and TV.  Previously, I have used uShare with a lot of success, but this package is better suited for me because it was designed specifically to work with PS3, and it takes advantage of my 8-core workstation allowing HD content to stream without any loss in quality.

No more copying multimedia to the modest-sized PS3 internal hard disk — just point PMS to the workstation’s file directories, ISOs, etc. to share with PS3, and it is conveniently integrated and organized on the gaming console.  Will wonders never cease?

The PMS UI reveals a lot of options, but fortunately it comes preset with normalized values and pick-lists with human-readable adjustments.  It comes bundled with its own tsMuxeR package, but it plays best by leveraging other multimedia codecs and transcoding from the mainstream projects in MEncoder and VLC.  And there are free text entry boxes to override and enhance even the nerdiest of implementations.

I made this simple script to add as an Avant Window Navigator launcher item:

#!/bin/sh
cd pms-linux-1.10.5
env JAVA_HOME=/usr/java/default ./PMS.sh
exit

8-bit New Additions

This week marked the arrival of some more toys for my 1980s computer collection.  This time they are for the Commodore “educational” line of home computers: C16 and Plus/4.  What was remarkable about these two models — that succeeded only in production date to the popular VIC 20 and C64 and not in marketing & sales — was the improved BASIC and a different video chip capable of displaying 121-colors.  It also sported a new ESCAPE key, which was very handy with the improved on-screen editing of BASIC programs and for applications that wanted to manage the screen with varying sized scroll regions (windowing)

The C16 (16kb memory) was to succeed the VIC 20 (5kb) for low-end computing, breaking the $100 price barrier for a color home computer.  That was the model I chose when shopping for my VIC 20 replacement, snubbing the more popular and powerful “gaming” computer in C64.  It was time to get a bit more serious about my career in computer programming, and I convinced myself that this little machine would serve my purposes better in that pursuit.  I was right at the time in December 1984, but in hindsight, the C128 home computer I would purchase just 7-months later was the real deal.

Pictured here is the Plus/4 model, with a price-point outside of its targeted consumers, outfitted in its sleek casing and cool keyboard layout.  It came with the full complement of 64kb RAM of which nearly 60kb of it was available to its improved BASIC 3.5 and built-in machine language monitor.  Back then, outlets were trying to gouge consumers for $399. Today, you can typically buy these in near-mint condition like this one for around $20.

Plus/4, joystick, floppy, and datasette

Plus/4, joystick, floppy, and datasette

I have to confess that owning this floppy drive was a bit pricey - about $90 Euros plus overseas shipping — and the cost of a U.S. to Foreign power converter from the local Radio Shack. Not one of my better purchases, however, I am pleased the transaction of getting this working dinosaur went smoothly and without any disappointing incidents that occur frequently. So, I bundled the order with the Datasette and Jack Attack game cartridge to make the total purchase a complete success for the seller at Tinchens Online Shop.  Here’s a picture showing the peripherals working:

Floppy and Tape works!

Floppy and Tape works!

C16 game: Jack Attack

C16 game: Jack Attack

The 1551 floppy drive connector into the game cartridge port has a passthru connector to allow a regular game cartridge to be fitted, as seen here with one of my all-time platform favorites in Jack Attack.

FiOS

My Internet-TV-Phone are now all switched over from a mix of analog/digital copper to fiber optics.  What can I say about it that has not already been said before by oh so many others?  Wow.

The switchover of our analog phone line to digital was totally seamless, including testing our home alarm system.  The only thing missing was the static on the phones.

Having download speeds of up to 25 Mbps and uploads of up to 15 Mbps — yes, it is true, it is fast.  It’s not about a single download, it’s the fact that I can download a large file and still have a few more usable Internet sessions working without incurring noticeable latencies.  Executing one of those Internet speed tests gauged my connection at nearly 29mbs download / 21mbs upload with only 16ms ping over a 50 mile distance to a Boston-based server.  And I was also downloading a 157mb file at the same time.  Impressive.

The included wireless router is first class.  3 WAN ports: coax and ethernet, 6 LAN ports: ethernet, coax, and USB, and wireless.  Excellent signal strength, I can roam anywhere inside and outside of my property.  Up the street and into a neighbor’s garage — 4 bars of signal strength and the mbs dropped from 56 to 11.

I have one HDTV along with three standard definition TVs, and all are now hooked up with set top boxes.  The picture quality is what you expect, except I have not experience any picture jitters yet.  What improved most noticeably was the numerous functions, responsiveness, and overall friendliness.  Each set top box provides their Guide and Internet Widgets (Facebook, Traffic, Weather, etc.)  Using the DVR remotely from my Blackberry or from any web browser is pretty cool too.  The number of channels in our package (no premium) is impressive, too, although I really don’t want to disclose to my father that I have the Horse Racing channel — he may never leave.

This experience reminds me of how it felt when I got my first cable modem.  And when our local cable company repeatedly promised a next generation of improved technologies and friendliness was coming (this campaign started over 5-years ago), all I got was a small incremental boost in speed — after I paid to upgrade my modem — and shuffling AND reduction of usable cable channels.  Well, cable truly dominated homes these past 25+ years with the last 12+ years including Internet.

I wonder where those carriers and services will be in the next 5 years?