From 6cee147b6b1f583a03844978c706a9a75749eef5 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 22 Aug 2004 22:51:39 +0000 Subject: Added -c switch --- int2tap.c | 24 +++++++++++++++++++++--- int2tap.txt | 41 ++++++++++++++++++++++++----------------- test/Makefile | 25 ++++++++++++++++++++++++- test/reset.asm | 23 +++++++++++++++++++++++ 4 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 test/reset.asm diff --git a/int2tap.c b/int2tap.c index 2c3eae9..ccfce7f 100644 --- a/int2tap.c +++ b/int2tap.c @@ -52,7 +52,7 @@ const char *progname; */ static void Usage(void) { - fprintf(stderr,"%s: usage %s [ -b ] [ -s ] [ -a address ] " + fprintf(stderr,"%s: usage %s [-b] [-s] [-a addr] [-c addr] " "output-file input-file ... \n",progname,progname); exit(EXIT_FAILURE); } @@ -66,9 +66,11 @@ int main(int argc, char *argv[]) IntelInfo *info; char *outname; unsigned exec_addr; + unsigned clear_addr; + int addr_defined; + int clear_defined; int bin_only; int split; - int addr_defined; int base; int no; int f; @@ -88,6 +90,7 @@ int main(int argc, char *argv[]) /* Set defaults and parse args */ addr_defined=FALSE; + clear_defined=FALSE; bin_only=FALSE; split=FALSE; @@ -120,11 +123,21 @@ int main(int argc, char *argv[]) } addr_defined=TRUE; - exec_addr=(unsigned)strtoul(argv[++f],NULL,0); break; + case 'c': + if (f>argc-2) + { + Usage(); + } + + clear_defined=TRUE; + clear_addr=(unsigned)strtoul(argv[++f],NULL,0); + + break; + default: Usage(); break; @@ -184,6 +197,11 @@ int main(int argc, char *argv[]) { BasicInit(); + if (clear_defined) + { + BasicClearLine(clear_addr); + } + BasicLoadLine(); if (split) diff --git a/int2tap.txt b/int2tap.txt index 6c5b6a7..858ef93 100644 --- a/int2tap.txt +++ b/int2tap.txt @@ -7,37 +7,44 @@ NAME TAP file. SYNOPSIS - int2tap [ -b ] [ -s ] [ -a address ] output-file input-file ... + int2tap [ -b ] [ -s ] [ -a address ] [ -c address ] output-file input- + file ... DESCRIPTION - hex2tap takes one or more Intel format segment files - as produced by - an assembler like tpasm(1) - and produces a Spectrum compatible tape + hex2tap takes one or more Intel format segment files - as produced by + an assembler like tpasm(1) - and produces a Spectrum compatible tape file (TAP file). - The tape file will also optionally include a BASIC loader (see - OPTIONS). This loader will load in the binary file(s) in the same - order they were on the command line. It will then run the code from + The tape file will also optionally include a BASIC loader (see + OPTIONS). This loader will load in the binary file(s) in the same + order they were on the command line. It will then run the code from execute address (see -a in OPTIONS). OPTIONS int2tap accepts these switches - -b Just produce the binary file. By default int2tap will generate - a TAP file with two files in - a BASIC loader and then the code - itself. This switch disables the generation of the BASIC loader - portion. + -b Just produce the binary file(s). By default int2tap will gener- + ate a TAP file with two files in - a BASIC loader and then the + code itself. This switch disables the generation of the BASIC + loader portion. - -s By default int2tap will generate a single CODE file in the tape - file. Using this switch means that each input file will gener- + -s By default int2tap will generate a single CODE file in the tape + file. Using this switch means that each input file will gener- ate a seperate CODE file. -a address - By default int2tap assumes that the base address of the first - input file is the start address. This switch allows that to be - overridden. Note this switch will have no effect if the -b - switch is used. The address can be passed either in decimal, + By default int2tap assumes that the base address of the first + input file is the start address. This switch allows that to be + overridden. Note this switch will have no effect if the -b + switch is used. The address can be passed either in decimal, octal (starting with a 0), or hex (starting with 0x). + -c address + Add a CLEAR address command to the generated BASIC loader. Note + this switch will have no effect if the -b switch is used. The + address can be passed either in decimal, octal (starting with a + 0), or hex (starting with 0x). + SEE ALSO tpasm(1) @@ -53,4 +60,4 @@ BUGS - int2tap(1) + $Date$ int2tap(1) diff --git a/test/Makefile b/test/Makefile index a4cf8c3..c3ebafb 100644 --- a/test/Makefile +++ b/test/Makefile @@ -18,36 +18,56 @@ # # ------------------------------------------------------------------------- # -# $Id: Makefile,v 1.1 2004-08-22 01:06:09 ianc Exp $ +# $Id: Makefile,v 1.2 2004-08-22 22:51:39 ianc Exp $ # +# One file with loader test +# test1: ../int2tap code.bin ../int2tap test1.tap code.bin fuse test1.tap +# Two file with loader test, split and with forced address test +# test2: ../int2tap code.bin screen.bin ../int2tap -a 0x8000 -s test2.tap screen.bin code.bin fuse test2.tap +# Binary only test +# test3: ../int2tap screen.bin ../int2tap -b test3.tap screen.bin fuse test3.tap +# Test for examination to see if it matches .TAP docs +# test4: ../int2tap b2.bin ../int2tap -b test4.tap b2.bin +# Binary only test (again for some reason...) +# test5: ../int2tap code.bin ../int2tap -b test5.tap code.bin fuse test5.tap +# M/C with just a RET (so the BASIC can be examined) +# test6: ../int2tap ret.bin ../int2tap test6.tap ret.bin fuse test6.tap +# Two files into one binary test +# test7: ../int2tap part1.bin part2.bin ../int2tap test7.tap part1.bin part2.bin fuse test7.tap +# CLEAR test +# +test8: ../int2tap reset.bin + ../int2tap -c 0x8000 test8.tap reset.bin + fuse test8.tap + code.bin: code.asm tpasm -P Z80 -o intel code.bin code.asm @@ -66,6 +86,9 @@ part1.bin: part1.asm part2.bin: part2.asm tpasm -P Z80 -o intel part2.bin part2.asm +reset.bin: reset.asm + tpasm -P Z80 -o intel reset.bin reset.asm + ../int2tap: ../*.[ch] cd .. ; make ; cd test diff --git a/test/reset.asm b/test/reset.asm new file mode 100644 index 0000000..9210842 --- /dev/null +++ b/test/reset.asm @@ -0,0 +1,23 @@ +; Test code - used with a CLEAR line to resist a new +; +; $Id$ +; + org 32768 + + ld d,8 +loop: + ld bc,6912 + ld hl,16384 + +loop1: + ld a,r + out (0xfe),a + inc (hl) + inc hl + dec c + jr nz,loop1 + djnz loop1 + + dec d + jr nz,loop + ret -- cgit v1.2.3