Jump to content
IGNORED

PM multiplexor


Heaven/TQA

Recommended Posts

small example:

 

;Sprite masking for normal screen width
grafp0	= $d00d
hposp0	= $d000
grafm	= $d011
hposm0	= $d004
sizem	= $d00c

pos0	= $0600

	org $4000

init:	lda #$ff
	sta grafm ;set all missle data
	sta grafp0+2 ;set player2 gfx
	lda #0 ;black color of pm0 and pm1
	sta 704
	sta 705
	lda #$3a
	sta 706
	lda #$ff ;all missles to 4x size
	sta sizem
;now set missles to left and right border
	lda #$28
	sta hposm0
	lda #$d0
	sta hposm0+1
	lda #1 ;priority mode 1
	sta 623
	lda #100
	sta pos0
loop:	lda 20
	cmp 20
	beq *-2 ;wait for VBL by checking OS clock
	inc pos0
	lda pos0
	sta hposp0+2 ;player2
	jmp loop

Edited by Heaven/TQA
Link to comment
Share on other sites

small example:

 

;Sprite masking for normal screen width
grafp0	= $d00d
hposp0	= $d000
grafm	= $d011
hposm0	= $d004
sizem	= $d00c

pos0	= $0600

	org $4000

init:	lda #$ff
	sta grafm ;set all missle data
	sta grafp0+2 ;set player2 gfx
	lda #0 ;black color of pm0 and pm1
	sta 704
	sta 705
	lda #$3a
	sta 706
	lda #$ff ;all missles to 4x size
	sta sizem
;now set missles to left and right border
	lda #$28
	sta hposm0
	lda #$d0
	sta hposm0+1
	lda #1 ;priority mode 1
	sta 623
	lda #100
	sta pos0
loop:	lda 20
	cmp 20
	beq *-2 ;wait for VBL by checking OS clock
	inc pos0
	lda pos0
	sta hposp0+2 ;player2
	jmp loop

 

I think after years of having chuffing big borders and having to do dec $d016/inc $d016 at cycle 56 I'm so going to enjoy not having side-borders the size of Russia on the screen, so wide screen mode all the way for me :)

Link to comment
Share on other sites

Bung some timer/pot code out, I'm sure some people will test it for you on hardware. I just got my 65xe but have no sio2pc or anything yet so can't help I'm afraid.

I'll being driving to Bratislava tomorrow morning to pick up a dirt cheap 130XE (and it's the perfect excuse to hit the Tesco there as well :lol: ), but I've still got to get off my arse and sort out some PC connection gizmo as well ;)

 

Anyway.. I'd be curious if this even works on a real A8..

 

It looks bizarre because it doesn't load the player graphics yet into the correct positions, it's just been a little experiment in learning the A8 and of doing raster splits with timers..

 

It won't work on Altirra because the Pots don't seemingly work, and also because it doesn't support some illegal opcodes.. Atari800WinPlus will be okay, but the timers are all out by a line or so..

 

any particular reason why you are starting $2006? ;)

Link to comment
Share on other sites

any particular reason why you are starting $2006? ;)

 

*		= $2000
	!byte $ff,$ff
	!word program_start
	!word program_end

Simply because I didn't know what your memory map looked like (where basic memory starts and so on, or even how you handle loading), so just took a guess with $2000 being suitably free on the very first program I wrote ;)

And it's just stayed like that as I've been experimenting ;)

Link to comment
Share on other sites

and... don't forget the 4k LMS feature... ;) who needs VCP or whatever the "LMS" like stuff is called... ;)

 

I do like that and the ability to do LMS on every line and have the screen layed out however you want.. I still don't get what Emkay and TMR are squabbling about with LMS in that other thread though.. More to read up I guess ;)

I'm still trying to get my head around the fancy scroll technique (MCP/MWP or something like that), but then there's still much to learn about this little beasty..

I do like it a lot though, but I find triggering interrupts (that are dynamic in anyway) to be a royal pain in the butt, especially when you're doing an LMS on every line..

Link to comment
Share on other sites

and... don't forget the 4k LMS feature... ;) who needs VCP or whatever the "LMS" like stuff is called... ;)

 

I do like that and the ability to do LMS on every line and have the screen layed out however you want.. I still don't get what Emkay and TMR are squabbling about with LMS in that other thread though.. More to read up I guess ;)

I'm still trying to get my head around the fancy scroll technique (MCP/MWP or something like that), but then there's still much to learn about this little beasty..

I do like it a lot though, but I find triggering interrupts (that are dynamic in anyway) to be a royal pain in the butt, especially when you're doing an LMS on every line..

 

 

pssst... I still not get MVP, too... even Analmux posted source code plus graphics how the magic wrapping is working... ;) I am more into the standard Gameboy technique using 2 screens and building the screen behind the visible one... ;)

Link to comment
Share on other sites

ok... ;) understood... but your loader does not put the header into memory... ;) so you could $2000 set as starting adress... ;)

 

I am just going through the monitor code and I am interested in the POT stuff you have mentioned... is there any chance of posting your source code???

 

:)

 

What do you mean by the loader doesn't put it into memory ? Have I missed something obvious about the xex formats then ? Do you mean the loader only parses the first 6 bytes of the header when it loads it ?

edit: What I mean is does it read the 6 bytes, then reads programend-programstart bytes into memory at address programstart, then reads the last 6 bytes (whatever the 1st 4 voodoo byte are) then jumps to the start address ?

 

I'll put the code out for the sprite stuff when it's all doing what I want, it's a total mess from experimenting with different things, and I want to get the thing running like it should do.. But I posted the guts of the timer stuff earlier in this thread ;)

 

edit: Basically all it does is:

 

@VBL: It sets an interrupt to just above the top of the visible screen line, something like 8 lines or so..

		lda #86
		sta AUDF4
		sta WSYNC
		lda #1
		sta STIMER

In the timer interrupt (8 lines above the top of the screen)

		lda POT0
		lda POT1
		lda POT2
		lda POT3
		lda POT4
		lda POT5
		lda POT6
		lda POT7

		sta POTGO
		sta WSYNC
		jsr plex_display

We load the 1st 4 players up in the hardware..

And set the time to the first interrupt, which will be the bottom line of sprite 0..

		;	Start the irq chain..
mux_l0		= *+1
		lda #$00
		beq .skip
		sec
		sbc POT7
		sbc #1
		sta AUDF4
		sta STIMER

And points to the first interrupt in the irq chain..

And then at the end of the useage of a hardware player, it then sets the player up for the next sprite, no matter how many lines away it actually is used.. So..

So from now on we're just falling through a preset irq chain..

.l			= * +1
		lda #0
		cmp POT7
		bcc .next
		beq .next
		sbc POT7
		sbc #1
		sta AUDF4
		sta STIMER

		lda #0
		sta IRQEN
		lda #4
		sta IRQEN

		lda #<.next_irq
		sta $fffe

And there's a seperate chunk of interrupt code for each sprite, with the last ones setting an interrupt up to give me a stable interrupt at the bottom of the visible screen to start doing stuff, rather than waiting for the VBL.. In fact any irq will exit to the last interrupt if it gets a y-position of 0..

Edited by andym00
Link to comment
Share on other sites

re: header

 

what I ment is that the loader does not copies $ff,$ff,lo,hi,lo,hi to the lo/hi adress but leaves that out... so nothing magic here...

 

I am sure your c64 assembler would mess it up... ;) atari assemblers do that correct... every ORG in the source code will cause putting a correct header into the XEX file...

 

so... f.e.

 

ORG $2000 ;-$23ff

put code here

ORG $8000 ;-$8fff

put gfx here

 

will NOT put a binary of f.e. $2000-$8fff length on disc but f.e. $ff,$ff,$00,$20,$ff,$23,code,code,code,..., $ff,$ff,$00,$80,$ff,$8f,gfx,gfx,gfx...

 

so the filesize would be $0400+$1000+$0c headers

 

or did I get it again wrong? ;)

Link to comment
Share on other sites

f.e. in Metagallactic Llamas & Gridrunner

 

I am putting "overlay" code with multiple ORGs over the original VIC code... so I have done like this

 

INS "gridrunner.prg"

;now patches

ORG $11xx

JSR CODE_PATCH

ORG $13xx

NOP

NOP

NOP

...

 

this worked perfect for Llama and Gridrunner but not for porting A8 code to C64 where no "overlays" via source code seems to be possible...

Link to comment
Share on other sites

pssst... I still not get MVP, too... even Analmux posted source code plus graphics how the magic wrapping is working... ;) I am more into the standard Gameboy technique using 2 screens and building the screen behind the visible one... ;)

 

This MVP, I get it from looking at the pictures and it's fairly straight forward, but then I read the textual explanation and I'm totally lost by what addresses are supposed to where on what lines.. I can see how to implement it, but it feels like I'm missing something compared to how he describes it.. One day I will sit down and understand exactly what he means in his explanation and implement the bugger :)

Edited by andym00
Link to comment
Share on other sites

re: header

 

what I ment is that the loader does not copies $ff,$ff,lo,hi,lo,hi to the lo/hi adress but leaves that out... so nothing magic here...

 

I am sure your c64 assembler would mess it up... ;) atari assemblers do that correct... every ORG in the source code will cause putting a correct header into the XEX file...

 

so... f.e.

 

ORG $2000 ;-$23ff

put code here

ORG $8000 ;-$8fff

put gfx here

 

will NOT put a binary of f.e. $2000-$8fff length on disc but f.e. $ff,$ff,$00,$20,$ff,$23,code,code,code,..., $ff,$ff,$00,$80,$ff,$8f,gfx,gfx,gfx...

 

so the filesize would be $0400+$1000+$0c headers

 

or did I get it again wrong? ;)

 

Right, I'm with you now.. I had no idea the loader worked like that, and certainly that it could handle multiple chunks like that.. That's very nice indeed.. In CBM land it's nice and caveman-like ;)

Umm, I could knock up a macro to do it, but an ORG is just an ORG in my world.. I wouldn't want the assembler doing anything else than setting the PC for me..

That's one thing that's impressed me about the A8s as well is how much more like a proper OS you've got, not that it really mattered on the C64, and in someways the A8s feel a bit over-engineered in that aspect, but I guess with your better basic and exposure of the hardware to basic that it was kind of required..

Link to comment
Share on other sites

f.e. in Metagallactic Llamas & Gridrunner

 

I am putting "overlay" code with multiple ORGs over the original VIC code... so I have done like this

 

INS "gridrunner.prg"

;now patches

ORG $11xx

JSR CODE_PATCH

ORG $13xx

NOP

NOP

NOP

...

 

this worked perfect for Llama and Gridrunner but not for porting A8 code to C64 where no "overlays" via source code seems to be possible...

 

I was wondering how you were doing that, whether you had it in a fixed chunk of memory and were manually patching it, or hacking the binary image directly or working with a dissasembly.. I'd never have guessed you were doing it like that, but that's a damn nice way of doing it :)

Link to comment
Share on other sites

re: VIC ports (patent pending... ;))

 

well... luckily VIC games are not so complicated... $1000-$1fff codevise for unexpaned games...so in general no conflicts on Atari side... hardware on the vic side is at $9000...so luckily again no harm here...

 

I am loading original vic code into the desired ram and then I can easily patch stuff... of course first of all I am setting up Atari to mimic the vic screen layout which is possible... I am using antic mode 6... unexpanded vic games mainly use $1e00-$1fff for screen ram, font most of the time at $1d00-$1dff so again perfect match... luckily I am choosing games which only have max. 64 chars so they can be mimic, too... color ram simulations can be done via the 4 colors of antic 6 and pm overlays plus DLIs...

 

of course I am switching off Atari OS so I have full access to the zero page...

 

and I am inserting the original VIC rom font, too...and if necessary I am inserting VIC rom code if needed... ;)

 

and at the moment I am used to Jeff's code as Llama & Gridrunner are similar how he has coded the games...

 

and I am using DIS6502 to disassemble the code and I am using a print out on oldschoolish paper to make my notes and to oversee the code in total... very handy... ;)

Edited by Heaven/TQA
Link to comment
Share on other sites

I am loading original vic code into the desired ram and then I can easily patch stuff...

 

Sorry to drag this even further off the original topic, but... eep! Are you not doing what i did with Kikstart C16 and converting the code to source?

Link to comment
Share on other sites

I am loading original vic code into the desired ram and then I can easily patch stuff...

 

Sorry to drag this even further off the original topic, but... eep! Are you not doing what i did with Kikstart C16 and converting the code to source?

 

nope. simply because it took me ages that DASM compiled Berzerk 800 on c64 with the Dis6502 generated source code... never worked with MADS+DIS6502... so I went the easy road... ;)

Link to comment
Share on other sites

pssst... I still not get MVP, too... even Analmux posted source code plus graphics how the magic wrapping is working... ;) I am more into the standard Gameboy technique using 2 screens and building the screen behind the visible one... ;)

 

This MVP, I get it from looking at the pictures and it's fairly straight forward, but then I read the textual explanation and I'm totally lost by what addresses are supposed to where on what lines.. I can see how to implement it, but it feels like I'm missing something compared to how he describes it.. One day I will sit down and understand exactly what he means in his explanation and implement the bugger :)

 

There is some source code posted on AtariAge from Gauntman that I found much easier to understand. It works with a 20 character screen mode however, but isn't difficult to change to a 40 column mode.

Link to comment
Share on other sites

There is some source code posted on AtariAge from Gauntman that I found much easier to understand. It works with a 20 character screen mode however, but isn't difficult to change to a 40 column mode.

 

Aha, that'll make for the perfect way to understand it now :) I good hunt for that will be in order this afternoon then..

Link to comment
Share on other sites

I've found a few hours to do some dabbling, a little update on this sprite business, probably mainly for Heaven :)

 

I've bumped it up to 48 sprites now, and copying is in, yeah, I know not very adventurous I know ;) It's not double buffered, but you'd never know anyway..

It still doesn't use the 5th player, since I'd always assumed that when you set the 5th player bit that the hardware would take care of positioning the 4 missiles together for you, but now I realise that in fact all it does is make the missiles use PF3, which is handy in a way, but the loading cost of the 5th player is scary, like 24 cycles or so!! But I'll add it since I think having one more player will ease the load on the plexer quite a lot.. To be honest I'm amazed what you can get away with with only 4 sprites..

 

I'm seriously losing my patience with Atari800WinPlus and trying to hold onto some solid timing reality ;) Anyway, worst case on the real-hardware is that it's all one line out, I think.. Actually, worst case is it (probably) doesn't work at all..

 

Can anyone tell me for certain on which line players are started to be drawn relative to the screen ? I assume there's some line they start to load from, but what line is it exactly ? And is there a reason there's the empty 1K of memory at the bottom of PMBASE ?

 

And one more question, what's the maximum screen height I can safely go to on PAL machines ? Is there some common values in A8 land ?

 

There's 2 versions, one with colours on the interrupts for curiosities sake..

And there's nothing handling more than 4 sprites cleverly yet, so the mess at the top and bottom is inevitable when they all pile up there..

Anyway, back to this miserable 5th player contraption..

post-3913-125293390317_thumb.png

playertest.zip

Link to comment
Share on other sites

Gracias,

 

the interesting part starts when you gonna implement the multiplexor handling more than 4 hw sprites per scanline... and of course I would vote for multicolor sprites as this looks much too 2600 like... ;)

 

but well dohne... ;) I should expermiment with rasters per sprite and see how far I can get it in leaving out the "zone" approach.

Link to comment
Share on other sites

Gracias,

 

the interesting part starts when you gonna implement the multiplexor handling more than 4 hw sprites per scanline... and of course I would vote for multicolor sprites as this looks much too 2600 like... ;)

 

but well dohne... ;) I should expermiment with rasters per sprite and see how far I can get it in leaving out the "zone" approach.

 

More than 4 per line isn't any more work as I said before.. I'll try to be more clear this time ;) In the sort use a 9bit key.. The bottom bit is the last displayed flag..

If the sprite can be added to the irq chain (ie: if ypos > players_end) eor the displayed flag and add into the irq chain, else discard it..

 

Next time around.. The non-displayed sprites will shuffle towards a higher position in the sort, and have a naturally higher priority than the one drawn last frame..

 

So assume 4 sprite on the same line, the number is just displayed flag..

S0 = 0 S1 = 0 S2 = 0 S3= 0

As we parse the list, we add S0 then eor display flag, add S1 eor display flag, then S2 S3 fail and don't get added..

 

Now, next frame, we have the bottom bits of the YPOS/SortKey looks like :

S0 = 1 S1 = 1 S2 = S3 = 0

 

And then, after we sort, the order will be

S2,S3,S0,S1

 

And this time it'll display display S2,S3, and their display flags gets eor'd, and S0, S1 will get rejected *unless* the player it wants is free..

 

So, next frame, we have:

S0 = 1 S1 =1 S2 = 1 S3 = 1

And the next sort they fall back into their natural sorted order because they're equal..

And we begin the whole cycle again..

 

And you can do this for as many sprites as you want.. If you want 32 on one line it just works.. It's no extra work whatsoever, well apart from having a 9bit sort, which is best with a 2 pass Radix sort.. a 5bit first pass, then a 4 bit second pass would be best for 48 or so, but with larger numbers a 6bit + 3 bit or even an 8bit + 1bit would be better if you're up to 128+..

The only extra work you do is compare the sprites Y position against the end line of the player you're about to use, if it fails discard the sprite for this frame, if it passes eor its display flag.. Okay, so there's a little extra work to insert the display bit flag into the sort key, but its like 4 or 6 cycles extra work..

Edited by andym00
Link to comment
Share on other sites

I think Heaven meant more than 4 per line using a horizontal split ;)

 

 

Pete

 

lol, no chance ;) I've had enough trouble re-using sprites in hand coded stuff trying to make a big full width single colour overlay using players so I can have a nice classic score, lives, hiscore panel overlaid over the background across the full width, and I feel like I'm back in 2600 land already ;)

Anyway, I'm not convinced that this whole flickering more than 4/5 per line will be of any use when using them as underlays on software sprites.. It'll look so unbelievably crap if the colours underlaying sprites are flickering on and off, and not the software part, though I guess you could switch the software one on and off as well for proper authentic flicker-vision ;)

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...