Merge branch 'master' into master
This commit is contained in:
@@ -5,13 +5,13 @@ MEMORY {
|
||||
ZP: file = "", define = yes, start = $0082, size = $007E;
|
||||
# First memory segment in file, show message
|
||||
LOADER: file = %O, start = $680, size = 128;
|
||||
# First memory segment in file, load over COLOR registers:
|
||||
# Second memory segment in file, load over COLOR registers:
|
||||
COLOR: file = %O, start = $2C4, size = 5;
|
||||
# Second memory segment, load at page 6:
|
||||
# Third memory segment, load at page 6:
|
||||
PAGE6: file = %O, start = $600, size = 128;
|
||||
# Third memory segment in file, load over SDLST register:
|
||||
# Fourth memory segment in file, load over SDLST register:
|
||||
SDLST: file = %O, start = $230, size = 2;
|
||||
# Main segment, load at "STARTADDRESS"
|
||||
# Fifth/Main segment, load at "STARTADDRESS"
|
||||
MAIN: file = %O, start = %S, size = $BC20 - %S;
|
||||
}
|
||||
FILES {
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *rev;
|
||||
unsigned int t, v;
|
||||
unsigned char palntsc;
|
||||
unsigned char *rev;
|
||||
unsigned char minor;
|
||||
unsigned char c;
|
||||
|
||||
|
||||
@@ -30,10 +30,13 @@ else
|
||||
LD := $(if $(wildcard ../../../bin/ld65*),../../../bin/ld65,ld65)
|
||||
endif
|
||||
|
||||
all: petscii.prg
|
||||
all: petscii.prg cbmdir-test.prg
|
||||
|
||||
petscii.prg: petscii.c
|
||||
$(CL) -t $(SYS) -O -o petscii.prg petscii.c
|
||||
|
||||
cbmdir-test.prg: cbmdir-test.c
|
||||
$(CL) -t $(SYS) -Oris -o $@ $<
|
||||
|
||||
clean:
|
||||
@$(DEL) petscii.prg 2>$(NULLDEV)
|
||||
@$(DEL) petscii.prg cbmdir-test.prg 2>$(NULLDEV)
|
||||
|
||||
119
targettest/cbm/cbmdir-test.c
Normal file
119
targettest/cbm/cbmdir-test.c
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
** Tests the CBM-specific directory functions.
|
||||
**
|
||||
** 2021-08-12, Greg King
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <conio.h>
|
||||
#include <cbm.h>
|
||||
|
||||
|
||||
/* device number */
|
||||
#define UNIT 8
|
||||
|
||||
/* directory patterm */
|
||||
static const char name[] = "$";
|
||||
|
||||
|
||||
static const char* const type[] = {
|
||||
"DEL",
|
||||
"CBM",
|
||||
"DIR",
|
||||
"LNK",
|
||||
"???",
|
||||
"Directory header",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"SEQ",
|
||||
"PRG",
|
||||
"USR",
|
||||
"REL",
|
||||
"VRP"
|
||||
};
|
||||
|
||||
static const char* const access[] = {
|
||||
"unknown",
|
||||
"read-only",
|
||||
"write-only",
|
||||
"read/write"
|
||||
};
|
||||
|
||||
static const char* const error[] = {
|
||||
"",
|
||||
"couldn't read it",
|
||||
"",
|
||||
"couldn't find start of file-name",
|
||||
"couldn't find end of file-name",
|
||||
"couldn't read file-type",
|
||||
"premature end of file"
|
||||
};
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned char go = 0;
|
||||
unsigned char rc;
|
||||
struct cbm_dirent E;
|
||||
|
||||
/* Explain use, and wait for a key. */
|
||||
printf ("use the following keys:\n"
|
||||
" g -> go ahead without stopping\n"
|
||||
" q -> quit directory lister\n"
|
||||
"tap any key to start ...\n\n");
|
||||
cgetc ();
|
||||
|
||||
/* Open the directory. */
|
||||
if (cbm_opendir (1, UNIT, name) != 0) {
|
||||
printf("error opening %s:\n %s\n", name, _stroserror (_oserror));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Output the directory. */
|
||||
printf("contents of \"%s\":\n", name);
|
||||
while ((rc = cbm_readdir (1, &E)) != 2) {
|
||||
if (rc != 0) {
|
||||
goto oops;
|
||||
}
|
||||
|
||||
printf (" name[]: \"%s\"\n", E.name);
|
||||
printf (" size :%6u\n", E.size);
|
||||
printf (" type : %s\n", type[E.type]);
|
||||
printf (" access: %s\n", access[E.access > 3 ? 0 : E.access]);
|
||||
printf ("----\n");
|
||||
|
||||
if (!go) {
|
||||
switch (cgetc ()) {
|
||||
case 'q':
|
||||
goto done;
|
||||
|
||||
case 'g':
|
||||
go = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf (" size :%6u free.\n", E.size);
|
||||
|
||||
done:
|
||||
/* Close the directory. */
|
||||
cbm_closedir (1);
|
||||
return 0;
|
||||
|
||||
oops:
|
||||
if (rc <= 6) {
|
||||
printf ("\ndirectory error:\n %s.\n", error[rc]);
|
||||
}
|
||||
cbm_closedir (1);
|
||||
return 1;
|
||||
}
|
||||
@@ -42,14 +42,15 @@ else
|
||||
COUNT := 1
|
||||
endif
|
||||
|
||||
all: conio.pce
|
||||
all: conio.bin
|
||||
|
||||
%.bin: %.c
|
||||
$(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@
|
||||
@echo "use 'make conio.pce' to produce a .pce file using dd"
|
||||
|
||||
%.pce: %.bin
|
||||
dd if=$< bs=8K skip=${COUNT} > $@
|
||||
dd if=$< bs=8K count=${COUNT} >> $@
|
||||
|
||||
%.bin: %.c
|
||||
$(CL) -t pce $< -Wl -D__CARTSIZE__=${CARTSIZE} -m $*.map -o $@
|
||||
|
||||
clean:
|
||||
@$(DEL) conio.o conio.??? 2>$(NULLDEV)
|
||||
|
||||
Reference in New Issue
Block a user