Re: A83: $0D


[Prev][Next][Index][Thread]

Re: A83: $0D



$0D is indeed in hex and = 13 decimal, the only thing that might sound weird now is that it goes to the next suit if it IS = 13 since there are 13 cards per suit....  the solution is simple, remember that computer start counting from 0, so 0 to 12 is 13
try it ! 0 1 2 3 4 5 6 7 8 9 10 11 12.... there !!
 
-Nicolas Gilles
 
PS: What's obvious for some, is not obvious for all...
----- Original Message -----
From: ComAsYuAre@aol.com
To: assembly-83@lists.ticalc.org
Sent: Tuesday, February 06, 2001 22:40
Subject: Re: A83: $0D

$0D is 0D in hex, which IS 13 :-)

Count from 1 to 9, then start at A (10) and move on up to D.


In a message dated 2/6/01 4:38:50 PM Eastern Standard Time,
playnogamz@nls.net writes:


I was reading throught the shuffle routine in Solitare (TI-83 AShell) and
noticed that it compared the current number loaded in a with $0D after
anding A and 00001111b.

Shuffle:
  ld b,4                       ;the number of suits
  xor a                        ;ld a with 0
  ld hl,CARDLIST

CreateListLoop:
  ld (hl),a
  inc hl
  inc a
  ld c,a
  and %00001111                ;don't look at the suit
\THESE TWO LINES
  cp $0D                       ;when low nibble is $D, move to next suit
/THESE TWO LINES
  ld a,c
  jr nz,CreateListLoop
  add a,%00010000              ;move to the next suit (add 1 to high
nibble)
  and %11110000                ;reset the low nibble
  djnz CreateListLoop


What does $0D stand for.  I thought that it stood for 0 but that whould make
16 cards for each suite, and there should only be 13.  Thanks in advance!





----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org

References: