Re: [stella] Help (Timing problems?)

Subject: Re: [stella] Help (Timing problems?)
From: Wade Brown <wbrown@xxxxxxxxxxxxx>
Date: Thu, 09 Aug 2001 21:18:07 -0400
First off, thanks to everyone who helped correct/optimize my code - I look to post something more functional soon.

Could someone please explain bit.w's functionality?  I have a rather lame 6502 instruction set ref (HTML page) which is
for 7800 and does not show opcodes, among other things...

Maybe someone out there has a link to a better opcode ref - If so I (and the list, no doubt) would sure appreciate hearing about it.

Also, I assume the reason the .byte $2c opcode is being used is because the opcode is undocumented (or maybe just un-supported by DASM?) If so, anyone out there know of any hacks to DASM to enable this and other un-supported 6507 mnemonics?

BTW, Thomas Jentzsch provided the following code in response to my question RE: better boundary detection - it is from this that
I derive my questions (full source code further down in this mail):

>>    bcc .inXBounds
>>    lda #RIGHT_BOUND
>>    .byte $2c       ;       opcode for bit.w, this hides the next instruction                 <-- I don't understand? (Wade)
>>.outOfLeftBound:
>>    lda #LEFT_BOUND
>>    sta Player1X
>>.inXBounds:

Thanks,
Wade

At 09:23 AM Tuesday 7/31/2001, you wrote:
Wade Brown wrote:
> I am working on a "shell" that I can use to flesh out some ideas I have -
> the idea being to have basic semi-reusable functions such as: b/w color
> selection, screen saver timer, and score digits.

That's a good idea, if you want to start programming the 2600. Later on, you will find, that often you need more specialized or optimized code.


> BTW, I was trying to get a fairly optimal way to read diagonals from the
> joystick - anyone out there see how I can improve this approach or has a
> different take, I would really like to see...

The code below is a bit more compact than yours:

; check joystick:
    lda SWCHA
    asl
    bcc .noRight
    inc Player1X
    bcs .withJoy    ;3      always taken branch, saves 1 byte compared to jmp
.noRight:
    asl
    bcc .noLeft
    inc Player1X
    bcs .withJoy    ;3      always taken branch, saves 1 byte compared to jmp
.noLeft:
    asl
    bcc .noDown
    ...
    bcs .withJoy    ;3      always taken branch, saves 1 byte compared to jmp
.noDown:
    asl
    bcc .noJoy
    ...
.withJoy:
    ldy #0          ;       joystick moved
    sty SaverTimer
.noJoy:


> I would especially appreciate any help in the
> area of boundary detection (i.e detecting when the player/enemy is at the
> edge of the screen).

Here is a slightly better solution:

; check x-bounds:
; I LOVE to use constants, because that makes the code more readable (for me:) and I can much easier change the parameters
LEFT_BOUND      =  20
RIGHT_BOUND     = 140

    lda Player1X
    cmp #LEFT_BOUND
    bcc .outOfLeftBound
    cmp #RIGHT_BOUND+1   
    bcc .inXBounds
    lda #RIGHT_BOUND
    .byte $2c       ;       opcode for bit.w, this hides the next instruction
.outOfLeftBound:
    lda #LEFT_BOUND
    sta Player1X
.inXBounds:

You could also combine the joystick and boundary routines. This might give you more optimal solutions. But that's mixing two different basic functions and doesn't fit into your concept.

Have fun!
Thomas

BTW: I don't think a screensaver mode is necessary any more. And it "wastes" a lot of valuable space.
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |


______________________________________________________________________________
Jetzt und nur hier Ihr original PREMIERE WORLD SportPaket
plus 100 Euro ExtraPrämie: http://premiere.web.de


-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

Wade Brown - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/

Current Thread