Re: [stella] Euchre back with odd behavior

Subject: Re: [stella] Euchre back with odd behavior
From: "Andrew Davie" <adavie@xxxxxxxxxxxxx>
Date: Sat, 16 Jun 2001 17:47:17 +1000
> StartBid1
>      lda #StageBidding1
>      sta Stage
>      lda Dealer
>      adc #$01
>      and #$03
>      sta Turn
>      adc #MsgNumSouth
>      sta MessageNum
>      lda #StageHold
>      sta Stage
>      rts



Clear the carry flag before doing your addition :)
ie:

    clc                                    ; this one is necessary
    lda Dealer
    adc #1
    and #3
    sta Turn
    clc                                    ; this one might be optional
    adc #MsgNumSouth



Cheers
A

--
 _  _  _| _ _        _| _    * _                               _  ,
(_|| )(_|( (/_\/\/  (_|(_|\/(_(/_                           ,~' L_|\
                                                         ,-'        \
see my Museum of Soviet Calculators at                  (            \
http://www.taswegian.com/MOSCOW/soviet.html              \    __     /
Qb: the latest retro video game!                          L,~'  "\__/
http://www.atari2600.org/qb.html                              @--> v

----- Original Message -----
From: "Erik J. Eid" <eeid@xxxxxxxxx>
To: "Stella Listserv" <stella@xxxxxxxxxxx>
Sent: Saturday, June 16, 2001 1:28 PM
Subject: [stella] Euchre back with odd behavior


> Greetings again!
>
> I've continued work on my Euchre game.  Rather than simply displaying a
few
> cards in your hand and on the table, the game now actually "deals"
> cards.  All you see is your hand plus the card turned up for the proposed
> trump suit.  Also, to ensure a random first deal, I force the player to
> push Reset.  (I hope to have room for a title screen, but for now, there's
> just a game over message.)
>
> I reworked the program to operate in "stages", which indicate what is
going
> on during that frame - shuffling (only once per frame eliminates the
> flicker), dealing (revealing cards), bidding, etc.  I also added the
> ability to display a message in the red section at the bottom of the
screen
> and a "cursor" to select a card from your hand (though you won't see it in
> this version).
>
> I'm now coming up against another problem that I can't get past.  Some
code
> is behaving in a peculiar way.
>
> Once the deal is complete, players are to start bidding.  While I don't
> have bidding set up yet, it starts with the player to the left of the
> dealer, and that player's name (north, east, etc.) should be displayed in
> the message section.  However, the name of the player across from the
> dealer is shown instead.
>
> Here's the critical code:
>
> StartBid1
>      lda #StageBidding1
>      sta Stage
>      lda Dealer
>      adc #$01
>      and #$03
>      sta Turn
>      adc #MsgNumSouth
>      sta MessageNum
>      lda #StageHold
>      sta Stage
>      rts
>
> What this does is set the current stage to the first phase of bidding, set
> the current turn to the player one "above" (meaning, to the left) of the
> dealer, show the message appropriate to that player (since south is the
> zeroth player, adding the turn to south's message number should bring up
> the first bidder's name), and put the program in a hold state.
>
> I used the debugger in PCAE and found something astonishing!  Whatever is
> in the accumulator after the "lda Dealer" statement is increased by two,
> not one, by "adc #$01".  To see this yourself, open up the debugger, find
> address 12D5, click the Here button, go back to the program window (it
> helps not to be in full-screen mode), hit F2 to reset, then click Trace
> repeatedly.  Watch the accumulator.  It will be increased by two.
>
> Am I just misunderstanding how an immediate-mode adc is supposed to work,
> or is there something very wrong here?  (It is interesting to note that
the
> value of memory location 01 - VBLANK - is 2 when this code is executed.)
>
> This oddness occurs under PCAE, Stella, and Z26, so I'm inclined to think
> my code is bad, but I can't see where at the moment.
>
> (The newbie strikes again...)
>


----------------------------------------------------------------------------
----


>
>     .      .     \_ +\_ + o_-/     .   O
>       .            \-_o -=/-   .          .
> .           .        \=//  .
> ---------\_______     ||O        ___.______
> /* Erik Eid */   \____||L/\_____/
> /* eeid@xxxxxxxxx */_______________________


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

Current Thread