I’d already written the screen driver (see previous post) and some evaluation stuff for VTL-2 but this looked more interesting to program in.

In some ways it’s appropriate. It was designed by someone in their “Third year of High School” (Erik Mueller, who I think is the guy pictured – not aged 13) in 1976, which means he is about the same age as me plus or minus a year.

It’s slightly odd as Tiny BASICs go ; for a start it has 1 byte values, both variables and line numbers – this means that my work on 2 byte maths routines is pretty much to pot. It does support strings, sort of and it also supports direct access to memory both for data and code.

It’s pretty impressive for a 13/14 year old and fits in under 2k of memory. This is what the code looks like :-

10 " *** NUMBER- A NUMBER GUESSING GAME (NUM05)

20 PR:PR" WHAT IS YOUR NAME";:IN$(14,1)

30 X=!:S=0:PR"HI, " ;$(14,1);" . WELCOME TO THE GAME OF NUMBER"

40 PR" I'M THINKING OF A NUMBER FROM 0 TO 255"

50 PR" GUESS MY NUMBER !!"

60 PR: PR "YOUR GUESS": ING: S=S+1

65 IFG=X; GOTO90

70 IFG<X; PR" TOO SMALL. TRY A BIGGER NUMBER."

80 IFX<G; PR"TOO BIG. TRY A SMALLER NUMBER."

85 GOTO60

90 PR " THAT’S RIGHT, ";$(14,1);" I ! YOU GOT IT IN";S; "GUESSES"

100 PR" PLAY AGAIN" ; : INA: IFA=’Y';GOTO30

110 PR " OK HOPE YOU HAD FUN . " : END

This is (of course) the very common Hi Lo game.

- $(14,1) is the string at H = 14, L = 1 e.g. $0E01,
- ! is a random number from 0-255.
- Lines beginning with a “ are comments (e.g. 10)

Other than that it should be fairly clear. I will probably be a bit more syntactically friendly, skipping spaces and so on - looking at the original code (8080 assembler) it could get a bit confused running program if you aren't fairly straight with syntax - so mine will support IF G=X ; GOTO 90 rather than IFG=X; GOTO90

## No comments:

## Post a Comment