Welcome, Guest. Please login or register.

Author Topic: Catagon  (Read 4604 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Leffmann

  • Full Member
  • ***
  • Join Date: Feb 2011
  • Posts: 119
    • Show only replies by Leffmann
Re: Catagon
« Reply #14 from previous page: September 23, 2014, 07:42:06 PM »
Quote from: BSzili;773745
The player interrupt definitely uses up too much CPU time. A better protracker replayer would solve the problem too, but they are all written in assembler, so it takes some effort to glue them to C code.


If you're writing it in C then it's just a few lines of code to fix that actually. Let me write up an example.

EDIT:

https://dl.dropboxusercontent.com/u/8177628/p61.zip

Just link with p61.o and use it f.ex. like this:
Code: [Select]
#include <proto/dos.h>

extern char module[];
extern char samples[];
extern int P61_Init(void*, void*);
extern void P61_End();

int main()
{
  if (P61_Init(module, samples) == 0)
  {
    Delay(10*50);
    P61_End();
  }

  return 0;
}
« Last Edit: September 23, 2014, 07:59:56 PM by Leffmann »
 

Offline BSziliTopic starter

  • Full Member
  • ***
  • Join Date: May 2012
  • Posts: 112
  • Country: 00
    • Show only replies by BSzili
    • http://bszili.morphos.me
Re: Catagon
« Reply #15 on: September 25, 2014, 07:39:58 AM »
Thanks, I'll check it out this weekend. BTW, these function prototypes look a bit odd to me. They don't have any registers specified for the arguments, and a lot of them are omitted, like A6, A4, D0 for P61_Init. Is this intentional? I also noticed there's an optimized version if The Player: http://aminet.net/package/mus/misc/P6111
« Last Edit: September 25, 2014, 07:59:40 AM by BSzili »
This is just like television, only you can see much further.
 

Offline Leffmann

  • Full Member
  • ***
  • Join Date: Feb 2011
  • Posts: 119
    • Show only replies by Leffmann
Re: Catagon
« Reply #16 on: September 25, 2014, 03:26:20 PM »
I added a stub to the player for standard C calls. IMO it's cleaner and more elegant than using compiler-specific keywords for register usage. It works and plays songs exactly like it's supposed to, it's not some random guesswork.

I'm not sure what the optimizations in the unofficial 6.1.11 are, as the official 6.1 is pretty fast and optimized as it is. I tried 6.1.8 some time ago, but the changes made it confusing to use, and it didn't work reliably. The problems might be fixed in 6.1.11, but I haven't tried it.
 

Offline BSziliTopic starter

  • Full Member
  • ***
  • Join Date: May 2012
  • Posts: 112
  • Country: 00
    • Show only replies by BSzili
    • http://bszili.morphos.me
Re: Catagon
« Reply #17 on: September 26, 2014, 01:39:25 PM »
Sorry, I didn't mean to imply that you've randomly omitted the register keywords :) I was just interested in how did you do it, and what does the stub look like. I was originally going to use Frank Wille's ProTracker player, which can play sounds effects on the least used channel. I went to ptreplay.libray for the demo, because it could us it "out of the box" from C code.
This is just like television, only you can see much further.
 

Offline Leffmann

  • Full Member
  • ***
  • Join Date: Feb 2011
  • Posts: 119
    • Show only replies by Leffmann
Re: Catagon
« Reply #18 on: September 26, 2014, 06:35:09 PM »
The arguments go on the stack in reverse order, D0/D1/A0/A1 can be used as scratch registers, all other registers must be preserved, and any return value should be passed in D0, so the stubs look like this:
Code: [Select]
_P61_Init  movem.l  (4, sp), a0-a1
           movem.l  d2-d7/a2-a6, -(sp)
           moveq    #0, d0
           bsr      P61_Init
           movem.l  (sp)+, d2-d7/a2-a6
           rts

P61_Init   ...


_P61_End   movem.l  a3/a6, -(sp)
           lea      $dff000, a6
           bsr      P61_End
           movem.l  (sp)+, a3/a6
           rts

P61_End    ...