So if you like to create a cart with a collection of programming languages, you have to hack the thing :) I had the challenge that a friend send me an Atari Artist Cart and asked me if I could put the Atari Artist Program into another cartridge. My idea was to put the software into an AtariMax Flashcart, together with another fine graphics programm, Design Master. But both Programs should work with DOS and should be able to load and save pictures.
The Atari Cartridge Specification defines that with Bit 1 and Bit 2 of the Option Register $BFFD/$9FFD CARTFG the Cart can choose whether a Diskboot should happend or not. Unforuntaly the AtariMax Software don't allow to set this behavior.
So I decided to bundle a DOS with with each Application.
With a Memory Monitor (a 16K BiboMon) a examined where this DOS loaded into memory. OS/A+ 2.0 occupies the memory between $0700 and $1C9F. I dumed this memory portion as a COM-File to disk. Next, a small machine program was appended to the dumped DOS file, taking care of all neccesary initialisation:
A good Linker or Packer (I used Thorsten Karwoths PowerPacker) will help to assemble the DOS File and the Loader into one file. The resulting file is for a plain OS/A+ DOS loadable from AtariMax Cart.
01000 .LI OFF 01010 ************************* 01020 ** DOS OSS/A+ LOADER ** 01030 ** (C) 2004 PSC ** 01040 ** OSS/A+ 2.00 ** 01050 ************************* 01060 ; 01070 .OR $2000 01080 .OF D:OSLOAD.COM 01090 ; 01100 ; 01110 BOOTFLG = $09 01120 DOSVEC = $0A 01130 DOSINI = $0C 01140 ; 01170 HDOSVEC = $15B7 01180 HDOSINI = $1540 01190 HDOSTAB = $07CB ; HTABS D: 01200 ; 01210 HATABS = $031A 01220 ; 01230 START 01240 ; 01250 LDA #$01 ; BOOT 01260 STA BOOTFLG ; SUCCESS 01270 ; SET DOS ADDRESS 01280 LDA #HDOSVEC 01290 STA DOSVEC 01300 LDA /HDOSVEC 01310 STA DOSVEC+1 01320 ; SET D: ENTRY 01330 LDX #$F ; OFFSET D: 01340 LDA #$44 ; D 01350 STA HATABS,X 01360 LDA #HDOSTAB 01370 STA HATABS+1,X 01380 LDA /HDOSTAB 01390 STA HATABS+2,X 01400 ; INIT DOS 01410 JSR HDOSINI 01420 LDA #START 01430 STA DOSINI 01440 LDA /START 01450 STA DOSINI+1 01460 ; START DOS SHELL 01470 JSR HDOSVEC 01480 ; 01490 RTS 01500 ------------------------------
The resulting compound file (COM-File) includes:
01000 .LI OFF 01010 ************************* 01020 ** DESIGN MASTER LOADER** 01030 ** (C) 2004 PSC ** 01040 ** OSS/A+ 2.00 ** 01050 ************************* 01060 ; 01070 .OR $2000 01080 .OF D:DMLOAD.COM 01090 ; 01100 ; 01110 BOOTFLG = $09 01120 DOSVEC = $0A 01130 DOSINI = $0C 01140 ; 01150 DMSTART = $79D1 01160 ; 01170 HDOSVEC = $15B7 01180 HDOSINI = $1540 01190 HDOSTAB = $07CB ; HTABS D: 01200 ; 01210 HATABS = $031A 01220 ; 01230 START 01240 ; 01250 LDA #$01 ; BOOT 01260 STA BOOTFLG ; SUCCESS 01270 ; SET DOS ADDRESS 01280 LDA #HDOSVEC 01290 STA DOSVEC 01300 LDA /HDOSVEC 01310 STA DOSVEC+1 01320 ; SET D: ENTRY 01330 LDX #$F ; OFFSET D: 01340 LDA #$44 ; D 01350 STA HATABS,X 01360 LDA #HDOSTAB 01370 STA HATABS+1,X 01380 LDA /HDOSTAB 01390 STA HATABS+2,X 01400 ; INIT DOS 01410 JSR HDOSINI 01420 LDA #START 01430 STA DOSINI 01440 LDA /START 01450 STA DOSINI+1 01460 ; START DESIGNMASTER 01470 JSR DMSTART 01480 ; 01490 RTS 01500 ------------------------------
The loader for Atari Artist has some more work to do:
01000 .LI OFF 01010 ************************* 01020 ** ATARI ARTIST LOADER ** 01030 ** (C) 2003 PSC ** 01040 ** OSS/A+ 2.00 ** 01050 ************************* 01060 ; 01070 .OR $7000 01080 .OF D:AARTIS3.COM 01090 ; 01100 ; 01110 RAMTOP = $6A 01120 CIOV = $E456 01130 ICCOM = $342 01140 ICBADR = $344 01150 ICAUX1 = $34A 01160 ICAUX2 = $34B 01170 ; 01180 COPN = $03 01190 CCLOSE = $0C 01200 ; 01210 FROM = $D2 01220 TO = $D4 01230 NUM = $D6 01240 ; 01250 BOOTFLG = $09 01260 DOSVEC = $0A 01270 DOSINI = $0C 01280 ; 01290 CARTINIT = $8F48 01300 CARTRUN = $8F5D 01310 ; 01320 HDOSVEC = $15B7 01330 HDOSINI = $1540 01340 HDOSTAB = $07CB ; HTABS D: 01350 ; 01360 HATABS = $031A 01370 ; 01380 START 01390 LDA #$80 ; SAVE MEM 01400 STA RAMTOP ; FOR CART 01410 ; 01420 LDA #0 ; GR.0 01430 JSR GRAFIX 01440 ; 01450 ; TEST IF INITAL RUN 01460 ; 01470 LDA $BFFF 01480 BNE .3 01490 ; 01500 LDA #$30 ; $3000 01510 STA FROM+1 01520 LDA #$80 ; $8000 01530 STA TO+1 01540 LDA #$40 ; $4000 01550 STA NUM 01560 LDA #0 01570 STA FROM 01580 STA TO 01590 ; 01600 TAY 01610 TAX 01620 .1 01630 LDA (FROM),Y 01640 STA (TO),Y 01650 INY 01660 BNE .2 01670 INC FROM+1 01680 INC TO+1 01690 .2 01700 DEX 01710 BNE .1 01720 DEC NUM 01730 BPL .1 01740 ; 01750 LDA #$01 ; BOOT 01760 STA BOOTFLG ; SUCCESS 01770 ; SET DOS ADDRESS 01780 .3 LDA #HDOSVEC 01790 STA DOSVEC 01800 LDA /HDOSVEC 01810 STA DOSVEC+1 01820 LDA #START 01830 STA DOSINI 01840 LDA /START 01850 STA DOSINI+1 01860 ; SET D: ENTRY 01870 LDX #$F ; OFFSET D: 01880 LDA #$44 ; D 01890 STA HATABS,X 01900 LDA #HDOSTAB 01910 STA HATABS+1,X 01920 LDA /HDOSTAB 01930 STA HATABS+2,X 01940 ; INIT DOS 01950 JSR HDOSINI 01960 ; RUN CART 01970 JSR CARTINIT 01980 JSR CARTRUN 01990 ; 02000 RTS 02010 ; 02020 GRAFIX 02030 PHA 02040 LDX #6*$10 ; #6 02050 LDA #CCLOSE 02060 STA ICCOM,X 02070 JSR CIOV ; CLOSE#6 02080 ; 02090 LDX #6*$10 02100 LDA #COPN 02110 STA ICCOM,X 02120 LDA #SNAME 02130 STA ICBADR,X 02140 LDA /SNAME 02150 STA ICBADR+1,X 02160 ; 02170 PLA ; SAVED GR.MODE 02180 STA ICAUX2,X 02190 AND #$F0 02200 EOR #$10 02210 ORA #$0C 02220 STA ICAUX1,X 02230 JSR CIOV 02240 RTS 02250 ; 02260 SNAME .AS "S:" 02270 .HX 9B00 02280 ------------------------------ 02290 .OR $02E0 02300 .DA START 02310 ------------------------------