Page 1 of 1

[Tuto] How to convert a Basic program to a ZX81/Spectrum..

Posted: Fri Jan 14, 2022 9:00 am
by XavSnap
Hi,

This is an article from the magazine "L'Ordinateur Individuel" written by Jean-Pierre BRUNERIE and Ludwick ZÜBER.
ConvertBasic.jpg
PDF link : http://zx81.archives.free.fr/Magazines_ ... mmands.pdf

Have fun.

Re: [Tuto] How to convert a Basic program to a ZX81/Spectrum..

Posted: Fri Jan 14, 2022 8:38 pm
by XavSnap
Note:
On many Basic language AND and OR can't support numerics values (Spectrum/Zx81).
Boolean AND Boolean = Boolean x Boolean
Boolean OR Boolean = Boolean + Boolean


Where TRUE=<>0 and FALSE=0.

Code: Select all

10 LET A=1
20 LET B=0
30 IF A THEN PRINT "A=";A
40 IF B THEN PRINT "B=";B
50 PRINT "A IS TRUE" AND A, "B IS FALSE" AND NOT B
60 PRINT "A IS TRUE" AND A, "B IS FALSE" AND NOT B
70 PRINT
100 FOR A=1 TO 10
110 LET B=A/2-INT (A/2)
120 IF B THEN PRINT "B IS TRUE =",B
130 IF NOT B THEN PRINT "B IS FALSE=",B
140 NEXT A
VALUE AND 0 = FALSE = 0
VALUE AND 1 = TRUE = 1
VALUE AND 128 = TRUE = 1

To get a numeric value, you had to use an ASM code:
1 REM xxxxxxxxxxxxx
100 POKE 16514+x,VALUE1
150 RAND VALUE2
200 LET Z= USR 16514

LD A,(IY+50) ; SEED VALUE2 RAND=x
OR/AND/XOR $VALUE1 ; NUMERIC ON A REGISTER
LD B,0
LD C,A
RET