General I/O
The ZX80 BASIC has a limited intepreter which lacks many keywords and has only upper-case characters and an inversed version of those upper-case characters. Its character set is non-ASCII compliant, and generally will only read and write to the screen and cassette tape. There are no ways to draw to the screen without the enchanced ZX81 ROM unless one PRINTs to the screen, or works out where the DFILE (screen location) is in RAM and POKEs individual bytes to the screen. The recent ZXPand allows your ZX80 to read and write to an SD card, although this requires a special kit for the ZX80. An emulator such as EightyOne will simulate a real ZX80 with a ZXPand.
Program that prints
Code: Select all
10 PRINT "HELLO MUM"
Code: Select all
10 PRINT "HELLO ";
20 GO SUB 100
30 STOP
100 PRINT "MUM"
110 RETURN
Code: Select all
10 LET A$="HELLO "
20 LET B$="MUM"
30 PRINT A$;B$
40 LET X=100
50 LET Y=200
60 PRINT X,Y
Loops
Code: Select all
10 FOR I=0 TO 10
20 PRINT I,;
30 NEXT I
Code: Select all
10 LET I=0
20 PRINT I,;
30 LET I=I+2
40 IF I<10 THEN GO TO 20
Code: Select all
10 INPUT A$
20 PRINT "YOU TYPED THE FOLLOWING STRING:"
30 PRINT A$
40 INPUT A
50 PRINT "YOU ENTERED THE FOLLOWING INTEGER:"
60 PRINT A
Handling floating point numbers
Well, this is a tough one but let's assume that you want to print prices of items that are priced from £0.01p through to £327.67p, here is one way of doing it:
Code: Select all
10 INPUT M
20 LET M=ABS(M)
30 LET S$="."
40 PRINT M/100;S$;
50 LET R$=STR$(M)
60 IF M<10 THEN PRINT "0";
70 IF M>99 THEN LET R$=TL$(R$)
80 IF M>999 THEN LET R$=TL$(R$)
90 IF M>9999 THEN LET R$=TL$(R$)
100 PRINT R$
Booleans
The ZX80 returns -1 if true or 0 if false. In order to do a not equals, one must use the following:
10 LET A$="1"
20 LET B$="2"
30 IF NOT A$=B$ THEN PRINT "NOT EQUALS"
40 IF A$=B$ THEN PRINT "EQUALS"
Animation
This is not really possible without using machine code as the screen is switched off whilst the BASIC interpreter computes. You will only get a static screen when waiting for a keyboard input with INPUT.
Color [SIC] text/graphics
The ZX80 has only a monochrome display
Obfuscating and minimising listings
The ZX80 does not accept BASIC minimisation or multi-statemented lines, like:
Code: Select all
10 PRINT "HELLO MUM ";: GO TO 10
Standard input/output
This wasn't even a thing in 1980, so standard in could mean reading from the keyboard to a varibale or from a cassette player (or the virtual equivalent) - and stardard out could mean writing to the screen, or storing data to a variable, or recording data to a cassette tape (or again virtual equivalent).
Unconditional loops
Yes, the GO TO keyword exists.
Object Orientation
Err...