Lance 12.5 / 25 / 50 KHz routine for STE (V13)

All 680x0 related coding posts in this section please.

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V12)

Postby ljbk » Wed May 08, 2013 3:36 pm

Hi !

This new version 12 was not part of the plan.

But as i found and corrected a bug of the original Lance code with Note Delay effect (EDx) that has an audible impact in the famous Kefrens Desert Dream 2 mod around 3:35 minutes and i add an idea about a progressive cheat option, i decided to do this build before the possible BPM build.
You can try the file desertd4.mod with the old code or the original Lance code and compare with the result you get now, you get with Octalyser (that does not use Lance feeder), or with the one you get with Winamp or Milky Tracker.
The "read skips" cheat, as i called it, is like a progressive octave 3 cheat.
It allows you to specify a number between 0 an 13.
Value 0 means the cheat is not active.
Any other value, means the cheat is active and it disables the "octave 3 cheat".
Any value will not affect the 12.5 KHz replay.
Only values above 7 affect the 25 KHz replay.
All non zero values affect the 50 KHz replay.
Low values will only affect the top octave 3 notes. A value 13 will have a similar impact to the octave 3 cheat but in a different way.
Low values mean less CPU saving and low sound impact. High values mean more CPU saving and more sound impact.

Enjoy,
Paulo.

User avatar
Zorro 2
Administrator
Administrator
Posts: 2195
Joined: Tue May 21, 2002 12:44 pm
Location: Saint Cloud (France)
Contact:

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V12)

Postby Zorro 2 » Thu May 09, 2013 4:01 pm

Hi Paulo !

I made new tests with your last versions and bring you new modules to play.

All comments are there :

Code: Select all

HACKL010.S
* Corrected in version 10
; dc.b   "E:\TEMP\Lance8\part5\unknow_9.mod"
; dc.b   "E:\TEMP\Lance8\part5\unknow_8.mod"
* not BADly but...
; dc.b   "E:\TEMP\Lance8\part5\ECLIPSE.MOD"
; dc.b   "E:\TEMP\Lance8\part5\stardust.mod"
; dc.b   "E:\TEMP\Lance8\part5\2002.mod"
; dc.b   "E:\TEMP\Lance8\part5\2X1287.MOD"   *   KO !
; dc.b   "E:\TEMP\Lance8\part5\estra-h.mod"
; dc.b   "E:\TEMP\Lance8\part5\THECAVES.MOD" * sound bizarre

Code: Select all

HACKL00H.S
* WORK
; dc.b   "E:\TEMP\Lance8\part5\2X1287.MOD"
; dc.b   "E:\TEMP\Lance8\part5\THECAVES.MOD"
* Corrected in version H
; dc.b   "E:\TEMP\Lance8\part5\unknow_9.mod"
; dc.b   "E:\TEMP\Lance8\part5\stardust.mod"
* not BADly but...
; dc.b   "E:\TEMP\Lance8\part5\unknow_8.mod"   *   end loop and sound ko
; dc.b   "E:\TEMP\Lance8\part5\ECLIPSE.MOD"   *   loop ko
; dc.b   "E:\TEMP\Lance8\part5\2002.mod"   *   stereo desynchro
; dc.b   "E:\TEMP\Lance8\part5\estra-h.mod"   *   loop et sound ko


Nice progression with different directions :D See the last Atari modile from 505 : 2X1287.MOD.
You do not have the required permissions to view the files attached to this post.
Member of NoExtra Team

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V12)

Postby ljbk » Thu May 09, 2013 9:13 pm

Zorro 2 wrote:Hi Paulo !

I made new tests with your last versions and bring you new modules to play.

All comments are there :

Code: Select all

HACKL00H.S
* WORK
; dc.b   "E:\TEMP\Lance8\part5\2X1287.MOD"
; dc.b   "E:\TEMP\Lance8\part5\THECAVES.MOD"
* Corrected in version H
; dc.b   "E:\TEMP\Lance8\part5\unknow_9.mod"
; dc.b   "E:\TEMP\Lance8\part5\stardust.mod"
* not BADly but...
; dc.b   "E:\TEMP\Lance8\part5\unknow_8.mod"   *   end loop and sound ko
; dc.b   "E:\TEMP\Lance8\part5\ECLIPSE.MOD"   *   loop ko
; dc.b   "E:\TEMP\Lance8\part5\2002.mod"   *   stereo desynchro
; dc.b   "E:\TEMP\Lance8\part5\estra-h.mod"   *   loop et sound ko


Nice progression with different directions :D See the last Atari modile from 505 : 2X1287.MOD.


Many thanks for your tests.
I will try to find out what is till wrong.

The Kefrens Desertd2 bug was quite dificult to isolate. For a long time i did notice that Oxygene STNICCC 2000 demo, that uses Lance code, sounded funny near the end. But to get down to the song position, pattern and voice where the different audio occured was not simple.
That is the difference between a single path demo and a generic program depending on input data: there is probably still some data combination leading to bugs.

Paulo.

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V12)

Postby ljbk » Fri May 10, 2013 10:25 am

Hi Zorro 2 !


I tested the unknow_8.mod and to my ear its sounds correct but may be i should listen more carefully ... :)
I attach a zip with 6 versions of the mod, one for each pattern. Can you tell me if all sound wrong to you or which one does ?
By the way, which reference are you using to compare: Amiga Protracker, Octalyser STE, Winamp, Milky Tracker ?
Did you remove the cheat options in HACKL00H.S and set the global volume to $FFFF ?
z_octave3_cheat dc.w $0000 Values 0 (no) 1 (active)
z_read_skips dc.w 0 Values 0..13
z_global_volume dc.w $FFFF values $0000 (mute) to $FFFF (maximum)


Thanks,
Paulo.
You do not have the required permissions to view the files attached to this post.

User avatar
Zorro 2
Administrator
Administrator
Posts: 2195
Joined: Tue May 21, 2002 12:44 pm
Location: Saint Cloud (France)
Contact:

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V12)

Postby Zorro 2 » Fri May 10, 2013 2:19 pm

ljbk wrote:Hi Zorro 2 !


I tested the unknow_8.mod and to my ear its sounds correct but may be i should listen more carefully ... :)
I attach a zip with 6 versions of the mod, one for each pattern. Can you tell me if all sound wrong to you or which one does ?
By the way, which reference are you using to compare: Amiga Protracker, Octalyser STE, Winamp, Milky Tracker ?
Did you remove the cheat options in HACKL00H.S and set the global volume to $FFFF ?
z_octave3_cheat dc.w $0000 Values 0 (no) 1 (active)
z_read_skips dc.w 0 Values 0..13
z_global_volume dc.w $FFFF values $0000 (mute) to $FFFF (maximum)


Thanks,
Paulo.

Hi mister Paulo :D

I use ModPlug Player v 1.46.01 on PC that you can download here : http://openmpt.org/legacy_software.

I did some different adjustments with our comments but the sound of the sample #1 don't have the same effect when you play it with your hacking source. This module is very simple to play and by the way, the pattern too. That's why I use it for the test :mrgreen:

It's maybe the loop on the sample did a long play of this sample then it's just a little short play. And the final play not loop correctly for the beginning.

I hope that you hear the difference :roll:
Member of NoExtra Team

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby ljbk » Fri May 10, 2013 10:16 pm

Hi !


Well here it is ... the BPM build: version 13.

Meanwhile, another error was found in the base code: if Sample Offset (9xy) is used and the xy leads to an offset after the end of the sample only the nlength was set to 1 and nstart was not updated still pointing to the normal sample start so the result was not ok.

Just for the record, the source is now almost 10000 lines long and twice the code size of the original.

Some details about the BPM implementation. It is not 100% accurate as if the mod was played on Amiga but it is as close as the Lance base strategy allows it.
As LCM is used to control part of the volume, up to 3 LCM, left and right, volume updates can occur per VBL, so timer C interrupts are used to change the volume if necessary at the appropriate time.
BPM values above 125 lead to higher CPU load than no BPM replay because the Protracker handler is called in average more than 1 time per VBL.
As a general fact, the BPM implementation slows down the replay. So an auto-detection mechanism is implemented like for volume control to detect if BPM is used or not.
You can also force the code not to use BPM.


@Zorro 2:
I did not re-test your error cases yet.
I wanted to finish this BPM matter to have a "final" 4 voices (with LCM) build.
But if you use ModPlug(or Winamp or Milky Tracker) as reference, you should use the Amiga NTSC clock value and "switch values" like this:

zreplayfreq dc.w $0003 Values 3 (50KHz)/ 2 (25KHz)/ 1 (12.5KHz)
z_autovoldetect dc.w $0001 Values 0 (no) 1 (active)
z_volume_active dc.w $0001 Values 0 (no volume control) 1 (active)
z_trash_idx dc.w 8 Values 2 (normal) 3..32 (N trash buffers)
z_improve_avg dc.w $0001 Values 0 (no) 1 (active)
z_octave3_cheat dc.w $0000 Values 0 (no) 1 (active)
z_read_skips dc.w 0 Values 0..13
z_global_volume dc.w $FFFF values $0000 (mute) to $FFFF (maximum)
z_autobpmdetect dc.w $0001 Values 0 (no) 1 (active)
z_bpm_active dc.w $0001 Values 0 (not active) 1 (active)
zs_amiga_freq dc.l 7159090 values 7093790 PAL 7159090 NTSC

On the STE side, if you use emulators, please remember that STEem 3.2 uses 50200 Hz as DMA frequency (and not the real 50066) so you will hear some glitches. Hatari has a more precise sound emulation.
Also PC sound card output will always be much better than any STE ouput.


Enjoy,
Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Sun Mar 09, 2014 10:54 am

I had liked to use this player in a program (if that is ok) and wonder if you have a "clean" source. I looked at the code and it seems it's not just the player, but more like a test program that checks for keyboard input and write text on the screen and so on. What I need is (more or less) just two functions. "start play, stop play".
What timers do the player use? I'm using the VBI and Timer B myself so maybe it will interfere with them?
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

evil
Captain Atari
Captain Atari
Posts: 156
Joined: Sun Nov 12, 2006 8:03 pm

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby evil » Tue Mar 11, 2014 4:26 pm

Zamuel_a wrote:I had liked to use this player in a program (if that is ok) and wonder if you have a "clean" source. I looked at the code and it seems it's not just the player, but more like a test program that checks for keyboard input and write text on the screen and so on. What I need is (more or less) just two functions. "start play, stop play".
What timers do the player use? I'm using the VBI and Timer B myself so maybe it will interfere with them?


I agree that a "clean" version would be nice :)

To use the player you only need to jsr it once every VBL, no additional interrupts used/needed, as long as the VBL is 50 Hz that is.
So it's basicly as easy to use as an oldskool madmax chipzik.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Tue Mar 11, 2014 5:46 pm

To use the player you only need to jsr it once every VBL, no additional interrupts used/needed, as long as the VBL is 50 Hz that is.
So it's basicly as easy to use as an oldskool madmax chipzik.


It had been great if it was so simple. As it is now I would have to dig into the code to pick out the parts I need, which is not what I want to do. I need a mod player there I just define the start address to the MOD, length and frequency and then just START and STOP and a call I can do from the VBL. If I get that, I will soon have a project for it finished :wink:
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Sun Mar 16, 2014 4:51 pm

I'm trying to see if it's possible to get the actual player out from this code, but there are alot of stuff that don't make sense. The routine saves / setup video addresses and alot of other video related stuff. Dealing with colors and so on and so on. Doesn't make sense in a mod player?
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby ljbk » Mon Mar 24, 2014 11:27 am

Hi !

The Hacking Lance program includes obviously everything to save and restore the context and writes some info on the screen.
That is why it deals with video, interrupts, keyboard ...
Otherwise while testing it from TOS you would get some bombs when returning to TOS ...
As it is open source, i think it is quite easy to remove these parts and to include the "main" part into the body of another program.
As for the "main" part of the code, it kept mainly the structure of the original author to allow anyone already using the original code to move to the speeded up one.

As for the "malloc" / "mfree" you refer in your PM, you need that or some kind of memory management strategy, even if it resumes to setting hardcoded addresses because you don't know for each of the several possibilities how much memory is needed for the generated code.
Of course if you know how you will set all the control variables like:

"
zreplayfreq dc.w $0003 Values 3 (50KHz)/ 2 (25KHz)/ 1 (12.5KHz)
z_autovoldetect dc.w $0001 Values 0 (no) 1 (active)
z_volume_active dc.w $0001 Values 0 (no volume control) 1 (active)
z_trash_idx dc.w 8 Values 2 (normal) 3..32 (N trash buffers)
z_improve_avg dc.w $0001 Values 0 (no) 1 (active)
z_octave3_cheat dc.w $0000 Values 0 (no) 1 (active)
z_read_skips dc.w 0 Values 0..13
z_global_volume dc.w $FFFF values $0000 (mute) to $FFFF (maximum)
z_autobpmdetect dc.w $0001 Values 0 (no) 1 (active)
z_bpm_active dc.w $0001 Values 0 (not active) 1 (active)
zs_amiga_freq dc.l 7159090 values 7093790 PAL 7159090 NTSC
"
then you can define the hardcoded memory addresses or offsets from a certain start point.


Hope it helps,
Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Mon Mar 24, 2014 12:32 pm

Hi!

I think I can use malloc, mfree if I just point it to my own buffer instead of letting TOS decide were any free memory is.

The biggest problem I have is that I can't use the file loading stuff since I'm outside of TOS. But when I try to include the mod file directly it doesn't work. I can't see what is wrong. I have got anything from 2,3,4 to 11 bombs :wink:

What is this function for: 'z_octave3_cheat'

I can see that the program takes two different paths depending on how this is set.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby ljbk » Mon Mar 24, 2014 12:59 pm

Hi !

As for 'z_octave3_cheat' and other parameters, please read the thread from begin and or the "read_me.txt" included in the Hacking Lance package. It is a cheat mode to achieve more speed with a cost: a reduced quality for octave 3 replay.
The program can follow many code paths depending on the parameters posted above.

Regarding loading and memory map, you can design your program to have the memory in sections:
- replay code;
- space for mod + free memory after (check extra space reserved at "l_mt_shift_down" label in mt_init : memory is not freed at the end of the MOD but some space after);
- space for generated code where your free memory start pointer might start;
So if you "incbin" the mod after the replay code then is is just a matter of memory reservation and pointer adaptation to have it to work: you don't need TOS at all.
Hacking Lance on the contrary was made to be tested from TOS and with a small effort i could even add the GEM file selector to it to allow you to select the mod you want to play and still have a clean exit to TOS and working from any start context.


Good luck,
Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Mon Mar 24, 2014 1:03 pm

I tried to put the incbin at the end and included the extra bytes, but it crasch anyway. If it's included into the program, nothing else should interfere with that memory area? So far I have just tried your player program by itself so it's nothing else that interfere with it.

If I add something like ds.b 200000 after the incbin mod, when it works for some mods.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Mon Mar 24, 2014 1:13 pm

Here is the code I tried to run:

At the bottom you can see the modfile I try to include. It bombs out unless I keep the last ds.b statement in there.

PLAYER.zip
You do not have the required permissions to view the files attached to this post.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
ljbk
Atari Super Hero
Atari Super Hero
Posts: 514
Joined: Thu Feb 19, 2004 4:37 pm
Location: Estoril, Portugal

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby ljbk » Mon Mar 24, 2014 5:56 pm

Look, instead of trying to debug your "experiences" it would be much faster for me to do a version where the mod is already "incbined".
But unfortunately, at the moment i have no free time to do it.
Sorry about that.
So either someone else does it or you will have do it yourself taking into account that the program has to reserve enough memory for all the parts "malloced" in the original version.
There are enough comments in the source for anyone (that knows the ST and 68000 code) to be able to do it because you don´t need to worry about the internal mechanics of the replay. You just need to care about your memory map.

Alternatively you can use the original Lance code that is already "incbined": program file will include the mod. I did the reverse path you want to build Hacking lance.

Again, good luck.

Paulo.

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Mon Mar 24, 2014 6:15 pm

DELETED
Last edited by Zamuel_a on Mon Mar 24, 2014 9:40 pm, edited 1 time in total.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

Zamuel_a
Atari God
Atari God
Posts: 1223
Joined: Wed Dec 19, 2007 8:36 pm
Location: Sweden

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby Zamuel_a » Mon Mar 24, 2014 9:12 pm

If I change the memory allocation routine to:

Code: Select all

qinitmemory:

   move.l   #memory_heap,d0
   lea   zfreememsize(pc),a0
   move.l   #TOTAL_BYTES,(a0)
   lea   zpfreemem(pc),a0
   move.l   d0,(a0)
   lea   zpreturnmem(pc),a0
   move.l   d0,(a0)
   moveq   #0,d1
   rts


and then at the end:

Code: Select all

test_mod   incbin   'desertd2.mod'
mod_extra   ds.b   484+31*2*664

TOTAL_BYTES   EQU   400000
memory_heap   ds.b   TOTAL_BYTES


It seems to work and I can call mt_init directly with:

Code: Select all

   move.l   #mod_extra,d0
   sub.l   #test_mod,d0

   bsr   mt_init


If I try something less than 400k in the memory area I can allocate, it crash, so I guess the module needs alot of extra RAM? Since that makes it impossible to run my final program on a 1Mb machine I might aswell replace the ds.b 400000 with something like $100000 so I force it to use all available memory above 1Mb if I know that rest of my code will run below that. Or am I missing something?

Is the amount of bytes after the module (484+31*2*664) correct or should it be more here? Maybe all other data is reserved with the malloc routine so it's handled differently.
ST / STFM / STE / Mega STE / Falcon / TT030 / Portfolio / 2600 / 7800 / Jaguar / 600xl / 130xe

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1034
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby MasterOfGizmo » Sat Apr 04, 2015 1:30 pm

I am currently struggling with this code on my FPGA STE implementation.

There are a few things i don't understand. First the begin of the timer a irq handler:

Code: Select all

TimerA   movem.l   d0-d7/a0-a6,-(sp)
   move.w   sr,d0
   move.w   (sp),d1
   andi.w   #$f8ff,d0
   andi.w   #$0700,d1
   or.w   d0,d1
   move.w   d1,sr
   ...


This first stores all registers on the stack and then combines the irq flags from the topmost stack entry with the sr. As all registers have just been saved there's a6 high word on top of the stack which in turn clears all irq mask bits which in turn enables the hbi which is undone by the usual hbi handler of tos. I don't think that's intentional. What is this code supposed to do?

Second, this code (a6 points to the mfp base) in the setup:

Code: Select all

        move.b   #1,$1f(a6)
   move.b   #8,$19(a6)


This sets timer_a value to 1 and enables event count mode. Won't this trigger the irq immediately? It does on my implementation as the counter reaching 1 causes the irq. Why doesn't that happen here? Or does it? If the cpu forces the counter to 1, doesn't it then trigger the irq?
MIST board, FPGA based Atari STE and more: https://github.com/mist-devel/mist-board/wiki

User avatar
npomarede
Atari God
Atari God
Posts: 1239
Joined: Sat Dec 01, 2007 7:38 pm
Location: France

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby npomarede » Sat Apr 04, 2015 5:13 pm

MasterOfGizmo wrote:I am currently struggling with this code on my FPGA STE implementation.

There are a few things i don't understand. First the begin of the timer a irq handler:

Code: Select all

TimerA   movem.l   d0-d7/a0-a6,-(sp)
   move.w   sr,d0
   move.w   (sp),d1
   andi.w   #$f8ff,d0
   andi.w   #$0700,d1
   or.w   d0,d1
   move.w   d1,sr
   ...


This first stores all registers on the stack and then combines the irq flags from the topmost stack entry with the sr. As all registers have just been saved there's a6 high word on top of the stack which in turn clears all irq mask bits which in turn enables the hbi which is undone by the usual hbi handler of tos. I don't think that's intentional. What is this code supposed to do?

This code does indeed looks useless/broken ; if registers were not saved with movem, then (sp) would be the content of SR before the interrupt, but here it will just set interrupt level to a wrong/random value (which should not be a problem anyway)
Second, this code (a6 points to the mfp base) in the setup:

Code: Select all

        move.b   #1,$1f(a6)
   move.b   #8,$19(a6)


This sets timer_a value to 1 and enables event count mode. Won't this trigger the irq immediately? It does on my implementation as the counter reaching 1 causes the irq. Why doesn't that happen here? Or does it? If the cpu forces the counter to 1, doesn't it then trigger the irq?

Timer A in event count mode will trigger when STE DMA sound loads a new sample address, so it should not trigger immediately, depends on the state of the sound being played.

Nicolas

User avatar
MasterOfGizmo
Atari God
Atari God
Posts: 1034
Joined: Fri Feb 08, 2013 12:15 pm
Contact:

Postby MasterOfGizmo » Sat Apr 04, 2015 9:34 pm

Having fixed an issue with the DMA interrupt polarity I can say that this routine now also works on the mist board.

joska
Hardware Guru
Hardware Guru
Posts: 4036
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Lance 12.5 / 25 / 50 KHz routine for STE (V13)

Postby joska » Mon Jun 22, 2015 6:44 am

Zamuel_a wrote:If I change the memory allocation routine to:

Code: Select all

qinitmemory:

   move.l   #memory_heap,d0
   lea   zfreememsize(pc),a0
   move.l   #TOTAL_BYTES,(a0)
   lea   zpfreemem(pc),a0
   move.l   d0,(a0)
   lea   zpreturnmem(pc),a0
   move.l   d0,(a0)
   moveq   #0,d1
   rts


and then at the end:

Code: Select all

test_mod   incbin   'desertd2.mod'
mod_extra   ds.b   484+31*2*664

TOTAL_BYTES   EQU   400000
memory_heap   ds.b   TOTAL_BYTES


It seems to work and I can call mt_init directly with:

Code: Select all

   move.l   #mod_extra,d0
   sub.l   #test_mod,d0

   bsr   mt_init


If I try something less than 400k in the memory area I can allocate, it crash, so I guess the module needs alot of extra RAM? Since that makes it impossible to run my final program on a 1Mb machine I might aswell replace the ds.b 400000 with something like $100000 so I force it to use all available memory above 1Mb if I know that rest of my code will run below that. Or am I missing something?

Is the amount of bytes after the module (484+31*2*664) correct or should it be more here? Maybe all other data is reserved with the malloc routine so it's handled differently.


I've just discovered the same problem here, I've been working on this code to make a bit more userfriendly.

I'm not sure what Paolo mean by "You just need to care about your memory map.". To me this looks like a bug.

If you look at Paolo's code the mod is put at the bottom of the heap. Then around 300kb is allocated on top of that. I can allocate memory for the mod anywhere, and it will work as long as it's immediately followed by a 350kb buffer. I can also put the rest of the heap in this 350kb buffer and it will work. But the heap and the mod-buffer doesn't have to be consecutive.

The crash appears in mt_init. I suspect a bug where data is written somewhere around 350kb after the mod buffer, and this works by accident because Paolo's code hogs all available memory and no harm is done.
Jo Even

Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64


Social Media

     

Return to “680x0”

Who is online

Users browsing this forum: No registered users and 2 guests