Jump to content
IGNORED

player editor


playsoft

Recommended Posts

Here is an example of what Irgendwer is referring to. In the first picture, you can see the car is ahead of the tires. This is because the position of the car was updated, then the DLI kicks off before the tire position is updated to match the car.

 

In the second picture, there are missing interrupts (red circles) and it looks like some of the tires weren't drawn.

post-47876-0-92046400-1508110925.png

post-47876-0-18750700-1508112435_thumb.png

Edited by Schlortt
Link to comment
Share on other sites

Hey Guyz,

 

I have another question: when exporting ASM code from Atari Interlace Studio, I can compile it with MADS and call from CC65 with a JSR.

I have created some background GFX in mode G11, with no raster, no DLI, really simple case.

However, after initialzing the G11 graphics, the sprites don't show up properly.

 

Would you mind having a quick look at the ASM and C code, and let me know what I am doing wrong?

Cheers!!!

// Atari Interlaced Studio

buf0	= $6010

gtictl	= $d01b
skctl	= $d20f
portb	= $d301

dmactl	= $d400
dlptr	= $d402
wsync	= $d40a
vcount	= $d40b
nmien	= $d40e
nmist	= $d40f

/*-------------------------------------------------------------------------------------------------*/

	org $80

regA	.ds 1
regX	.ds 1
regY	.ds 1
cnt	.ds 1

/*-------------------------------------------------------------------------------------------------*/

	.get 'g11.dat',-9		; palette

	org buf0
	ins 'g11.dat',0,8000

/*-------------------------------------------------------------------------------------------------*/

	.align	$100

	dlist0:	dta d'ppp'
		dta $4f,a(buf0)
		:101 dta $f
		dta $4f,0,h(buf0+$1000)
		:89 dta $f
		dta $41,a(dlist0)

/*-------------------------------------------------------------------------------------------------*/

.proc StartG11
	lda:cmp:req 20

	mva	#$00	nmien
	mva	#$fe	portb

	mwa	#dlist0	dlptr
	mwa	#NMI	$fffa
	mva	#$c0	nmien

	lda:rne vcount
	rts				; exit
.endp

.proc StopG11
	lda:rne vcount

	mva	#$ff	portb
	mva	#$40	nmien
	
	rts
.endp

/*-------------------------------------------------------------------------------------------------*/

NMI	
	bit nmist
	bpl vbl

vdli equ *-2

vbl	sta nmist
	phr

	;mva #$22 dmactl
	mva #62 dmactl

	;mva #$c0 gtictl		; graphics 11
	mva #241 gtictl		; graphics 11

	plr
	rti

#include <cc65.h>
#include <conio.h>
#include <peekpoke.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#define PLAYERS (4)
#define FRAMES (16)
#define HEIGHT (13)

#define PMGMem (0x4000)

// sprites data
unsigned int PMGBase[5] = {PMGMem+1024, PMGMem+1280, PMGMem+1536, PMGMem+1792, PMGMem+768};
unsigned int PMGAddr[5] = {PMGMem+1024, PMGMem+1280, PMGMem+1536, PMGMem+1792, PMGMem+768};
unsigned char PMColor[5] = {0x72, 0x22, 0xb6, 0xec, 0x00};
unsigned char xpos[4];
unsigned char ypos[4];
unsigned char frame[4];

#define FRAMES (16)
#define HEIGHT (13)

const unsigned char BODY[FRAMES][HEIGHT] =
{ { 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3e, 0x32, 0x32, 0x3e, 0x3c, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x04, 0x1e, 0x3a, 0x32, 0x36, 0x3e, 0x18, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x04, 0x0e, 0x1a, 0x34, 0x38, 0x38, 0x30, 0x10, 0x00, 0x00 },
  { 0x00, 0x00, 0x18, 0x1c, 0x14, 0x28, 0x38, 0x38, 0x38, 0x30, 0x10, 0x00, 0x00 },
  { 0x00, 0x00, 0x10, 0x38, 0x28, 0x28, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00, 0x00 },
  { 0x00, 0x00, 0x30, 0x70, 0x50, 0x28, 0x38, 0x38, 0x38, 0x18, 0x10, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x20, 0x70, 0x58, 0x2c, 0x1c, 0x1c, 0x0c, 0x08, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x20, 0x78, 0x5c, 0x4c, 0x6c, 0x7c, 0x18, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7c, 0x4c, 0x4c, 0x7c, 0x3c, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x18, 0x7c, 0x6c, 0x4c, 0x5c, 0x78, 0x20, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x08, 0x0c, 0x1c, 0x1c, 0x2c, 0x58, 0x70, 0x20, 0x00, 0x00 },
  { 0x00, 0x00, 0x08, 0x0c, 0x1c, 0x1c, 0x1c, 0x14, 0x28, 0x38, 0x18, 0x00, 0x00 },
  { 0x00, 0x00, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x14, 0x14, 0x1c, 0x08, 0x00, 0x00 },
  { 0x00, 0x00, 0x08, 0x18, 0x1c, 0x1c, 0x1c, 0x14, 0x0a, 0x0e, 0x0c, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x10, 0x30, 0x38, 0x38, 0x34, 0x1a, 0x0e, 0x04, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x18, 0x3e, 0x36, 0x32, 0x3a, 0x1e, 0x04, 0x00, 0x00, 0x00 } };

const unsigned char TIRES[FRAMES][HEIGHT] =
{ { 0x00, 0x00, 0x28, 0x28, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x28, 0x28, 0x00 },
  { 0x00, 0x00, 0x08, 0x28, 0x20, 0x04, 0x0c, 0x08, 0x00, 0x04, 0x14, 0x10, 0x00 },
  { 0x00, 0x00, 0x00, 0x18, 0x10, 0x04, 0x4a, 0x46, 0x00, 0x08, 0x08, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x20, 0x28, 0x14, 0x44, 0x40, 0x00, 0x08, 0x08, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x00, 0x54, 0x54, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x08, 0x28, 0x50, 0x44, 0x04, 0x00, 0x20, 0x20, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x18, 0x08, 0x20, 0x52, 0x62, 0x00, 0x10, 0x10, 0x00, 0x00 },
  { 0x00, 0x00, 0x10, 0x14, 0x04, 0x20, 0x30, 0x10, 0x00, 0x20, 0x28, 0x08, 0x00 },
  { 0x00, 0x00, 0x14, 0x14, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x14, 0x14, 0x00 },
  { 0x00, 0x00, 0x08, 0x28, 0x20, 0x00, 0x10, 0x30, 0x20, 0x04, 0x14, 0x10, 0x00 },
  { 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x62, 0x52, 0x20, 0x08, 0x18, 0x00, 0x00 },
  { 0x00, 0x00, 0x10, 0x10, 0x00, 0x02, 0x22, 0x28, 0x14, 0x04, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x22, 0x22, 0x00, 0x00, 0x2a, 0x2a, 0x00, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x04, 0x04, 0x00, 0x20, 0x22, 0x0a, 0x14, 0x10, 0x00, 0x00, 0x00 },
  { 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x46, 0x4a, 0x04, 0x10, 0x18, 0x00, 0x00 },
  { 0x00, 0x10, 0x14, 0x04, 0x00, 0x08, 0x0c, 0x04, 0x20, 0x28, 0x08, 0x00, 0x00 } };  

clock_t tFPS;
unsigned long f;
void DrawFPS()
{	
	// Calculate stats
    unsigned int fps;
	tFPS = clock() - tFPS;
    fps = (f*CLK_TCK)/tFPS;
	tFPS = clock();	

	// Output stats
    gotoxy(0,0);
    printf("FPS: %u", fps);
}

unsigned char i;

void InitSprites(void)
{
	POKE(54279, PMGMem>>; // Tell ANTIC where the PM data is located
	POKE(53277, 2+1);       // Tell GTIA to enable players + missile	
	POKE(623, 32+16+1);		// Tricolor players + enable fifth player + priority
	POKE(559, 32+16+8+4+2); // DMA Screen + Enable P/M + DMA Players + DMA Missiles + Single resolution
    for (i=0; i<4; i++) {
        bzero(PMGAddr[i],0x100);   // Clear Player memory
        POKE(704+i, PMColor[i]);   // Set Player colors
    }
    bzero(PMGAddr[4],0x100);  // Clear Missile memory
	POKE(711, PMColor[4]);	  // Set Player color
}

void ShowSprites(void)
{ 
    clock_t timer = clock();
    unsigned int angle = 0;
    tFPS = clock();	
	while (!kbhit()) {   
        // Update body position
        //if (clock()>timer) {
        //    timer = clock();
            angle++;
            for (i=0; i<PLAYERS; i++) {
                xpos[i] = 128+cc65_cos((angle+i*90)%360)/6;
                ypos[i] = 128+cc65_sin((angle+i*90)%360)/4;
                frame[i] = ((12-(angle+(i+1)*90))%360)/23;
                POKE(53248+i, xpos[i]);
                bzero(PMGAddr[i], HEIGHT);        
                PMGAddr[i] = PMGBase[i]+ypos[i];
                memcpy(PMGAddr[i], BODY[frame[i]], HEIGHT);
            }       
        //}
        
        // Flicker TIRES
        i = f%PLAYERS;
        bzero(PMGAddr[4], HEIGHT);
        PMGAddr[4] = PMGBase[4]+ypos[i];
        POKE(53252, xpos[i]+6);
        POKE(53253, xpos[i]+4);
        POKE(53254, xpos[i]+2);
        POKE(53255, xpos[i]+0);
        memcpy(PMGAddr[4], TIRES[frame[i]], HEIGHT);          

        // Next Frame
        if (f > 60) { DrawFPS(); f=0; }
        f++;
    }
}
/*
** Hello world program using cc65.
*/

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <unistd.h>
#include "sprites1.h"

/*****************************************************************************/
/*                                   Code                                    */
/*****************************************************************************/

int main (void)
{       
    // Start CIN
    __asm__("jsr $80CA"); 
    
	// Start Sprites
    InitSprites();
    ShowSprites();

	// Stop G11
	__asm__("jsr $80F9");	
    
    // Done
    return EXIT_SUCCESS;
}

freeway.xex

sources.zip

Link to comment
Share on other sites

So, back with more questions!

I have integrated my sprites animation with a CIN background image as shown here:

 

post-53448-0-22649200-1508314834.jpg

 

I still have a couple of issues:

 

(1) I set the colour of P4 (tires) with: POKE(53273, PMColor[4]); // Set Player colors

However, the colour flickers based on P0-P3...

 

(2) I have an issue with this line of code in the asm file: mva #$fe portb

This functions is used by CIN to disable to ROM, or something like that, but the functions clock() and cgect() in cc65 stop working.
If I comment this line I can use clock() and cget(), but then the CIN gfx do not appear.

 

Could you guyz give me again some advice?? Thx a lot in advance!!!!

Tony

post-53448-0-22649200-1508314834.jpg

sources.zip

freeway.xex

  • Like 1
Link to comment
Share on other sites

The multicolored tires is a sign that gprior (623)/ prior (53275) are not set. Enabling the 5th player (bit 4) is what allows you to set the missiles to a single color. I see in your code, you set 623. 623 is a shadow register for hardware register 53275. Shadow registers get copied to hardware registers by the OS routines during the vertical blank as I understand it. Additionally, the clock memlocs (18,19,20) are also managed by the OS routines so that should explain the clock not working. I think this explains what is going here, but whether you use the OS or write custom routines to meet your specific needs is up to you.

Link to comment
Share on other sites

The multicolored tires is a sign that gprior (623)/ prior (53275) are not set. Enabling the 5th player (bit 4) is what allows you to set the missiles to a single color. I see in your code, you set 623. 623 is a shadow register for hardware register 53275. Shadow registers get copied to hardware registers by the OS routines during the vertical blank as I understand it. Additionally, the clock memlocs (18,19,20) are also managed by the OS routines so that should explain the clock not working. I think this explains what is going here, but whether you use the OS or write custom routines to meet your specific needs is up to you.

Hey Schlortt

I will try to figure out the tire issue based on your remarks.

The OS stuff is much more problematic for me. I do not want to disable it, but the CIN code I obtained from Atari Interlaced Studio seems to require setting the OS off.

By looking at the ASM code, could you tell me why CIN needs it, and if there is a way to avoid switching off the OS.

Link to comment
Share on other sites

I have integrated my sprites animation with a CIN background image as shown here:

 

Only a general remark: If you like to have at least somewhat acceptance for your game in PAL-land do not use CIN or other interlaced background graphics.

They flicker like hell and it's a complete different story to interlaced PMGs as the area is much bigger.

The issue may not be apparent one most LCD monitors but it is there.

 

  • Like 2
Link to comment
Share on other sites

  • 4 years later...
44 minutes ago, OxC0FFEE said:

@playsoft is the player editor still hosted online? I am getting an error for your domain.

Flash now doesn't work with browsers.

But you can continue to use Player Editor offline with the files you can download here:

https://atariage.com/forums/topic/315767-atariplayereditor-flash/

  • Like 1
Link to comment
Share on other sites

  • 5 weeks later...
  • 1 year later...
On 9/3/2017 at 1:18 PM, mono said:

Is your player editor still accessible? I've got 404 😕

Yep common problem with 2011 posts - stuff has all dead links. I wish everyone would stick with stuff like the archive.org or some way to keep uploaded links alive for longer.  Sourceforge even keeps old projects alive for decades. I can still find 15 year old Dot Net code I posted on sourceforge - still good.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...