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

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
XavSnap
Posts: 1403
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

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

Post 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.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1403
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

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

Post 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
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply