[stella] Poker Solitaire

Subject: [stella] Poker Solitaire
From: "B. Watson" <urchlay@xxxxxxxxxxxxxxxx>
Date: Fri, 16 Nov 2001 18:39:08 -0500 (EST)
Been a while since I posted here... Work's keeping me busy, got a big
backlog of list mail.

I did manage to find some time to write some Stella code over the past
week. I decided the birds/wizard thing wasn't going anywhere, maybe I'll
do something with it later, but I wanted to get completely away from the
`shooting stuff' type of game..

Just recently, somebody taught me to play a card game called Poker
Solitaire... so naturally I had the idea to code it up for the 2600.

The game is pretty simple: you shuffle the cards & turn them over one at
a time, placing each card in a 5x5 grid of cards on the table. The goal is
to get the best 10 poker hands you can get (5 horizontally, 5 vertically).

Complete rules: http://www.solitairecentral.com/rules/psq_rules.html

I use the English scoring system, except that I think a royal flush should
be worth more than a non-royal straight flush, so I score 40 for the royal
and 30 for the non-royal straight flush (though I have yet to actually get
a royal flush in any hand!)

The binary attached to this message is fully playable, but missing a few
important features:

There's no score calculation at all. At the end of the game, when the
score should be displayed, I just show some junk pixels.

No sound. There should at least be bloops & bleeps for audible feedback
when you place a card (or a buzz if you try to place a card on top of an
already placed card)

Joystick movement is a little wonky (try it)

I haven't tested it on real hardware yet.

And maybe the worst problem of all: The entire game only takes up the
right-hand side of the display. I'm drawing 5 cards, using interleaved
players 0 and 1, like so:

0 1 0 1 0

using NUSIZ0=6, NUSIZ1=2, so each card is 8 clocks wide, with 8 blank
clocks between columns.. I can move it over a few pixels to the left,
but centering it will be rough (or impossible) since I don't have
enough RAM left to buffer the sprite data & therefore must use the
time-consuming LDA (zp),Y mode...

The code is kind of rough... I waste a *lot* of ROM by storing 12 bytes
of sprite data per card, rather than storing each suit symbol once and
each number or letter once... and the kernel is bloated too... but I
wanted to get the thing working before I killed myself trying to optimize
it...

When you first start up the game, the deck is being shuffled. I keep
displaying the first 25 cards of the deck while it's happening, which
I think might be the coolest effect I've ever achieved on the 2600 :)
(well, I think it's cool anyway...)

Press the fire button to stop shuffling & start the game. Move the
cursor around with the stick, place cards with the fire button.. at
any time, press Game Reset to reshuffle & start over...

So as usual, asking everyone for their opinion... does it suck? if so,
can it be made to suck less? Does the fact that the display only takes
up half the screen really matter? (this is a matter of taste I guess).

Hopefully I'll get a chance to sort thru the pile of incoming stuff
this weekend, I really want to see Manuel's latest Gunfight build,
if nothing else...

Adios,
Brian

Attachment: pokersol_000a.bin
Description: Binary data

; pokersol.asm

; by B. Watson <atari@xxxxxxxxxxxxxx>

; Idea for a silly game...

; (not yet) Tested on a real Atari 2600
; Tested on z26 v1.46 on a windows machine
; Tested on xstella 1.1 on a linux machine

 processor 6502
 include "vcs.h"

 seg.u data

 org $80

card0ptr ds 50
end_ptrs
tableau ds 25 ; the cards that have been played
stock ds 27 ; the rest of the cards
deck = tableau ; the whole deck (which gets shuffled, then the
               ; first 25 cards get overwritten with the
               ; blank tableau)
current_card ds 1 ; index into stock, points at card being placed
tmp ds 1
tmp2 ds 1
playerpos ds 1 ; 5*y + x (or else $FF for `game not on'
framectr ds 1
card_count ds 1 ; 0 = new game, 25 = end of game
color0 ds 5
random ds 2

 echo *-$80,"bytes of zero page used."

; constants:
RED = $32

 seg code

 org $F000

cartstart
 sei
 cld
 ldx #$ff
 txs
 lda #0
iloop
 sta 0,x
 dex
 bne iloop

initvcs
 lda #55
 sta random
 lda #$AA
 sta random+1
 lda #$FF
 sta playerpos

; initialize deck
 jsr deal_deck

main_loop
 lda #2
 sta VSYNC ; start blanking
 sta WSYNC
 sta WSYNC
 lda #44
 sta TIM64T ; go ahead & set timer
 lda #0
 sta WSYNC
 sta VSYNC ; 3 WSYNC's, then turn off VSYNC

game_calc
 inc framectr

; position players
 sta WSYNC
 repeat 23
 nop
 repend
 sta RESP0
 sta RESP1
 lda #255
 sta COLUP0
 sta COLUP1
 lda #$d0
 sta HMP1
 lda #$40
 sta HMP0
 sta WSYNC
 sta HMOVE
 repeat 12
 nop
 repend
 sta HMCLR

; setup pointers to card sprite data (25 of them!)
;   note to self: saved 50 cycles by swapping roles of X and Y here
;   (I had 2 sta zp,y's, which are actually sta.w, since there's no sta zp,y)
;   there is still an lda zp,y (same deal), but not much I can do about this
;   put it in stelladoc as an example...
 ldy #0
 ldx #0
card_disp
 sty tmp
 lda tableau,y
 tay
 lda lo_bytes,y
 sta card0ptr,x
 inx
 lda hi_bytes,y
 sta card0ptr,x
 inx
 ldy tmp
 iny
 cpy #25
 bne card_disp

; set up card color bytes (1 per row)
 ldx #0
 stx color0
 stx color0+1
 stx color0+2
 stx color0+3
 stx color0+4
cbyte_loop
 lda tableau,x
 cmp #26
 rol color0
 lda tableau+5,x
 cmp #26
 rol color0+1
 lda tableau+10,x
 cmp #26
 rol color0+2
 lda tableau+15,x
 cmp #26
 rol color0+3
 lda tableau+20,x
 cmp #26
 rol color0+4
 inx
 cpx #5
 bne cbyte_loop

 
; blink cursor 
 lda framectr
 and #8 ; blink 8 frames, then don't blink 8 frames
 beq no_blink 
 lda current_card
 cmp #25
 beq no_blink ; dont blink if game is over
 lda playerpos
 asl
 tax
 lda #<no_card
 sta card0ptr,x
 lda #>no_card
 sta card0ptr+1,x

no_blink
 lda framectr
 and #15
 bne no_stick

 lda INPT4
 bmi no_fire
 lda playerpos ; check & see if games is already on ($FF = no)
 bpl place_card
 lda #0 ; player pressed fire during shuffling
 sta playerpos ; so start the game
 sta current_card
 ldx #24
 lda #52 ; blank card
blank_tableau
 sta tableau,x
 dex
 bpl blank_tableau
 bmi no_fire ; always branch

place_card ; player pressed fire while game is on
 ldx current_card
 ldy playerpos
 lda tableau,y ; can't place a card where a card already is
 cmp #52 ; 52 is `no card placed'
 bne no_fire
 lda stock,x
 sta tableau,y
 inc current_card
no_fire

 lda playerpos
 bmi no_stick

; read joystick

check_stick
 lda SWCHA
 asl
 bcs no_right
 inc playerpos
no_right
 asl
 bcs no_left
 dec playerpos
no_left
 asl
 bcs no_down
 tax
 lda playerpos
 adc #5
 sta playerpos
 txa
no_down
 asl
 bcs no_up 
 lda playerpos
 sbc #4 ; subtract 5 (carry always clear)
 sta playerpos
no_up
 lda playerpos
 bpl not_minus
 clc
 adc #25
 sta playerpos
not_minus
 cmp #25
 bcc not_toohigh
 sec
 sbc #25
 sta playerpos
not_toohigh

no_stick

 lda SWCHB
 and #$01
 bne no_reset
 jsr deal_deck ; player pressed game reset
 lda #$FF ; $FF in playerpos means `game not on, so shuffle'
 sta playerpos

no_reset

 lda #0
 sta COLUBK
 sta COLUPF
 sta PF0
 sta PF1
 sta PF2

wait_timer
 lda INTIM
 bne wait_timer ; busy-wait for timer to expire
 sta WSYNC
 sta VBLANK
 sta WSYNC ; wby do I need these 2??
 lda #6
 sta NUSIZ0
 lda #2
 sta NUSIZ1
 sta WSYNC

kernel
 lda #$ff
 sta COLUP0
 ldx #192

 mac cardloop
 lda #0
 sta COLUBK
 lda #%01111110
 sta GRP0
 sta GRP1
 sta WSYNC
 lda #%11111111
 sta GRP0
 sta GRP1
 sta PF0
 sta PF1
 sta PF2
 ldx color0+{1} ; 3
 lda colPF0,x ; +4 = 7
 sta PF0 ; +3 = 11
 lda colPF1,x ; +4 = 15
 sta PF1 ; +3 = 18
 lda colPF2,x ; +4 = 22
 sta PF2 ; +3 = 25

 ldy #11
.cardloop0
 repeat 2
 sta WSYNC ; 0
 lda #0
 sta.w COLUBK
 lda (card0ptr+{1}*10+0),y ; 5
 sta GRP0 ; 3 = 8
 lda (card0ptr+{1}*10+2),y ; 5 = 13
 sta GRP1 ; 3 = 16
 lda (card0ptr+{1}*10+8),y ; 5 = 21
 tax ; 2 = 23
 txs ; 2 = 25
 lda (card0ptr+{1}*10+6),y ; 5 = 30
 tax ; 2 = 32

 nop
 nop
 lda #RED
 sta.w COLUBK ; 42

 lda (card0ptr+{1}*10+4),y ; 5 = 47
 sta GRP0 ; 3 = 50
 stx GRP1 ; 3 = 53
 tsx ; 2 = 55
 stx GRP0 ; 3 = 58
 repend 
 dey ; 2 = 60
 bpl .cardloop0

 sta WSYNC
 lda #%11111111
 sta GRP0
 sta GRP1
 sta PF0
 sta PF1
 sta PF2
 sta WSYNC
 lda #%01111110
 sta GRP0
 sta GRP1
 sta WSYNC
 lda #0
 sta GRP0
 sta GRP1

 sta WSYNC
 iny
 sty GRP0
 sty GRP1
 sta WSYNC
 endm ; end of mac cardloop

 cardloop 0
 cardloop 1
 cardloop 2
 cardloop 3
 cardloop 4

 sta WSYNC
 ldy #40
 lda playerpos
; bmi kill_rest ; this branch is too far!
 bpl k_ok
 jmp kill_rest
k_ok
 lda current_card
 cmp #25
; beq kill_rest ; this branch is too far!
 bne k_ok2
 jmp draw_score
k_ok2
 sta WSYNC

 lda #0
 sta NUSIZ0
 lda #%01111110
 sta GRP0
 sta WSYNC
 lda #%11111111
 sta GRP0
 ldx current_card
 lda stock,x
 tax
 lda lo_bytes,x
 sta tmp
 lda hi_bytes,x
 sta tmp+1
 lda #0
 cpx #26
 ldx #$F0
 bcc last_card_black
 ldx #$c0
last_card_black
 ldy #11
draw_last_card
 repeat 2
 sta WSYNC
 lda #0
 sta COLUBK
 lda (tmp),y
 sta GRP0
 stx PF0
 repeat 10
 nop
 repend
 lda #RED
 sta COLUBK
 repend
 dey
 bpl draw_last_card
 nop
 nop
 nop
 lda #0
 sta COLUBK

 sta WSYNC 
 lda #%11111111
 sta GRP0
 sta WSYNC 
 lda #%01111110
 sta GRP0
 sta WSYNC
 lda #0
 sta GRP0 


 ldy #11
kill_rest
 sta WSYNC
 dey
 bne kill_rest
 jmp end_kernel

draw_score
 sta WSYNC
 lda #12 ; white
 sta COLUPF
 lda #0
 sta COLUBK
 sta PF0
 sta PF2
 lda #<score_string
 sta tmp
 lda #>score_string
 sta tmp+1
 ldy #5
draw_score_loop
 sta WSYNC
 lda #0 ; 2
 sta PF1 ; 3=5
 repeat 13
 nop
 repend
 lda (tmp),y ; 5
 sta PF1
 sta WSYNC
 lda #0
 sta PF1
 repeat 13
 nop
 repend
 lda (tmp),y
 sta PF1
 dey
 bpl draw_score_loop
 iny
 sta WSYNC
 sty COLUPF
 sty COLUBK
 ldy #26
 jmp kill_rest

 echo *-kernel,"bytes of kernel code"
end_kernel
 lda #37
 sta TIM64T

overscan
 lda #2
 sta VBLANK
 
 ldx #$FF
 txs
 lda playerpos
 bpl finish_overscan
 jsr shuffle

finish_overscan
 lda INTIM
 bne finish_overscan
; sta WSYNC

 jmp main_loop

deal_deck
 ldx #0
 ldy #0
deal_loop
 stx deck,y
 iny
 inx
 cpy #52
 bne deal_loop 
 rts

getrandbit
 lda random
 lsr
 lsr
 sbc random
 lsr
 ror random+1
 ror random
; lda random
 rts

getrandbyte
 ldx #8
grloop
 jsr getrandbit
 rol tmp
 dex
 bne grloop
 lda tmp
 rts

; shuffle deck
shuffle
 ldy #50
shuffle_loop
 lda random ; 3
 lsr ; +2 = 5
 lsr ; +2 = 7
 sbc random ; +3 = 10
 lsr ; +2 = 12
 ror random+1 ; +5 = 17
 ror random ; +5 = 17
 bcs noswap ; +3 = 20
 lda deck,y ; +4 = 24 ; if we got a 1 (carry), swap card with the one after it
 ldx deck+1,y ; +4 = 28
 stx deck,y ; +4 = 32
 sta deck+1,y ; +4 = 38
noswap
 dey ; +2 = 40
 bpl shuffle_loop ; +3 = 43
 rts

 echo *-$f000,"bytes of code"

 org $Fc00
cards
spades1
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %10111011
 byte %10111011
 byte %10000011
 byte %11010111
 byte %11101111
spades2
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %10000011
 byte %11011111
 byte %11100111
 byte %10111011
 byte %11000111
spades3
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %10000111
 byte %11111011
 byte %11100111
 byte %10111011
 byte %11000111
spades4
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11111011
 byte %10000011
 byte %10111011
 byte %11011011
 byte %11101011
spades5
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11000111
 byte %10111011
 byte %11100111
 byte %11011111
 byte %11000011
spades6
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11000111
 byte %10111011
 byte %10000111
 byte %10111111
 byte %11000011
spades7
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11011111
 byte %11101111
 byte %11110111
 byte %11111011
 byte %10000011
spades8
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11000111
 byte %10111011
 byte %11000111
 byte %10111011
 byte %11000111
spades9
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %10000111
 byte %11111011
 byte %11000011
 byte %10111011
 byte %11000111
spades10
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %00010011
 byte %10101101
 byte %10101101
 byte %00101101
 byte %10110011
spadesj
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11001111
 byte %10110111
 byte %11110111
 byte %11110111
 byte %11100011
spadesq
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %11111011
 byte %11000111
 byte %10111011
 byte %10111011
 byte %11000111
spadesk
 byte %11000111
 byte %01101101
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111
 byte %11111111
 byte %10110111
 byte %10101111
 byte %10011111
 byte %10101111
 byte %10110111
clubs1
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111
 byte %11111111
 byte %10111011
 byte %10111011
 byte %10000011
 byte %11010111
 byte %11101111
clubs2
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %10000011
 byte %11011111
 byte %11100111
 byte %10111011
 byte %11000111
clubs3
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %10000111
 byte %11111011
 byte %11100111
 byte %10111011
 byte %11000111
clubs4
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11111011
 byte %10000011
 byte %10111011
 byte %11011011
 byte %11101011
clubs5
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11000111
 byte %10111011
 byte %11100111
 byte %11011111
 byte %11000011
clubs6
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11000111
 byte %10111011
 byte %10000111
 byte %10111111
 byte %11000011
clubs7
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11011111
 byte %11101111
 byte %11110111
 byte %11111011
 byte %10000011
clubs8
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11000111
 byte %10111011
 byte %11000111
 byte %10111011
 byte %11000111
clubs9
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %10000111
 byte %11111011
 byte %11000011
 byte %10111011
 byte %11000111
clubs10
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %00010011
 byte %10101101
 byte %10101101
 byte %00101101
 byte %10110011
clubsj
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11001111
 byte %10110111
 byte %11110111
 byte %11110111
 byte %11100011
clubsq
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %11111011
 byte %11000111
 byte %10111011
 byte %10111011
 byte %11000111
clubsk
 byte %11000111
 byte %11101111
 byte %00101001
 byte %00111001
 byte %11000111
 byte %11000111

 byte %11111111
 byte %10110111
 byte %10101111
 byte %10011111
 byte %10101111
 byte %10110111
hearts1
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %10111011
 byte %10111011
 byte %10000011
 byte %11010111
 byte %11101111
hearts2
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %10000011
 byte %11011111
 byte %11100111
 byte %10111011
 byte %11000111
hearts3
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %10000111
 byte %11111011
 byte %11100111
 byte %10111011
 byte %11000111
hearts4
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %11111011
 byte %10000011
 byte %10111011
 byte %11011011
 byte %11101011
hearts5
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %11000111
 byte %10111011
 byte %11100111
 byte %11011111
 byte %11000011
hearts6
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011

 byte %11111111
 byte %11000111
 byte %10111011
 byte %10000111
 byte %10111111
 byte %11000011
hearts7
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %11011111
 byte %11101111
 byte %11110111
 byte %11111011
 byte %10000011
hearts8
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %11000111
 byte %10111011
 byte %11000111
 byte %10111011
 byte %11000111
hearts9
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %10000111
 byte %11111011
 byte %11000011
 byte %10111011
 byte %11000111
hearts10
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %00010011
 byte %10101101
 byte %10101101
 byte %00101101
 byte %10110011
heartsj
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %11001111
 byte %10110111
 byte %11110111
 byte %11110111
 byte %11100011
heartsq
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %11111011
 byte %11000111
 byte %10111011
 byte %10111011
 byte %11000111
heartsk
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %00010001
 byte %10111011


 byte %11111111
 byte %10110111
 byte %10101111
 byte %10011111
 byte %10101111
 byte %10110111
 byte %01111110
diam1
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %10111011
 byte %10111011
 byte %10000011
 byte %11010111
 byte %11101111
diam2
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %10000011
 byte %11011111
 byte %11100111
 byte %10111011
 byte %11000111
diam3
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %10000111
 byte %11111011
 byte %11100111
 byte %10111011
 byte %11000111
diam4
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11111011
 byte %10000011
 byte %10111011
 byte %11011011
 byte %11101011
diam5
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11000111
 byte %10111011
 byte %11100111
 byte %11011111
 byte %11000011
diam6
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11000111
 byte %10111011
 byte %10000111
 byte %10111111
 byte %11000011
diam7
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11011111
 byte %11101111
 byte %11110111
 byte %11111011
 byte %10000011
diam8
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11000111
 byte %10111011
 byte %11000111
 byte %10111011
 byte %11000111
diam9
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %10000111
 byte %11111011
 byte %11000011
 byte %10111011
 byte %11000111
diam10
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %00010011
 byte %10101101
 byte %10101101
 byte %00101101
 byte %10110011
diamj
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11001111
 byte %10110111
 byte %11110111
 byte %11110111
 byte %11100011
diamq
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %11111011
 byte %11000111
 byte %10111011
 byte %10111011
 byte %11000111
diamk
 byte %11101111
 byte %11000111
 byte %10000011
 byte %00000001
 byte %10000011
 byte %11000111
 byte %11101111

 byte %10110111
 byte %10101111
 byte %10011111
 byte %10101111
 byte %10110111
blank_card
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
 byte %11111111
no_card
 repeat 14
 byte 0
 repend

lo_bytes
 byte <spades1, <spades2, <spades3, <spades4, <spades5
 byte <spades6, <spades7, <spades8, <spades9, <spades10
 byte <spadesj, <spadesq, <spadesk
 byte <clubs1, <clubs2, <clubs3, <clubs4, <clubs5
 byte <clubs6, <clubs7, <clubs8, <clubs9, <clubs10
 byte <clubsj, <clubsq, <clubsk
 byte <hearts1, <hearts2, <hearts3, <hearts4, <hearts5
 byte <hearts6, <hearts7, <hearts8, <hearts9, <hearts10
 byte <heartsj, <heartsq, <heartsk
 byte <diam1, <diam2, <diam3, <diam4, <diam5
 byte <diam6, <diam7, <diam8, <diam9, <diam10
 byte <diamj, <diamq, <diamk, <blank_card, <no_card
hi_bytes
 byte >spades1, >spades2, >spades3, >spades4, >spades5
 byte >spades6, >spades7, >spades8, >spades9, >spades10
 byte >spadesj, >spadesq, >spadesk
 byte >clubs1, >clubs2, >clubs3, >clubs4, >clubs5
 byte >clubs6, >clubs7, >clubs8, >clubs9, >clubs10
 byte >clubsj, >clubsq, >clubsk
 byte >hearts1, >hearts2, >hearts3, >hearts4, >hearts5
 byte >hearts6, >hearts7, >hearts8, >hearts9, >hearts10
 byte >heartsj, >heartsq, >heartsk
 byte >diam1, >diam2, >diam3, >diam4, >diam5
 byte >diam6, >diam7, >diam8, >diam9, >diam10
 byte >diamj, >diamq, >diamk, >blank_card, >no_card

; colors:
;

; PF0: %aaaaXXXX  PF1: %bbbbcccc %PF2 %ddddeeee

; a = column 0 ($c = red, $f = black)
; b = column 1 ($3 = red, $f = black)
; c = column 2 ($3 = red, $f = black)
; d = column 4 ($c = red, $f = black)
; e = column 3 ($c = red, $f = black)

colPF0
 repeat 16
 byte $f0
 repend
 repeat 16
 byte $c0
 repend

colPF1
 repeat 4
 byte $ff,$ff,$ff,$ff,$f3,$f3,$f3,$f3,$3f,$3f,$3f,$3f,$33,$33,$33,$33
 repend

colPF2
 repeat 8
 byte $ff,$cf,$fc,$cc
 repend

score_string
 byte %00000001
 byte %00000010
 byte %00000011
 byte %00000100
 byte %00000101

 echo *-cards,"bytes of data"

 org $FFFC
 word $F000
 word $F000


Current Thread