···23This is a card solitaire game for the TI-84 Plus CE and TI-83 Premium CE.
400000000005## Roadmap
67-This branch is still heavily under development! Check back later for more information.
89## Dependencies
10
···23This is a card solitaire game for the TI-84 Plus CE and TI-83 Premium CE.
45+## How to Play
6+7+This is calculation. There are four foundation piles, each of which start with one card at the beginning of the game: the first pile starts with an ace, the second with a two, and so on. Each foundation is built on in multiples of the initial card (i.e. its position). So the first pile is built A, 2, 3, 4...; the second 2, 4, 6, 8...; the third 3, 6, 9, Q...; and the fourth 4, 8, Q, 3.... The card after K is A, though once a foundation has a king played to it, that is its thirteenth card and it is now complete, and no more cards may be played to it.
8+9+Additionally, there are four tableau piles beneath the foundation piles. A card can always be placed on the top of a tableau pile, but it can only be removed from the pile by playing it to a foundation. Therefore, the clever placement of cards in the tableau is key to victory.
10+11+Cards may be drawn one at a time from the deck by pressing `alpha` or picked up from the selected tableau pile with `2nd`. The card held in the player's hand may be played to the selected pile with `2nd` or returned to its origin pile in the tableau with `clear`. When interacting with tableau and foundation piles, the selected pile is marked with the cursor, which can be moved with the arrow keys. Moving the cursor all the way to the left or right causes it to wrap around from the tableau to the foundations or vice versa.
12+13+Once all four foundations are completed, the game is over. The game can be reset at any point by pressing `del`.
14+15## Roadmap
1617+As more and more of the core game logic is made generic, the goal is to spin out the rules of the game to an interpreted script, and then allow the play of multiple solitaire games with one program and set of graphical assets.
1819## Dependencies
20
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#ifndef drawing_include_file
18+#define drawing_include_file
19+20+#include <graphx.h>
21+#include <gfx/gfx.h>
22+#include "variables.h"
23+24+#define CARD_HEIGHT 41
25+#define CARD_WIDTH 27
26+#define CARD_SPACING 5
27+#define CARD_VOFFSET 7
28+29+#define CARD_NUMERAL_HOFFSET 1
30+#define CARD_NUMERAL_VOFFSET 1
31+#define CARD_FACE_HOFFSET 4
32+#define CARD_FACE_VOFFSET 4
33+#define CARD_FACE_WIDTH 19
34+#define CARD_FACE_HEIGHT 17
35+#define CARD_FSUIT_HOFFSET 1
36+#define CARD_FSUIT_VOFFSET 7
37+#define LOCK_ICON_VOFFSET 17
38+#define LOCK_ICON_HOFFSET 9
39+#define FC_VPOS 50
40+#define TABL_VPOS 100
41+#define FC_HPOS 98
42+#define TABL_HPOS 98
43+44+#define TEXT_CHAR_WIDTH 8
45+#define SELCARD_DISP_X 5
46+#define SELCARD_DISP_Y 9
47+#define NUMWINS_DISP_X (GFX_LCD_WIDTH - 5 - 3 * TEXT_CHAR_WIDTH)
48+49+#define BKGND_COLOR 3
50+#define BORDER_COLOR 0
51+#define CARD_COLOR 0
52+#define BLACK_COLOR 1
53+#define RED_COLOR 2
54+55+#define TOP_BORDER 25
56+57+#define DECK_VPOS FC_VPOS
58+#define DECK_HPOS (FC_HPOS - CARD_WIDTH - CARD_SPACING)
59+#define DECK_CARDS_PER_HEIGHT 9
60+61+#define SELCARD_XPOS 147
62+#define SELCARD_YPOS 210
63+64+#define MOVE_ANIM_LENGTH 40
65+66+extern gfx_sprite_t* cardSprite[11];
67+68+unsigned int getCursorX();
69+unsigned char getCursorY();
70+void drawCursor();
71+void drawCard(card_t toDraw, unsigned int x, unsigned char y, bool useCutoff);
72+void drawStack(unsigned char stackIndex);
73+void drawBar();
74+void drawFrame(bool drawSelected);
75+void animateMove(unsigned int x0, unsigned char y0, unsigned int x1, unsigned char y1, bool faceDown);
76+void animateDeal();
77+78+#define getOrgX() (TABL_HPOS + (orgStack - NUM_FREECELLS) * (CARD_WIDTH + CARD_SPACING))
79+#define getOrgY() (TABL_VPOS + orgIndex * CARD_VOFFSET)
80+81+#define animateGrab() animateMove(getCursorX(), getCursorY(), SELCARD_XPOS, SELCARD_YPOS, false)
82+#define animateDrop() animateMove(SELCARD_XPOS, SELCARD_YPOS, getCursorX(), getCursorY(), false)
83+#define animateDraw() animateMove(DECK_HPOS, DECK_VPOS, SELCARD_XPOS, SELCARD_YPOS, true)
84+#define animateClear() animateMove(SELCARD_XPOS, SELCARD_YPOS, getOrgX(), getOrgY(), false)
85+86+#endif
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#include "input.h"
18+19+#include <stdlib.h>
20+#include <keypadc.h>
21+#include "variables.h"
22+#include "ops.h"
23+#include "save.h"
24+25+unsigned char down, left, right, up;
26+27+bool doInput()
28+{
29+ const bool prevSecond = kb_IsDown(kb_Key2nd);
30+ const bool prevAlpha = kb_IsDown(kb_KeyAlpha);
31+ const bool prevClear = kb_IsDown(kb_KeyClear);
32+33+ kb_Scan();
34+35+ up = kb_IsDown(kb_KeyUp) ? up + 1 : 0;
36+ down = kb_IsDown(kb_KeyDown) ? down + 1 : 0;
37+ left = kb_IsDown(kb_KeyLeft) ? left + 1 : 0;
38+ right = kb_IsDown(kb_KeyRight) ? right + 1 : 0;
39+40+ const bool select = (kb_IsDown(kb_Key2nd) && !prevSecond);
41+ const bool draw = (kb_IsDown(kb_KeyAlpha) && !prevAlpha);
42+ const bool clear = (kb_IsDown(kb_KeyClear) && !prevClear);
43+44+ if (select)
45+ {
46+ if (cursorMode == SELECT)
47+ {
48+ if (canGrabCard())
49+ {
50+ grabCard();
51+ cursorMode = DROP;
52+ }
53+ }
54+ else if (canDropCard())
55+ {
56+ dropCard();
57+ cursorMode = SELECT;
58+ }
59+ }
60+ else if (clear)
61+ {
62+ if (canClearCard())
63+ {
64+ clearCard();
65+ cursorMode = SELECT;
66+ }
67+ }
68+ else if (draw)
69+ {
70+ if (cursorMode == SELECT && deckCards > 0)
71+ {
72+ getNewCard();
73+ orgStack = DECK_ORG;
74+ cursorMode = DROP;
75+ }
76+ }
77+78+ unsigned char prevCursorStack = cursorStack;
79+80+ if (down == 1 || down > HOLD_TIME)
81+ {
82+ if (cursorStack < NUM_FREECELLS || !(tableau[cursorStack][cursorIndex + 1] & CARD_EXISTS)) cursorIndex++;
83+ }
84+ else if (left == 1 || left > HOLD_TIME)
85+ {
86+ if (cursorStack == 0) cursorStack = NUM_FREECELLS + NUM_TABLSLOTS - 1; // wrap
87+ else cursorStack--;
88+ }
89+ else if (right == 1 || right > HOLD_TIME)
90+ {
91+ if (cursorStack > NUM_FREECELLS + NUM_TABLSLOTS - 2) cursorStack = 0; // wrap
92+ else cursorStack++;
93+ }
94+ else if (up == 1 || up > HOLD_TIME)
95+ {
96+ if (cursorIndex > 0) cursorIndex--;
97+ }
98+99+ if (cursorStack < NUM_FREECELLS)
100+ {
101+ cursorIndex = 0;
102+ }
103+ else if (cursorMode == DROP)
104+ {
105+ maxCursorIndex();
106+ if (cursorStack >= NUM_FREECELLS && (tableau[cursorStack - NUM_FREECELLS][0] & CARD_EXISTS)) cursorIndex++;
107+ }
108+ else if (cursorStack != prevCursorStack)
109+ {
110+ maxCursorIndex();
111+ }
112+113+ if (kb_IsDown(kb_KeyDel))
114+ {
115+ deleteSave();
116+ start();
117+ }
118+119+ return !kb_On && progress < 10;
120+}
+24
src/input.h
···000000000000000000000000
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#ifndef input_include_file
18+#define input_include_file
19+20+#include <stdbool.h>
21+22+bool doInput();
23+24+#endif
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#include <fileioc.h>
18+#include <stdlib.h>
19+#include <math.h>
20+#include <time.h>
21+#include <sys/rtc.h>
22+#include <keypadc.h>
23+24+#include "variables.h"
25+#include "input.h"
26+#include "drawing.h"
27+#include "save.h"
28+#include "ops.h"
29+30+card_t tableau[NUM_TABLSLOTS][TABL_STACK_SIZE];
31+card_t freeCells[NUM_FREECELLS];
32+unsigned char progress;
33+34+bool run()
35+{
36+ start();
37+38+ while (doInput())
39+ {
40+ clock_t frameTimer = clock();
41+42+ drawFrame(true);
43+44+ while (clock() - frameTimer < FRAME_TIME);
45+ }
46+47+ if (progress == PROGRESS_COMPLETE)
48+ {
49+ // this way we know not to try to resume
50+ deleteSave();
51+52+ drawFrame(true);
53+54+ while (kb_AnyKey());
55+56+ while (true)
57+ {
58+ kb_Scan();
59+ if (kb_On) return false;
60+ if (kb_IsDown(kb_Key2nd) || kb_IsDown(kb_KeyEnter)) return true;
61+ }
62+ }
63+ else
64+ {
65+ // user exited mid-game
66+ save();
67+ return false;
68+ }
69+}
70+71+int main(void)
72+{
73+ srand(rtc_Time());
74+75+ gfx_Begin();
76+ gfx_SetDrawBuffer();
77+ gfx_SetPalette(global_palette, sizeof_global_palette, 0);
78+ gfx_SetTransparentColor(3);
79+80+ kb_EnableOnLatch();
81+ kb_ClearOnLatch();
82+83+ loadWins();
84+85+ while (run());
86+87+ gfx_End();
88+89+ kb_ClearOnLatch();
90+91+ return 0;
92+}
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#include "ops.h"
18+19+#include <stdlib.h>
20+#include <fileioc.h>
21+22+#include "variables.h"
23+#include "save.h"
24+#include "drawing.h"
25+26+unsigned char cursorStack;
27+unsigned char cursorIndex;
28+enum cursorMode_t cursorMode;
29+unsigned char selectedCard;
30+unsigned char selectedQty;
31+unsigned char orgStack;
32+unsigned char orgIndex;
33+34+void start()
35+{
36+ loadWins();
37+ load(); // will call deal() as well if necessary
38+39+ // set initial variables
40+ cursorMode = SELECT;
41+ cursorStack = NUM_FREECELLS;
42+ maxCursorIndex();
43+ selectedCard = CARD_EMPTY;
44+}
45+46+bool canGrabCard()
47+{
48+ if (cursorStack < NUM_FREECELLS) return false;
49+ else if (tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS) return false;
50+ else return tableau[cursorStack - NUM_FREECELLS][cursorIndex] & CARD_EXISTS;
51+}
52+53+bool canDropCard()
54+{
55+ if (cursorStack < NUM_FREECELLS)
56+ {
57+ if ((freeCells[cursorStack] & CARD_NUMBER) == CARD_KING) return false;
58+ else return (selectedCard & CARD_NUMBER) == (cursorStack + (freeCells[cursorStack] & CARD_NUMBER) + 1) % 13;
59+ }
60+ else if (orgStack != DECK_ORG)
61+ {
62+ return cursorStack == orgStack;
63+ }
64+ else if (cursorIndex == 0)
65+ {
66+ return true;
67+ }
68+ else
69+ {
70+ return !(tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS);
71+ }
72+}
73+74+bool canClearCard()
75+{
76+ if (orgStack == DECK_ORG) return false;
77+ else return selectedCard & CARD_EXISTS;
78+}
79+80+void getNewCard()
81+{
82+ while (true)
83+ {
84+ selectedCard = (rand() & CARD_SUIT) | (rand() % 13) | CARD_EXISTS;
85+ if (!removeFromDeck(selectedCard)) break;
86+ }
87+88+ animateDraw();
89+}
90+91+bool removeFromDeck(card_t toRemove)
92+{
93+ unsigned char cardIndex = ((toRemove & CARD_SUIT) >> 4) * 13 + (toRemove & CARD_NUMBER);
94+ unsigned char *deckByte = deck + (cardIndex / 8);
95+ unsigned char pokeByte = 0x01 << (cardIndex % 8);
96+ if (*deckByte & pokeByte) return true;
97+98+ *deckByte |= pokeByte;
99+ deckCards--;
100+ return false;
101+}
102+103+void grabCard()
104+{
105+ orgStack = cursorStack;
106+ orgIndex = cursorIndex;
107+108+ selectedCard = tableau[cursorStack - NUM_FREECELLS][cursorIndex];
109+ tableau[cursorStack - NUM_FREECELLS][cursorIndex] = CARD_EMPTY;
110+111+ animateGrab();
112+}
113+114+void dropCard()
115+{
116+ animateDrop();
117+118+ unsigned char const prevProgress = progress;
119+120+ if (cursorStack < NUM_FREECELLS)
121+ {
122+ freeCells[cursorStack] = selectedCard;
123+ if ((selectedCard & CARD_NUMBER) == CARD_KING) progress++;
124+ }
125+ else
126+ {
127+ tableau[cursorStack - NUM_FREECELLS][cursorIndex] = selectedCard;
128+ }
129+130+ if (progress == PROGRESS_COMPLETE && prevProgress < PROGRESS_COMPLETE) (*numWins)++;
131+}
132+133+void clearCard()
134+{
135+ animateClear();
136+ tableau[orgStack - NUM_FREECELLS][orgIndex] = selectedCard;
137+ selectedCard = CARD_EMPTY;
138+}
139+140+void maxCursorIndex()
141+{
142+ if (cursorStack < NUM_FREECELLS) return;
143+144+ cursorIndex = 0;
145+ while (tableau[cursorStack - NUM_FREECELLS][cursorIndex + 1] & CARD_EXISTS) cursorIndex++;
146+}
+41
src/ops.h
···00000000000000000000000000000000000000000
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#ifndef ops_include_file
18+#define ops_include_file
19+20+#include <stdbool.h>
21+#include "variables.h"
22+23+#define canPress2nd() (cursorMode == SELECT ? canGrabCard() : canDropCard())
24+#define canPressAlpha() (!(selectedCard & CARD_EXISTS))
25+#define canPressClear() (canClearCard())
26+#define canPressDel() (true)
27+28+void start();
29+30+bool canGrabCard();
31+bool canDropCard();
32+bool canClearCard();
33+34+void getNewCard();
35+bool removeFromDeck(card_t toRemove); // returns true iff card not in deck
36+void grabCard();
37+void dropCard();
38+void clearCard();
39+void maxCursorIndex();
40+41+#endif
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#include "save.h"
18+19+#include <sys/rtc.h>
20+#include <fileioc.h>
21+#include <stdlib.h>
22+23+#include "variables.h"
24+#include "drawing.h"
25+#include "ops.h"
26+27+unsigned char deck[7];
28+unsigned char deckCards;
29+30+unsigned int *numWins;
31+unsigned char *saveData;
32+33+void deal()
34+{
35+ progress = 0;
36+ deckCards = 52;
37+38+ for (unsigned char i = 0; i < 7; i++)
39+ {
40+ deck[i] = 0x00;
41+ }
42+43+ for (unsigned char i = 0; i < NUM_TABLSLOTS; i++)
44+ {
45+ for (unsigned char j = 0; j < TABL_STACK_SIZE; j++)
46+ {
47+ tableau[i][j] = CARD_EMPTY;
48+ }
49+ }
50+51+ for (unsigned char i = 0; i < NUM_FREECELLS; i++)
52+ {
53+ freeCells[i] = CARD_EXISTS | i | (unsigned char)(rand() & CARD_SUIT);
54+ removeFromDeck(freeCells[i]);
55+ }
56+57+ animateDeal();
58+}
59+60+void loadWins()
61+{
62+ unsigned char winsHandle = ti_Open(WINS_VAR_NAME, "r+");
63+64+ if (winsHandle == 0)
65+ {
66+ // create a new blank file
67+ winsHandle = ti_Open(WINS_VAR_NAME, "w");
68+ ti_PutC(0, winsHandle);
69+ ti_Seek(0, SEEK_SET, winsHandle);
70+ }
71+72+ // is there already an entry for this game?
73+ unsigned char *length = ti_GetDataPtr(winsHandle);
74+ highscore_t *entries = (highscore_t *)length + sizeof(char);
75+ for (unsigned char i = 0; i < *length; i++)
76+ {
77+ if (entries[i].gameId == GAME_ID)
78+ {
79+ numWins = &(entries[i].score);
80+ goto found_wins;
81+ }
82+ }
83+84+ // add a new blank entry
85+ (*length)++;
86+ ti_Seek(sizeof(char) + *length * sizeof(highscore_t), SEEK_SET, winsHandle);
87+ const highscore_t newHighScore = { GAME_ID, 0 };
88+ highscore_t *entry = (highscore_t *)ti_GetDataPtr(winsHandle);
89+ ti_Write(&newHighScore, sizeof(highscore_t), 1, winsHandle);
90+ numWins = &(entry->score);
91+92+found_wins:
93+ ti_Close(winsHandle);
94+}
95+96+void load()
97+{
98+ unsigned char saveHandle = ti_Open(SAVE_VAR_NAME, "r");
99+100+ if (saveHandle == 0)
101+ {
102+ // no save present
103+ deal();
104+ }
105+ else
106+ {
107+ unsigned char magicNumber = ti_GetC(saveHandle);
108+ if (magicNumber != GAME_ID)
109+ {
110+ // this is from a different solitaire game
111+ deal();
112+ }
113+ else
114+ {
115+ // load save
116+ ti_Read(freeCells, 1, NUM_FREECELLS, saveHandle);
117+ ti_Read(tableau, 1, NUM_TABLSLOTS * TABL_STACK_SIZE, saveHandle);
118+119+ // how far along does that make us?
120+ progress = 0;
121+ for (unsigned char i = 0; i < NUM_FREECELLS; i++)
122+ {
123+ if ((freeCells[i] & CARD_NUMBER) == CARD_KING) progress++;
124+ }
125+126+ ti_Read(&deckCards, 1, 1, saveHandle);
127+ ti_Read(deck, 1, 7, saveHandle);
128+ ti_Read(&selectedCard, 1, 1, saveHandle);
129+ }
130+ }
131+132+ ti_Close(saveHandle);
133+}
134+135+void save()
136+{
137+ unsigned char saveHandle = ti_Open(SAVE_VAR_NAME, "w");
138+139+ ti_PutC(GAME_ID, saveHandle);
140+ ti_Write(freeCells, 1, NUM_FREECELLS, saveHandle);
141+ ti_Write(tableau, 1, NUM_TABLSLOTS * TABL_STACK_SIZE, saveHandle);
142+ ti_Write(&deckCards, 1, 1, saveHandle);
143+ ti_Write(deck, 1, 7, saveHandle);
144+ ti_Write(&selectedCard, 1, 1, saveHandle);
145+146+ ti_Close(saveHandle);
147+}
148+149+void deleteSave()
150+{
151+ ti_Delete(SAVE_VAR_NAME);
152+}
+31
src/save.h
···0000000000000000000000000000000
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#ifndef save_include_file
18+#define save_include_file
19+20+typedef struct {
21+ unsigned char gameId;
22+ unsigned int score;
23+} highscore_t;
24+25+void deal();
26+void load();
27+void save();
28+void deleteSave();
29+void loadWins();
30+31+#endif
···1+// Calculation Solitaire / CALCSLTR for the TI-84 Plus CE
2+// Copyright (C) 2025 euphory
3+//
4+// This program is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// This program is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <https://www.gnu.org/licenses/>.
16+17+#ifndef variables_include_file
18+#define variables_include_file
19+20+#define WINS_VAR_NAME "SLTRWINS"
21+#define SAVE_VAR_NAME "SLTRSAVE"
22+#define GAME_ID 0x02
23+24+#define FRAME_TIME 3277
25+#define HOLD_TIME 2
26+27+#define NUM_FREECELLS 4
28+#define NUM_TABLSLOTS 4
29+#define TABL_STACK_SIZE 12
30+31+#define PROGRESS_COMPLETE 4
32+#define DECK_ORG 0xff
33+34+#define CARD_RED 0x20
35+#define CARD_SUIT 0x30
36+#define CARD_NUMBER 0x0f
37+#define CARD_KING 12
38+#define CARD_EMPTY 0x00
39+#define CARD_EXISTS 0x80
40+41+typedef unsigned char card_t;
42+43+extern card_t tableau[NUM_TABLSLOTS][TABL_STACK_SIZE];
44+extern card_t freeCells[NUM_FREECELLS];
45+46+extern unsigned char cursorStack;
47+extern unsigned char cursorIndex;
48+extern enum cursorMode_t { SELECT, DROP } cursorMode;
49+extern card_t selectedCard;
50+extern unsigned char orgStack;
51+extern unsigned char orgIndex;
52+53+extern unsigned char progress;
54+extern unsigned int *numWins;
55+56+extern unsigned char deck[7];
57+extern unsigned char deckCards;
58+59+#endif