Import coco-planes 0.1.0 upstream source snapshot

Original author: Pierre Sarrazin. Preserve upstream GPLv3-or-later and file-specific notices.
Source: http://sarrazip.com/dev/coco-planes-0.1.0.tar.gz
Archive SHA-256: 29191e6ba225965caa637ee726e1189639dc7fcdf2b68310fb93fbffd56c9c52
This commit is contained in:
Brian Holman committed 2026-11-09 23:39:59 -07:00
commit 7939132267
78 files changed
+6990

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
#include "Score.h"
#include "util.h"
void
Score_init(Score *self)
{
* (word *) self->digits = 0;
}
__gcccall void
Score_addPoint(Score *self)
{
if (Score_isWinningScore(self))
return;
byte *p = self->digits;
if (p[1] == 9)
{
p[1] = 0;
++p[0];
}
else
++p[1];
}
__gcccall BOOL asm
Score_isWinningScore(const Score *self)
{
#if 0 /* Original C code. */
const byte *p = self->digits;
return p[0] == WINNING_SCORE / 10 && p[1] == WINNING_SCORE % 10;
#else
asm
{
; X is 'self' b/c __gcccall.
ldb ,x ; digits[0], i.e., tens
cmpb #WINNING_SCORE/10
bne @no
ldb 1,x ; digits[1], i.e., units
cmpb #WINNING_SCORE%10
bne @no
ldb #1 ; return TRUE
rts
@no
clrb ; return FALSE
}
#endif
}