Jump to content
IGNORED

How do I reflect the left side playfield onto the right side in Batari


karnov

Recommended Posts

Can I reflect playfield graphics from the left side of the screen to the right side? I fooled around with the playfield registers, but was only able to reverse playfield graphics previously plotted onto the right side. I need to reuse playfield graphics plotted on the left side on the right side to save memory. Thanks for reading everyone, and please ask if you need clarification.

Link to comment
Share on other sites

Can I reflect playfield graphics from the left side of the screen to the right side? I fooled around with the playfield registers, but was only able to reverse playfield graphics previously plotted onto the right side. I need to reuse playfield graphics plotted on the left side on the right side to save memory. Thanks for reading everyone, and please ask if you need clarification.

There are a few options. One, you can use the multisprite kernel, which always uses a reflected PF, but it has other limitations.

 

If using the standard kernel, you can do this by hacking std_kernel.asm. In this file you will see several places with writes to playfield registers in a row, i.e.:

 

lda ...
sta PF1
lda ...
sta PF2
lda ...
sta PF2
lda ...
sta PF1

Perhaps the easiest way would be to change the last two writes to $3F, i.e.:

lda ...
sta PF1
lda ...
sta PF2
lda ...
sta $3F
lda ...
sta $3F

This will prevent the kernel from writing to the right half of the screen and will reflect the left side.

 

You can then use the right-side variables for other purposes with dim, i.e.:

dim myvar1=playfield+2

dim myvar2=playfield+3

dim myvar3=playfield+6

dim myvar4=playfield+7

dim myvar5=playfield+10

dim myvar6=playfield+11

... and so on ...

dim myvar23=playfield+46

dim myvar24=playfield+47

 

The problem with doing the above, however, is that the drawing routines may still attempt to draw there if your X value is >=16, and pfscroll and pfclear will certainly obliterate these variables since they still expect a full width playfield.

Link to comment
Share on other sites

Can I reflect playfield graphics from the left side of the screen to the right side? I fooled around with the playfield registers, but was only able to reverse playfield graphics previously plotted onto the right side. I need to reuse playfield graphics plotted on the left side on the right side to save memory. Thanks for reading everyone, and please ask if you need clarification.

There are a few options. One, you can use the multisprite kernel, which always uses a reflected PF, but it has other limitations.

 

If using the standard kernel, you can do this by hacking std_kernel.asm. In this file you will see several places with writes to playfield registers in a row, i.e.:

 

lda ...
sta PF1
lda ...
sta PF2
lda ...
sta PF2
lda ...
sta PF1

Perhaps the easiest way would be to change the last two writes to $3F, i.e.:

lda ...
sta PF1
lda ...
sta PF2
lda ...
sta $3F
lda ...
sta $3F

This will prevent the kernel from writing to the right half of the screen and will reflect the left side.

 

You can then use the right-side variables for other purposes with dim, i.e.:

dim myvar1=playfield+2

dim myvar2=playfield+3

dim myvar3=playfield+6

dim myvar4=playfield+7

dim myvar5=playfield+10

dim myvar6=playfield+11

... and so on ...

dim myvar23=playfield+46

dim myvar24=playfield+47

 

The problem with doing the above, however, is that the drawing routines may still attempt to draw there if your X value is >=16, and pfscroll and pfclear will certainly obliterate these variables since they still expect a full width playfield.

 

Thanks! I am not very comfortable with 6502 assembly yet. What do I need to put after the ldas (ex. lda...)? Also, I am using the first version of batari.

Link to comment
Share on other sites

Thanks! I am not very comfortable with 6502 assembly yet. What do I need to put after the ldas (ex. lda...)? Also, I am using the first version of batari.

What I meant with the the lda ... is that these lines can remain unchanged.

 

Also, I think that in some places, the kernel might use ldy and sty instead of lda and sta. These also need to be changed in the same manner.

Link to comment
Share on other sites

Thanks! I am not very comfortable with 6502 assembly yet. What do I need to put after the ldas (ex. lda...)? Also, I am using the first version of batari.

I was going to ask you which version you're using, because I think I can modify some of the includes files for you, but I'd need to modify the correct versions. :)

 

Um, when you say you're using the first version, do you mean 0.1???

 

You would just leave the lda lines alone, and change the second two sta lines, so that they store the data in some safely-unused location. But another alternative would be to change the lda/sta pairs to something else that just wastes the appropriate amount of time without doing anything. The two pairs of lda/sta take 14 cycles, so you can use sleep 14. That actually saves 1 byte of ROM. :)

 

Here's the code as it would be changed. For bB versions 0.1 or 0.2, save a backup of 2600basic.asm first, then find these lines, put this change in, and save it:

 

;missile/ball? 
 lda playfield,y;4
 sta PF1;3
 lda playfield+1,y;4
 sta PF2;3
; lda playfield+3,y;4 <-- add ";" at start of line
; sta PF1; 3 too early? <-- add ";" at start of line
; lda playfield+2,y;4 <-- add ";" at start of line
; sta PF2;3 <-- add ";" at start of line
 sleep 14; <-- add this line

 

For bB versions 0.3 and up, you would save a backup of std_kernel.asm first, then make those same changes to it.

 

Michael

Edited by SeaGtGruff
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...