diff --git a/presets/apple2/dos33bin.a b/presets/apple2/dos33bin.a new file mode 100644 index 00000000..5554b998 --- /dev/null +++ b/presets/apple2/dos33bin.a @@ -0,0 +1,112 @@ +; -------------------------------------------------- +; Example showing how to create a DOS 3.3 binary +; header and program that is automatically loaded +; into the desired ORIGIN memory address. +; -------------------------------------------------- + + processor 6502 + +; -------------------------------------------------- +; Desired origin +; - Origin must be less than $C000 +; - Origin + size must be less than $13000 +; - Origin must be $0803 or aligned to $xx00 +; -------------------------------------------------- +ORIGIN equ $2000 +SIZE equ END_OF_PRORGAM-ORIGIN + +; -------------------------------------------------- +; DOS 3.3 binary header (4 bytes) +; -------------------------------------------------- + org ORIGIN - 4 ; Subtract 4 ensures correct memory locations + word ORIGIN ; Origin (2 bytes) + word SIZE ; Size (2 bytes), must be length - 4 + +; -------------------------------------------------- +; ROM routines +; -------------------------------------------------- +HOME equ $FC58 + +; -------------------------------------------------- +; Origin and start of program +; -------------------------------------------------- + org ORIGIN ; Starting address + + +start + ; -------------------------------------------------- + ; Clear screen + ; -------------------------------------------------- + jsr HOME + + ; -------------------------------------------------- + ; Print "START $" (7 chars) to $0400..$0406 + ; -------------------------------------------------- + ldx #0 +pfx_loop + lda prefix,x + ora #$80 + sta $0400,x + inx + cpx #7 + bne pfx_loop + + + ; -------------------------------------------------- + ; Print origin in hex to $0407 - $040A + ; -------------------------------------------------- + + ; High byte high nibble + lda #>start + lsr + lsr + lsr + lsr + tax + lda hexchar,x + ora #$80 + sta $0407 + + ; High byte low nibble + lda #>start + and #$0F + tax + lda hexchar,x + ora #$80 + sta $0408 + + ; Low byte high nibble + lda # implements Platform { - newMachine() { return new AppleII(); } - getPresets() { return APPLE2_PRESETS; } + newMachine() { return new AppleII(); } + getPresets() { return APPLE2_PRESETS; } getDefaultExtension() { return ".c"; }; - readAddress(a) { return this.machine.readConst(a); } + readAddress(a) { return this.machine.readConst(a); } // TODO loadBIOS(bios) { this.machine.loadBIOS(a); } - getMemoryMap = function() { return { main:[ - {name:'Zero Page RAM',start:0x0,size:0x100,type:'ram'}, - {name:'Line Input RAM',start:0x200,size:0x100,type:'ram'}, - {name:'RAM',start:0x300,size:0xc0,type:'ram'}, - {name:'DOS Vectors',start:0x3c0,size:0x40,type:'ram'}, - {name:'Text/Lores Page 1',start:0x400,size:0x400,type:'ram'}, - {name:'RAM',start:0x800,size:0x1800,type:'ram'}, - {name:'Hires Page 1',start:0x2000,size:0x2000,type:'ram'}, - {name:'Hires Page 2',start:0x4000,size:0x2000,type:'ram'}, - {name:'RAM',start:0x6000,size:0x6000,type:'ram'}, - {name:'I/O',start:0xc000,size:0x1000,type:'io'}, - {name:'ROM',start:0xd000,size:0x3000,type:'rom'}, - ] } }; - getROMExtension(rom:Uint8Array) { - if (rom && rom.length == 35*16*256) return ".dsk"; // DSK image + getMemoryMap = function () { + return { + main: [ + { name: 'Zero Page RAM', start: 0x0, size: 0x100, type: 'ram' }, + { name: 'Line Input RAM', start: 0x200, size: 0x100, type: 'ram' }, + { name: 'RAM', start: 0x300, size: 0xc0, type: 'ram' }, + { name: 'DOS Vectors', start: 0x3c0, size: 0x40, type: 'ram' }, + { name: 'Text/Lores Page 1', start: 0x400, size: 0x400, type: 'ram' }, + { name: 'RAM', start: 0x800, size: 0x1800, type: 'ram' }, + { name: 'Hires Page 1', start: 0x2000, size: 0x2000, type: 'ram' }, + { name: 'Hires Page 2', start: 0x4000, size: 0x2000, type: 'ram' }, + { name: 'RAM', start: 0x6000, size: 0x6000, type: 'ram' }, + { name: 'I/O', start: 0xc000, size: 0x1000, type: 'io' }, + { name: 'ROM', start: 0xd000, size: 0x3000, type: 'rom' }, + ] + } + }; + getROMExtension(rom: Uint8Array) { + if (rom && rom.length == 35 * 16 * 256) return ".dsk"; // DSK image return ".bin"; }; - getToolForFilename = (fn:string) : string => { + getToolForFilename = (fn: string): string => { if (fn.endsWith(".lnk")) return "merlin32"; else return getToolForFilename_6502(fn); }