Compare commits
No commits in common. "main" and "v1" have entirely different histories.
|
@ -18,4 +18,3 @@ wave
|
|||
*.wav
|
||||
*.mp4
|
||||
scratch
|
||||
.kodiak.dat
|
||||
|
|
BIN
buttons.chr
BIN
buttons.chr
Binary file not shown.
23
cards.tal
23
cards.tal
|
@ -42,18 +42,17 @@
|
|||
,set-sprite/layer LDR ORA .Screen/sprite DEOk DEOk DEO JMP2r
|
||||
|
||||
@draw-background ( -> )
|
||||
#01 .Screen/auto DEO
|
||||
#0000 .Screen/y DEO2
|
||||
#f2 .Screen/auto DEO
|
||||
;tiles #0200 ADD2 .Screen/addr DEO2
|
||||
.height LDZ2 #03 SFT2 #0000 &yloop
|
||||
#0080 .Screen/x DEO2
|
||||
draw-background/twice
|
||||
#0000 .Screen/x DEO2
|
||||
.width LDZ2 #03 SFT2 #0000 &xloop
|
||||
#81 .Screen/sprite DEO
|
||||
INC2 GTH2k ?&xloop
|
||||
POP2 POP2
|
||||
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
|
||||
INC2 GTH2k ?&yloop
|
||||
POP2 POP2 JMP2r
|
||||
&twice
|
||||
#0000 .Screen/y DEO2
|
||||
#81 .Screen/sprite
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEOk
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEOk
|
||||
DEOk DEOk DEOk DEOk DEOk DEOk DEOk DEO JMP2r
|
||||
|
||||
@draw-spot-down ( -> )
|
||||
#16 .Screen/auto DEO ( ; draw 2 tiles, increment x and addr )
|
||||
|
@ -160,6 +159,10 @@
|
|||
( - byte 3: x position )
|
||||
( - byte 4: y position )
|
||||
|
||||
@cursor 80c0 e0f0 f8e0 1000
|
||||
( @cursox 7f3f 1f0f 071f efff )
|
||||
@blank 0000 0000 0000 0000
|
||||
|
||||
( @rng &x $2 &y $2 )
|
||||
@rng-x $2
|
||||
@rng-y $2
|
||||
|
|
BIN
kodiak.rom
BIN
kodiak.rom
Binary file not shown.
419
kodiak.tal
419
kodiak.tal
|
@ -1,6 +1,8 @@
|
|||
( kodiak.tal )
|
||||
|
||||
( TODO )
|
||||
( * display message on win )
|
||||
( * make bear react to moving cards )
|
||||
( * buttons, stock flash when clicked )
|
||||
( * save game file? stats? )
|
||||
( * card sounds? )
|
||||
|
@ -33,7 +35,7 @@
|
|||
( - #6c queen of hearts, face down )
|
||||
( - #93 three of diamonds, held )
|
||||
|
||||
( zero page - currently using 254 of 256 bytes )
|
||||
( zero page - currently using 232 of 256 bytes )
|
||||
|0000
|
||||
@stock $34 ( draw pile - 52 bytes, 24 bytes at start )
|
||||
@waste $18 ( face up pile - 24 bytes )
|
||||
|
@ -60,12 +62,6 @@
|
|||
@about $1 ( is about screen visible? 01 start, ff resume )
|
||||
@audio [ $1 ( is audio enabled? )
|
||||
&pos $2 ] ( position in music )
|
||||
@easy $1 ( true: draw 1 card false: draw 3 cards )
|
||||
@width $2 ( screen width )
|
||||
@height $2 ( screen height )
|
||||
@seconds $1 ( when to count time )
|
||||
@tick $1 ( already counted? )
|
||||
( 256 bytes )
|
||||
|
||||
|0100
|
||||
( metadata )
|
||||
|
@ -76,8 +72,9 @@
|
|||
#8d12 .System/g DEO2
|
||||
#4d12 .System/b DEO2
|
||||
|
||||
load-scores
|
||||
init-screen
|
||||
( 256x192 )
|
||||
#0100 .Screen/w DEO2
|
||||
#00c0 .Screen/h DEO2
|
||||
|
||||
( set up vectors )
|
||||
;on-mouse .Mouse/vect DEO2
|
||||
|
@ -94,9 +91,6 @@
|
|||
#0231 #0580 ;triangle #0004 #64 .Audio3 setup-audio
|
||||
#011f #00b0 ;noise #0200 #44 .Audio4 setup-audio
|
||||
|
||||
.DateTime/sec DEI .seconds STZ
|
||||
#00 .tick STZ
|
||||
|
||||
start-audio
|
||||
|
||||
( display about window when first starting )
|
||||
|
@ -106,58 +100,17 @@
|
|||
@metadata 00
|
||||
( title ) "kodiak 0a
|
||||
( details ) &details "klondike 20 "solitaire 20 "game 0a
|
||||
( author ) "by 20 "d6 0a
|
||||
( version ) "version 20 "4 0a
|
||||
( date ) "03 20 "sep 20 "2024 00
|
||||
01 ( 1 extended field )
|
||||
( icon ) 83 =icon-24
|
||||
( author ) "by 20 "d_m 0a
|
||||
( version ) "version 20 "0 0a
|
||||
( date ) "5 20 "aug 20 2024 00
|
||||
00
|
||||
|
||||
@score-file ".kodiak.dat 00
|
||||
|
||||
@score-data $a
|
||||
|
||||
@save-scores ( -> )
|
||||
LIT2r =score-data
|
||||
LIT2 "ko STH2kr STA2 INC2r INC2r
|
||||
;draw-scores/games LDA2 STH2kr STA2 INC2r INC2r
|
||||
;draw-scores/wins LDA2 STH2kr STA2 INC2r INC2r
|
||||
;draw-scores/time LDA2 STH2kr STA2 INC2r INC2r
|
||||
.easy LDZ #01 AND #00 STH2r STA2
|
||||
|
||||
;score-file .File1/name DEO2
|
||||
#000a .File1/len DEO2
|
||||
;score-data .File1/w DEO2
|
||||
JMP2r
|
||||
|
||||
@load-scores ( -> )
|
||||
;score-file .File1/name DEO2
|
||||
#000a .File1/len DEO2
|
||||
;score-data .File1/r DEO2
|
||||
|
||||
( dat file should be exactly 10 bytes )
|
||||
.File1/ok DEI2 #000a NEQ2 ?&invalid
|
||||
|
||||
( first two bytes must be "ko" )
|
||||
;score-data LDA2 LIT2 "ko NEQ2 ?&invalid
|
||||
|
||||
( next 6 bytes contains 3 shorts )
|
||||
;score-data INC2 INC2
|
||||
LDA2k ;draw-scores/games STA2 INC2 INC2
|
||||
LDA2k ;draw-scores/wins STA2 INC2 INC2
|
||||
LDA2k ;draw-scores/time STA2 INC2 INC2
|
||||
|
||||
( next byte contains easy/hard bit )
|
||||
LDA #01 AND .easy STZ
|
||||
|
||||
( last byte ignored, for now )
|
||||
JMP2r
|
||||
|
||||
&invalid
|
||||
#0000 ;draw-scores/games STA2
|
||||
#0000 ;draw-scores/wins STA2
|
||||
#0000 ;draw-scores/time STA2
|
||||
#00 .easy STZ
|
||||
JMP2r
|
||||
@icon-24x24
|
||||
00 00 03 02 00 01 01 01 03 07 07 07 03 03 06 06
|
||||
00 00 00 00 00 c3 c3 c3 00 81 81 ff ff ff bd bd
|
||||
00 00 c0 40 00 80 80 8e c0 e0 e0 e0 c0 c0 60 6e
|
||||
00 00 00 00 00 00 00 00 07 07 07 03 03 01 00 00
|
||||
( tbc... )
|
||||
|
||||
@setup-audio ( adsr* sample* slen* dur* vol^ dev^ -> )
|
||||
STHk #0e ORA DEO ( [dev^] ; <-vol )
|
||||
|
@ -167,13 +120,6 @@
|
|||
STHr #08 ORA DEO2 ( ; <-adsr )
|
||||
JMP2r
|
||||
|
||||
@inc-games ( -> )
|
||||
;draw-scores/games LDA2k INC2 SWP2 STA2 JMP2r
|
||||
|
||||
@restart
|
||||
is-game-won ?{ inc-games save-scores }
|
||||
( >> )
|
||||
|
||||
@reset
|
||||
init-rng-from-datetime
|
||||
init-stock
|
||||
|
@ -194,25 +140,6 @@
|
|||
.about LDZ ?draw-about
|
||||
draw !auto-move
|
||||
|
||||
@init-screen ( -> )
|
||||
( our target resolution is 256x192. )
|
||||
( )
|
||||
( if the emulator's screen is more than twice that in )
|
||||
( either dimension we'll request a resize to 256x192. )
|
||||
( )
|
||||
( this will faciliate zooming, which is better for )
|
||||
( high resolution screens. )
|
||||
.Screen/w DEI2 #0200 LTH2
|
||||
.Screen/h DEI2 #0180 LTH2 AND ?&save
|
||||
|
||||
( resize to 256x192 )
|
||||
#0100 .Screen/w DEO2 #00c0 .Screen/h DEO2
|
||||
|
||||
( save screen dimensions for future use )
|
||||
&save
|
||||
.Screen/w DEI2 .width STZ2
|
||||
.Screen/h DEI2 .height STZ2 JMP2r
|
||||
|
||||
@clear-fg ( -> )
|
||||
#0000 .Screen/x DEO2
|
||||
#0000 .Screen/y DEO2
|
||||
|
@ -220,10 +147,10 @@
|
|||
JMP2r
|
||||
|
||||
@quit ( -> brk )
|
||||
is-game-won ?{ inc-games } save-scores #010f DEO BRK
|
||||
#010f DEO BRK ( TODO: save game? save stats? )
|
||||
|
||||
@dump-byte ( byte^ -- )
|
||||
DUP #04 SFT /hex #0f AND ( >> )
|
||||
DUP #04 SFT ,&hex JSR #0f AND ,&hex JMP
|
||||
&hex #30 ADD DUP #39 GTH #27 MUL ADD .Console/w DEO
|
||||
JMP2r
|
||||
|
||||
|
@ -276,17 +203,17 @@
|
|||
|
||||
@draw ( -> )
|
||||
draw-background
|
||||
draw-scores
|
||||
draw-buttons
|
||||
draw-decorations
|
||||
draw-stock
|
||||
draw-waste
|
||||
draw-foundation
|
||||
draw-tableau
|
||||
!draw-curr-mouse
|
||||
draw-curr-mouse
|
||||
JMP2r
|
||||
|
||||
@initialize ( start^ count^ -> )
|
||||
OVR ADD STH STH #00 ( 0^ [lim=start+count^ start^] )
|
||||
OVR ADD SWP STH2 #00 ( 0^ [lim=start+count^ start^] )
|
||||
&loop DUP STHkr STZ INCr GTHkr STHr ?&loop ( 0^ [lim^ pos^] )
|
||||
POP POP2r JMP2r ( )
|
||||
|
||||
|
@ -391,7 +318,9 @@
|
|||
#0030 .Screen/x DEO2 #00a8 .Screen/y DEO2 #14 draw-horiz
|
||||
|
||||
#0028 .Screen/x DEO2 #0018 .Screen/y DEO2 #12 draw-vert
|
||||
#00d0 .Screen/x DEO2 #0018 .Screen/y DEO2 #12 !draw-vert
|
||||
#00d0 .Screen/x DEO2 #0018 .Screen/y DEO2 #12 draw-vert
|
||||
|
||||
JMP2r
|
||||
|
||||
@draw-logo ( -> )
|
||||
#0054 .Screen/x DEO2
|
||||
|
@ -401,19 +330,12 @@
|
|||
#80 .Screen/sprite DEOk DEO
|
||||
JMP2r
|
||||
|
||||
( @draw-face ( x* y* addr* -> )
|
||||
@draw-face ( x* y* addr* -> )
|
||||
.Screen/addr DEO2
|
||||
.Screen/y DEO2
|
||||
.Screen/x DEO2
|
||||
#16 .Screen/auto DEO
|
||||
#80 .Screen/sprite DEOk DEO JMP2r )
|
||||
|
||||
@draw-mouth ( x* y* addr* -> )
|
||||
#0020 ADD2 .Screen/addr DEO2
|
||||
#0008 ADD2 .Screen/y DEO2
|
||||
.Screen/x DEO2
|
||||
#16 .Screen/auto DEO
|
||||
#80 .Screen/sprite DEO JMP2r
|
||||
#80 .Screen/sprite DEOk DEO JMP2r
|
||||
|
||||
@draw-about-content ( -> )
|
||||
|
||||
|
@ -425,10 +347,10 @@
|
|||
#0078 #0048 #3b draw-xyc
|
||||
|
||||
#0060 #0038 #80 draw-bear
|
||||
#0060 #0038 ;sprites #00c0 ADD2 draw-mouth
|
||||
#0060 #0038 ;sprites #00c0 ADD2 draw-face
|
||||
|
||||
#00a8 #0038 #90 draw-bear
|
||||
#0090 #0038 ;sprites #0100 ADD2 draw-mouth
|
||||
#0090 #0038 ;sprites #0100 ADD2 draw-face
|
||||
|
||||
#0038 #0070 ;line1 print-str
|
||||
#0040 #0078 ;line2 print-str
|
||||
|
@ -436,11 +358,11 @@
|
|||
|
||||
#0070 #0094 resume-button-addr draw-button
|
||||
|
||||
JMP2r
|
||||
POP2 POP2 JMP2r
|
||||
|
||||
@line1 "klondike 20 "solitaire 00
|
||||
@line2 "version 20 "4 20 "by 20 "d6 00
|
||||
@line3 "september 20 "3 20 "2024 00
|
||||
@line2 "version 20 "1 20 "by 20 "d_m 00
|
||||
@line3 "august 20 "6 20 "2024 00
|
||||
|
||||
@print-str ( x* y* s* -> )
|
||||
STH2 .Screen/y DEO2 ( x* [s*] )
|
||||
|
@ -450,18 +372,6 @@
|
|||
LDAk load-ch #00 .Screen/sprite DEO ( s* )
|
||||
INC2 !&loop ( s+1* )
|
||||
|
||||
@print-dec ( x* y* n* -> )
|
||||
#01 ,pr-digit/a STR
|
||||
STH2 .Screen/y DEO2 .Screen/x DEO2
|
||||
#01 .Screen/auto DEO
|
||||
STH2r #2710 pr-digit #03e8 pr-digit #0064 pr-digit #000a pr-digit !pr-digit/emit
|
||||
|
||||
@pr-digit ( n* d* -> n%d* )
|
||||
DIV2k STH2k MUL2 SUB2 STH2r
|
||||
DUP2 #0000 EQU2 LIT [ &a 01 ] AND ?&leading-zero
|
||||
&emit #00 ,&a STR NIP LIT "0 ADD load-ch #00 .Screen/sprite DEO JMP2r
|
||||
&leading-zero POP2 #20 load-ch #00 .Screen/sprite DEO JMP2r
|
||||
|
||||
@load-ch ( c^ -> )
|
||||
#00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2 JMP2r
|
||||
|
||||
|
@ -493,63 +403,22 @@
|
|||
#8a .Screen/sprite DEO JMP2r
|
||||
|
||||
@restart-button-addr ( -> addr* )
|
||||
is-game-won ?&won ;restart-button JMP2r
|
||||
game-won ?&won ;restart-button JMP2r
|
||||
&won ;new-game-button JMP2r
|
||||
|
||||
@audio-button-addr ( -> addr* )
|
||||
.audio LDZ ?&on ;audio-off-button JMP2r
|
||||
&on ;audio-on-button JMP2r
|
||||
|
||||
@difficulty-button-addr ( -> addr* )
|
||||
.easy LDZ ?&easy ;hard-button JMP2r
|
||||
&easy ;easy-button JMP2r
|
||||
|
||||
@draw-scores ( -> )
|
||||
.width LDZ2 #002c SUB2 #0029 ;text/games print-str
|
||||
.width LDZ2 #002c SUB2 #0032 LIT2 [ &games $2 ] print-dec
|
||||
.width LDZ2 #002c SUB2 #0041 ;text/wins print-str
|
||||
.width LDZ2 #002c SUB2 #004a LIT2 [ &wins $2 ] print-dec
|
||||
.width LDZ2 #002c SUB2 #0059 ;text/time print-str
|
||||
.width LDZ2 #002c SUB2 #0062 LIT2 [ &time $2 ] print-dec
|
||||
@draw-buttons ( -> )
|
||||
#0008 #00b4 restart-button-addr draw-button
|
||||
#0030 #00b4 ;quit-button draw-button
|
||||
#0058 #00b4 audio-button-addr draw-button
|
||||
#0080 #00b4 ;about-button draw-button
|
||||
JMP2r
|
||||
|
||||
@text [ &n "12345 00 &games "games 00 &wins 20 "wins 00 &time 20 "time 00 ]
|
||||
|
||||
@draw-buttons ( -> )
|
||||
.height LDZ2 #000c SUB2
|
||||
#0008 OVR2 restart-button-addr draw-button
|
||||
#0030 OVR2 ;quit-button draw-button
|
||||
#0058 OVR2 audio-button-addr draw-button
|
||||
#0080 OVR2 ;about-button draw-button
|
||||
#00a8 SWP2 difficulty-button-addr !draw-button
|
||||
|
||||
@draw-bear-smile ( -> )
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 ;sprites #00c0 ADD2 !draw-mouth
|
||||
|
||||
@draw-bear-oh ( -> )
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 ;sprites #0100 ADD2 !draw-mouth
|
||||
|
||||
@draw-you-win ( -> )
|
||||
|
||||
draw-bear-smile
|
||||
|
||||
#0048 .Screen/x DEO2
|
||||
#c6 .Screen/auto DEO
|
||||
#8f #0008 draw-you-win/draw
|
||||
#80 #0020 draw-you-win/draw
|
||||
#85 #0038 draw-you-win/draw
|
||||
#8a #0050 draw-you-win/draw
|
||||
#85 #0068 draw-you-win/draw
|
||||
#80 #0080 draw-you-win/draw
|
||||
#8f #0098 !draw-you-win/draw
|
||||
|
||||
&draw ( tint^ y* -> )
|
||||
.Screen/y DEO2 ;you-win .Screen/addr DEO2
|
||||
.Screen/sprite DEOk DEO JMP2r
|
||||
|
||||
@draw-decorations ( -> )
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 #80 draw-bear
|
||||
is-game-won ?draw-you-win JMP2r
|
||||
#00e8 #0098 #80 !draw-bear
|
||||
|
||||
@draw-stock ( -> )
|
||||
.stock LDZk #00 EQU ?&empty ( stock^ )
|
||||
|
@ -605,7 +474,7 @@
|
|||
|
||||
@column-y ( col^ -> y* )
|
||||
bot-column DUP #13 find-top SWP SUB
|
||||
#00 SWP #30 SFT2 #0024 ADD2 JMP2r
|
||||
#00 SWP #0008 MUL2 #0024 ADD2 JMP2r
|
||||
|
||||
@draw-column ( idx^ -> )
|
||||
DUP column-x ,&x STR2 ( idx^ ; x<-32+24*idx )
|
||||
|
@ -622,7 +491,7 @@
|
|||
&done POP POP2 JMP2r ( )
|
||||
|
||||
@maybe-draw-c ( card^ -> )
|
||||
DUP ?{ POP !draw-spot-down } ( >> )
|
||||
DUP ?{ POP !draw-spot-down } !draw-c
|
||||
|
||||
( assumes x/y already set )
|
||||
@draw-c ( card^ -> )
|
||||
|
@ -686,10 +555,10 @@
|
|||
.move/y1 LDZ2 .move/y0 LDZ2 !scale
|
||||
|
||||
@max ( x* y* -> max* )
|
||||
GTH2k [ JMP SWP2 POP2 ] JMP2r
|
||||
GTH2k JMP SWP2 POP2 JMP2r
|
||||
|
||||
@dist ( a* b* -> |a-b|* )
|
||||
GTH2k [ JMP SWP2 SUB2 ] JMP2r
|
||||
GTH2k JMP SWP2 SUB2 JMP2r
|
||||
|
||||
@move-duration ( -> duration* )
|
||||
.move/x1 LDZ2 .move/x0 LDZ2 dist ( dx* )
|
||||
|
@ -761,15 +630,8 @@
|
|||
@on-audio ( -> brk )
|
||||
.audio LDZ ?{ BRK } play-audio BRK
|
||||
|
||||
@update-time ( -> )
|
||||
.DateTime/sec DEI .seconds LDZ EQU STHk
|
||||
.tick LDZ AND ?{ STHr #00 EQU .tick STZ JMP2r }
|
||||
;draw-scores/time LDA2k INC2 SWP2 STA2
|
||||
#00 .tick STZ !draw
|
||||
|
||||
@on-refresh ( -> brk )
|
||||
update-time
|
||||
#00 .move/card LDZ EQU ?{ update-move }
|
||||
.move/card LDZ #00 EQU ?{ update-move }
|
||||
on-refresh-bear ( ; possibly refresh bear )
|
||||
.frame LDZk INC SWP STZ ( ; increment frame counter )
|
||||
BRK
|
||||
|
@ -779,7 +641,7 @@
|
|||
DUP #e8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
||||
DUP #f0 NEQ ?{ POP ;sprites #0080 ADD2 JMP2r }
|
||||
DUP #f8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
||||
DUP ?{ POP ;sprites JMP2r }
|
||||
DUP #00 NEQ ?{ POP ;sprites JMP2r }
|
||||
POP #0000 JMP2r
|
||||
|
||||
@draw-bear-eyes ( addr* x* y* -> )
|
||||
|
@ -796,9 +658,13 @@
|
|||
|
||||
@on-refresh-bear ( -> )
|
||||
.about LDZ ?on-refresh-about-bears
|
||||
#00 .dragging LDZ EQU ?{ draw-bear-oh }
|
||||
load-bear-frame ORAk ?{ POP2 JMP2r }
|
||||
.width LDZ2 #0018 SUB2 .height LDZ2 #0028 SUB2 !draw-bear-eyes
|
||||
load-bear-frame ORAk ?&update POP2 JMP2r
|
||||
&update .Screen/addr DEO2 ( ; s/addr<-addr )
|
||||
#0098 .Screen/y DEO2 ( ; s/x<-0x98 )
|
||||
#00e8 .Screen/x DEO2 ( ; s/y<-0xe8 )
|
||||
#16 .Screen/auto DEO ( ; draw 2 tiles, inc addr and y )
|
||||
#80 .Screen/sprite DEO ( ; draw it! )
|
||||
JMP2r
|
||||
|
||||
@on-mouse ( -> brk )
|
||||
on-move
|
||||
|
@ -811,7 +677,6 @@
|
|||
@on-move ( -> )
|
||||
.Mouse/x DEI2 .prev/mouse-x LDZ2 NEQ2 ?draw-mouse
|
||||
.Mouse/y DEI2 .prev/mouse-y LDZ2 NEQ2 ?draw-mouse
|
||||
[ LIT &last $1 ] .Mouse/state DEI DUP ,&last STR EQU ?{ draw-mouse }
|
||||
JMP2r
|
||||
|
||||
@draw-mouse ( -> )
|
||||
|
@ -853,25 +718,23 @@
|
|||
&done POP2 POP2r POP2r !set-bg ( )
|
||||
|
||||
@clear-prev-mouse ( -> )
|
||||
#00 .Screen/auto DEO
|
||||
;blank .Screen/addr DEO2
|
||||
.prev/mouse-x LDZ2 #0004 SUB2 .Screen/x DEO2
|
||||
.prev/mouse-y LDZ2 #0005 SUB2 .Screen/y DEO2
|
||||
[ LIT2 12 -Screen/auto ] DEO
|
||||
#41 .Screen/sprite DEOk DEO JMP2r
|
||||
.prev/mouse-x LDZ2 .Screen/x DEO2
|
||||
.prev/mouse-y LDZ2 .Screen/y DEO2
|
||||
#41 .Screen/sprite DEO JMP2r
|
||||
|
||||
@draw-curr-mouse ( -> )
|
||||
.Mouse/x DEI2 DUP2 .prev/mouse-x STZ2 #0004 SUB2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .prev/mouse-y STZ2 #0005 SUB2 .Screen/y DEO2
|
||||
.Mouse/x DEI2 DUP2 .prev/mouse-x STZ2 .Screen/x DEO2
|
||||
.Mouse/y DEI2 DUP2 .prev/mouse-y STZ2 .Screen/y DEO2
|
||||
.dragging LDZ ?&skip
|
||||
( | draw )
|
||||
[ LIT2 16 -Screen/auto ] DEO
|
||||
;touch-chr #00 [ LIT2 00 -Mouse/state ] DEI NEQ #60 SFT2 ADD2 .Screen/addr DEO2
|
||||
#cf .Screen/sprite DEOk DEO
|
||||
;cursor .Screen/addr DEO2
|
||||
.about LDZ ?{ #43 .Screen/sprite DEO !&skip } #41 .Screen/sprite DEO
|
||||
&skip JMP2r
|
||||
|
||||
@on-click-down ( -> )
|
||||
.Mouse/state DEI ( state^ )
|
||||
#ff .prev/mouse-state LDZ EOR AND ( down^ )
|
||||
.prev/mouse-state LDZ #ff EOR AND ( down^ )
|
||||
#01 AND ?&ok JMP2r &ok
|
||||
.about LDZ ?on-click-down-about
|
||||
maybe-select-button ?&skip
|
||||
|
@ -1019,7 +882,7 @@
|
|||
inc-unless-empty STH ( root^ src^ [dst^] )
|
||||
|
||||
LDZk #40 EOR STHkr STZ #00 OVR STZ ( root^ src^ [dst^] ; dst<-src, src<-0 )
|
||||
EQUk ?&done .easy LDZ ?&done #01 SUB INCr ( root^ src-1^ [dst+1] )
|
||||
EQUk ?&done #01 SUB INCr ( root^ src-1^ [dst+1] )
|
||||
|
||||
LDZk #40 EOR STHkr STZ #00 OVR STZ ( root^ src-1^ [dst+1^] ; dst+1<-src-1, src-1<-0 )
|
||||
EQUk ?&done #01 SUB INCr ( root^ src-2^ [dst+2] )
|
||||
|
@ -1031,7 +894,6 @@
|
|||
.Mouse/x DEI2 #0008 LTH2 ?&no ( ; x<8 )
|
||||
.Mouse/x DEI2 #0017 GTH2 ?&no ( ; x>=23 )
|
||||
.Mouse/y DEI2 #0020 GTH2 ?&no ( ; y>=32 )
|
||||
.waste LDZ .stock LDZ ORA #00 EQU ?&no
|
||||
deal-from-stock draw #01 JMP2r ( 1^ )
|
||||
&no #00 JMP2r ( 0^ )
|
||||
|
||||
|
@ -1063,18 +925,17 @@
|
|||
ROT2 NIP DUP start-drag draw #01 JMP2r
|
||||
|
||||
@maybe-select-waste ( -> bool^ )
|
||||
.waste LDZ #00 EQU ?&no1
|
||||
.Mouse/y DEI2 #0008 LTH2 ?&no1 ( )
|
||||
.Mouse/y DEI2 #0020 GTH2 ?&no1 ( )
|
||||
top-waste STHk #00 EQU ?&no2 ( [t^] )
|
||||
#001c #00 STHkr .waste SUB #30 SFT2 ADD2 ( w=0x1c+8*index* [t^ w*] )
|
||||
DUP2 ,&dx STR2 ( w* [t^ w*] ; dx<-w )
|
||||
.Mouse/x DEI2 GTH2 ?&no2 ( [t^ w*] )
|
||||
#002c #00 STHkr .waste SUB #30 SFT2 ADD2 ( 0x2c+8*index* [t^ w*] )
|
||||
.Mouse/x DEI2 LTH2 ?&no2 ( [t^] )
|
||||
LIT2 [ &dx $2 ] #0008 STHr DUP ( dx* dy=8* t^ t^ )
|
||||
start-drag draw #01 JMP2r ( 1^ )
|
||||
&no2 POP2r POPr &no1 #00 JMP2r ( 0^ )
|
||||
.Mouse/y DEI2 #0008 LTH2 ?&no1 ( )
|
||||
.Mouse/y DEI2 #0020 GTH2 ?&no1 ( )
|
||||
top-waste STHk #00 EQU ?&no2 ( [t^] )
|
||||
#001c #00 STHkr .waste SUB #0008 MUL2 ADD2 ( w=0x1c+8*index* [t^ w*] )
|
||||
DUP2 ,&dx STR2 ( w* [t^ w*] ; dx<-w )
|
||||
.Mouse/x DEI2 GTH2 ?&no2 ( [t^ w*] )
|
||||
#002c #00 STHkr .waste SUB #0008 MUL2 ADD2 ( 0x2c+8*index* [t^ w*] )
|
||||
.Mouse/x DEI2 LTH2 ?&no2 ( [t^] )
|
||||
LIT2 [ &dx $2 ] #0008 STHr DUP ( dx* dy=8* t^ t^ )
|
||||
start-drag draw #01 JMP2r ( 1^ )
|
||||
&no2 POP2r POPr &no1 #00 JMP2r ( 0^ )
|
||||
|
||||
@maybe-select-tableau ( -> bool^ )
|
||||
.Mouse/y DEI2 #0024 LTH2 ?&no1 ( )
|
||||
|
@ -1089,7 +950,7 @@
|
|||
INCr GTHkr STHr ?&loop ( y2 [lim i+1^] )
|
||||
&no2 POP2 POP2r &no1 #00 JMP2r ( 0^ )
|
||||
&col ( x* [lim^ i^] )
|
||||
POP2 NIPr STHr ( >> )
|
||||
POP2 NIPr STHr !maybe-select-column ( bool^ )
|
||||
|
||||
@maybe-select-column ( i^ -> bool^ )
|
||||
.Mouse/y DEI2 #0024 LTH2 ?&no ( i^ )
|
||||
|
@ -1099,27 +960,27 @@
|
|||
GTHk ?&next !&done ( i^ top^ row^ [n*] )
|
||||
&next ( i^ top^ row^ [n*] )
|
||||
.Mouse/y DEI2 ( i^ top^ row^ y* [n*] )
|
||||
STH2kr #30 SFT2 #0024 ADD2 ( i^ top^ row^ y* lim=36+8n* [n*] )
|
||||
STH2kr #0008 MUL2 #0024 ADD2 ( i^ top^ row^ y* lim=36+8n* [n*] )
|
||||
LTH2 ?&match INC INC2r !&loop ( i^ top^ row+1^ [n+1*] )
|
||||
&done ( i^ top^ row^ [n*] )
|
||||
.Mouse/y DEI2 ( i^ top^ row^ y* [n*] )
|
||||
STH2kr #30 SFT2 #0034 ADD2 ( i^ top^ row^ y* lim=52+8n* [n*] )
|
||||
STH2kr #0008 MUL2 #0034 ADD2 ( i^ top^ row^ y* lim=52+8n* [n*] )
|
||||
LTH2 ?&match ( i^ top^ row^ [n*] )
|
||||
POP2r POP2 &no POP #00 JMP2r ( 0^ )
|
||||
&match ( i^ top^ row^ [n*] )
|
||||
LDZk #00 EQU ?&cancel ( i^ top^ row^ [n*] )
|
||||
LDZk #40 AND ?&cancel ( i^ top^ row^ [n*] )
|
||||
STH2 SWP2r column-x ( x* [top^ row^ n*] )
|
||||
STH2r #30 SFT2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
||||
STHr STHr ( x* y* row^ top^ )
|
||||
STH2r #0008 MUL2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
||||
STH2r SWP ( x* y* row^ top^ )
|
||||
start-drag draw #01 JMP2r ( 1^ )
|
||||
&cancel ( i^ top^ row^ [n*] )
|
||||
POP2 POP POP2r #00 JMP2r ( 0^ )
|
||||
|
||||
@maybe-select-button ( -> bool^ )
|
||||
.Mouse/y DEI2
|
||||
DUP2 .height LDZ2 #000c SUB2 LTH2 ?&no
|
||||
DUP2 .height LDZ2 #0005 SUB2 GTH2 ?&no
|
||||
DUP2 #00b4 LTH2 ?&no
|
||||
DUP2 #00bb GTH2 ?&no
|
||||
POP2 .Mouse/x DEI2
|
||||
DUP2 #0008 LTH2 ?&no
|
||||
DUP2 #0028 LTH2 ?&restart
|
||||
|
@ -1129,21 +990,13 @@
|
|||
DUP2 #0078 LTH2 ?&audio
|
||||
DUP2 #0080 LTH2 ?&no
|
||||
DUP2 #00a0 LTH2 ?&about
|
||||
DUP2 #00a8 LTH2 ?&no
|
||||
DUP2 #00c8 LTH2 ?&difficulty
|
||||
&no POP2 #00 JMP2r
|
||||
&restart POP2 restart #01 JMP2r
|
||||
&restart POP2 reset #01 JMP2r
|
||||
&quit POP2 quit #01 JMP2r
|
||||
&audio POP2 toggle-audio #01 JMP2r
|
||||
&about POP2 open-about #01 JMP2r
|
||||
&difficulty POP2 toggle-difficulty #01 JMP2r
|
||||
|
||||
@on-game-win ( -> )
|
||||
;draw-scores/games LDA2k INC2 SWP2 STA2
|
||||
;draw-scores/wins LDA2k INC2 SWP2 STA2
|
||||
save-scores !draw-buttons
|
||||
|
||||
@is-game-won ( -> bool^ )
|
||||
@game-won ( -> bool^ )
|
||||
.foundation #04 OVR ADD SWP ( lim^ start^ )
|
||||
&loop ( lim^ pos^ )
|
||||
LDZk #0f AND #0d NEQ ?&no ( lim^ pos^ )
|
||||
|
@ -1157,31 +1010,15 @@
|
|||
&disable stop-audio
|
||||
&done !draw-buttons
|
||||
|
||||
@toggle-difficulty ( -> )
|
||||
.easy LDZk #00 EQU SWP STZ !draw-buttons
|
||||
|
||||
@min ( x^ y^ -> min[x,y]^ )
|
||||
LTHk JMP SWP POP JMP2r
|
||||
|
||||
( to automatically move a card, we need to know that )
|
||||
( the alternate suits are both within 2 of its face )
|
||||
( value, and that its "parallel" suit is within 3 )
|
||||
( )
|
||||
( for example, its not safe to auto-play 4h if it )
|
||||
( might be needed for 3s, 3c, or 2d. )
|
||||
@check-auto ( card^ -> ok^ )
|
||||
DUP #30 AND ( card^ suit^ )
|
||||
#04 SFT .auto ADD LDZ INC ( card^ base+1^ )
|
||||
OVR #0f AND EQU ?&ok ( card^ ; base+1=face? )
|
||||
POP #00 JMP2r ( 0^ )
|
||||
&ok ( card^ suit^ )
|
||||
DUP #30 AND ( card^ )
|
||||
#04 SFT INC INC #03 AND ( card^ par^ )
|
||||
.auto ADD LDZ #04 ADD ( card^ pface+4^ )
|
||||
OVR #0f AND GTH ?&ok2 ( card^ )
|
||||
POP #00 JMP2r ( 0^ )
|
||||
&ok2 ( card^ )
|
||||
DUP #30 AND ( card^ suit^ )
|
||||
&ok DUP #30 AND ( card^ suit^ )
|
||||
#04 SFT INC #03 AND ( card^ alt1^ )
|
||||
INCk INC #03 AND ( card^ alt1^ alt2^ )
|
||||
.auto ADD LDZ SWP ( card^ face2^ alt1^ )
|
||||
|
@ -1229,10 +1066,10 @@
|
|||
SWP #0f AND SWP STZ JMP2r ( ; zp<-face )
|
||||
|
||||
@post-move ( -> )
|
||||
auto-move is-game-won ?on-game-win JMP2r
|
||||
auto-move game-won ?draw-buttons JMP2r
|
||||
|
||||
@on-click-up ( -> )
|
||||
#ff .Mouse/state DEI EOR ( not-state^ )
|
||||
.Mouse/state DEI #ff EOR ( not-state^ )
|
||||
.prev/mouse-state LDZ AND ( up^ )
|
||||
#01 AND ?&ok JMP2r &ok
|
||||
.dragging LDZ ?release
|
||||
|
@ -1243,9 +1080,12 @@
|
|||
.Controller/button DEI .prev/button STZ
|
||||
BRK
|
||||
|
||||
@on-release ( -> )
|
||||
JMP2r
|
||||
|
||||
@on-press ( -> )
|
||||
.Controller/key DEI #0d EQU ?dump-state ( ; 0x0d: return )
|
||||
.Controller/key DEI #1b EQU ?restart ( ; 0x1b: esc )
|
||||
.Controller/key DEI #1b EQU ?reset ( ; 0x1b: esc )
|
||||
.Controller/key DEI #20 EQU ?auto-move ( ; 0x20: space )
|
||||
JMP2r
|
||||
|
||||
|
@ -1253,81 +1093,55 @@
|
|||
|
||||
@sprites ~sprites.tal
|
||||
|
||||
@cursor 80c0 e0f0 f8e0 1000
|
||||
@blank 0000 0000 0000 0000
|
||||
|
||||
@touch-chr [
|
||||
0000 0000 0814 1417 0000 0000 0008 0808
|
||||
0000 0000 0000 00c0 0000 0000 0000 0000
|
||||
1010 2010 1008 0700 0f0f 1f0f 0f07 0000
|
||||
2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ]
|
||||
&down [
|
||||
0000 0000 0000 0817 0000 0000 0000 0008
|
||||
0000 0000 0000 00c0 0000 0000 0000 0000
|
||||
1010 2010 1008 0700 0f0f 1f0f 0f07 0000
|
||||
2010 1010 2020 c000 c0e0 e0e0 c0c0 0000 ]
|
||||
|
||||
@restart-button ( 4x1 tiles )
|
||||
@restart-button
|
||||
7f ff ff ff ff ff ff 7f 7f ce d5 cc d5 d6 ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 62 df 67 fb 47 ff ff
|
||||
ff ff ff ff ff ff ff ff ff 36 6a 62 6a 6a ff ff
|
||||
fe ff ff ff ff ff ff fe fe 63 b7 77 b7 b7 ff fe
|
||||
|
||||
@quit-button ( 4x1 tiles )
|
||||
@quit-button
|
||||
7f ff ff ff ff ff ff 7f 7f ff ff ff ff ff ff 7f
|
||||
ff ff ff ff ff ff ff ff ff cd b5 b5 b5 cc f7 ff
|
||||
ff ff ff ff ff ff ff ff ff 51 5b 5b 5b 5b ff ff
|
||||
fe ff ff ff ff ff ff fe fe ff ff ff ff ff ff fe
|
||||
|
||||
@audio-off-button ( 4x1 tiles )
|
||||
@audio-off-button
|
||||
7f ff ff ff ff ff ff 7f 7f da aa 8a aa a8 ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 9b aa aa aa 9b ff ff
|
||||
ff ff ff ff ff ff ff ff ff 3e d5 dd d5 3e ff ff
|
||||
fe ff ff ff ff ff ff fe fe c9 5b 49 5b db ff fe
|
||||
|
||||
@easy-button ( 4x1 tiles )
|
||||
7f ff ff ff ff ff ff 7f 7f ff ff ff ff ff ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 1b 75 11 75 15 ff ff
|
||||
ff ff ff ff ff ff ff ff ff 8a 7a 98 ed 1d ff ff
|
||||
fe ff ff ff ff ff ff fe fe ff ff ff ff ff ff fe
|
||||
|
||||
@hard-button ( 4x1 tiles )
|
||||
7f ff ff ff ff ff ff 7f 7f ff ff ff ff ff ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 5b 55 11 55 55 ff ff
|
||||
ff ff ff ff ff ff ff ff ff 33 55 35 55 53 ff ff
|
||||
fe ff ff ff ff ff ff fe fe ff ff ff ff ff ff fe
|
||||
|
||||
@audio-on-button ( 4x1 tiles )
|
||||
@audio-on-button
|
||||
7f ff ff ff ff ff ff 7f 7f da aa 8a aa a8 ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 9b aa aa aa 9b ff ff
|
||||
ff ff ff ff ff ff ff ff ff 3e d5 dd d5 3e ff ff
|
||||
fe ff ff ff ff ff ff fe fe cf 57 57 57 d7 ff fe
|
||||
|
||||
@about-button ( 4x1 tiles )
|
||||
@about-button
|
||||
7f ff ff ff ff ff ff 7f 7f fe fd fc fd fd ff 7f
|
||||
ff ff ff ff ff ff ff ff ff ce 55 4d 55 4e ff ff
|
||||
ff ff ff ff ff ff ff ff ff d4 56 56 56 c6 ff ff
|
||||
fe ff ff ff ff ff ff fe fe 7f ff ff ff ff ff fe
|
||||
|
||||
@new-game-button ( 4x1 tiles )
|
||||
@new-game-button
|
||||
7f ff ff ff ff ff ff 7f 7f 99 ab a9 ab a9 ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 57 56 56 56 af ff ff
|
||||
ff ff ff ff ff ff ff ff ff 37 ea a2 aa 2a ff ff
|
||||
fe ff ff ff ff ff ff fe fe 59 ab a9 ab a9 ff fe
|
||||
|
||||
@start-button ( 4x1 tiles )
|
||||
@start-button
|
||||
7f ff ff ff ff ff ff 7f 7f fe fd fe ff fc ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 23 f6 76 b6 76 ff ff
|
||||
ff ff ff ff ff ff ff ff ff 66 ab 27 ab ab ff ff
|
||||
fe ff ff ff ff ff ff fe fe 3f 7f 7f 7f 7f ff fe
|
||||
|
||||
@resume-button ( 4x1 tiles )
|
||||
@resume-button
|
||||
7f ff ff ff ff ff ff 7f 7f e7 ea e6 ea eb ff 7f
|
||||
ff ff ff ff ff ff ff ff ff 31 ef 33 fd 23 ff ff
|
||||
ff ff ff ff ff ff ff ff ff 5a 55 55 55 15 ff ff
|
||||
fe ff ff ff ff ff ff fe fe e7 5f 47 5f 67 ff fe
|
||||
|
||||
@logo ( 11x2 tiles )
|
||||
@logo
|
||||
6c fe 38 38 38 39 3b 7f 48 a4 20 20 20 21 22 40
|
||||
6c fe 38 70 e0 c0 80 00 48 a4 20 40 80 00 00 00
|
||||
00 07 1c 38 38 38 38 7c 00 04 10 20 20 20 20 40
|
||||
|
@ -1351,45 +1165,6 @@
|
|||
3f 3b 39 38 38 38 fe 6c 20 22 21 20 20 20 a4 48
|
||||
00 80 c0 e0 70 38 fe 6c 00 00 00 80 40 20 a4 48
|
||||
|
||||
@you-win ( 13x2 tiles )
|
||||
6c fe 38 1c 0e 07 03 03 24 5a 18 0c 06 03 01 01
|
||||
6c fe 38 70 e0 c0 80 80 24 5a 18 30 60 c0 80 80
|
||||
00 07 1c 38 38 38 38 7c 00 03 0c 18 18 18 18 3c
|
||||
00 c0 70 38 38 38 38 7c 00 c0 30 18 18 18 18 3c
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
6c fe 38 38 38 38 38 7c 24 5a 18 18 18 18 18 3c
|
||||
6c fe 3c 3e 3f 3b 39 38 24 5a 1c 1e 1b 19 18 18
|
||||
6c fe 38 38 38 b8 f8 f8 24 5a 18 18 18 98 d8 78
|
||||
03 03 03 03 03 03 0f 06 01 01 01 01 01 01 05 02
|
||||
80 80 80 80 80 80 e0 c0 80 80 80 80 80 80 a0 40
|
||||
38 38 38 38 38 1c 07 00 18 18 18 18 18 0c 03 00
|
||||
38 38 38 38 38 70 c0 00 18 18 18 18 18 30 c0 00
|
||||
38 38 38 38 38 1c 07 00 18 18 18 18 18 0c 03 00
|
||||
38 38 38 38 38 70 c0 00 18 18 18 18 18 30 c0 00
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
38 38 1c 0e 07 03 0f 06 18 18 0c 06 03 01 05 02
|
||||
38 38 7c ee c7 83 ef c6 18 18 3c 66 c3 81 a5 42
|
||||
38 38 70 e0 c0 80 e0 c0 18 18 30 60 c0 80 a0 40
|
||||
38 38 38 38 38 38 fe 6c 18 18 18 18 18 18 5a 24
|
||||
38 38 38 38 38 38 fe 6c 18 18 18 18 18 18 5a 24
|
||||
78 38 38 38 38 38 fe 6c 38 18 18 18 18 18 5a 24
|
||||
|
||||
@icon-24 ( 3x3 tiles )
|
||||
00 00 03 02 00 01 01 01 03 07 07 07 03 03 06 06
|
||||
00 00 00 00 00 c3 c3 c3 00 81 81 ff ff ff bd bd
|
||||
00 00 c0 40 00 80 80 8e c0 e0 e0 e0 c0 c0 60 6e
|
||||
00 00 00 00 00 00 00 00 07 07 07 03 03 01 00 00
|
||||
3c 18 00 18 00 00 00 00 ff ff ff ff ff ff ff ff
|
||||
01 08 04 00 00 00 00 00 ef ef ef cf cf 8f 0f 1f
|
||||
00 00 00 00 00 00 00 00 01 03 07 1f 3f 3f 7f 7f
|
||||
00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff
|
||||
00 00 00 00 00 00 00 00 ff fe fe fc fc f8 f0 f0
|
||||
|
||||
@corner 00 00 00 1f 1f 18 18 18
|
||||
@vert 18 18 18 18 18 18 18 18
|
||||
@horiz 00 00 00 ff ff 00 00 00
|
||||
|
|
BIN
logo.chr.nmt
BIN
logo.chr.nmt
Binary file not shown.
Loading…
Reference in New Issue