Drive A: updated
Posted: Mon Jun 19, 2023 6:48 am
The cloud CPM A: has been updated to include Production Dave's game updates. On A: User Area 3 you will find tetris.com, snake.com and invaders.com
Help and Support for products featured by nabu.ca
https://forums.nabu.ca/
Code: Select all
A:0> C:
C:0> dir
No file
C:0> A:
A:0> rncmd 3/A:INVADERS.COM 0/C:INVADERS.COM
++++++++++... etc,
24320 Bytes copied
A:0> C:
C:0> invaders
Code: Select all
uint16_t getHighScore() {
uint16_t hs;
#if BIN_TYPE == BIN_CPM
FILE * fp = fopen("invaders.dat", "r");
if (fp) {
fscanf(fp, "%d", &hs);
} else {
hs = 0;
}
fclose(fp);
#else
hs = 0;
#endif
return hs;
}
void setHighScore(uint16_t hs) __z88dk_fastcall {
#if BIN_TYPE == BIN_CPM
FILE * fp = fopen("invaders.dat", "w");
fprintf(fp, "%d", hs);
fclose(fp);
#else
(void)hs;
#endif
}
Code: Select all
/* headers */
uint8_t _CCP;
char current_vol;
uint8_t user_area;
char hs_filename[16];
/* code */
void main(void) {
__asm
ld a,(0x0004);
ld (__CCP),a
__endasm;
current_vol = (_CCP & 0x0f) + 0x41;
user_area = (_CCP >> 4);
sprintf(hs_filename, "%d/%c:invaders.dat", user_area, current_vol);
...
Code: Select all
// address 4 : current drive number (0=a, ..., 15=p)
// (uuuudddd) where 'uuuu' is the user number
// and 'dddd' is the drive number.
__at (0x0004) uint8_t CPM_USER_DRIVE;