EightyOne emulator may have bug with WAV generating

Emulator and emulator development specific topics
bwinkel67
Posts: 147
Joined: Mon Mar 23, 2020 2:38 am

EightyOne emulator may have bug with WAV generating

Post by bwinkel67 »

So I had trouble converting this program (as a .p file which loaded successfully) into a WAV file with the EightyOne emulator.

Code: Select all

10 REM MADN
15 REM (C) 1981-87 BODO WENZEL
16 REM UPDATE: 2020 MIKE JONAS
20 CLS
22 PRINT TAB 3;"MENSCH AERGERE DICH NICHT";AT 20,0;"WIEVIELE SPIELER (1-4)?"
23 INPUT SP
24 PRINT AT 20,0;"STEHEN ZU...           "
25 DIM S(4,4)
26 DIM T(4,4)
30 REM ANFANG
40 PRINT AT 14,0
41 DIM P(4)
50 FOR J=1 TO SP
51 GOSUB 1300
52 LET P(J)=W
53 NEXT J
60 LET J=0
61 LET K=J
70 FOR I=1 TO SP
71 IF P(I)=K THEN GOTO 30
80 IF P(I)>K THEN LET J=I
81 IF P(I)>K THEN LET K=P(I)
85 FOR N=1 TO 4
86 LET S(I,N)=1
87 NEXT N
90 NEXT I
91 FOR Z=0 TO 99
92 NEXT Z
93 GOSUB 1000
95 PRINT AT 14,0
96 FOR L=1 TO SP
97 PRINT "                  "
98 NEXT L
100 REM SCHLEIFE
110 LET Z=3
120 IF S(J,1)>48 THEN GOTO 180
130 GOSUB 1200
131 FOR K=1 TO 4
132 LET PO=S(J,K)
133 IF PO>0 AND PO<40+4*J+K+16*(J=1) THEN LET Z=1
134 REM \F5\C117,0;"J=";J;" K=";K;" PO=";PO;
135 GOSUB 400
136 REM \F5" ADD=";PO;" Z=";Z;"  ";\C120,0
137 IF PO<>S(J,K) THEN GOTO 140
138 NEXT K
139 GOTO 170
140 LET Z=1
141 IF J=1 THEN GOTO 200
150 PRINT "WELCHER STEIN (1-4)?"
151 INPUT K
160 LET PO=S(J,K)
161 GOSUB 400
162 PRINT AT 21,0;"                    "
163 GOSUB 500
170 LET Z=Z-1
171 IF W=6 OR Z>0 THEN GOTO 120
180 LET J=J*(J<SP)+1
181 GOTO 100
200 REM COMP
210 PRINT "ACHTUNG"
220 FOR K=1 TO 4
221 LET PO=S(J,K)
222 LET P(K)=K
223 GOSUB 700
230 LET P(K)=P(K)-PR
231 GOSUB 400
232 GOSUB 700
240 LET P(K)=P(K)+PR
241 IF PO=S(J,K) THEN LET P(K)=-30
250 NEXT K
300 REM ZUG
310 LET K=1
311 FOR I=2 TO 4
312 IF P(I)>=P(K) THEN LET K=I
320 NEXT I
321 GOTO 160
400 REM ADD
410 IF PO<>0 THEN GOTO 430
420 LET PO=(12*J-11)*(W=6)
421 GOTO 470
430 LET PO=PO+W
431 IF J<>1 AND S(J,K)<49 AND PO>48 THEN LET PO=PO-48
440 IF PO<12*J-12+48*(J=1) THEN GOTO 470
441 REM VOR HAUS
450 IF S(J,K)<12*J-12+48*(J=1) THEN LET PO=PO-J*8+53-32*(J=1)
451 REM IN HAUS
460 IF PO>J*4+44+16*(J=1) THEN LET PO=S(J,K)
470 FOR I=1 TO 4
471 IF PO=S(J,I) AND I<>K THEN LET PO=S(J,K)
472 REM SELBSTSCHLAG
480 NEXT I
481 RETURN
500 REM KO
510 LET T(J,K)=PO
511 FOR I=1 TO SP
512 FOR K=1 TO 4
513 IF I<>J AND PO=S(I,K) THEN LET T(I,K)=0
520 NEXT K
521 NEXT I
550 REM SORT
560 FOR I=1 TO 3
561 FOR K=I TO 4
562 IF T(J,K)>=T(J,I) THEN GOTO 570
563 LET PO=T(J,I)
564 LET T(J,I)=T(J,K)
565 LET T(J,K)=PO
570 NEXT K
571 NEXT I
600 REM ENDE
610 FOR I=1 TO SP
611 FOR K=1 TO 4
612 IF T(I,K)<49 THEN RETURN
620 NEXT K
621 NEXT I
622 RUN
700 REM PRIO
710 LET PR=0
720 FOR J=2 TO SP
721 FOR I=1 TO 4
722 IF PO=0 THEN GOTO 800
730 IF S(J,I)=0 OR S(J,I)>48 THEN GOTO 900
740 REM VERFOLGEN
741 IF PO+6<S(J,I) THEN LET PR=PR-2
750 REM UEBERRUNDEN
751 IF PO>S(J,I) THEN LET PR=PR-3
760 REM FLUECHTEN
761 IF PO<S(J,I)+7-48*(S(J,I)>42 AND PO<13) THEN LET PR=PR-6
770 REM SCHLAGEN
771 IF PO=S(J,I) THEN LET PR=PR+30
810 REM VORRAT
811 IF PO=0 AND W=6 THEN LET PR=PR-8
820 REM EIGENER START
821 IF PO<>1 AND S(1,K)=1 THEN LET PR=PR+9
830 REM INS HAUS
831 IF PO>60 THEN LET PR=PR+10
900 REM FREMDER START
901 IF PO<>J*12-11 THEN LET PR=PR+4
910 NEXT I
911 NEXT J
912 LET J=1
913 RETURN
1000 REM BILD
1005 PRINT AT 2,3;"%B%B%B%B    ()()()()%C%C    %C%C%C%C",
1010 PRINT TAB 3;"%B%B%B%B    ()  %C%H  ()    %C%C%C%C",
1015 PRINT TAB 11;"()  %C%H  ()",TAB 11;"()  %C%H  ()"
1020 PRINT TAB 3;"%B%B()()()()  %C%H  ()()()()()",TAB 3;"()";
1025 PRINT TAB 27;"()",TAB 3;"()%B%H%B%H%B%H%B%H      %D%H%D%H%D%H%D%H()",TAB 3;"()";
1030 PRINT TAB 27;"()",TAB 3;"()()()()()  %A%H  ()()()()%D%D"
1035 PRINT TAB 11;"()  %A%H  ()",TAB 11;"()  %A%H  ()",
1040 PRINT TAB 3;"%A%A%A%A    ()  %A%H  ()    %D%D%D%D",
1045 PRINT TAB 3;"%A%A%A%A    %A%A()()()()    %D%D%D%D"
1050 RETURN
1200 REM NEUES BILD
1210 FOR I=1 TO SP
1211 FOR K=1 TO 4
1212 IF S(I,K)=T(I,K) THEN GOTO 1280
1220 LET W=S(I,K)
1221 FOR N=5 TO I*4+K
1222 IF W<>0 AND W=T(INT ((N*100/4-25)/100),N-4*INT ((N*100/4-25)/100)) THEN GOTO 1261
1223 NEXT N
1224 GOSUB 1500
1230 IF W<>0 THEN GOTO 1235
1231 LET N=I
1232 GOTO 1237
1235 FOR N=1 TO 4
1236 IF W<>12*N-11 THEN GOTO 1240
1237 LET P$=CHR$ (165+N)+CHR$ (165+N)
1238 GOTO 1260
1240 NEXT N
1241 IF W<49 THEN GOTO 1250
1242 LET P$=CHR$ (165+I)+"%H"
1243 GOTO 1260
1250 LET P$="()"
1260 PRINT AT PR+2,2*PO+3;P$
1261 LET S(I,K)=T(I,K)
1262 LET W=S(I,K)
1263 GOSUB 1500
1270 PRINT AT PR+2,2*PO+3;CHR$ (37+I);K
1280 NEXT K
1281 NEXT I
1290 PRINT AT 19,0
1300 REM WUERFEL
1310 LET W=INT (RND*6)+1
1320 PRINT "SPIELER ";CHR$ (37+J);", WURF: ";W
1330 RETURN
1550 IF W<>0 THEN GOTO 1560
1551 LET PO=11*(I>2)+(K=2 OR K=4)
1552 LET PR=11*(I=1 OR I=4)+(K>2)
1553 RETURN
1560 IF W>4 THEN GOTO 1570
1561 LET PO=4
1562 LET PR=13-W
1563 RETURN
1570 IF W>8 THEN GOTO 1580
1571 LET PO=9-W
1572 LET PR=8
1573 RETURN
1580 IF W>12 THEN GOTO 1590
1581 LET PO=0
1582 LET PR=17-W
1583 RETURN
1590 IF W>16 THEN GOTO 1600
1591 LET PO=W-13
1592 LET PR=4
1593 RETURN
1600 IF W>20 THEN GOTO 1610
1601 LET PO=4
1602 LET PR=21-W
1603 RETURN
1610 IF W>24 THEN GOTO 1620
1611 LET PO=W-17
1612 LET PR=0
1613 RETURN
1620 IF W>28 THEN GOTO 1630
1621 LET PO=8
1622 LET PR=W-25
1623 RETURN
1630 IF W>32 THEN GOTO 1640
1631 LET PO=W-21
1632 LET PR=4
1633 RETURN
1640 IF W>36 THEN GOTO 1650
1641 LET PO=12
1642 LET PR=W-29
1643 RETURN
1650 IF W>40 THEN GOTO 1660
1651 LET PO=49-W
1652 LET PR=8
1653 RETURN
1660 IF W>44 THEN GOTO 1670
1661 LET PO=8
1662 LET PR=W-33
1663 RETURN
1670 IF W>48 THEN GOTO 1680
1671 LET PO=53-W
1672 LET PR=12
1673 RETURN
1680 IF W>52 THEN GOTO 1690
1681 LET PO=W-48
1682 LET PR=6
1683 RETURN
1690 IF W>56 THEN GOTO 1700
1691 LET PO=6
1692 LET PR=W-52
1693 RETURN
1700 IF W>60 THEN GOTO 1710
1701 LET PO=68-W
1702 LET PR=6
1703 RETURN
1710 LET PO=6
1711 LET PR=72-W
1712 RETURN
I solved it by using an old 1999 conversion program called ZXC.EXE that generates RAW files and then using Audacity to generate the WAV file. I also posted about it here.

viewtopic.php?p=38792#p38792

Anyone else have load issues with digitally generated WAV files from EightyOne. I was under the impression the digitally clean generated analog audio file should just work. Note that I had done this conversion successfully many times with other .p programs that I generated from text, some much longer.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: EightyOne emulator may have bug with WAV generating

Post by Moggy »

Never had any success with Eighty One re wav saving.

I no longer bother with tape loading but when I did I used to save the file as a tzx or P file and use tzxwav to get a wav that always loaded. The program seems to have disappeared from the web unfortunately.
stroebeljc
Posts: 63
Joined: Thu Apr 23, 2020 6:02 am

Re: EightyOne emulator may have bug with WAV generating

Post by stroebeljc »

I have also had problems with EightyOne wav files. Many on this site, including me, find the Java ZX81 Tape Converter to be one of the best tools available.
John
bwinkel67
Posts: 147
Joined: Mon Mar 23, 2020 2:38 am

Re: EightyOne emulator may have bug with WAV generating

Post by bwinkel67 »

Oh, I didn't realize the the Java ZX81 Tape Converter could go in both directions. I had used it to try and convert a real tape to .p unsuccessfully but it was very helpful. Speaking of tzxwav disappearing, I also couldn't find 81PToWav.zip which existed about 10 years ago. Unfortunately both the ZXC.EXE and ZXD.EXE are 16 bit application and the author noted that "for now" he was not going to release the source code and that was back in 1999 so likely that code won't pop up again. Sometimes it's nice to recompile it for the 32/64 bit world.

I'm not sophisticated enough with my TS1000 to have anything other than audio input. With my QL I have vDrive so an SD card is nice...but I don't do enough with the TS1000 to, as yet, warrant something similar. I have just invested in a WiFi SD card converter and will see if I can get it to work on my QL as a networked SD card would be even cooler :-/

I'll see if EightyOne takes bug reports.
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: EightyOne emulator may have bug with WAV generating

Post by Moggy »

Attachments
winTZX0.9a.zip
(1.12 MiB) Downloaded 244 times
Fruitcake
Posts: 346
Joined: Wed Sep 01, 2010 10:53 pm

Re: EightyOne emulator may have bug with WAV generating

Post by Fruitcake »

bwinkel67 wrote: Tue Aug 04, 2020 2:58 am Anyone else have load issues with digitally generated WAV files from EightyOne.
Do you mean you can't create create a .wav file, or you can but it won't load into a real ZX81?
bwinkel67
Posts: 147
Joined: Mon Mar 23, 2020 2:38 am

Re: EightyOne emulator may have bug with WAV generating

Post by bwinkel67 »

Fruitcake wrote: Wed Aug 05, 2020 2:20 am
Do you mean you can't create create a .wav file, or you can but it won't load into a real ZX81?
I can create a .wav file but it cannot be loaded into a real TS1000 or a real ZX81. All other .wav files that were created by EightyOne (about 8 of them) work with no problem. When I convert this particular one (the one for madn.bas) using an old 1999 tool, ZXC.EXE (which created a .RAW and then Audacity created the .WAV) it works. Since it's creating a digitally clean analog signal I was surprised by that. I would have figured it should work for all of them.
bwinkel67
Posts: 147
Joined: Mon Mar 23, 2020 2:38 am

Re: EightyOne emulator may have bug with WAV generating

Post by bwinkel67 »

Moggy wrote: Tue Aug 04, 2020 11:36 pm Found it here.

http://archive.sundby.com/mirror/www.wo ... ities.html
Cool. Anyone have that 81PToWav.zip?
Fruitcake
Posts: 346
Joined: Wed Sep 01, 2010 10:53 pm

Re: EightyOne emulator may have bug with WAV generating

Post by Fruitcake »

bwinkel67 wrote: Wed Aug 05, 2020 8:51 am I can create a .wav file but it cannot be loaded into a real TS1000 or a real ZX81. All other .wav files that were created by EightyOne (about 8 of them) work with no problem. When I convert this particular one (the one for madn.bas) using an old 1999 tool, ZXC.EXE (which created a .RAW and then Audacity created the .WAV) it works. Since it's creating a digitally clean analog signal I was surprised by that. I would have figured it should work for all of them.
I'd like to try and replicate the error so I can investigate its cause.

Are you creating the .wav file from EightyOne as follows?
- Copy the BASIC listing text from your original post above
- Paste it into a new blank text file and save it with name MADN.b81
- Run EightyOne
- Open the Tape Manager window
- Open the Wave Loader window
- Drag/drop the MADN.b81 file into the EightyOne main window or the Tape Manager window
- At the dialog that appears, leave all load options unchecked and click OK
- The program loads into EightyOne and the Tape Manager shows the program
- In the Tape Manager window, right click on the MADN program and select "Convert Tape to Wave"
- In the Wave Loader window, click the Save icon, type the filename "MADN.wav" and click Save

And then the generated .wav file will fail to load into a real ZX81?

If you create the .wav file via another method in EightyOne, could you list the steps you use.
Fruitcake
Posts: 346
Joined: Wed Sep 01, 2010 10:53 pm

Re: EightyOne emulator may have bug with WAV generating

Post by Fruitcake »

Moggy wrote: Tue Aug 04, 2020 11:36 pm Found it here.

http://archive.sundby.com/mirror/www.wo ... ities.html
This later version also supports the ZX80:
winTZX0.9d.zip
(1.15 MiB) Downloaded 291 times
Post Reply