git @ Cat's Eye Technologies SixtyPical / 72efecb
Support different preludes for different archs (c64 and vic20 now.) Chris Pressey 4 years ago
6 changed file(s) with 33 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
7878 Not because it saves 3 bytes, but because it's a neat trick. Doing it optimally
7979 is probably NP-complete. But doing it adequately is probably not that hard.
8080
81 ### Different preludes for different architectures
82
83 `--prelude=c64-basic`
84
8581 ### And at some point...
8682
8783 * `low` and `high` address operators - to turn `word` type into `byte`.
3636 help="Only parse and analyze the program; do not compile it."
3737 )
3838 argparser.add_argument(
39 "--basic-prelude",
40 action="store_true",
41 help="Insert a Commodore BASIC 2.0 snippet before the program "
42 "so that it can be LOADed and RUN on Commodore platforms."
39 "--prelude", type=str,
40 help="Insert a snippet before the compiled program "
41 "so that it can be LOADed and RUN on a certain platforms. "
42 "Also sets the origin. "
43 "Options are: c64 or vic20."
4344 )
4445 argparser.add_argument(
4546 "--debug",
9293 fh = sys.stdout
9394 start_addr = 0xc000
9495 prelude = []
95 if options.basic_prelude:
96 if options.prelude == 'c64':
9697 start_addr = 0x0801
9798 prelude = [0x10, 0x08, 0xc9, 0x07, 0x9e, 0x32,
9899 0x30, 0x36, 0x31, 0x00, 0x00, 0x00]
100 elif options.prelude == 'vic20':
101 start_addr = 0x1001
102 prelude = [0x0b, 0x10, 0xc9, 0x07, 0x9e, 0x34,
103 0x31, 0x30, 0x39, 0x00, 0x00, 0x00]
104 else:
105 raise NotImplementedError
99106
100107 # we are outputting a .PRG, so we output the load address first
101108 # we don't use the Emitter for this b/c not part of addr space
0 #!/bin/sh
1
2 if [ "X$X64" = "X" ]; then
3 X64=x64
4 fi
5 SRC=$1
6 if [ "X$1" = "X" ]; then
7 echo "Usage: ./loadngo-c64.sh <source.60p>"
8 exit 1
9 fi
10 OUT=/tmp/a-out.prg
11 bin/sixtypical --traceback --prelude=c64 $SRC > $OUT || exit 1
12 ls -la $OUT
13 if [ -e vicerc ]; then
14 $X64 -config vicerc $OUT
15 else
16 $X64 $OUT
17 fi
18 rm -f $OUT
+0
-19
loadngo.sh less more
0 #!/bin/sh
1
2 if [ "X$X64" = "X" ]; then
3 X64=x64
4 fi
5 SRC=$1
6 if [ "X$1" = "X" ]; then
7 echo "Usage: ./loadngo.sh <source.60p>"
8 exit 1
9 fi
10 OUT=/tmp/a-out.prg
11 bin/sixtypical --traceback --basic-prelude $SRC > $OUT || exit 1
12 ls -la $OUT
13 if [ -e vicerc ]; then
14 $X64 -config vicerc $OUT
15 else
16 $X64 $OUT
17 fi
18 rm -f $OUT
66 [Falderal]: http://catseye.tc/node/Falderal
77
88 -> Functionality "Compile SixtyPical program" is implemented by
9 -> shell command "bin/sixtypical --basic-prelude --traceback %(test-body-file) >/tmp/foo && tests/appliances/bin/dcc6502-adapter </tmp/foo"
9 -> shell command "bin/sixtypical --prelude=c64 --traceback %(test-body-file) >/tmp/foo && tests/appliances/bin/dcc6502-adapter </tmp/foo"
1010
1111 -> Tests for functionality "Compile SixtyPical program"
1212
00 #!/usr/bin/env python
11
2 # script that allows the binary output of sixtypical --basic-prelude --compile to be
2 # script that allows the binary output of sixtypical --prelude=c64 --compile to be
33 # disassembled by https://github.com/tcarmelveilleux/dcc6502
44
55 import sys