Skip to content

Commit 9fb0757

Browse files
authored
Merge pull request #82 from craigthomas/extract-cas-to-disk
Ability to extract `CAS` to `DSK` and `DSK` to `CAS`
2 parents e8dd5fd + 46437c1 commit 9fb0757

File tree

9 files changed

+795
-565
lines changed

9 files changed

+795
-565
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ that are available:
127127

128128
* `--print` - prints out the assembled statements
129129
* `--symbols` - prints out the symbol table
130-
* `--bin_file` - save assembled contents to a binary file
131-
* `--cas_file` - save assembled contents to a cassette file
132-
* `--dsk_file` - save assembled contents to a virtual disk file
130+
* `--to_bin` - save assembled contents to a binary file
131+
* `--to_cas` - save assembled contents to a cassette file
132+
* `--to_dsk` - save assembled contents to a virtual disk file
133133
* `--name` - saves the program with the specified name on a cassette or virtual disk file
134134

135135
---
@@ -240,9 +240,9 @@ The columns are as follows:
240240

241241
### Save to Binary File
242242

243-
To save the assembled contents to a binary file, use the `--bin_file` switch:
243+
To save the assembled contents to a binary file, use the `--to_bin` switch:
244244

245-
python3 assembler.py test.asm --bin_file test.bin
245+
python3 assembler.py test.asm --to_bin test.bin
246246

247247
The assembled program will be saved to the file `test.bin`. Note that this file
248248
may not be useful on its own, as it does not have any meta information about
@@ -255,9 +255,9 @@ will not have any effect on the assembled file).
255255

256256
### Save to Cassette File
257257

258-
To save the assembled contents to a cassette file, use the `--cas_file` switch:
258+
To save the assembled contents to a cassette file, use the `--to_cas` switch:
259259

260-
python3 assembler.py test.asm --cas_file test.cas
260+
python3 assembler.py test.asm --to_cas test.cas
261261

262262
This will assemble the program and save it to a cassette file called `test.cas`.
263263
The source code must include the `NAM` mnemonic to name the program (e.g.
@@ -268,7 +268,7 @@ The source code must include the `NAM` mnemonic to name the program (e.g.
268268
not be overwritten. If you wish to add the program to `test.cas`, you must
269269
specify the `--append` flag during assembly:
270270

271-
python3 assembler.py test.asm --cas_file test.cas --append
271+
python3 assembler.py test.asm --to_cas test.cas --append
272272

273273
To load from the cassette file, you must use BASIC's `CLOADM` command as follows:
274274

@@ -278,9 +278,9 @@ To load from the cassette file, you must use BASIC's `CLOADM` command as follows
278278

279279
### Save to Disk File
280280

281-
To save the assembled contents to a disk file, use the `--dsk_file` switch:
281+
To save the assembled contents to a disk file, use the `--to_dsk` switch:
282282

283-
python3 assembler.py test.asm --dsk_file test.dsk
283+
python3 assembler.py test.asm --to_dsk test.dsk
284284

285285
This will assemble the program and save it to a disk file called `test.dsk`.
286286
The source code must include the `NAM` mnemonic to name the program on disk (e.g.
@@ -291,7 +291,7 @@ The source code must include the `NAM` mnemonic to name the program on disk (e.g
291291
not be updated. If you wish to add the program to `test.dsk`, you must specify the
292292
`--append` flag during assembly:
293293

294-
python3 assembler.py test.asm --dsk_file test.dsk --append
294+
python3 assembler.py test.asm --to_dsk test.dsk --append
295295

296296
To load from the disk file, you must use Disk Basic's `LOADM` command as follows:
297297

assembler.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ def parse_arguments():
3838
help="print out the assembled statements when finished"
3939
)
4040
parser.add_argument(
41-
"--bin_file", metavar="BIN_FILE", help="stores the assembled program in a binary BIN_FILE"
41+
"--to_bin", metavar="BIN_FILE", help="stores the assembled program in a binary BIN_FILE"
4242
)
4343
parser.add_argument(
44-
"--cas_file", metavar="CAS_FILE", help="stores the assembled program in a cassette image CAS_FILE"
44+
"--to_cas", metavar="CAS_FILE", help="stores the assembled program in a cassette image CAS_FILE"
4545
)
4646
parser.add_argument(
47-
"--dsk_file", metavar="DSK_FILE", help="stores the assembled program in a disk image DSK_FILE"
47+
"--to_dsk", metavar="DSK_FILE", help="stores the assembled program in a disk image DSK_FILE"
4848
)
4949
parser.add_argument(
5050
"--name", help="the name of the file to be created on the cassette or disk image"
@@ -107,10 +107,10 @@ def main(args):
107107
for statement in program.get_statements():
108108
print(statement)
109109

110-
if args.bin_file:
110+
if args.to_bin:
111111
try:
112112
virtual_file = VirtualFile(
113-
SourceFile(args.bin_file, file_type=SourceFileType.BINARY),
113+
SourceFile(args.to_bin, file_type=SourceFileType.BINARY),
114114
VirtualFileType.BINARY
115115
)
116116
virtual_file.open_virtual_file()
@@ -120,13 +120,13 @@ def main(args):
120120
print("Unable to save binary file:")
121121
print(error)
122122

123-
if args.cas_file:
123+
if args.to_cas:
124124
if not coco_file.name:
125125
print("No name for the program specified, not creating cassette file")
126126
return
127127
try:
128128
virtual_file = VirtualFile(
129-
SourceFile(args.cas_file, file_type=SourceFileType.BINARY),
129+
SourceFile(args.to_cas, file_type=SourceFileType.BINARY),
130130
VirtualFileType.CASSETTE
131131
)
132132
virtual_file.open_virtual_file()
@@ -136,13 +136,13 @@ def main(args):
136136
print("Unable to save cassette file:")
137137
print(error)
138138

139-
if args.dsk_file:
139+
if args.to_dsk:
140140
if not coco_file.name:
141141
print("No name for the program specified, not creating disk file")
142142
return
143143
try:
144144
virtual_file = VirtualFile(
145-
SourceFile(args.dsk_file, file_type=SourceFileType.BINARY),
145+
SourceFile(args.to_dsk, file_type=SourceFileType.BINARY),
146146
VirtualFileType.DISK
147147
)
148148
virtual_file.open_virtual_file()

0 commit comments

Comments
 (0)