------------------------------------------------------------------------------------------------------------
Vintage Computing Christmas Challenge 2024 Timex/Sinclair 2068
emulated 8K AROS (Application ROM-Oriented Software) auto-boot
cartridge entry by TS2068_FAN
 
If you are interested in learning more about the Timex/Sinclair 2068, I recommend participating in:
https://www.timexsinclair.com/community/
https://ts2068.groups.io/
------------------------------------------------------------------------------------------------------------
Essential Dependencies:
------------------------------------------------------------------------------------------------------------
A host operating system (OS) that supports DOSBox (or one of its variants)
 
DOSBox : https://www.dosbox.com/download.php?main=1
 
AZ80 built for MS-DOS (I used TurboC 2.01): https://www.retrotechnology.com/restore/az80.html
CHKSUM for MS-DOS : https://vetusware.com/download/CHKSUM%201.04a/?id=12617
DZ80 for MS-DOS : http://www.inkland.org.uk/dz80/
EAEDX.BAT : See below source code
EZEDIT : https://web.archive.org/web/20101026184430/http://craighessel.webs.com/
HEX2BIn : https://www.keil.com/download/docs/7.asp
OD.EXE : See below source code
UHEX : https://sourceforge.net/projects/uhex/
Warajevo 2.51 : https://worldofspectrum.net/warajevo/Download.html
------------------------------------------------------------------------------------------------------------
Non-Essential Dependencies (edit EAEDX.BAT to exclude their use, if necessary):
------------------------------------------------------------------------------------------------------------
CREATERM.BAT : See below for source code to create this document
MD5SUM : https://sourceforge.net/projects/freedos/
TOUCH : https://sourceforge.net/projects/freedos/
ZIP : https://sourceforge.net/projects/freedos/
------------------------------------------------------------------------------------------------------------
To review and run the Timex/Sinclair 2068 Vintage Computing Christmas Challenge
2024 emulated cartridge entry within a DOSBox environment:
1) EAEDX VCCC2024               (opens the source code for review/edit)
2) Press <Enter> to open the default file "VCCC2024.Z80" at the "Text file:" prompt.
3) {Review the code}
4) Press <F7>                   (save the text document)
5) Press <Enter> to the question "Abort? N"
6) Press <Enter> to the question "Switch? N"
7) Press <Enter> to save the current file as "VCCC2024.Z80"
 
You should see the following quickly appear on the screen:
Z-80 Cross-Assembler (Portable) Ver 0.1++
Copyright (c) 1986-1988 William C. Colley, III
Copyright (c) 2021 Herb Johnson w/fixes
 
No Errors
 
HEX2BIN Version 1.06
Copyright (c) 1995 Programix Corp.
Portions copyright (c) 1993-1995 BITWARE.
All rights reserved.
Status: Creating binary file.
Status: Writing 8 bytes at address 0x00008078.
Status: HEX to BIN conversion was successful.
INFO: Read [120] bytes of binary data starting at 0x8008 from [vccc2024.bin]
INFO: Wrote [8201] bytes of binary data to output file [vccc2024.dck]
INFO: Wrote [120] bytes of binary Z-80 machine code to file [8008z80.bin]
Exiting...
 8008HZ80.BIN
   1 File(s) copied.
00000000 Warning: cannot open swap file c:\cwsdpmi.swp
 
8) Warajevo's T/S 2068 emulator should launch with the emulated DOCK cartridge
9) Press <ALT><F4> to exit the cartridge simulation
You should see the following on the screen:
Program finish at address #8038
Exiting...
Y:\AZ80
------------------------------------------------------------------------------------------------------------
Example dependencies in your DOSBox \AZ80 (or equivalent) folder and their checksums
(Essentials are prefaced with a "* ") :
 
Y:\AZ80\
8008hz80.bin   113EE48A  EF61   Sun 12-22-2024  21:04:14  A...            120
az80.c         ADEF4FAA  881C   Sat 10-12-2024  08:02:02  A...         20,082
az80.doc       77939437  0DAD   Sat  6-04-2022  16:18:34  A...         44,316
az80.h         1EB9946D  A454   Sat 10-12-2024  08:02:02  A...         12,588
az80dir.chk    00000000  0000   Sun 12-22-2024  21:36:18  A...              0
az80eval.c     4DDB5234  6DB9   Sat 10-12-2024  08:02:02  A...         13,111
az80eval.exe   CAE98C7F  2EAA   Sat 10-12-2024  08:02:02  A...         21,372
az80util.c     43C14EF4  E825   Sat 10-12-2024  08:02:02  A...         18,248
az80ut~1.c     70127259  B1B4   Sun  6-20-2021  16:59:42  A...         13,347
az80ut~2.c     70127259  B1B4   Sun  6-20-2021  16:59:42  A...         13,347
az80_2~1.c     0A619CEE  9145   Sat 10-12-2024  08:02:02  A...         19,677
az80_dec.exe   3A296629  D172   Mon  8-05-2024  18:42:34  A...         21,372
az80_dir.chk   43F1AF50  0AA0   Wed 12-18-2024  08:02:20  A...          6,182
* az80_dos.exe   12183534  68E6   Fri  4-23-2021  12:20:36  A...         36,294
bunzip2.exe    32E7B2E2  169A   Sat 12-14-2024  22:11:52  A...          2,048
bzcat.exe      32E7B2E2  169A   Sat 12-14-2024  22:11:52  A...          2,048
bzip2.exe      DC7B83C0  B7C9   Sat 12-14-2024  22:11:52  A...        192,512
* chksum.com     E248E220  9C30   Thu 12-12-2024  21:09:24  A...          5,696
createrm.bat   7B85B66F  9286   Sun 12-22-2024  21:30:54  A...            545
creati~1.odt   757CB353  7BB0   Wed 12-18-2024  08:25:04  A...         28,823
cwsdpmi.exe    A18C506D  274F   Sat 12-14-2024  22:11:52  A...         21,325
debug.com      B8760D40  72A7   Sat 12-14-2024  22:11:52  A...         22,544
debugx.com     8BBFF09B  BE77   Sat 12-14-2024  22:11:52  A...         27,656
dz80.exe       A2C7D042  F175   Thu 12-12-2024  21:09:32  A...         83,588
dz80.ini       0A3A0058  DB07   Thu 12-12-2024  21:09:34  A...          1,400
dz80.txt       457A6111  F01C   Thu 12-12-2024  21:09:34  A...         29,554
* eaedx.bat      E9E886D4  B0FA   Sun 12-22-2024  20:30:04  A...          2,339
* ezedit.com     34FDBBE0  69EF   Sat 10-12-2024  08:02:02  A...          5,502
fc.exe         B8FA415F  94D6   Sat 12-14-2024  22:11:52  A...         14,835
file_id.diz    5BAFF8FF  C207   Sun 12-22-2024  21:16:08  A...            720
find.com       9ABDE35B  4287   Sat 12-14-2024  22:11:52  A...          7,668
grep.com       6D5C467E  3C8E   Sat 10-12-2024  08:02:02  A...          7,029
grep.exe       C2BA85FD  21C6   Sat 12-14-2024  22:11:52  A...         89,679
gzip.exe       F28E7F03  9568   Sat 12-14-2024  22:11:52  A...         39,910
head.com       319D589C  7648   Sat 12-14-2024  22:11:52  A...          9,742
* hex2bin.exe    0AFDD0F7  1E23   Tue 10-01-2024  07:15:54  A...         11,642
hex2bin.zip    F81746AA  9FA6   Tue 10-01-2024  07:15:40  A...         12,343
less.exe       00E87E04  C91C   Sat 12-14-2024  22:11:54  A...         95,356
md5sum.exe     247DA3F9  CE46   Sat 12-14-2024  22:11:54  A...         30,579
more.exe       DE16FE96  39DF   Sat 12-14-2024  22:11:54  A...          6,942
more2.exe      99ED0C74  6A8E   Thu 12-12-2024  21:33:32  A...         13,824
od.c           F3796D26  E406   Sun 12-22-2024  21:30:16  A...          2,380
* od.exe         47CE09D7  560C   Wed  8-12-1998  00:22:44  A...          9,254
padfile4.c     B312BE9D  F9A6   Sun 12-22-2024  20:40:54  A...          6,669
* padfile4.exe   2AE976D1  9EC8   Sat 12-14-2024  09:38:12  A...         24,589
r1             2904A74A  6C0C   Sun 12-22-2024  20:27:44  A...          3,784
r2             570CE9E4  19EA   Sun 12-22-2024  20:30:26  A...            244
r3             DCE5F4BB  FF4F   Sun 12-22-2024  20:30:54  A...            243
r4             8DB9B4DC  CCCD   Sun 12-22-2024  20:31:16  A...            240
r5             3287459B  D2C8   Sun 12-22-2024  20:31:46  A...            235
r6             3AFD1812  6F19   Sun 12-22-2024  20:32:04  A...            241
r7             F06BA882  C7F7   Sun 12-22-2024  20:32:38  A...            266
r8             C1C18C62  2394   Sun 12-22-2024  20:34:18  A...            249
readme.txt     C88A5BA2  079A   Tue 10-03-1989  17:41:00  A...          4,137
tar.exe        9D0F5402  A4DD   Sat 12-14-2024  22:11:54  A...         56,789
tee.exe        10D2970B  AFCF   Sat 12-14-2024  22:11:54  A...         12,315
touch.com      9C70B378  BF08   Sat 12-14-2024  22:11:54  A...          2,661
tree.com       A75463FC  C89D   Sat 12-14-2024  22:11:54  A...          9,893
uhex.com       61B80748  5E7F   Tue 10-01-2024  07:17:24  A...         10,993
uhex.txt       078431A0  FD53   Tue 10-01-2024  07:17:24  A...          3,329
unpack.com     B29D0D56  9EDD   Sat 10-12-2024  08:02:06  A...         14,710
unzip.exe      02567750  7368   Sat 12-14-2024  22:11:54  A...        197,120
* vcc2024c.z80   0CE5D8A5  D4E3   Sun 12-22-2024  19:29:22  A...          3,177
vccc2024.bak   E851F9F4  0455   Sun 12-22-2024  21:04:10  A...            670
vccc2024.bin   113EE48A  EF61   Sun 12-22-2024  21:04:14  A...            120
vccc2024.chk   F3029A8A  6D83   Sun 12-22-2024  21:04:16  A...            173
vccc2024.dck   11D8122E  EB97   Sun 12-22-2024  21:04:14  A...          8,201
vccc2024.dis   2A79DA60  B5A4   Sun 12-22-2024  21:04:16  A...        146,814
vccc2024.hex   504B8C11  36F1   Sun 12-22-2024  21:04:14  A...            357
vccc2024.lst   1BBC1A17  3741   Sun 12-22-2024  21:04:14  A...          2,408
vccc2024.txt   CFF8088D  9EB8   Sun 12-22-2024  21:34:42  A...         27,540
* vccc2024.z80   E851F9F4  0455   Sun 12-22-2024  21:04:14  A...            670
vccc20~1.png   0EE4F625  192F   Sun 12-22-2024  21:21:54  A...         27,848
zip.exe        A9DE61FD  9AE7   Sat 12-14-2024  22:11:54  A...         93,048
zip16.exe      72FD61DC  5290   Sat 12-14-2024  22:11:54  A...         86,049
zipcloak.exe   6EB821FE  1B73   Sat 12-14-2024  22:11:54  A...         53,713
zipnote.exe    01DCAD44  DD97   Sat 12-14-2024  22:11:54  A...         51,272
zipsplit.exe   4912E077  063C   Sat 12-14-2024  22:11:54  A...         52,373
zmac.c         150E1BDB  BBC0   Sat 10-12-2024  08:02:06  A...        146,250
zmac.exe       95854474  FCAC   Tue 12-17-2024  23:03:30  A...         50,348
 
Files processed:  80    Total size:  2,117,277 bytes
Master total:  C3989BB0  EEEA
------------------------------------------------------------------------------------------------------------
Example dependencies in your DOSBox \WARSP251 (or equivalent) folder and their checksums
(Essentials are prefaced with a "* ") :
 
 
Y:\WARSP251\
addition.dbf   FD503E15  3D3A   Sat 12-14-2024  00:33:04  A...             67
basascii.txt   9199D2B4  45AE   Sun  2-25-2024  21:07:50  A...             27
comm128.bzx    B27461F9  4241   Tue  7-19-2022  08:32:00  A...          6,000
e.tap          A668DDF3  5DE2   Sun 12-22-2024  21:04:18  A...             12
faq.doc        F7A47E49  F465   Tue  7-19-2022  08:32:00  A...         30,276
ico&pifs.zip   BEA5A8AD  AD2F   Tue  7-19-2022  08:32:00  A...          4,147
makereg.exe    90149035  448F   Tue  7-19-2022  08:32:00  A...         16,096
news.doc       D841BC2D  2F03   Tue  7-19-2022  08:32:00  A...         32,254
software.dbf   CCFF6CCD  B84F   Sat 12-14-2024  00:33:04  A...            483
software.dbt   BBC13E4E  DF0B   Sat 12-14-2024  00:33:04  A...            512
specsim.cfg    C50339D1  4C72   Sun 12-22-2024  00:01:36  A...             42
transhlp.doc   F8EE6513  4507   Tue  7-19-2022  08:32:00  A...         18,234
* ts2068.exe     CD17BDB6  04A1   Tue  7-19-2022  08:32:00  A...        100,753
* ts2068_h.rom   BF44EC3F  3CF1   Tue  7-19-2022  08:32:00  A...         16,384
* ts2068_x.rom   AE16233A  CFE6   Tue  7-19-2022  08:32:00  A...          8,192
vccc2024.dck   11D8122E  EB97   Sun 12-22-2024  21:04:16  A...          8,201
 
Files processed:  16    Total size:  241,680 bytes
Master total:  995DED69  5E13
------------------------------------------------------------------------------------------------------------
CREATERM.BAT listing:
------------------------------------------------------------------------------------------------------------
@ECHO OFF
REM CREATERM.BAT
REM Create "Readme.txt" file for Vintage Computing Christmas Challenge 2024
REM Timex/Sinclair 2068 AROS auto-start cartridge entry
REM TS2068_FAN
REM 22DEC24
ECHO Creating VCCC2024.TXT from individual text items...
DEL AZ80DIR.CHK
DEL WARAJDIR.CHK
CHKSUM > AZ80DIR.CHK
CHKSUM \WARSP251 > WARAJDIR.CHK
DEL VCCC2024.TXT
COPY R1+AZ80DIR.CHK+R2+WARAJDIR.CHK+R3+CREATERM.BAT+R4+EAEDX.BAT+R5+OD.C+R6+PADFILE4.C+R7+VCC2024C.Z80+R8 VCCC2024.TXT > NUL:
ECHO VCCC2024.TXT "Readme" file should now be available...
------------------------------------------------------------------------------------------------------------
EAEDX.BAT listing:
------------------------------------------------------------------------------------------------------------
@ECHO OFF
REM EAEDX.bat - Edit, Assemble, Extract (machine code), Dock file create,
REM             Checksum
REM
REM Based upon Myarc Geneve 9640 ecars.bat (Edit, Compile [C], Assemble, Run,
REM Save)
REM
REM This MS-DOS batch file may be used to work on a Timex/Sinclair 2068
REM 8K machine code (MC) DOCK (*.dck) cartridge file project
 
REM TS2068_FAN
REM 20241212
REM
REM Backup source file in case anything gets corrupted
COPY %1.z80 %1.BAK
IF NOT ERRORLEVEL 0 GOTO :COPYERR
 
REM Allow user to review/edit Zilog Z-80 source code file
EZEDIT %1.z80
IF NOT ERRORLEVEL 0 GOTO :EDITERR
 
REM Assemble Z-80 source code
AZ80_DOS %1.Z80 -l%1.LST -o%1.HEX
IF NOT ERRORLEVEL 0 GOTO :COMPERR
 
REM Convert Intel Hex az80 output to a binary Z80 machine code [MC] file
HEX2BIN %1.HEX %1.BIN
IF NOT ERRORLEVEL 0 GOTO :CONVERR
 
REM Convert MC data to an auto-executable machine code 8K cartridge for the Timex/Sinclair 2068 cartridge port
PADFILE4 %1.BIN %1.DCK
IF NOT ERRORLEVEL 0 GOTO :DCKERR
 
REM Rename the raw MC data file to match the project name
DEL %1.BIN
COPY 8008HZ80.BIN %1.BIN
IF NOT ERRORLEVEL 0 GOTO :BINERR
 
REM For completeness, add the hex to text version of the MC to the deliverable
OD -x %1.BIN %1.ODH
IF NOT ERRORLEVEL 0 GOTO :ODERR
 
REM Calculate CRC32 (32-bit checksum)
CHKSUM %1.DCK > %1.CHK
IF NOT ERRORLEVEL 0 GOTO :XSUMERR
 
REM For completeness, ensure that the MC data disassembles correctly
DZ80 %1.DCK -h=17 -m=0x8008 -l > %1.DIS
IF NOT ERRORLEVEL 0 GOTO :DISERR
 
REM Make cartridge easier to find for loading into the Warajevo T/S 2068 emulator
COPY %1.DCK \WARSP251\
REM Run the executable
CD \WARSP251
CALL TS2068 /n /e%1
CD \AZ80
GOTO :END
 
REM Error output
:COPYERR
ECHO Error making a backup of input file.
GOTO :END
:EDITERR
ECHO Error editing source file.
GOTO :END
:COMPERR
ECHO Error compiling input Z-80 source file.
GOTO :END
:CONVERR
ECHO Error converting Intel Hex file to a binary file.
GOTO :END
:DCKERR
ECHO Error extracting machine code and/or creating %1.DCK file.
GOTO :END
:BINERR
ECHO Error extracting machine code into binary file.
GOTO :END
:XSUMERR
ECHO Error determining checksum of %1.DCK file.
GOTO :END
:DISERR
ECHO Error disassembling %1.DCK file's machine code.
GOTO :END
:END
ECHO Exiting...
------------------------------------------------------------------------------------------------------------
OD.C listing:
------------------------------------------------------------------------------------------------------------
/* od.c - a simple implementation of the UNIX 'od' command */
/* Jeffrey A. Kuhlmann 24JUL98 */
 
#include "stdio.h"              /* because I use file- and i/o-handling */
 
main(int argc,char **argv)
{
int MAGIC;
int ictr,ictr1,iinchar,ibase;    /* set up temporary counter,input character */
                           /* and integer base */
FILE *infile;              /* process arguments */
char hexcode[80],temp[255];        /* 1 line's worth of hexdata */
MAGIC = 8;      /* dump 8 bytes at a time, default */
/* the next lines clear out a string [strcpy[hexcode,""] doesn't do it */
for (ictr1=0;ictr1<sizeof(hexcode)-2;ictr1++)
 hexcode[ictr1]='\0';
hexcode[ictr1]='\0';    /* null-terminate string */
hexcode[0]=0;
if (argc<2) {help(); printf("%d \n%s",sizeof(hexcode),hexcode); exit(1);}
for(ictr=1;ictr<argc-1;ictr++)
 { if (argv[ictr][1] == 'c') ibase=26; else
   if (argv[ictr][1] == 'C') ibase=26; else
   if (argv[ictr][1] == 'x') { ibase=16; MAGIC=16;} else
   if (argv[ictr][1] == 'X') { ibase=16; MAGIC=16;} else
                             ibase=26;
 }
ictr=0;
infile = fopen(argv[argc-1],"r");  /* open file for read-only */
 printf("%06x ",0);                /* show first offset (0) */
while (1)
{ iinchar = fgetc(infile);         /* get character from file */
  if (iinchar == EOF) break;       /* if it is EOF, stop this process */
  if (ibase==16) printf("%02x ",iinchar); else
  if ((iinchar>31) && (iinchar<128))
  { printf("   %2c ",iinchar);
  sprintf(temp," %02x",iinchar);
  strcat(hexcode,temp);
  }
  else
  {
  printf(" \\%3d ",iinchar);
  sprintf(temp," %02x",iinchar);
  strcat(hexcode,temp);
  }
  ictr++;
  if ((ictr%MAGIC)==0)
  {
  printf("%s\n%06x ",hexcode,ictr);  /* after every 8 chars, n/l */
  /* the next lines clear out a string [strcpy[hexcode,""] doesn't do it */
  for (ictr1=0;ictr1<sizeof(hexcode)-2;ictr1++)
  hexcode[ictr1]='\0';
  hexcode[ictr1]='\0';  /* null-terminate string */
  hexcode[0]=0;
  }
}
if ((ictr%8)!=0)
{ ictr1 = (8 - (ictr%8) + 1) * 5;
  for(ictr=0;ictr<=ictr1;ictr++) putch(' ');
  printf("%s",hexcode);
}
exit(0);
}
 
help()
{
puts("od - a simple implementation of UNIX od command");
puts("Jeffrey A. Kuhlmann 24JUL98");
puts("Usage: od {-x/-X/-c/-C} file_name");
puts("where 'x' is hex and 'c' is character-output");
return;
}
 
------------------------------------------------------------------------------------------------------------
PADFILE4.C listing:
------------------------------------------------------------------------------------------------------------
/* PadFile4.c - A very simple C executable that will extract a portion   */
/*             of an Intel-hex format to binary file converted T/S 2068  */
/*             *.bin file and extract just the binary data needed for    */
/*             appending to Warajevo and T/S 2068 AROS DOCK Cartridge    */
/*             headers.  An 8K DOCK (*.DCK) file will be created.         */
 
/* Normal usage:                                                         */
/* 1) Use az80 (for MS-DOS) to compile Zilog Z-80 machine code (MC)      */
/*      for an 8K Timex/Sinclair 2068 DOCK bank ROM, starting at 0x8008  */
/* 2) run 3rd party hex2bin program on the Intel Hex to get a *.bin file */
/* 3) Run this program to convert the Z80 MC *.bin file to an auto-start */
/*      AROS DOCK file for the Timex/Sinclair 2068                       */
/* 4) Test the resulting DOCK image using Warajevo or ZSaurux emulators  */
 
/* Limitations:                                                          */
/* . Restricted to extracting 8K of machine code (MC) data at 0x8008     */
 
/* TO DO: */
/* . Add more validation checks                                          */
/* . Allow user to specify size of output file (must be in 8K multiples  */
/* . Add help switch (and display if no command-line options present)    */
/* . Port to other Windows (Code::Blocks) and/or MS-DOS C compilers (gcc)*/
/* . Port to PowerBASIC, since some of Jeff B's utilities use it         */
 
/* Reference(s):                                                         */
/* https://loadzx.com/timexcomputerworld/timex-cartridge/                */
 
/* Written in Borland Turbo C 2.01 */
/* 20241214 */
/* TS2068_FAN */
 
#include <stdio.h>
#include <stdlib.h>
 
char buff[8201]; /* Max buffer needed for 8K T/S 2068 DCK image + emulator header */
 
void initEmulatorHeader(void)
{
        /* Warajevo emulator DCK 9-byte header */
        buff[ 0] = 0x00; /* DOCK file */
        buff[ 1] = 0x00; /* Read only 8K chunk #1 (see memory map) */
        buff[ 2] = 0x00; /*                     2 */
        buff[ 3] = 0x00; /*                     3 */
        buff[ 4] = 0x00; /*                     4 */
        buff[ 5] = 0x02; /*                     5 */
        buff[ 6] = 0x00; /*                     6 */
        buff[ 7] = 0x00; /*                     7 */
 
        buff[ 8] = 0x00; /*                     8 */
 
        /* AROS 8 byte header */
        buff[ 9] = 0x02; /* Machine Code only */
        buff[10] = 0x02; /* AROS cartridge */
        buff[11] = 0x08; /* Starting address (LSB/MSB) */
        buff[12] = 0x80; /* Cartridge will boot at 0x8000, MC start at 0x8008 */
        buff[13] = 0x0f; /* Memory chunk specification */
        buff[14] = 0x01; /* autostart if '1' */
        buff[15] = 0x00; /* Number of bytes to reserve for MC variables (LSB/MSB) */
        buff[16] = 0x02; /* " " - reserve 256 bytes */
 
        return;
}
 
void help(char* progName)
{
        printf("NOTE: Only input file and output file are currently supported\n");
        printf("%s options and usage:\n", progName);
        printf("Where options are the following:\n");
        printf("* indicates not implemented\n");
        printf("-a/-A   AROS image [default]\n");
        printf("-b/-B   BASIC program (and BASIC+MC)\n");
        printf("-c/-C*  Chunk specifications\n");
        printf("        (use binary 00000000-11111111 to indicate used \n");
        printf("        memory banks\n");
        printf("-d/-D   Add 8 byte dock header before user file [default]\n");
        printf("-e/-E   Add 9 byte emulator header [default]\n");
        printf("-f/-F   Add 0xFF between binary sections\n");
        printf("-i/-I   Input file (required)\n");
        printf("-j/-J   'Jam' machine code bytes into an existing REM statement\n");
        printf("-l/-L*  LROS image\n");
        printf("-m/-M   Machine Code program\n");
        printf("-n/-N   No auto-run bit set\n");
        printf("-o/-O   Output file (defaults to output.dck\n");
        printf("-r/-R*  Auto-run (auto-start) cartridge\n");
        printf("-s/-S*  Starting address [defaults to 0x8008] usage: -s8008\n");
        printf("-v/-V*  Bytes to reserve for machine code variables\n");
        printf("        (enter 0100 for 1 byte, 0002 for 512 bytes reserved)\n");
        printf("        usage: -v0002\n");
        printf("-0*     Create 40K ROM image\n");
        printf("-1/-16* Create 16K ROM image\n");
        printf("-2/-24* Create 24K ROM image\n");
        printf("-3/-32* Create 32K ROM image\n");
        printf("-4/-48* Create 48K ROM image\n");
        printf("-5/-56* Create 56K ROM image\n");
        printf("-6/-64* Create 64K ROM image\n");
        printf("-8      Create  8K ROM image\n");
        printf("-9      Create  4K REM statement containing 0xC9 [RET]\n");
 
        printf("-l/-L LROS image [not implemented]\n");
        return;
}
 
int main(int argc, char** argv)
{
        /* Set up file handles */
        FILE *inf; /* input file: must be an 8K binary Zilog Z-80 machine code file */
        FILE *MC;  /* File handle for writing raw machine code data to a separate file */
        FILE *outf; /* File handle for output 8K Timex/Sinclair 2068 DOCK *.dck cartridge file */
 
        /* int ctr; */
        size_t readcount, writecount;
 
        initEmulatorHeader();
 
        /* If insufficient command-line arguments are provided, print program help */
        if (argc != 3)
        {
                help(argv[0]);
                exit(1);
        }
 
        inf =  fopen(argv[1],"rb");
        if (!inf)
        {
                printf("Error reading input file [%s]\n",argv[1]);
        }
 
        outf = fopen(argv[2],"wb");
        if (!outf)
        {
                printf("Error writing output file [%s]\n",argv[2]);
        }
 
        /* When hex2bin converts az80's Intel Hex file to a binary file, */
        /* it creates a binary file padded with 32K of data before MC    */
        /* that we want to put into the cartridge image.  This must be   */
        /* bypassed */
        fseek(inf,0x8008,0);
        readcount = fread(&buff[0x11],sizeof(char),sizeof(buff)-17*sizeof(char),inf);
        printf("INFO: Read [%d] bytes of binary data starting at 0x8008 from [%s]\n",readcount,argv[1]);
 
        MC = fopen("8008hz80.bin","wb");
        if (!MC)
        {
                printf("Error writing raw Z-80 binary data to [%s]\n","8008hz80.bin");
        }
        writecount = fwrite(&buff[0],sizeof(char),sizeof(buff),outf);
        printf("INFO: Wrote [%d] bytes of binary data to output file [%s]\n",writecount,argv[2]);
 
        writecount = fwrite(&buff[0x11],sizeof(char),readcount,MC);
        printf("INFO: Wrote [%d] bytes of binary Z-80 machine code to file [%s]\n",writecount,"8008hz80.bin");
        fclose(inf);
        fclose(outf);
        fclose(MC);
        printf("Exiting...\n");
        return 0;
}
------------------------------------------------------------------------------------------------------------
VCCC2024.Z80 (Commented Z-80 assembler code)
------------------------------------------------------------------------------------------------------------
; VCC2024C.Z80
; Zilog Z-80 assembly language, compatible with MS-DOS az80 assembler
; Source code for the following:
; Vintage Computing Christmas Challenge 2024 (VC3 2024) submission
; https://logiker.com/Vintage-Computing-Christmas-Challenge-2024
;
; TS2068_FAN 20241215
 
; Equates
; NOTE: If assembling for the Sinclair Spectrum, the below equates may be different
ROM_CLS EQU $08A6
AT      EQU $16
 
        ORG $8008 ; T/S 2068 AROS 8K DOCK cartridge file start of machine code (MC)
 
; Clear screen and position cursor for first character print
 
        CALL ROM_CLS ; CLS
 
        LD A,AT   ; AT command.  Locate cursor at given X,Y coordinate
        RST $10
        LD A,3    ; Y coordinate
        RST $10
        LD A,14   ; X coordinate
        RST $10
 
; Print bow on top of present
; This might be able to be optimized by using "print string" OS call
        LD A,'\'
        RST $10
        LD A,'o'
        RST $10
        LD A,'/'
        RST $10
 
; Print top line of present (Top-Middle-Bottom graphic)
        CALL TMB
 
; Print 8 rows for the top half of the inside of the present
        LD B,8
LP5     PUSH BC
        CALL INS
        POP BC
        DJNZ LP5
 
; Print middle line of present
        CALL TMB
 
; Print 8 rows for the bottom half of the inside of the present
        LD B,8
LP6     PUSH BC
        CALL INS
        POP BC
        DJNZ LP6
 
        CALL TMB
FIN  JR FIN ; END program.  We can't use RET here because there is no available context/environment to return to
 
; ---------------------------------------------
; - INS - Inside of present logic             -
; ---------------------------------------------
INS  LD A,13 ; Send CR
     RST $10
 
     LD B,6 ; 6 spaces before '!'
     LD A,' '
     LD C,'!'
     CALL LP3
     LD B,8 ; 8 space characters in each section
     LD A,' '
     LD C,'!'
     CALL LP3
     LD B,8
     LD A,' '
     LD C,'!'
     CALL LP3
     RET
; ---------------------------------------------
; - End of INS logic                          -
; ---------------------------------------------
 
; ---------------------------------------------
; - TMB - Top Middle Bottom logic             -
; ---------------------------------------------
TMB  LD A,13  ; Send CR
     RST $10
 
     LD B,6   ; 6 spaces before 1st half of TMB row
     LD A,' '
     LD C,'+'
     CALL LP3
     LD B,8   ; 8 '-' characters in each section
     LD A,'-'
     LD C,'+'
     CALL LP3
     LD B,8
     LD A,'-'
     LD C,'+'
     CALL LP3
     RET
; --------------------------------------------
; - End of TMB logic                         -
; --------------------------------------------
 
; --------------------------------------------
; - Common logic used by TMB and INS         -
; --------------------------------------------
LP3  PUSH AF
     RST $10
     POP AF
     DJNZ LP3
     LD A,C
     RST $10
     RET
; --------------------------------------------
; - End of common logic                      -
; --------------------------------------------
    END ; of source code for VCC2024C.Z80
------------------------------------------------------------------------------------------------------------
END OF VCCC2024 README FILE
------------------------------------------------------------------------------------------------------------
