implemented some Z80 and randseeding
This commit is contained in:
+12
-1
@@ -4,6 +4,7 @@ PROJNAME=scoundrel
|
|||||||
CFILES=scoundrel.c
|
CFILES=scoundrel.c
|
||||||
PBTDIR=platform-build-tools
|
PBTDIR=platform-build-tools
|
||||||
CCBUILD=cl65 --standard c89 -O -Os
|
CCBUILD=cl65 --standard c89 -O -Os
|
||||||
|
Z80BUILD=zcc
|
||||||
BUILDDIR=build
|
BUILDDIR=build
|
||||||
|
|
||||||
$(PROJNAME): bdir
|
$(PROJNAME): bdir
|
||||||
@@ -48,7 +49,17 @@ pet: bdir
|
|||||||
plus4: bdir
|
plus4: bdir
|
||||||
$(CCBUILD) -t plus4 -o $(BUILDDIR)/$(PROJNAME)-plus4.bin $(CFILES)
|
$(CCBUILD) -t plus4 -o $(BUILDDIR)/$(PROJNAME)-plus4.bin $(CFILES)
|
||||||
|
|
||||||
all: $(PROJNAME) a2 a2e atari8bit c64 c16 c128 pet plus4
|
msx: bdir
|
||||||
|
$(Z80BUILD) +msx -create-app -subtype=rom $(CFILES) -o $(PROJNAME)
|
||||||
|
mv $(PROJNAME).rom $(BUILDDIR)/$(PROJNAME)-msx.rom
|
||||||
|
rm -f $(PROJNAME) *.bin *.img
|
||||||
|
|
||||||
|
zxspec: bdir
|
||||||
|
$(Z80BUILD) +zx -lndos -clib=ansi -pragma-define:ansicolumns=40 -create-app $(CFILES) -o $(PROJNAME)
|
||||||
|
mv $(PROJNAME).tap $(BUILDDIR)/$(PROJNAME)-zxspec.tap
|
||||||
|
rm $(PROJNAME)
|
||||||
|
|
||||||
|
all: $(PROJNAME) a2 a2e atari8bit c64 c16 c128 pet plus4 zxspec msx
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILDDIR) *.o
|
rm -rf $(BUILDDIR) *.o
|
||||||
|
|||||||
+30
-6
@@ -8,10 +8,35 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef __CC65__
|
#if defined(__CC65__) || defined(__Z80__)
|
||||||
|
#define RETRO_IMPL
|
||||||
|
#endif
|
||||||
|
#ifndef RETRO_IMPL
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char scanchar() {
|
||||||
|
char c;
|
||||||
|
scanf(" %c", &c);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RETRO_IMPL
|
||||||
|
void randomize() {
|
||||||
|
int seed = 0, i, x, n = 6;
|
||||||
|
printf("\nType %d characters: ", n);
|
||||||
|
for(i=0;i<n;i++) {
|
||||||
|
x = (int) scanchar();
|
||||||
|
x ^= x << 7;
|
||||||
|
x ^= x >> 9;
|
||||||
|
x ^= x << 8;
|
||||||
|
seed ^= x;
|
||||||
|
}
|
||||||
|
srand(seed);
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* UI choices */
|
/* UI choices */
|
||||||
#define CH1 0
|
#define CH1 0
|
||||||
#define CH2 1
|
#define CH2 1
|
||||||
@@ -51,7 +76,7 @@ void print_msg(char *s) {
|
|||||||
char get_choice() {
|
char get_choice() {
|
||||||
char c, res;
|
char c, res;
|
||||||
printf("Your choice: ");
|
printf("Your choice: ");
|
||||||
scanf(" %c", &c);
|
c = scanchar();
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
@@ -88,8 +113,7 @@ char get_choice() {
|
|||||||
int confirm(char *prompt) {
|
int confirm(char *prompt) {
|
||||||
char c, d;
|
char c, d;
|
||||||
printf("%s", prompt);
|
printf("%s", prompt);
|
||||||
c = getchar();
|
c = scanchar();
|
||||||
scanf(" %c", &c);
|
|
||||||
if(c == 'y' || c == 'Y') d = 1;
|
if(c == 'y' || c == 'Y') d = 1;
|
||||||
else d = 0;
|
else d = 0;
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -322,8 +346,8 @@ int game() {
|
|||||||
/* Entry point */
|
/* Entry point */
|
||||||
int main() {
|
int main() {
|
||||||
int score;
|
int score;
|
||||||
#ifdef __CC65__
|
#ifdef RETRO_IMPL
|
||||||
_randomize();
|
randomize();
|
||||||
#else
|
#else
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user