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
|
@metadata 00
|
||||||
( title ) "kodiak 0a
|
( title ) "kodiak 0a
|
||||||
( details ) &details "klondike 20 "solitaire 20 "game 0a
|
( details ) &details "klondike 20 "solitaire 20 "game 0a
|
||||||
( version ) "version 20 "2 20 "by 20 "d_m 0a
|
( author ) "by 20 "d_m 0a
|
||||||
( date ) "august 20 "7 20 "2024 00
|
( version ) "version 20 "2 0a
|
||||||
( 1 extended field ) 01
|
( date ) "7 20 "aug 20 "2024 00
|
||||||
|
01 ( 1 extended field )
|
||||||
( icon ) 83 =icon-24
|
( icon ) 83 =icon-24
|
||||||
|
|
||||||
@setup-audio ( adsr* sample* slen* dur* vol^ dev^ -> )
|
@setup-audio ( adsr* sample* slen* dur* vol^ dev^ -> )
|
||||||
|
@ -141,7 +142,7 @@
|
||||||
#010f DEO BRK ( TODO: save game? save stats? )
|
#010f DEO BRK ( TODO: save game? save stats? )
|
||||||
|
|
||||||
@dump-byte ( byte^ -- )
|
@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
|
&hex #30 ADD DUP #39 GTH #27 MUL ADD .Console/w DEO
|
||||||
JMP2r
|
JMP2r
|
||||||
|
|
||||||
|
@ -200,11 +201,10 @@
|
||||||
draw-waste
|
draw-waste
|
||||||
draw-foundation
|
draw-foundation
|
||||||
draw-tableau
|
draw-tableau
|
||||||
draw-curr-mouse
|
!draw-curr-mouse
|
||||||
JMP2r
|
|
||||||
|
|
||||||
@initialize ( start^ count^ -> )
|
@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^] )
|
&loop DUP STHkr STZ INCr GTHkr STHr ?&loop ( 0^ [lim^ pos^] )
|
||||||
POP POP2r JMP2r ( )
|
POP POP2r JMP2r ( )
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@
|
||||||
&resume ;resume-button JMP2r
|
&resume ;resume-button JMP2r
|
||||||
|
|
||||||
@draw-about ( -> )
|
@draw-about ( -> )
|
||||||
|
|
||||||
.about LDZ #7f GTH ?{ clear-screen !draw-about-content }
|
.about LDZ #7f GTH ?{ clear-screen !draw-about-content }
|
||||||
fill-box !draw-about-content
|
fill-box !draw-about-content
|
||||||
|
|
||||||
|
@ -308,9 +309,7 @@
|
||||||
#0030 .Screen/x DEO2 #00a8 .Screen/y DEO2 #14 draw-horiz
|
#0030 .Screen/x DEO2 #00a8 .Screen/y DEO2 #14 draw-horiz
|
||||||
|
|
||||||
#0028 .Screen/x DEO2 #0018 .Screen/y DEO2 #12 draw-vert
|
#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 ( -> )
|
@draw-logo ( -> )
|
||||||
#0054 .Screen/x DEO2
|
#0054 .Screen/x DEO2
|
||||||
|
@ -495,7 +494,7 @@
|
||||||
|
|
||||||
@column-y ( col^ -> y* )
|
@column-y ( col^ -> y* )
|
||||||
bot-column DUP #13 find-top SWP SUB
|
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^ -> )
|
@draw-column ( idx^ -> )
|
||||||
DUP column-x ,&x STR2 ( idx^ ; x<-32+24*idx )
|
DUP column-x ,&x STR2 ( idx^ ; x<-32+24*idx )
|
||||||
|
@ -512,7 +511,7 @@
|
||||||
&done POP POP2 JMP2r ( )
|
&done POP POP2 JMP2r ( )
|
||||||
|
|
||||||
@maybe-draw-c ( card^ -> )
|
@maybe-draw-c ( card^ -> )
|
||||||
DUP ?{ POP !draw-spot-down } !draw-c
|
DUP ?{ POP !draw-spot-down } ( >> )
|
||||||
|
|
||||||
( assumes x/y already set )
|
( assumes x/y already set )
|
||||||
@draw-c ( card^ -> )
|
@draw-c ( card^ -> )
|
||||||
|
@ -576,10 +575,10 @@
|
||||||
.move/y1 LDZ2 .move/y0 LDZ2 !scale
|
.move/y1 LDZ2 .move/y0 LDZ2 !scale
|
||||||
|
|
||||||
@max ( x* y* -> max* )
|
@max ( x* y* -> max* )
|
||||||
GTH2k JMP SWP2 POP2 JMP2r
|
GTH2k [ JMP SWP2 POP2 ] JMP2r
|
||||||
|
|
||||||
@dist ( a* b* -> |a-b|* )
|
@dist ( a* b* -> |a-b|* )
|
||||||
GTH2k JMP SWP2 SUB2 JMP2r
|
GTH2k [ JMP SWP2 SUB2 ] JMP2r
|
||||||
|
|
||||||
@move-duration ( -> duration* )
|
@move-duration ( -> duration* )
|
||||||
.move/x1 LDZ2 .move/x0 LDZ2 dist ( dx* )
|
.move/x1 LDZ2 .move/x0 LDZ2 dist ( dx* )
|
||||||
|
@ -652,7 +651,7 @@
|
||||||
.audio LDZ ?{ BRK } play-audio BRK
|
.audio LDZ ?{ BRK } play-audio BRK
|
||||||
|
|
||||||
@on-refresh ( -> brk )
|
@on-refresh ( -> brk )
|
||||||
.move/card LDZ #00 EQU ?{ update-move }
|
#00 .move/card LDZ EQU ?{ update-move }
|
||||||
on-refresh-bear ( ; possibly refresh bear )
|
on-refresh-bear ( ; possibly refresh bear )
|
||||||
.frame LDZk INC SWP STZ ( ; increment frame counter )
|
.frame LDZk INC SWP STZ ( ; increment frame counter )
|
||||||
BRK
|
BRK
|
||||||
|
@ -662,7 +661,7 @@
|
||||||
DUP #e8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
DUP #e8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
||||||
DUP #f0 NEQ ?{ POP ;sprites #0080 ADD2 JMP2r }
|
DUP #f0 NEQ ?{ POP ;sprites #0080 ADD2 JMP2r }
|
||||||
DUP #f8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
DUP #f8 NEQ ?{ POP ;sprites #0040 ADD2 JMP2r }
|
||||||
DUP #00 NEQ ?{ POP ;sprites JMP2r }
|
DUP ?{ POP ;sprites JMP2r }
|
||||||
POP #0000 JMP2r
|
POP #0000 JMP2r
|
||||||
|
|
||||||
@draw-bear-eyes ( addr* x* y* -> )
|
@draw-bear-eyes ( addr* x* y* -> )
|
||||||
|
@ -680,7 +679,7 @@
|
||||||
@on-refresh-bear ( -> )
|
@on-refresh-bear ( -> )
|
||||||
.about LDZ ?on-refresh-about-bears
|
.about LDZ ?on-refresh-about-bears
|
||||||
( .frame LDZ #00 EQU ?draw-bear-normal )
|
( .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 }
|
load-bear-frame ORAk ?{ POP2 JMP2r }
|
||||||
#00e8 #0098 !draw-bear-eyes
|
#00e8 #0098 !draw-bear-eyes
|
||||||
|
|
||||||
|
@ -752,7 +751,7 @@
|
||||||
|
|
||||||
@on-click-down ( -> )
|
@on-click-down ( -> )
|
||||||
.Mouse/state DEI ( state^ )
|
.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
|
#01 AND ?&ok JMP2r &ok
|
||||||
.about LDZ ?on-click-down-about
|
.about LDZ ?on-click-down-about
|
||||||
maybe-select-button ?&skip
|
maybe-select-button ?&skip
|
||||||
|
@ -943,17 +942,17 @@
|
||||||
ROT2 NIP DUP start-drag draw #01 JMP2r
|
ROT2 NIP DUP start-drag draw #01 JMP2r
|
||||||
|
|
||||||
@maybe-select-waste ( -> bool^ )
|
@maybe-select-waste ( -> bool^ )
|
||||||
.Mouse/y DEI2 #0008 LTH2 ?&no1 ( )
|
.Mouse/y DEI2 #0008 LTH2 ?&no1 ( )
|
||||||
.Mouse/y DEI2 #0020 GTH2 ?&no1 ( )
|
.Mouse/y DEI2 #0020 GTH2 ?&no1 ( )
|
||||||
top-waste STHk #00 EQU ?&no2 ( [t^] )
|
top-waste STHk #00 EQU ?&no2 ( [t^] )
|
||||||
#001c #00 STHkr .waste SUB #0008 MUL2 ADD2 ( w=0x1c+8*index* [t^ w*] )
|
#001c #00 STHkr .waste SUB #30 SFT2 ADD2 ( w=0x1c+8*index* [t^ w*] )
|
||||||
DUP2 ,&dx STR2 ( w* [t^ w*] ; dx<-w )
|
DUP2 ,&dx STR2 ( w* [t^ w*] ; dx<-w )
|
||||||
.Mouse/x DEI2 GTH2 ?&no2 ( [t^ w*] )
|
.Mouse/x DEI2 GTH2 ?&no2 ( [t^ w*] )
|
||||||
#002c #00 STHkr .waste SUB #0008 MUL2 ADD2 ( 0x2c+8*index* [t^ w*] )
|
#002c #00 STHkr .waste SUB #30 SFT2 ADD2 ( 0x2c+8*index* [t^ w*] )
|
||||||
.Mouse/x DEI2 LTH2 ?&no2 ( [t^] )
|
.Mouse/x DEI2 LTH2 ?&no2 ( [t^] )
|
||||||
LIT2 [ &dx $2 ] #0008 STHr DUP ( dx* dy=8* t^ t^ )
|
LIT2 [ &dx $2 ] #0008 STHr DUP ( dx* dy=8* t^ t^ )
|
||||||
start-drag draw #01 JMP2r ( 1^ )
|
start-drag draw #01 JMP2r ( 1^ )
|
||||||
&no2 POP2r POPr &no1 #00 JMP2r ( 0^ )
|
&no2 POP2r POPr &no1 #00 JMP2r ( 0^ )
|
||||||
|
|
||||||
@maybe-select-tableau ( -> bool^ )
|
@maybe-select-tableau ( -> bool^ )
|
||||||
.Mouse/y DEI2 #0024 LTH2 ?&no1 ( )
|
.Mouse/y DEI2 #0024 LTH2 ?&no1 ( )
|
||||||
|
@ -968,7 +967,7 @@
|
||||||
INCr GTHkr STHr ?&loop ( y2 [lim i+1^] )
|
INCr GTHkr STHr ?&loop ( y2 [lim i+1^] )
|
||||||
&no2 POP2 POP2r &no1 #00 JMP2r ( 0^ )
|
&no2 POP2 POP2r &no1 #00 JMP2r ( 0^ )
|
||||||
&col ( x* [lim^ i^] )
|
&col ( x* [lim^ i^] )
|
||||||
POP2 NIPr STHr !maybe-select-column ( bool^ )
|
POP2 NIPr STHr ( >> )
|
||||||
|
|
||||||
@maybe-select-column ( i^ -> bool^ )
|
@maybe-select-column ( i^ -> bool^ )
|
||||||
.Mouse/y DEI2 #0024 LTH2 ?&no ( i^ )
|
.Mouse/y DEI2 #0024 LTH2 ?&no ( i^ )
|
||||||
|
@ -978,19 +977,19 @@
|
||||||
GTHk ?&next !&done ( i^ top^ row^ [n*] )
|
GTHk ?&next !&done ( i^ top^ row^ [n*] )
|
||||||
&next ( i^ top^ row^ [n*] )
|
&next ( i^ top^ row^ [n*] )
|
||||||
.Mouse/y DEI2 ( i^ top^ row^ y* [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*] )
|
LTH2 ?&match INC INC2r !&loop ( i^ top^ row+1^ [n+1*] )
|
||||||
&done ( i^ top^ row^ [n*] )
|
&done ( i^ top^ row^ [n*] )
|
||||||
.Mouse/y DEI2 ( i^ top^ row^ y* [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*] )
|
LTH2 ?&match ( i^ top^ row^ [n*] )
|
||||||
POP2r POP2 &no POP #00 JMP2r ( 0^ )
|
POP2r POP2 &no POP #00 JMP2r ( 0^ )
|
||||||
&match ( i^ top^ row^ [n*] )
|
&match ( i^ top^ row^ [n*] )
|
||||||
LDZk #00 EQU ?&cancel ( i^ top^ row^ [n*] )
|
LDZk #00 EQU ?&cancel ( i^ top^ row^ [n*] )
|
||||||
LDZk #40 AND ?&cancel ( i^ top^ row^ [n*] )
|
LDZk #40 AND ?&cancel ( i^ top^ row^ [n*] )
|
||||||
STH2 SWP2r column-x ( x* [top^ row^ n*] )
|
STH2 SWP2r column-x ( x* [top^ row^ n*] )
|
||||||
STH2r #0008 MUL2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
STH2r #30 SFT2 #001c ADD2 ( x* y=28+8n* [top^ row^] )
|
||||||
STH2r SWP ( x* y* row^ top^ )
|
STHr STHr ( x* y* row^ top^ )
|
||||||
start-drag draw #01 JMP2r ( 1^ )
|
start-drag draw #01 JMP2r ( 1^ )
|
||||||
&cancel ( i^ top^ row^ [n*] )
|
&cancel ( i^ top^ row^ [n*] )
|
||||||
POP2 POP POP2r #00 JMP2r ( 0^ )
|
POP2 POP POP2r #00 JMP2r ( 0^ )
|
||||||
|
@ -1090,7 +1089,7 @@
|
||||||
auto-move is-game-won ?on-game-win JMP2r
|
auto-move is-game-won ?on-game-win JMP2r
|
||||||
|
|
||||||
@on-click-up ( -> )
|
@on-click-up ( -> )
|
||||||
.Mouse/state DEI #ff EOR ( not-state^ )
|
#ff .Mouse/state DEI EOR ( not-state^ )
|
||||||
.prev/mouse-state LDZ AND ( up^ )
|
.prev/mouse-state LDZ AND ( up^ )
|
||||||
#01 AND ?&ok JMP2r &ok
|
#01 AND ?&ok JMP2r &ok
|
||||||
.dragging LDZ ?release
|
.dragging LDZ ?release
|
||||||
|
|
Loading…
Reference in New Issue