Jump to content
IGNORED

how to re-use players (atari 8 bit)


Thelen

Recommended Posts

Here is something that even I can help with!! I've done this many times...

 

All you do is draw your 2 sprites data at different memory locations withing the Player "strip".

 

FOR EXAMPLE -- if you are using Player1 and say it starts at $1A00. Copy the Alien1 data starting about $1A20 or so to put it at the top of the screen. Copy the Alien2 data at about $1AA0, which puts it lower on the screen.

 

Player1's horizontal position is controlled via register HPOSP1. If you do nothing else, you will see both Aliens, at top and bottom, but they will always have the same horizontal position. That is why you need to change the HPOSP1 register in a mid-screen Display List Interrupt.

 

So, in Vertical Blank (or in a Modeline1 DLI) set HPOSP1 to Alien1's HPOS variable setting. In a DLI mid-screen (Between the 2 sprites), set HPOSP1 to Alien2's HPOS variable setting.

 

I hope that helps. As far as collision, you must determine the height on-screen to determine which of the 2 aliens was collided with/shot etc.

Link to comment
Share on other sites

Yeah...and the DLI's can be placed on any graphic line. So if you used a higher graphics mode, you have more opportunities to split the player up. If you have a gap of at least one line in-between the enemy sprites, you could use one DLI (on the scanline with the gap) to change the color...and another DLI (on the scanline with the object data) to change HPOS.

Link to comment
Share on other sites

There's enough time to change both actually. In each DLI there are 3 phases. Right after the usual "STA WSYNC" stmt, you can lda / sta two times each & should be enough time (it always was for me).

 

If you need more time you can just do some code in the DLI then have an additional "STA WSYNC" and some more code which in effect is like another DLI call but without the administration of pointing the DLI routine to the new code. Then, finally end the long DLI with the RTI.

Link to comment
Share on other sites

If you need more time you can just do some code in the DLI then have an additional "STA WSYNC" and some more code which in effect is like another DLI call but without the administration of pointing the DLI routine to the new code.

 

Let me guess: You are using an Emulator, do you?

 

With only one WSYNC, the rest of the DLI is synchronized to the screen.

In ADMIRANDUS Start-/Manual-Screen, I used only one 1 DLI for the Background, and the Color changes 10 times per scanline at the small screen-setting (32Bytes wide)

Maybe, in full screenwidth, there are 16 changes in a scanline. Nothing is flickering With a WSYNC there were only one Color in one scanline... I've used Charmode...

So, for easy calculating, the WSYNC costs about 16 times of a real color Change.

Link to comment
Share on other sites

thanks guys. I think I understand it now (haven't tried anything yet) I was doing things with pmbase switching....and changing the Pcolors....haha.

 

The only thing is off course that if I re-use player0 the re-used player will have thesame color as player0, or I should use a kernel...

 

Thelen

Link to comment
Share on other sites

thanks guys. I think I understand it now (haven't tried anything yet) I was doing things with pmbase switching....and changing the Pcolors....haha.

 

The only thing is off course that if I re-use player0 the re-used player will have thesame color as player0, or I should use a kernel...

 

Thelen

 

It is no Problem to change the color of the PMG in the same DLI on wich you are changing the position of the player.

Link to comment
Share on other sites

I used STA WSYNC to wait until the start of the next horizontal blank. That's what I thought it did. If that isn't technically correct, I still mean 'the next scanline'. I don't know what you mean emkay, about using an emulator. Maybe you mean emulators act differently. Atari800win seems to act pretty darn close to the real thing.

 

For example, one DLI:

 

...

 

STA WSYNC

lda #$70

sta COLBK

STA WSYNC

lda #$76

sta COLBK

...

rti

 

Well, I'm not looking at the code & its been months since I did it but I think that is the gist of what I was talking about. I don't think it really applies here since I believe you have plenty of time to change more than one value in a DLI on a scanline.

Link to comment
Share on other sites

here my little code to understand the stuff:

 

p0 = $6200

p1 = $6280

p2 = $6300

p3 = $6380

 

org $4000

 

; clear the player data in memory BEFORE enabling them

; so no gfx trash will be on screen

init lda #255 ; the player dummy data (%11111111)

ldx #0

init0 sta p0,x

sta p2,x

inx

bne init0

;now initialise the hardware

ldx #3

init1 lda #1 ; double sized players

sta 53256,x ; size of the players

lda #15 ; white color

sta 704,x ; color register

dex

bpl init1

lda #48

sta 53248 ; set player0 on xpos = 48

lda #64

sta 53249 ; set player1 on xpos = 64

lda #$60

sta 54279 ;pmbase i could be wrong here...

lda #3 ; player/missle gfx enabled

sta 53277

lda #46 ; dma on

sta 559

 

endloop jmp endloop

rts

 

when we do assembling then you should get 2 white stripes on screen.

 

now replace the endloop routine with this

 

endloop lda #15 ; white color of player0

sta $d012

lda #48

sta 53248

lda $d40b ; vcount = rasterline of the electro beam

cmp #$40 ; wait until 64 rasterlines passed (well...not 100% correct but)

bcc endloop

sta $d40a ; now sync CPU with rasterbeam to avoid flickering

lda 53770 ; get random number 0-255

sta $d01a ; write into background color

lda #128 ; new position of player0

sta 53248

lda #$ff ; yellow color

sta $d012 ; hardware register of color player0

jmp endloop

 

you will get (hopefully...i haven't tested the code) that player0 is

splittet into 2 vertically... this actually is not a DLI but a so called "kernel" routine... display list interrupts (DLIs) can be easily set and can be controlled easily...

 

be creative using DLIs... you can do everything you want with DLIs...

even split the pokey sound registers vertical...

 

 

 

 

 

ps emkay... befor we here restart the DLI discussion... ;) the guy is just starting using DLIs so don't let us "confuse" him with more technical stuff... :)

Link to comment
Share on other sites

Humor (humour?) me ... why would you want / need to change Pokey Registers in a DLI?

 

While playing Samples and DLIs are active, you'll notice crackles. Because the Computer does wait for a WSYNC without doing anything. A clever programmer could create a routine, that plays samples ( a Sample-Step)while a DLI before the WSYNC occurs to reduce the crackles.

 

 

@Nukey Shay

 

The difference is, that splitted registers can simply moved together by Software ;)

Link to comment
Share on other sites

well... check it out... split the sound registeres via dli and you get 8 ones... maybe you ruin the speakers but it definitly works... :)

 

no joking...

 

hve

 

All you're doing thru this is some kind of sampling. Do you really think, the ANTIC is that allmighty, don't you? All that a DLI does is to use some CPU-Time to change registers while the Screen is built on the TV.

You can, due to a softwaretiming, do the same... like on ST.

This wrong thinking exists since it was known, that Players are multiplexable in a DLI. But even the GTIA is able only to display one Player at one Time. Multiplexed Players are even not displayed at one time.... think about it.

Link to comment
Share on other sites

8) emkay... check it out... you don't believe me... do you? ;)

 

it's more like sampling... because i do write into the sound freq register as well... not just the "volume"....

 

i don't know if its useful or not... but...

 

f.e. you can try to do a "real" overscan as well... real means display more than 240 scanlines... i had a scroller done "above" the 1st scanline antic can produce... how? accidently the display began to roll after a too long display list... but correcting this "on the fly" somehow my code managed to stop the rolling and my scroller was above the 1st scanline... (no... i don't mean the $70,$70,$70 area... i mean above the 1st scanline)

 

it was around 1991 as far as i remember... unfortunatly the code was just working on my machine and on my TV set...

 

hve

Link to comment
Share on other sites

@Heaven/TQA

 

>emkay... check it out... you don't believe me... do you? ;)

 

>it's more like sampling... because i do write into the sound freq register as well... not just the "volume"....

 

OK.... Sampling was the wrong word. But you only switch the Soundregisters and get two "Voices" which are not clear. Because they are not clear, due to the fact, that they are not played at one time..

But, you may use that for special Soundeffects...

 

 

>f.e. you can try to do a "real" overscan as well... real means display more than 240 scanlines... i had a scroller done "above" the 1st scanline antic can produce... how? accidently the display began to roll after a too long display list... but correcting this "on the fly" somehow my code managed to stop the rolling and my scroller was above the 1st scanline... (no... i don't mean the $70,$70,$70 area... i mean above the 1st scanline)

 

 

No Problem. In NTSC there are 60Hz. The GTIA produces for PAL a 50Hz screen , so there are two black borders on the top and on the bottom of the screen.. Is the DL to long, the Screen switches to 60Hz, that a PAL TV cannot handle. The Screen rolls and the Borders are gone....

A switch in the right Moment, and on the TV, you'll have an extra "Display". The Line cannot be "killed" due to the fact, that the Scanline is not refreshed on the TV.... until the next VB.

 

>it was around 1991 as far as i remember... unfortunatly the code was just working on my machine and on my TV set...

 

 

No doubts about that.

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