Add 2005/sykes/try.sh and test.sh + make test rule

The try.sh is different from others in that it is a loop showing a menu
with different options to use the emulator. It notes at the start of
each iteration that one has to hit ctrl-c or whatever they have set
their interrupt as.

The test.sh is run by make test. The exit status is ignored as it
returns non-zero.

Format/typo check README.md.

I am not done with this entry as the bugs.md should probably be updated
to note some things the author noted. This will have to come another
time.
This commit is contained in:
Cody Boone Ferguson committed 2023-11-21 12:48:58 -08:00
1 parent 0f33a6784a
commit 794903b627
5 files changed
+110 -20

No files matched your search

+3
View File
@@ -137,6 +137,9 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
test: ${PROG} test.sh
-./test.sh
# alternative executable
#
alt: data ${ALT_TARGET}
+16 -20
View File
@@ -15,19 +15,9 @@ make
### Try:
```sh
./sykes pet.rom
# type in the following for an old Easter egg:
WAIT 6502,12
./try.sh
```
Also try:
```
./sykes chess
```
for some good [chess](https://en.wikipedia.org/wiki/Chess) fun.
## Judges' remarks:
@@ -57,7 +47,7 @@ dd bs=2k count=1 if=/dev/zero of=nullfill.bin
```
For your convenience, we have added the above mentioned files to this entry directory.
They are used to form the `pet.rom` file.
They were used to form the `pet.rom` file.
## Author's remarks:
@@ -71,6 +61,7 @@ This is the second version of the same entry, but this one takes care to
not include any possibly copyrighted items in the info files, to be sure
to not infringe the rules.
### Test
Compile the program, then test the
@@ -85,6 +76,7 @@ A basic test is done for each instruction and addressing mode, all tests
should pass. At the end of the tests, it loops forever - break out with
control-C.
### PET EMULATION
Cast your mind back to 1977... a little company called
@@ -180,8 +172,8 @@ WAIT 6502,12
The program is basically a
[6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description)
[emulator](https://en.wikipedia.org/wiki/Emulator), and it does NOT need the
[commodore](https://en.wikipedia.org/wiki/Commodore_PET)
[rom](https://en.wikipedia.org/wiki/ROM_image) to work.
[Commodore](https://en.wikipedia.org/wiki/Commodore_PET)
[ROM](https://en.wikipedia.org/wiki/ROM_image) to work.
Supplied as a demonstration is a
compiled-for-[6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description)
@@ -222,10 +214,11 @@ In
the screen understands normal
[ASCII](https://en.wikipedia.org/wiki/ASCII#Character_set).
Lastly, the before [emulation](https://en.wikipedia.org/wiki/Emulator) starts,
the low byte from a `time()` call is placed at address 0 - this can be used as a
Lastly, before [emulation](https://en.wikipedia.org/wiki/Emulator) starts,
the low byte from a `time(3)` call is placed at address 0 - this can be used as a
random seed.
### Technical description
Most of the program comprises the
@@ -241,7 +234,7 @@ the [PET](https://en.wikipedia.org/wiki/Commodore_PET) hardware for it to work.
If the supplied file is exactly 16384 bytes, the
[emulator](https://en.wikipedia.org/wiki/Emulator) assumes it is a
[PET](https://en.wikipedia.org/wiki/Commodore_PET)
[rom](https://en.wikipedia.org/wiki/ROM_image), and goes into PET emulation
[ROM](https://en.wikipedia.org/wiki/ROM_image), and goes into PET emulation
mode. Otherwise some PET specific features are skipped during normal
[6502](https://en.wikipedia.org/wiki/MOS_Technology_6502#Technical_description)
[emulation](https://en.wikipedia.org/wiki/Emulator).
@@ -255,6 +248,7 @@ instructions according to a table and executes them.
The addressing mode is decoded in a similar expression starting on line
53.
### Bugs
The machine emulated is an older 40 column
@@ -268,8 +262,8 @@ The parameter controls the speed of the 60Hz "jiffy clock", and not the
processor speed. This means many games may run too fast to be usable -
it really depends on the speed of your machine.
Although the PET [emulator](https://en.wikipedia.org/wiki/Emulator) can do LOAD
and SAVE, it cannot VERIFY or OPEN and CLOSE files.
Although the PET [emulator](https://en.wikipedia.org/wiki/Emulator) can do `LOAD`
and `SAVE`, it cannot `VERIFY` or `OPEN` and `CLOSE` files.
The [PET](https://en.wikipedia.org/wiki/Commodore_PET) hardware
[emulation](https://en.wikipedia.org/wiki/Emulator) is not at all complete -
@@ -281,6 +275,7 @@ The
[emulation](https://en.wikipedia.org/wiki/Emulator) does not include the seldom
used decimal mode, or any of the "undocumented" instructions.
### IMPORTANT NOTE
I think it is great fun to run the
@@ -288,11 +283,12 @@ I think it is great fun to run the
[emulation](https://en.wikipedia.org/wiki/Emulator) and mess around with
[Microsoft](https://en.wikipedia.org/wiki/Microsoft)
[BASIC](https://en.wikipedia.org/wiki/BASIC). However, this obviously needs the
[rom](https://en.wikipedia.org/wiki/ROM_image) file to work. My
[ROM](https://en.wikipedia.org/wiki/ROM_image) file to work. My
program is original and completely free of any copyright, but, of
course, the `pet.rom` is not my work. So I ask the user to download it
from the Internet. This is to avoid directly infringing any copyright.
### Finally
What does this do?
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# 2005/sykes/test.sh - run the test suite
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "NOTE: you will have to hit ctrl-c to exit after the test." 1>&2
read -r -n 1 -p "Press any key to continue: "
echo 1>&2
./sykes 6502test 6 2>&1
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# try.sh - demonstrate IOCCC winner 2005/sykes
#
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
# this way allows us to have the user specify a different compiler in an easy
# way.
if [[ -z "$CC" ]]; then
CC="cc"
fi
make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
while true; do
echo "(0) Run demo" 1>&2
echo "(1) Show Easter egg" 1>&2
echo "(2) Play chess" 1>&2
echo "(3) Run test-suite" 1>&2
echo "(4) Run pet.rom with -1" 1>&2
echo "NOTE: you have to hit ctrl-c or whatever your interrupt combination is to" 1>&2
echo "exit the program to continue here." 1>&2
read -rp "Make your selection (0 - 4 or any other key to exit): " mode
echo 1>&2
case "${mode}" in
0) # demo
printf "LOAD \"DEMO\"\nRUN\n" | ./sykes pet.rom 6
;;
1) # show old Easter egg
echo "WAIT 6502,12" | ./sykes pet.rom 6
;;
2) # chess
./sykes chess 6
;;
3) # test mode
make test
;;
4) # -1
./sykes pet.rom -1
;;
*)
exit 0
esac
read -r -n 1 -p "Do you want to continue? " ans
if [[ "$ans" != "y" && "$ans" != "Y" ]]; then
break;
fi
echo 1>&2
done
+13
View File
@@ -3023,6 +3023,19 @@ how https is set up, in which case just enjoy it for what it was. But there
might be some command line that will let it work that way.
## [2005/sykes](2005/sykes/sykes.c) ([README.md](2005/sykes/README.md]))
Cody added the [try.sh](2005/sykes/try.sh) script which runs in a loop with a
menu of things one might wish to try, asking if they wish to continue when done.
Cody added the script [test.sh](2005/sykes/test.sh) and the make rule `test` to
run the test suite. The program will enter an infinite loop after it runs so you
have to hit ctrl-c to end it which the script tells you.
The scripts note every time that one will have to send ctrl-c or whatever their
interrupt is set to in order to exit the program.
## [2005/timwi](2005/timwi/timwi.c) ([README.md](2005/timwi/README.md]))
Cody added [try.sh](2005/timwi/try.sh). It only has one command as he doesn't