GOSUB without RETURN

Published June 01, 2006
Advertisement
I have had a lot of fun removing the cobwebs from Hammurabi thus far, but I've taken it about as far as it can go. At this point, it screams "Yahoo! Widget", "Flash" or "Open Lazlo", which means a complete paradigm shift anyway, i.e. it'll have to be completely redone. And that's okay... Hammurabi is not the most complex of games.



So, on to the next forgotten BASIC text based game:

http://www.atariarchives.org/adventure/chapter15.php

I decided on a slightly different tactic this time...

For one, I decided to go with C++ right off the bat, using std::cout, and std::string.

But this time, I decided to write functions to replace the various BASIC commands. It isn't quite exact, but I did get to write a templated print function and input function. I got to simulate the read/data mechanism of BASIC (fortunately, this game only has numeric DATA statements, not numbers and strings mixed.

And so I'm going along quite swimmingly. As the game runs, it foists the main loop onto a subroutine with a GOSUB, which is all well and good, until I notice the part where the subroutine checks for death.... there is a GOTO, and it leaps outside of the subroutine.

Now, I've been approximating subroutines and GOSUBs with functions, and now I've got a GOTO in a function, and where it needs to get to in another function.

Of course, this really speaks poorly of the writer of the original code. Even by the standards of the time, one should not have a GOSUB without a RETURN.

And that just goes to show that back in the day(ca. 1983), as it is now, they let just any old person write a book.

My solution to the problem at hand? I'm going to put the common code into a separate function, put a label in the subroutine, and call that function from both the functions that need it to run.

The bar is really really low for code quality during a port like this.

Next Entry Nope...
0 likes 2 comments

Comments

johnhattan
MMM, wrong direction. What you need is a BASIC interpreter done in Flash or OpenLaszlo so that you can just paste that code in and run it.

Of course, that Coco emulator you were working on would work too.
June 01, 2006 09:06 PM
Tesseract
Hi TANSTAAFL

two things:

1. great minds must think alike. I built a version in Flash about eight months ago.

2. There is now a Commodore 64 emulator written in Flash, which may be able to run your BASIC files.
June 26, 2006 11:50 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Music To My Ears

1773 views

Getting There...

2015 views

Guess Chess

1915 views

iPhone JetLag

1867 views

iPhone JetLag

1708 views
Advertisement