Zeddy & Speccy Characters w/ Same Code that Print Same

Post Reply
MOB-i-L
Posts: 60
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Zeddy & Speccy Characters w/ Same Code that Print Same

Post by MOB-i-L »

I discovered, as others may have done before me, that there are some characters with the same code in ZX81 and ZX Spectrum that print exactly the same. This can be useful if you want to write programs for ZX81 and ZX Spectrum that use the same source code. I used this program that I converted to p- and tap-files using bas2tap and zxtext2p, respectively. (ZXText2P handles "GO SUB" and converts it to GOSUB, but bas2tap cannot handle GOSUB.)

Code: Select all

10 FOR I=133 TO 134
20 GO SUB 90
30 NEXT I
60 FOR I=230 TO 255
70 IF NOT(I=231 OR I=232 OR 236<=I AND I<=237 OR I=249 OR I=252) THEN GO SUB 90
80 NEXT I
89 STOP
90 PRINT STR$ I;":";CHR$ I;"."
99 RETURN
(The STR$ is a way to circumvent a bug in ZEsarUX that doesn't print plain numbers when printing to stdout.)

This prints the following except 133 and 134 that are block characters similar to \ and |.

Code: Select all

133:.
134:.
230: NEW .
233: DIM .
234: REM .
235: FOR .
238: INPUT .
239: LOAD .
240: LIST .
241: LET .
242: PAUSE .
243: NEXT .
244: POKE .
245: PRINT .
246: PLOT .
247: RUN .
248: SAVE .
250: IF .
251: CLS .
253: CLEAR .
254: RETURN .
255: COPY .
2022-06-12-011214_704x640_scrot.png
2022-06-12-011247_704x656_scrot.png
2022-06-12-011313_704x640_scrot.png
2022-06-12-011348_704x656_scrot.png
I also have a command line for Linux that converts some simple ZX81 BASIC programs to ZX Spectrum:

Code: Select all

sed 's/GOTO/GO TO/;s/GOSUB/GO SUB/;s/RAND/RANDOMIZE/;s/SCROLL/POKE 23692,255/' aritm-zx81.bas > aritm-zx81sp.bas
One program that was automatically converted is Aritm for ZX81 that now exists for ZX Spectrum: https://github.com/mobluse/aritmjs/rele ... zx81sp.tap
One could then polish the translation. There are many more emulators for ZX Spectrum than for ZX81 for e.g. phones.
Attachments
zx81spsamechr.p
(1.09 KiB) Downloaded 116 times
Post Reply