1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-14 08:29:33 +00:00

Support different preludes for different archs (c64 and vic20 now.)

This commit is contained in:
Chris Pressey 2018-03-06 17:00:39 +00:00
parent dbba7cc7b9
commit 72efecbb1a
5 changed files with 16 additions and 13 deletions

View File

@ -79,10 +79,6 @@ are trashed inside the block.
Not because it saves 3 bytes, but because it's a neat trick. Doing it optimally
is probably NP-complete. But doing it adequately is probably not that hard.
### Different preludes for different architectures
`--prelude=c64-basic`
### And at some point...
* `low` and `high` address operators - to turn `word` type into `byte`.

View File

@ -37,10 +37,11 @@ if __name__ == '__main__':
help="Only parse and analyze the program; do not compile it."
)
argparser.add_argument(
"--basic-prelude",
action="store_true",
help="Insert a Commodore BASIC 2.0 snippet before the program "
"so that it can be LOADed and RUN on Commodore platforms."
"--prelude", type=str,
help="Insert a snippet before the compiled program "
"so that it can be LOADed and RUN on a certain platforms. "
"Also sets the origin. "
"Options are: c64 or vic20."
)
argparser.add_argument(
"--debug",
@ -93,10 +94,16 @@ if __name__ == '__main__':
fh = sys.stdout
start_addr = 0xc000
prelude = []
if options.basic_prelude:
if options.prelude == 'c64':
start_addr = 0x0801
prelude = [0x10, 0x08, 0xc9, 0x07, 0x9e, 0x32,
0x30, 0x36, 0x31, 0x00, 0x00, 0x00]
elif options.prelude == 'vic20':
start_addr = 0x1001
prelude = [0x0b, 0x10, 0xc9, 0x07, 0x9e, 0x34,
0x31, 0x30, 0x39, 0x00, 0x00, 0x00]
else:
raise NotImplementedError
# we are outputting a .PRG, so we output the load address first
# we don't use the Emitter for this b/c not part of addr space

View File

@ -5,11 +5,11 @@ if [ "X$X64" = "X" ]; then
fi
SRC=$1
if [ "X$1" = "X" ]; then
echo "Usage: ./loadngo.sh <source.60p>"
echo "Usage: ./loadngo-c64.sh <source.60p>"
exit 1
fi
OUT=/tmp/a-out.prg
bin/sixtypical --traceback --basic-prelude $SRC > $OUT || exit 1
bin/sixtypical --traceback --prelude=c64 $SRC > $OUT || exit 1
ls -la $OUT
if [ -e vicerc ]; then
$X64 -config vicerc $OUT

View File

@ -7,7 +7,7 @@ SixtyPical to 6502 machine code.
[Falderal]: http://catseye.tc/node/Falderal
-> Functionality "Compile SixtyPical program" is implemented by
-> shell command "bin/sixtypical --basic-prelude --traceback %(test-body-file) >/tmp/foo && tests/appliances/bin/dcc6502-adapter </tmp/foo"
-> shell command "bin/sixtypical --prelude=c64 --traceback %(test-body-file) >/tmp/foo && tests/appliances/bin/dcc6502-adapter </tmp/foo"
-> Tests for functionality "Compile SixtyPical program"

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
# script that allows the binary output of sixtypical --basic-prelude --compile to be
# script that allows the binary output of sixtypical --prelude=c64 --compile to be
# disassembled by https://github.com/tcarmelveilleux/dcc6502
import sys