some optimizations from neauoire
This commit is contained in:
parent
db984fbfa4
commit
5ba423aa9f
69
kodiak.tal
69
kodiak.tal
|
@ -98,9 +98,10 @@
|
|||
@metadata 00
|
||||
( title ) "kodiak 0a
|
||||
( details ) &details "klondike 20 "solitaire 20 "game 0a
|
||||
( version ) "version 20 "2 20 "by 20 "d_m 0a
|
||||
( date ) "august 20 "7 20 "2024 00
|
||||
( 1 extended field ) 01
|
||||
( author ) "by 20 "d_m 0a
|
||||
( version ) "version 20 "2 0a
|
||||
( date ) "7 20 "aug 20 "2024 00
|
||||
01 ( 1 extended field )
|
||||
( icon ) 83 =icon-24
|
||||
|
||||
@setup-audio ( adsr* sample* slen* dur* vol^ dev^ -> )
|
||||
|
@ -141,7 +142,7 @@
|
|||
#010f DEO BRK ( TODO: save game? save stats? )
|
||||
|
||||
@dump-byte ( byte^ -- )
|
||||
DUP #04 SFT ,&hex JSR #0f AND ,&hex JMP
|
||||
DUP #04 SFT /hex #0f AND ( >> )
|
||||
&hex #30 ADD DUP #39 GTH #27 MUL ADD .Console/w DEO
|
||||
JMP2r
|
||||
|
||||
|
@ -200,11 +201,10 @@
|
|||
draw-waste
|
||||
draw-foundation
|
||||
draw-tableau
|
||||
draw-curr-mouse
|
||||
JMP2r
|
||||
!draw-curr-mouse
|
||||
|
||||
@initialize ( start^ count^ -> )
|
||||
OVR ADD SWP STH2 #00 ( 0^ [lim=start+count^ start^] )
|
||||
OVR ADD STH STH #00 ( 0^ [lim=start+count^ start^] )
|
||||
&loop DUP STHkr STZ INCr GTHkr STHr ?&loop ( 0^ [lim^ pos^] )
|
||||
POP POP2r JMP2r ( )
|
||||
|
||||
|
@ -258,6 +258,7 @@
|
|||
&resume ;resume-button JMP2r
|
||||
|
||||
@draw-about ( -> )
|
||||
|
||||
.about LDZ #7f GTH ?{ clear-screen !draw-about-content }
|
||||
fill-box !draw-about-content
|
||||
|
||||
|
@ -308,9 +309,7 @@
|
|||
#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
|
||||
|
||||
JMP2r
|
||||
#00d0 .Screen/x DEO2 #0018 .Screen/y DEO2 #12 !draw-vert
|
||||
|
||||
@draw-logo ( -> )
|
||||
#0054 .Screen/x DEO2
|
||||
|
@ -495,7 +494,7 @@
|
|||
|
||||
@column-y ( col^ -> y* )
|
||||
bot-column DUP #13 find-top SWP SUB
|
||||
#00 SWP #0008 MUL2 #0024 ADD2 JMP2r
|
||||
#00 SWP #30 SFT2 #0024 ADD2 JMP2r
|
||||
|
||||
@draw-column ( idx^ -> )
|
||||
DUP column-x ,&x STR2 ( idx^ ; x<-32+24*idx )
|
||||
|
@ -512,7 +511,7 @@
|
|||
&done POP POP2 JMP2r ( )
|
||||
|
||||
@maybe-draw-c ( card^ -> )
|
||||
DUP ?{ POP !draw-spot-down } !draw-c
|
||||
DUP ?{ POP !draw-spot-down } ( >> )
|
||||
|
||||
( assumes x/y already set )
|
||||
@draw-c ( card^ -> )
|
||||
|
@ -576,10 +575,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* )
|
||||
|
@ -652,7 +651,7 @@
|
|||
.audio LDZ ?{ BRK } play-audio BRK
|
||||
|
||||
@on-refresh ( -> brk )
|
||||
.move/card LDZ #00 EQU ?{ update-move }
|
||||
#00 .move/card LDZ EQU ?{ update-move }
|
||||
on-refresh-bear ( ; possibly refresh bear )
|
||||
.frame LDZk INC SWP STZ ( ; increment frame counter )
|
||||
BRK
|
||||
|
@ -662,7 +661,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 #00 NEQ ?{ POP ;sprites JMP2r }
|
||||
DUP ?{ POP ;sprites JMP2r }
|
||||
POP #0000 JMP2r
|
||||
|
||||
@draw-bear-eyes ( addr* x* y* -> )
|
||||
|
@ -680,7 +679,7 @@
|
|||
@on-refresh-bear ( -> )
|
||||
.about LDZ ?on-refresh-about-bears
|
||||
( .frame LDZ #00 EQU ?draw-bear-normal )
|
||||
.dragging LDZ #00 EQU ?{ draw-bear-oh }
|
||||
#00 .dragging LDZ EQU ?{ draw-bear-oh }
|
||||
load-bear-frame ORAk ?{ POP2 JMP2r }
|
||||
#00e8 #0098 !draw-bear-eyes
|
||||
|
||||
|
@ -752,7 +751,7 @@
|
|||
|
||||
@on-click-down ( -> )
|
||||
.Mouse/state DEI ( state^ )
|
||||
.prev/mouse-state LDZ #ff EOR AND ( down^ )
|
||||
#ff .prev/mouse-state LDZ EOR AND ( down^ )
|
||||
#01 AND ?&ok JMP2r &ok
|
||||
.about LDZ ?on-click-down-about
|
||||
maybe-select-button ?&skip
|
||||
|
@ -943,17 +942,17 @@
|
|||
ROT2 NIP DUP start-drag draw #01 JMP2r
|
||||
|
||||
@maybe-select-waste ( -> bool^ )
|
||||
.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^ )
|
||||
.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^ )
|
||||
|
||||
@maybe-select-tableau ( -> bool^ )
|
||||
.Mouse/y DEI2 #0024 LTH2 ?&no1 ( )
|
||||
|
@ -968,7 +967,7 @@
|
|||
INCr GTHkr STHr ?&loop ( y2 [lim i+1^] )
|
||||
&no2 POP2 POP2r &no1 #00 JMP2r ( 0^ )
|
||||
&col ( x* [lim^ i^] )
|
||||
POP2 NIPr STHr !maybe-select-column ( bool^ )
|
||||
POP2 NIPr STHr ( >> )
|
||||
|
||||
@maybe-select-column ( i^ -> bool^ )
|
||||
.Mouse/y DEI2 #0024 LTH2 ?&no ( i^ )
|
||||
|
@ -978,19 +977,19 @@
|
|||
GTHk ?&next !&done ( i^ top^ row^ [n*] )
|
||||
&next ( i^ top^ row^ [n*] )
|
||||
.Mouse/y DEI2 ( i^ top^ row^ y* [n*] )
|
||||
STH2kr #0008 MUL2 #0024 ADD2 ( i^ top^ row^ y* lim=36+8n* [n*] )
|
||||
STH2kr #30 SFT2 #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 #0008 MUL2 #0034 ADD2 ( i^ top^ row^ y* lim=52+8n* [n*] )
|
||||
STH2kr #30 SFT2 #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 #0008 MUL2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
||||
STH2r SWP ( x* y* row^ top^ )
|
||||
STH2r #30 SFT2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
||||
STHr STHr ( x* y* row^ top^ )
|
||||
start-drag draw #01 JMP2r ( 1^ )
|
||||
&cancel ( i^ top^ row^ [n*] )
|
||||
POP2 POP POP2r #00 JMP2r ( 0^ )
|
||||
|
@ -1090,7 +1089,7 @@
|
|||
auto-move is-game-won ?on-game-win JMP2r
|
||||
|
||||
@on-click-up ( -> )
|
||||
.Mouse/state DEI #ff EOR ( not-state^ )
|
||||
#ff .Mouse/state DEI EOR ( not-state^ )
|
||||
.prev/mouse-state LDZ AND ( up^ )
|
||||
#01 AND ?&ok JMP2r &ok
|
||||
.dragging LDZ ?release
|
||||
|
|
Loading…
Reference in New Issue