Jump to content
  • entries
    656
  • comments
    2,683
  • views
    897,070

Paddle reading is done


SpiceWare

1,008 views

I've redone the dragon routines so only 1 fireball is visible while the dragon's onscreen. I've not yet written the "dragon not there" code, but that should be pretty easy.

 

With this change I was able to keep the dragon routine with 2 double wide sprites at single line resolution w/single line shifting and still squeeze in enough time to read 2 paddles every other scanline on each frame. The following macros are used to read the paddles. The value of Paddles2Read is either 0 or 1. Due to timing issues there was not always enough cycles to read 2 paddles at the same time, so there's a macro to read the even, odd and both.

 

	   MAC READ_PADDLE_1_OR_3
   ldx Paddles2Read; 13-14 cycles
   lda INPT0,x
   bpl .save
   .byte $2c
.save  sty Paddle1,x
   ENDM

   MAC READ_PADDLE_2_OR_4
   ldx Paddles2Read; 13-14 cycles
   lda INPT2,x
   bpl .save
   .byte $2c
.save  sty Paddle3,x
   ENDM

   MAC READ_TWO_PADDLES
   ldx Paddles2Read; 21-23 cycles
   lda INPT0,x
   bpl .save1
   .byte $2c
.save1 sty Paddle1,x
   lda INPT2,x
   bpl .save2
   .byte $2c
.save2 sty Paddle3,x
   ENDM
 

 

 

If you'd like to test out the paddles, START the game. The first 2 digits of the score line will be the current paddle's reading. the 3rd digit will be which paddle's reading is shown. Hit RESET to change the paddle being shown. Paddle readings range from 00 - 4A, which covers the 75 distinct shield positions possible.

 

 

BINmm.bin

 

SourceMedieval_Mayhem.zip

6 Comments


Recommended Comments

Hmm - in rereading this, I see the macros should really be called

 

READ_PADDLE_1_OR_2

 

and

 

READ_PADDLE_3_or_4

 

I'll have to fix that tonight :ponder:

Link to comment

If you're only reading paddles in the middle part of the screen, I would think it would be advantageous to (1) read them every line, to get better resolution, but (2) use separate code for reading paddles 1/2 and 3/4. The mid-screen kernel isn't a whole lot of code; if you're using a bank-switched cart anyway, I would think it should be easy enough to use two copies of the mid-screen kernel (one for paddles 1-2 and the other for 3-4) and then invoke them on alternate frames.

 

If your kernel is unrolled 2x, reading paddles every scan line is simple. Do half the scan lines as you presently do. On the other half, do:

  lda INPT0 ; or INPT2
 lsr
 ora INPT1 ; or INPT3
 eor paddleLSB
 sta paddleLSB

That's 14 cycles, a little faster than the 18 cycles you're using now. To add the extra bit to your paddle readings once the kernel is done is a tiny bit tricky. Before the frame, set paddleLSB to 0 or $C0 (experiment to find out which).

  asl paddleLSB
 rol
 adc paddle1 ; or paddle3; Toggle LSB if carry set
 lsr
 rol paddle1
 asl paddleLSB
 rol
 adc paddle0 ; or paddle2; Toggle LSB if carry set
 lsr
 rol paddle0

Link to comment

The paddles are being read every other line starting the middle of the top castles and ending in the middle of the bottom castles. Normally there'd be plenty of time to read the paddles in just the middle part of the screen - but the time becomes constrained when the dragon comes into play. I don't want to read the paddles different when the dragon is flying as the users would be positioning their shields in anticipation of the fireball being launched.

Link to comment

This is too cool... keep up the work, this is really shaping out. Don't give up on this, and I will buy this the day it gets released in the AA store!

Link to comment

Don't worry - I plan to finish this! It is, however, taking longer than I expected due to constraints of the system. I had planned to get the paddles moving the shields yesterday, but instead made the dragon routines run in 2 banks so there's more room for animation frames. Basically the 4 banks are set up like this:

 

Bank 1 - Init System, Dragon Animation, Lower Castles

Bank 2 - all Main Menu routines

Bank 3 - Overscan (fireball processing), Vertical Blank (shield processing)

Bank 4 - Scores, Upper Castles, no-dragon, Dragon Animation

 

The code drawing the castles had to be "unrolled" in order to have cycles for colored kings, 3 fireballs and shields, so they take up most of bank 1 and 4.

 

I currently have this free:

RAM - $b (11 bytes)

Bank 1 - $492 (1170) (not counting "dummy" dragon image)

Bank 2 - $2a8 (680)

Bank 3 - $700 (1792)

Bank 4 - $2a3 (675) (not counting "dummy" dragon image)

 

Of course Banks 1 and 4 will fill up once Nathan finishes the dragon :ponder:

Link to comment
Guest
Add a comment...

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