Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

On the creation of AY or Beeper music, including the packages used to do so.
Post Reply
qaenoip
Drutt
Posts: 4
Joined: Sun Mar 08, 2020 11:24 am

Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by qaenoip »

Here's the problem: I've created a module in Vortex Tracker 2.5 and realized that i want to play it on my spectrum. How can you save modules in VT so they could be played on real hardware or an emulator?I tried saving in .tap but when I played it in an emulator for testing I was greeted with this:
Image
It just fills the entire central area and goes on and on.
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by Alessandro »

You cannot just save the player and the music data as a TAP file and expect it to work. You must activate the player so that it plays the music continuously or until a key is pressed. This is a simple starter code that will play the music exported from Vortex Tracker II as a TAP file with player and music data until a key is pressed. It assumes the player is exported at the default address, 49152:

Code: Select all

  PLAYER EQU 49152

  ORG 49120

  LD A,1
  LD (PLAYER+10),A
  CALL PLAYER
  EI
LOOP:
  HALT
  CALL PLAYER+5
  XOR A
  IN A,(#FE)
  CPL 
  AND #1F
  JR NZ,FINE
  LD A,(PLAYER+10)
  RLA
  JR NC,LOOP
FINE:
  CALL PLAYER+8
  RET
Assemble it as a TAP file with Pasmo (or another assembler) and use it with this BASIC program:

Code: Select all

10 CLEAR 49119
20 FOR n = 1 TO 3: LOAD "" CODE: NEXT n
30 PAUSE 1: RANDOMIZE USR 49120
The program must load the starter code, then the player, and finally the music data.

If you want to hear the music again enter GO TO 30.
qaenoip
Drutt
Posts: 4
Joined: Sun Mar 08, 2020 11:24 am

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by qaenoip »

I have troubles assembling to tap. It just opens the prompt for a split second. I'm unable to type the required comand in.
qaenoip
Drutt
Posts: 4
Joined: Sun Mar 08, 2020 11:24 am

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by qaenoip »

Wait. I got a bin file out of txt with your code. What next?
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by R-Tape »

If you just want to hear it on a Speccy, then this is how I'd do it:

BY the looks of it, you already have your .TAP with the player and music. Insert this tape in the emulator. Assuming you have compiled your .TAP to the default 49152, type:

10 CLEAR 32768: LOAD ""CODE: LOAD""CODE
20 RANDOMIZE USR 49152
30 PAUSE 1:RANDOMIZE USR 49157:GOTO 30

Should work.
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by Alessandro »

Pasmo is a command-line assembler. You cannot use it by double-clicking on it. Also remember to use version 0.5.4.beta2; 0.6.0 is an experimental untested version and can give compiling errors.

Open a command prompt window in the folder where you have both PASMO.EXE and the .ASM file with the starter code and enter:

pasmo --tap filename.asm filename.tap

where filename of course is the name you gave to the .ASM file with the starter code. You now should have two TAP files: one with the starter code and another with the music player and data exported from Vortex Tracker II. Remember for now to export it at address 49152; you will be able to change it later if you wish, provided you also change the ORG and PLAYER values in the starter code as well. Now type the BASIC program on the emulated Spectrum and enter RUN. It will then start to load three pieces of code. Begin with the TAP file with the starter program, then insert the TAP file with the music player and data. Once all of three pieces have been loaded, the music will play until you press a key. Enter GO TO 30 to hear the music again if you wish.

You can also save your BASIC program with: SAVE "prog" LINE 0

[mention]R-Tape[/mention] : That works as well, but to exit that program you need to press BREAK and reset the AY chip by entering RANDOMIZE USR 49162, otherwise it will keep playing the last note on and on.
qaenoip
Drutt
Posts: 4
Joined: Sun Mar 08, 2020 11:24 am

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by qaenoip »

Thanks a lot! It really works!
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by djnzx48 »

Alessandro wrote: Sun Mar 08, 2020 5:39 pm @R-Tape : That works as well, but to exit that program you need to press BREAK and reset the AY chip by entering RANDOMIZE USR 49162, otherwise it will keep playing the last note on and on.
I think you mean USR 49152, not 49162.

@qaenoip: You may want to be aware that EmuZWin does not emulate the AY chip correctly, and in particular any use of the noise generator will produce wrong-sounding output.
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by Alessandro »

djnzx48 wrote: Sun Mar 08, 2020 7:43 pmI think you mean USR 49152, not 49162.
Sorry, I meant 49160 in fact, i.e. the player's starting position plus 8, which is the beginning of the code for ending the playback, as in the starter code at FINE ("end" in Italian). Tested before posting :)
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by djnzx48 »

Oh, you're right; I didn't read that bit properly. Although USR 49152 should still work for muting the song if you don't mind it restarting from the beginning.
XoRRoX
Manic Miner
Posts: 231
Joined: Wed Jul 11, 2018 6:34 am

Re: Playing ZX Spectrum modules(.vt,.tap,.asm,etc.) on real hardware or an emulator

Post by XoRRoX »

Late to the party, but still wanted to reply, even for completeness sake.

If you have a esxDOS device such as divMMC, you can save the tune from Vortex Tracker as a pt3 and then simply use the playpt3 dot-command included in any esxDOS archive.

Besides for pt3, there are also commands for sqt, stc and tfm files.
Post Reply