CONVERTING TZX into "P" and into WAV?

Emulator and emulator development specific topics
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: CONVERTING TZX into "P" and into WAV?

Post by yerzmyey »

It must work.

I use an amplifier for WAV/MP3 loading.

Image

I would check it out by myself but for now I have some mess with the hardware (many various machines in one room ;) ), so I will be able to connect properly the ZX81 only in some time.
Last edited by yerzmyey on Mon Jan 04, 2010 5:46 pm, edited 1 time in total.
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONVERTING TZX into "P" and into WAV?

Post by XavSnap »

Hi,

ht[url]tp://www.wintzx.fr[/url] ?
;)
I asked to Patrick to make easy the "tzx" to "wav/mp3" conversion.
The last release able to select a "Rookie" or a "Pro" interface.
Have Fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
MOB-i-L
Posts: 63
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: CONVERTING TZX into "P" and into WAV?

Post by MOB-i-L »

Hi, I need to convert tzx-files with several programs into equally many p-files (for use in e.g. the Zed Ex-emulator for Android). In Eightyone you can only convert to p-file if it only contains one program.

BTW I sampled all my ZX81-cassettes now. Sometimes there were errors and I need to test which files work and since I have many copies of a file on the same and different tapes I need to convert them into p-files in order to compare them using e.g. diff, fc or comp.

I also have Artic ZX Forth screens (i.e. data-blocks) in the tzx-files and I need to extract them. Each ZX Forth screen is 1028 bytes of ASCII, but a Forth screen is really 1024 bytes. In the ZX Forth screen the first two bytes are probably the screen number and the last two are always 0.

One way to extract them is to use Edit... in Eightyone and copy and paste the text and then convert that into a file. I could write a program to do that but if there already exits one that would be faster. Example of a ZX Forth screen (from my game Convoy Bomb from 1982-1983 written using some Swedish names):

Code: Select all

0000: C8 00 28 20 43 4F 4E 56 4F 59 20 42 4F 4D 42 20 : ..( CONVOY BOMB 
000F: 20 20 20 20 20 38 33 2E 30 35 2E 30 37 29 20 20 :      83.05.07)  
001F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
002F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
003F: 20 20 46 4F 52 54 48 20 44 45 46 49 4E 49 54 49 :   FORTH DEFINITI
004F: 4F 4E 53 20 44 45 43 49 4D 41 4C 20 20 20 20 20 : ONS DECIMAL     
005F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
006F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
007F: 20 20 28 20 53 43 52 20 23 20 32 31 20 3C 47 52 :   ( SCR # 21 <GR
008F: 41 46 49 4B 3E 20 4C 4F 41 44 41 44 2E 29 20 20 : AFIK> LOADAD.)  
009F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
00AF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
00BF: 20 20 3A 20 54 41 53 4B 20 3B 20 20 20 20 20 20 :   : TASK ;      
00CF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
00DF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
00EF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
00FF: 20 20 30 20 56 41 52 49 41 42 4C 45 20 56 42 20 :   0 VARIABLE VB 
010F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
011F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
012F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
013F: 20 20 30 20 56 41 52 49 41 42 4C 45 20 4E 20 20 :   0 VARIABLE N  
014F: 30 20 56 41 52 49 41 42 4C 45 20 41 42 20 20 20 : 0 VARIABLE AB   
015F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
016F: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
017F: 20 20 3A 20 56 49 53 41 2D 50 20 48 4F 4D 45 20 :   : VISA-P HOME 
018F: 2E 22 20 43 4F 4E 56 4F 59 20 42 4F 4D 42 22 20 : ." CONVOY BOMB" 
019F: 31 30 20 53 50 41 43 45 53 20 2E 22 20 50 4F 41 : 10 SPACES ." POA
01AF: 4E 47 3A 22 20 4E 20 40 20 35 20 2E 52 20 3B 20 : NG:" N @ 5 .R ; 
01BF: 20 20 30 20 56 41 52 49 41 42 4C 45 20 58 46 20 :   0 VARIABLE XF 
01CF: 20 30 20 56 41 52 49 41 42 4C 45 20 59 46 20 20 :  0 VARIABLE YF  
01DF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
01EF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
01FF: 20 20 3A 20 46 4C 59 47 50 4C 41 4E 20 59 46 20 :   : FLYGPLAN YF 
020F: 40 20 31 2B 20 58 46 20 40 20 50 4C 4F 54 20 59 : @ 1+ XF @ PLOT Y
021F: 46 20 40 20 58 46 20 40 20 50 4C 4F 54 20 59 46 : F @ XF @ PLOT YF
022F: 20 40 20 58 46 20 40 20 31 2B 20 50 4C 4F 54 20 :  @ XF @ 1+ PLOT 
023F: 20 20 59 46 20 40 20 58 46 20 40 20 32 2B 20 50 :   YF @ XF @ 2+ P
024F: 4C 4F 54 20 59 46 20 40 20 58 46 20 40 20 33 20 : LOT YF @ XF @ 3 
025F: 2B 20 50 4C 4F 54 20 59 46 20 40 20 58 46 20 40 : + PLOT YF @ XF @
026F: 20 34 20 2B 20 50 4C 4F 54 20 20 20 20 20 20 20 :  4 + PLOT       
027F: 20 20 59 46 20 40 20 58 46 20 40 20 35 20 2B 20 :   YF @ XF @ 5 + 
028F: 50 4C 4F 54 20 59 46 20 40 20 58 46 20 40 20 36 : PLOT YF @ XF @ 6
029F: 20 2B 20 50 4C 4F 54 20 3B 20 20 20 20 20 20 20 :  + PLOT ;       
02AF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
02BF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
02CF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
02DF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
02EF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
02FF: 20 20 3A 20 46 4C 59 47 20 59 46 20 40 20 31 2B :   : FLYG YF @ 1+
030F: 20 58 46 20 40 20 31 20 2D 20 55 4E 50 4C 4F 54 :  XF @ 1 - UNPLOT
031F: 20 59 46 20 40 20 58 46 20 40 20 31 20 2D 20 55 :  YF @ XF @ 1 - U
032F: 4E 50 4C 4F 54 20 46 4C 59 47 50 4C 41 4E 20 31 : NPLOT FLYGPLAN 1
033F: 20 20 58 46 20 2B 21 20 58 46 20 40 20 36 35 20 :   XF +! XF @ 65 
034F: 3D 20 49 46 20 2D 37 20 58 46 20 21 20 31 36 34 : = IF -7 XF ! 164
035F: 33 36 20 43 40 20 39 20 2F 20 31 32 20 2B 20 59 : 36 C@ 9 / 12 + Y
036F: 46 20 21 20 56 42 20 40 20 49 46 20 2D 31 31 37 : F ! VB @ IF -117
037F: 20 4E 20 2B 21 20 4E 20 40 20 30 3C 20 49 46 20 :  N +! N @ 0< IF 
038F: 30 20 4E 20 21 20 54 48 45 4E 20 56 49 53 41 2D : 0 N ! THEN VISA-
039F: 50 20 54 48 45 4E 20 54 48 45 4E 20 3B 20 20 20 : P THEN THEN ;   
03AF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
03BF: 20 20 2D 2D 3E 20 20 20 20 20 20 20 20 20 20 20 :   -->           
03CF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
03DF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
03EF: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 :                 
03FF: 20 20 00 00                                     :   ..
But I have a lot of screens and many copies that I want to compare. Maybe I can extract them into p-files using a normal tzx to p converter (that I hope to find) and that would be the ZX Forth screens. Another alternative would be to convert the tzx-files into wav-files and then convert them to p-files, but that would require more work and might introduce errors.

I do have the tzx-files I want to convert here (note that some of them contain errors due to bad tapes): http://www.df.lth.se.orbin.se/~mikaelb/ ... 1/mob-i-l/
Last edited by MOB-i-L on Sat Oct 26, 2013 10:06 am, edited 1 time in total.
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONVERTING TZX into "P" and into WAV?

Post by XavSnap »

Hi,
Vb81 XuR can read binarys in Tzx. (Not a Wav forme signal)
...
You had to convaert your tzx in wav, and launch this file in EO.
Or use ZxSpectape in a Zx81 raw mode.
Have Fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
MOB-i-L
Posts: 63
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: CONVERTING TZX into "P" and into WAV?

Post by MOB-i-L »

I discovered TzxManager and that works for me, although I now have to extract the binaries using right click on every block.
http://dskcenter.free.fr/zxtools.html
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONVERTING TZX into "P" and into WAV?

Post by XavSnap »

Hi,
I had to code a new program !!!
;-)
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
MOB-i-L
Posts: 63
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: CONVERTING TZX into "P" and into WAV?

Post by MOB-i-L »

TzxManager didn't work for the ZX FORTH-files in a TZX-file. They became smaller. This probably related to that when making p-files you remove the name, but FORTH screens (i.e. data blocks) doesn't have a name and should be saved completely (i.e. 1028 bytes in the ZX FORTH case). Now I solved this problem by opening the TZX-file in an editor (Notepad++) and copied and pasted the ASCII parts into new files (the ASCII-part is always 1024 bytes). Now I have collected the FORTH screens here and one can also view them as textfiles:
http://www.df.lth.se.orbin.se/~mikaelb/ ... forth-scr/
Of these files I have once entered all on my ZX81 except the Artic ZX FORTH-editor. Some of the programs were developed by me in 1982-1985. Unfortunately one screen is lost in the game CONVOY BOMB.
Last edited by MOB-i-L on Sat Oct 26, 2013 10:03 am, edited 1 time in total.
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONVERTING TZX into "P" and into WAV?

Post by XavSnap »

Hi,
In "TzxManager", all blocs are mirrored in the "Blocs" directory!
Juste rename ".tmp" files and edit them in the note-pad.
All datas are in ascii, not in ZX81 character code.(!!!Spectrum compatibility!!!)
>>Unfortunately one screen is lost in the game CONVOY BOMB.
You can use a wav editor (like GoldWave) to replace all destroyed harmonics.
... or use "ZxSpectape" to rebuild/reazimute the signal!
(let's me know, my release may be up to date!)
Or upload your wrong wav file (44k-mono), i will try to recover it's datas.

I will contact Dominique Contant to test ascii files on then inboard XuR Forth.

Have fun.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: CONVERTING TZX into "P" and into WAV?

Post by XavSnap »

Hi Mob-i-L,

Unfortunatly, you wont be able to convert these files to "p" files.
They are Datas files generated by an home made code, like "Fast-load" codes.
"P" files are saved in "ascii" Zx81 characters codes, and the wave train is initialised in the Tzx bloc Header (0=4 waves and 1=8 waves)
All harmonics are corrupts ... Eo take them like a Spectrum binary code.
You aren't able to read them as is.
EO wont work using your Spectrum TZX!
You had to keep you wavs files to reload your screen datas on EO.
But... Your Tzx able to retrieve screen scripts.
There sprites can be reload on the Zx-Forth using the EO's "Binary load".
Juste load this datas in the right memory offset !
But, you wont be able to save it in a "P" file.
To get a "P" file, you had to compile datas, and make a compiled stand-alone "auto-run" file.
I don't know if Zx-Forth can build this kind of file.
The best way to use them, on externals emulators is to create a ZX81 memory snap "Z81".
It will allow to run a compiled Forth code on a waiting loop, before a run command.(splash screen...)

>>Unfortunately one screen is lost in the game CONVOY BOMB.
On the Tzx bloc, a read error had generated a bit decay (2>) &08 was &20

Code: Select all

\
\ CONVOY BOMB      83.05.07
\ BY ...
\ 
\       
\  (LEFT AND RIGHT CURSORS)
\  
\  TYPE: 1 SCR COMPIL
\   ->   OK.
\  TYPE: "CONVOY-BOMB" TO RUN THIS GAME.
\
\ "CONVOY_BOMB.4TT" for VB81 XUR INBOARD FORTH
\ You have 14 screen in the codes.
\ D.Contant's compiler use
\ 12 screens, 8 lines per screen
\ 125 bytes per line.
\
\ NEED TO BE CHECKED AND DEBUGGED.
\ HOME replaced by CLS.
\ ";CODE" replaced by a new fuction.
\ "R" ??? variables no declared. (R0???)

<COMPILTAG=OFF>

<SCR 1>
\ -----------------------------------

<LINE 1>
 {
( CONVOY BOMB      83.05.07)
\FORTH DEFINITIONS
DECIMAL
( SCR # 21 <GRAFIK> LOADAD.) : TASK ; 0 VARIABLE VB 0 VARIABLE N 0 VARIABLE AB 0 VARIABLE R
 }

<LINE 2>
 {
: VISA-P HOME ." CONVOY BOMB" 10 ASPACE ." POANG:" N @ 5 R @ . ; 0 VARIABLE XF 0 VARIABLE YF 
 }

<LINE 3>
 {
: FLYGPLAN YF @ 1+ XF @ PLOT YF @ XF @ PLOT YF @ XF @ 1+ PLOT YF @ XF @ 2+ PLOT YF @ XF @ 3 + PLOT YF @ XF @ 4 +  
 }

<LINE 4>
 {    
PLOT YF @ XF @ 5 + PLOT YF @ XF @ 6 + PLOT ; : FLYG YF @ 1+ XF @ 1 - UNPLOT YF @ XF @ 1 - UNPLOT FLYGPLAN 1 XF +! XF @ 65 = 
 }

<LINE 5>
 {
IF -7 XF ! 16436 C@ 9 / 12 + YF ! VB @ IF -117 N +! N @ 0< IF 0 N ! THEN VISA-P THEN THEN ; 
 }
<LINE 6>
 {
-->
 }

<SCR 2>
\ -----------------------------------
( GRAFISKA KOMMANDON:PLOT UNPLOT)        
\FORTH DEFINITIONS HEX
HEX : ;CODE *N SCODE , STATE 0SET ; IMMEDIATE
: PIT ;CODE E1 C, D1 C, C5 C, 4D C, 43 C, CD C, 0BB2 , C1 C, C3 C, NEXT , SMUDGE PIT 
: PIT1 4030 C! PIT ;     
: PLOT1 ( Y X --- ) 9B PIT1 ;   
: UNPLOT1  ( Y X --- ) A0 PIT1 ; DECIMAL     
: ?UTANF0R OVER OVER >R >R R -1 > R 44 < AND R> DROP R -1 > R 64 < AND R> DROP AND ; 
: 2DROP DROP DROP ;      
: PLOT ?UTANFOR IF PLOT1 ELSE 2DROP ENDIF ;        
: UNPLOT ?UTAN
: HOME CLS

;S

<SCR 3>

( CONVOY BOMB      83.05.07)          
( SKEPP DEF. FORTS. >> )
YS @ 2+ XS @ 5 + PLOT YS @ 1+ XS @ 5 + PLOT YS @ XS @ 5 + PLOT YS @ 2+ XS @ 4 + PLOT
YS @ 1+ XS @ 4 + PLOT YS @ XS @ 4 + PLOT YS @ 2+ XS @ 3 + PLOT YS @ 1+ XS @ 3 + PLOT YS @ 2+ XS @ 2+ PLOT
YS @ 1+ XS @ 2+ PLOT YS @ 2+ XS @ 1+ PLOT YS @ 2+ XS @ PLOT ;

: FLYT -1 XS +! SKEPP YS @ 5 + XS @ 12 + UNPLOT YS @ 4 + XS @ 13 + UNPLOT YS @ 3 + XS @ 13 + UNPLOT YS @ 2+ XS @ 15 + UNPLOT
YS @ 1+ XS @ 14 + UNPLOT YS @ XS @ 13 + UNPLOT XS @ -14 < IF 1 AB +! 64 XS ! THEN ;

: VATTEN HOME 21 0 DO CR LOOP 32 0 DO 23 EMIT LOOP ; 

: VISA 0 VB ! VATTEN -6 XF ! 2 YS ! 64 XS ! BEGIN 40 YF ! FLYG  FLYT FLYG 16421 @ -577 = UNTIL ; 

-->

<SCR 4>

( CONVOY BOMB      83.05.07)          
0 VARIABLE XB  4 VARIABLE RB 0 VARIABLE ?BOMB -1 VARIABLE ?S 

: BOM 2 XB @ 1 - PLOT 2 XB @ 1+ PLOT 3 XB @ PLOT 3 XB @ 2+ PLOT 4 XB @ 1+ PLOT ;    

: SUDDA HOME 17 0 DO CR LOOP 128  ASPACE ;          

: EXPLODERA SUDDA 13 5 12 4 13 4 10 3 9 5 2 4 4 6 6 6 6 5 0 3 0 1 15 3 14 0 8 3 6 3 4 3 3 2 3 1 2 1 3 0 13 1 12 2 12 1  11
1 11 0 4 1 5 2 6 2 7 2 8 1 6 1 5 0 9 0 8 0 6 0 7 0 36 0  DO YS @ + SWAP XS @ + PLOT LOOP 1 AB +! ; 0 VARIABLE YB         

: ?TRAFF YB @ RB @ - 3 < IF XB  @ XS @ 3 + > XB @ XS @ 14 + < AND IF EXPLODERA 375 N +! VISA-P 72 XS ! ELSE BOM THEN 
VATTEN 0 ?BOMB ! 6 ?S ! THEN ; 

: FALL YB @ RB @ - XB @ UNPLOT YB @ RB @  13 * 10 / DUP RB ! - XB @ 1+ DUP XB ! PLOT ?TRAFF ;

: BOMBINIT 16421 @ -8321 =  IF 1 ?BOMB ! XF @ 4 + XB ! 4 RB ! YF @ 3 + YB ! THEN ;

-->         

<SCR 5>

( CONVOY BOMB      83.05.07)          
: B 0 N ! CLS VISA-P 0 AB ! 1 VB ! VATTEN         
BEGIN FLYG FLYT ?BOMB @ IF FALL ELSE BOMBINIT THEN -1 ?S +! FLYG ?S @ 0= IF SUDDA THEN AB @ 5 = UNTIL ;        


: IT CLS CR CR 6 ASPACE ." C O N V O Y   B O M B" CR CR         
." DITT UPPDRAG AR ATT SANKA ALLA" CR ." FARTYGEN I EN KONVOJ. KONVOJEN" CR ." BESTAR AV 8 HANDELSFARTYG." CR 
." DU FAR POANG F0R VARJE SANKT" CR ." SKEPP OCH POANGAVDRAG F0R VARJE" CR        
." 0VERFLYGNING." CR ." F0R ATT FALLA EN BOMB, TRYCK NER"       
." <B> TILLS DU SER BOMBEN FALLA." CR ." DU KAN INTE FALLA NASTA BOMB" CR ." F0RREN DEN F0RRA HARLANDAT." CR 
." DU KAN EJ REGLERA H0JDEN EFTER-" CR ." SOM DU EJ AR PILOT UTAN BOMB-" CR       
." FALLARE." CR ." F0R ATT B0RJA, SKRIV <N/L>." ;  

: CONVOY-BOMB BEGIN IT VISA B HOME CR CR CR CR ." VILL DU SPELA EN GANG TILL?(J/N)" 0 BEGIN DROPKEY DUP DUP 78 = SWAP 74 = 
OR UNTIL 78 = UNTIL CLS ." ADJ0. HOPPAS NI HADE TREVLIGT." CR ; ;S

<SCR 6>

  ( CONVOY BOMB      83.05.07)
\  FORTH DEFINITIONS
DECIMAL
  ( SCR # 21 <GRAFIK> LOADAD.)

: TASK ;
 0 VARIABLE VB  0 VARIABLE N  0 VARIABLE AB 

: VISA-P HOME ." CONVOY BOMB" 10 ASPACE ." POANG:" N @ 5 R @ . ; 0 VARIABLE XF  0 VARIABLE YF 

: FLYGPLAN YF @ 1+ XF @ PLOT YF @ XF @ PLOT YF @ XF @ 1+ PLOT YF @ XF @ 2+ PLOT YF @ XF @ 3 + PLOT YF @ XF @ 4 + PLOT
YF @ XF @ 5 + PLOT YF @ XF @ 6 + PLOT ;

: FLYG YF @ 1+ XF @ 1 - UNPLOT YF @ XF @ 1 - UNPLOT FLYGPLAN 1 XF +! XF @ 65 = IF -7 XF ! 16436 C@ 9 / 12 + YF ! VB @
IF -117 N +! N @ 0< IF 0 N ! THEN VISA-P THEN THEN ;        

-->

<SCR 7>

( GRAFISKA KOMMANDON:PLOT UNPLOT)  

\FORTH DEFINITIONS 
HEX

: PIT ;CODE E1 C, D1 C, C5 C, 4D C, 43 C, CD C, 0BB2 , C1 C, C3 C, NEXT , SMUDGE PIT 

: PIT1 4030 C! PIT ;        

: PLOT1 ( Y X --- ) 9B PIT1 ;   

: UNPLOT1  ( Y X --- ) A0 PIT1 ; DECIMAL            

: ?UTANF0R OVER OVER >R >R R -1 > R 44 < AND R> DROP R -1 > R 64 < AND R> DROP AND ;    

: 2DROP DROP DROP ;

: PLOT ?UTANF0R IF PLOT1 ELSE 2DROP ENDIF ;        

: UNPLOT ?UTANF0R IF UNPLOT1 ELSE 2DROP ENDIF ;          

;S

\FORTH DEFINITIONS 
HEX 

: PIT ;CODE E1 C, D1 C, C5 C, 4D C, 43 C, CD C, 0BB2 , C1 C, C3 C, NEXT , SMUDGE PIT     

: PIT1 4030 C! PIT ;        

: PLOT1 ( Y X --- ) 9B PIT1 ;   

: UNPLOT1  ( Y X --- ) A0 PIT1 ; DECIMAL            

: ?UTANF0R OVER OVER >R >R R -1 > R 44 < AND R> DROP R -1 > R 64 < AND R> DROP AND ;        

: 2DROP DROP DROP ;

: PLOT ?UTANF0R IF PLOT1 ELSE 2DROP ENDIF ;        

: UNPLOT ?UTANF0R IF UNPLOT1 ELSE 2DROP ENDIF ;          
;S

<SCR 8>

( CONVOY BOMB      83.05.07)
( SKEPP DEF. FORTS. >> ) 
YS @ 2+ XS @ 5 + PLOT YS @ 1+ XS @ 5 + PLOT YS @ XS @ 5 + PLOT  YS @ 2+ XS @ 4 + PLOT YS @ 1+ XS @ 4 +  PLOT 
YS @ XS @ 4 + PLOT YS @ 2+ XS @ 3 + PLOT YS @ 1+ XS @ 3 + PLOT YS @ 2+ XS @ 2+ PLOT YS @ 1+ XS @ 2+ PLOT 
YS @ 2+ XS @ 1+ PLOT YS @ 2+ XS @ PLOT ;  

: FLYT -1 XS +! SKEPP YS @ 5 + XS @ 12 + UNPLOT YS @ 4 + XS @ 13 + UNPLOT YS @ 3 + XS @ 13 + UNPLOT YS @ 2+ XS @ 15 + UNPLOT 
YS @ 1+ XS @ 14 + UNPLOT YS @ XS @ 13 + UNPLOT XS @ -14 < IF 1 AB +! 64 XS ! THEN ;       

: VATTEN HOME 21 0 DO CR LOOP 32 0 DO 23 EMIT LOOP ;

: VISA 0 VB ! VATTEN -6 XF ! 2 YS ! 64 XS ! BEGIN 40 YF ! FLYG FLYT FLYG 16421 @ -577 = UNTIL ;

-->

<SCR 9>

( CONVOY BOMB      83.05.07)          
0 VARIABLE XB  4 VARIABLE RB 0 VARIABLE ?BOMB -1 VARIABLE ?S 

: BOM 2 XB @ 1 - PLOT 2 XB @ 1+ PLOT 3 XB @ PLOT 3 XB @ 2+ PLOT 4 XB @ 1+ PLOT ;    

: SUDDA HOME 17 0 DO CR LOOP 128 ASPACE ;          

: EXPLODERA SUDDA 13 5 12 4 13 4 10 3 9 5 2 4 4 6 6 6 6 5 0 3 0 1 15 3 14 0 8 3 6 3 4 3 3 2 3 1 2 1 3 0 13 1 12 2 12 1 11 1 
11 0 4 1 5 2 6 2 7 2 8 1 6 1 5 0 9 0 8 0 6 0 7 0 36 0 DO YS @ + SWAP XS @ + PLOT LOOP 1 AB +! ; 0 VARIABLE YB

: ?TRAFF YB @ RB @ - 3 < IF XB @ XS @ 3 + > XB @ XS @ 14 + < AND IF EXPLODERA 375 N +! VISA-P 72 XS ! ELSE BOM THEN VATTEN 0 
?BOMB ! 6 ?S ! THEN ; 

: FALL YB @ RB @ - XB @ UNPLOT YB @ RB @ 13 * 10 / DUP RB ! - XB @ 1+ DUP XB ! PLOT ?TRAFF ;

: BOMBINIT 16421 @ -8321 =  IF 1 ?BOMB ! XF @ 4 + XB ! 4 RB !     YF @ 3 + YB ! THEN ;
    
-->

<SCR 10>

( CONVOY BOMB      83.05.07)
: B 0 N ! CLS VISA-P 0 AB ! 1 VB !  VATTEN         
BEGIN FLYG FLYT ?BOMB @ IF FALL ELSE BOMBINIT THEN -1 ?S +!     
FLYG ?S @ 0= IF SUDDA THEN AB @ 5 = UNTIL ;

: IT CLS CR CR 6 ASPACE ." C O N  V O Y   B O M B" CR CR         
." DITT UPPDRAG AR ATT SANKA ALLA" CR ." FARTYGEN I EN KONVOJ.KONVOJEN" CR 
." BESTAR AV 8 HANDELSFARTYG." CR ." DU FAR POANG F0R VARJE SANKT" CR ." SKEPP OCH POANGAVDRAG F0R VARJE" CR       
." 0VERFLYGNING." CR ." F0R ATT FALLA EN BOMB, TRYCK NER"       
." <B> TILLS DU SER BOMBEN FALLA." CR ." DU KAN INTE FALLA NASTA BOMB" CR ." F0RREN DEN F0RRA HAR LANDAT." CR 
." DU KAN EJ REGLERA H0JDEN EFTER-" CR ." SOM DU EJ AR PILOT UTAN BOMB-" CR ." FALLARE." CR ." F0R ATT B0RJA, SKRIV <N/L>." ;  

: CONVOY-BOMB BEGIN IT VISA B HOME CR CR CR CR ." VILL DU SPELA EN GANG TILL?(J/N)" 0 BEGIN DR
OP KEY DUP DUP 78 = SWAP 74 = OR
 UNTIL 78 = UNTIL CLS ." ADJ0. HOPPAS NI HADE TREVLIGT." CR ; ;S

<SCR 11>

  ( CONVOY BOMB      83.05.07)
  \FORTH DEFINITIONS
  DECIMAL ( SCR # 21 <GRAFIK> LOADAD.)

: TASK ; 0 VARIABLE VB 0 VARIABLE N  0 VARIABLE AB 

: VISA-P HOME ." CONVOY BOMB" 10 ASPACE ." POANG:" N @ 5 R @ . ; 0 VARIABLE XF  0 VARIABLE YF 

: FLYGPLAN YF @ 1+ XF @ PLOT YF @ XF @ PLOT YF @ XF @ 1+ PLOT YF @ XF @ 2+ PLOT YF @ XF @ 3 + PLOT YF @ XF @ 4 + PLOT
YF @ XF @ 5 + PLOT YF @ XF @ 6 + PLOT ;

: FLYG YF @ 1+ XF @ 1 - UNPLOT YF @ XF @ 1 - UNPLOT FLYGPLAN 1 XF +! XF @ 65 = IF -7 XF ! 16436 C@ 9 / 12 + YF ! VB @
IF -117 N +! N @ 0< IF 0 N ! THEN VISA-P THEN THEN ;        

-->         

<SCR 12>

( GRAFISKA KOMMANDON:PLOT UNPLOT)
\FORTH DEFINITIONS 
HEX

: PIT ;CODE E1 C, D1 C, C5 C, 4D C, 43 C, CD C, 0BB2 , C1 C, C3 C, NEXT , SMUDGE PIT 

: PIT1 4030 C! PIT ;

: PLOT1 ( Y X --- ) 9B PIT1 ;

: UNPLOT1  ( Y X --- ) A0 PIT1 ;  DECIMAL

: ?UTANF0R OVER OVER >R >R R -1 > R 44 < AND R> DROP R -1 > R 64 < AND R> DROP AND ; 

: 2DROP DROP DROP ;

: PLOT ?UTANF0R IF PLOT1 ELSE  2DROP ENDIF ;        
: UNPLOT ?UTANF0R IF UNPLOT1  ELSE 2DROP ENDIF ;
;S

<SCR 13>

 ( CONVOY BOMB      83.05.07)  ( SKEPP DEF. FORTS. >> )
 YS @ 2+ XS @ 5 + PLOT YS @ 1+ XS @ 5 + PLOT YS @ XS @ 5 +  PLOT YS @ 2+ XS @ 4 + PLOT YS @ 1+ XS @ 4 + PLOT
 YS @ XS @ 4 + PLOT YS @ 2+ XS @ 3 + PLOT YS @ 1+ XS @ 3 + PLOT YS @ 2+ XS @  2+ PLOT YS @ 1+ XS @ 2+ PLOT
 YS  @ 2+ XS @ 1+ PLOT YS @ 2+ XS @ PLOT ;

: FLYT -1 XS +! SKEPP YS @ 5 + XS @ 12 + UNPLOT YS @ 4 + XS @ 13 + UNPLOT YS @ 3 + XS @ 13 + UNPLOT YS @ 2+ XS @ 15 + UNPLOT
 YS @ 1+ XS @ 14 + UNPLOT YS @ XS @ 13 + UNPLOT XS @ -14 < IF 1 AB +! 64 XS ! THEN ;  
 
: VATTEN HOME 21 0 DO CR LOOP 32  0 DO 23 EMIT LOOP ;

: VISA 0 VB ! VATTEN -6 XF ! 2 YS ! 64 XS ! BEGIN 40 YF ! FLYG FLYT FLYG 16421 @ -577 = UNTIL ; 

-->

<SCR 14>

( CONVOY BOMB      83.05.07)
0 VARIABLE XB  4 VARIABLE RB 0 VARIABLE ?BOMB -1 VARIABLE ?S 

: BOM 2 XB @ 1 - PLOT 2 XB @ 1+ PLOT 3 XB @ PLOT 3 XB @ 2+ PLOT 4 XB @ 1+ PLOT ;

: SUDDA HOME 17 0 DO CR LOOP 128 ASPACE ;
  
: EXPLODERA SUDDA 13 5 12 4 13 4 10 3 9 5 2 4 4 6 6 6 6 5 0 3 0 1 15 3 14 0 8 3 6 3 4 3 3 2 3 1 2 1 3 0 13 1 12 2 12 1 11 1 
11 0 4 1 5 2 6 2 7 2 8 1 6 1 5 0 9 0 8 0 6 0 7 0 36 0 DO YS @ + SWAP XS @ + PLOT LOOP 1 AB +! ; 0 VARIABLE YB 

: ?TRAFF YB @ RB @ - 3 < IF XB @ XS @ 3 + > XB @ XS @ 14 + < AND IF EXPLODERA 375 N +! VISA-P 72 XS ! ELSE BOM THEN VATTEN 0 
 ?BOMB ! 6 ?S ! THEN ; 

: FALL YB @ RB @ - XB @ UNPLOT YB @ RB @ 13 * 10 / DUP RB ! - XB @ 1+ DUP XB ! PLOT ?TRAFF ;

: BOMBINIT 16421 @ -8321 = IF 1 ?BOMB ! XF @ 4 + XB ! 4 RB ! YF @ 3 + YB ! THEN ;
-->
     
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
MOB-i-L
Posts: 63
Joined: Mon Apr 19, 2010 12:13 am
Location: Lund, Skåne/Scania, Sweden
Contact:

Re: CONVERTING TZX into "P" and into WAV?

Post by MOB-i-L »

Unfortunately I don't have the missing ZX Forth screen of Convoy Bomb because when I saved it 30 years ago I had the wrong contents of my ramdisk in screen #2. All copies on that tape contain the wrong screen (some plot-commands instead of the definition of skepp i.e. ship). If I'm lucky I might find another cassette-tape where it is.
Post Reply