mirror of
https://github.com/Torrididdle/Arcle.git
synced 2026-05-26 15:53:48 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3df912a84c | |||
| 19704626a6 | |||
| 9cedf9a825 | |||
| 054e108433 |
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
+80
-1
@@ -8,13 +8,58 @@ _kernel_swi_regs outreg;
|
||||
|
||||
// Hard coded - must match file sizes (or be greater).
|
||||
char answers[11545];
|
||||
char dict[64735];
|
||||
char dict[64870];
|
||||
|
||||
char logo[46*9] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x14, 0x14, 0x14, 0x34, 0x34, 0x34, 0x34, 0x34, 0x75, 0x75, 0x75, 0x75, 0x75,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0xA8, 0xA8, 0xA8, 0xA8, 0xA8, 0x0E, 0x0E, 0x0E, 0x0E, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x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
||||
0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00,
|
||||
0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
// Should be enough (famous last words)
|
||||
char textbuffer[16];
|
||||
|
||||
int arclenum = 0;
|
||||
|
||||
void logo_draw(int x, int y)
|
||||
{
|
||||
int i, j;
|
||||
int width = 46;
|
||||
int height = 9;
|
||||
|
||||
int input[2];
|
||||
|
||||
input[0] = 149; /*Hardware memory*/
|
||||
input[1] = -1;
|
||||
inreg.r[0] = (int)input;
|
||||
inreg.r[1] = (int)input;
|
||||
_kernel_swi(OS_ReadVduVariables,&inreg,&outreg);
|
||||
|
||||
for(j = 0; j < width; j++)
|
||||
{
|
||||
for(i = 0; i < height; i++)
|
||||
{
|
||||
memcpy(input[0] + x + ((y + i) * 640) + (j * 2),logo + (width * i) + j, 1);
|
||||
memcpy(input[0] + x + ((y + i) * 640) + (j * 2) + 1,logo + (width * i) + j, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void display_mode(int mode, int height)
|
||||
{
|
||||
int pitch;
|
||||
@@ -217,6 +262,26 @@ void screen_clear()
|
||||
_kernel_swi(OS_WriteC,&inreg,&outreg);
|
||||
}
|
||||
|
||||
int get_days_since_1jan1900()
|
||||
{
|
||||
char datebuffer[5];
|
||||
unsigned int date;
|
||||
|
||||
// Get centiseconds since 1 Jan 1900
|
||||
datebuffer[0] = 3;
|
||||
inreg.r[0] = 14;
|
||||
inreg.r[1] = (int)datebuffer;
|
||||
_kernel_swi(OS_Word,&inreg,&outreg);
|
||||
|
||||
// Drop a byte to get centiseconds/255 (so we can store in uint32)
|
||||
date = datebuffer[1] + (datebuffer[2] << 8) + (datebuffer[3] << 16) + (datebuffer[4] << 24);
|
||||
|
||||
// Turn into days (there are 33750 255th-centiseconds in a day)
|
||||
date = date / 33750;
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int font = 0;
|
||||
@@ -236,11 +301,25 @@ int main(int argc, char *argv[])
|
||||
loaddict("dict");
|
||||
printf("Loading answers...\n");
|
||||
loadanswers("answers");
|
||||
|
||||
// Start 19th of June 2021 with 0
|
||||
arclenum = get_days_since_1jan1900() - 44364;
|
||||
|
||||
// In case we have gone past Oct 2027 we can just loop
|
||||
while(arclenum > 2309)
|
||||
arclenum = arclenum - 2309;
|
||||
|
||||
// If we pre-date wordle (perhaps clock not set) go with what's on file
|
||||
if(arclenum < 0)
|
||||
{
|
||||
printf("Loading number...\n");
|
||||
loadarclenum("arcnum");
|
||||
}
|
||||
|
||||
screen_clear();
|
||||
|
||||
logo_draw(538,242);
|
||||
|
||||
font = font_find("Corpus.Bold",32,20);
|
||||
font_colour(0x00F00F00,0x00000000,font);
|
||||
sprintf(textbuffer,"Arcle #%d",arclenum);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,2 +1,2 @@
|
||||
!Arcle/c/* linguist-language=C
|
||||
!Arcle/c/Arcle linguist-language=C
|
||||
!Arcle/Makefile,fe1 linguist-language=Makefile
|
||||
|
||||
@@ -3,4 +3,4 @@ An implementation of Wordle for the Acorn Archimedes series.
|
||||
|
||||
Done using SWI calls as a challenge. Code is pretty messy, Sunday afternoon job and a hack-together from some old RiscOS stuff I've done.
|
||||
|
||||
Starts at the very first wordle, will move forwards as you get them right. No date handling etc yet.
|
||||
Attempts to find the right word from the system clock. If the clock is un-set or pre-dates the first word then it starts at the beginning (or the one after the last one you've completed if appropriate).
|
||||
|
||||
Reference in New Issue
Block a user