AS09 Assembler for M6809/H6309 [1.11]. Page 1 --------------------------------- CSAVEB.ASM --------------------------------- 265 lines read, no errors in pass 1. ****************************************************** * CSAVEB * Save ASCII text in memory to tape as a BASIC program * * This program is relocatable, except that it assumes * its data buffer to start at $4000, and its end-buffe * pointer to be at $3100 and $3101, as per COMM4. Not * that this end-buffer pointer points one byte past th * last byte to be saved; it does not point at the last * byte itself. * * By default (entry point=$3000), the starting address * of the data to save is $4000. The last byte saved * is determined by the end-buffer pointer as described * above. * * The alternative (entry point=$3002) is that the * starting address is found at run-time, at $3102 * and $3103. The last byte saved is determined by the * end-buffer pointer as described above. * * It maps out ROMs when reading the data to write onto * tape, allowing for programs up to almost 48K (if the * saved data starts at address $4000). * * 20-Aug-99 310am WJY - initial version * 2-Sep-99 930pm WJY - write gaps between data blocks * 2-Sep-99 1000pm WJY - write a gap before the EOF blo * 4-Sep-99 1130pm WJY - swap out ROMs to allow 48K fil * 5-Sep-99 105am WJY - show count of written data bloc * 12-Sep-99 10pm WJY - improved block counter * 12-Sep-99 1030pm WJY - allow alternate data address ****************************************************** noopt include "coco.asm" nolist * COMM4 leftover data 4000 = buffer equ $4000 ; buffer of ASCII data 3100 = last equ $3100 ; last address filled + 1 * These are considered as external to the program, * so references to them should not be relative. * Data needed with the special entry point ($3002) 3102 = spdata equ $3102 ; address of the data to save * buffer location for the block of data to write 3200 = blkbuf equ $3200 ; .. $32FF - data block to write 3000 = org $3000 3000 : 2012 start bra normal 3002 : 2016 start2 bra specl 3004 : 9909121030 fcb $99,$09,$12,$10,$30 ; revision date & time 3009 : 43534156454220.. fcc "CSAVEB V0.7" AS09 Assembler for M6809/H6309 [1.11]. Page 2 --------------------------------- CSAVEB.ASM --------------------------------- 3014 : 8e4000 normal ldx #buffer ; default addresses == buffer 3017 : bf3102 stx spdata 301a : 1a50 specl orcc #IRQ|FIRQ ; disable interrupts 301c : 6f8d00c6 clr numwrt,pc ; no blocks written yet 3020 : 8630 lda #$30 3022 : b705fd sta ACTIND-2 * write the name block 3025 : 308d00ac leax namblk,pc 3029 : bf007e stx CBUFAD 302c : cc000f ldd #(NAMBLK<<8)+15 ; NAMBLK:BLKLEN=15 302f : fd007c std BLKTYP ; and BLKLEN 3032 : ad9fa00c jsr [WRTLDR] 3036 : ad9fa008 jsr [BLKOUT] ; write the name block 303a : 8d65 bsr count ; increment block counter * write the data blocks 303c : be3102 ldx spdata 303f : af8d00a1 stx blksrc,pc ; initialize data pointer 3043 : fc3100 dloop ldd last ; figure out the length 3046 : a38d009a subd blksrc,pc 304a : 233c bls endblk ; no data left? 304c : 4d tsta 304d : 2702 beq length 304f : c6ff ldb #255 ; block length = max 3051 : 8601 length lda #DATBLK 3053 : fd007c std BLKTYP ; and BLKLEN 3056 : ae8d008a ldx blksrc,pc ; copy data from source 305a : 108e3200 ldy #blkbuf ; ... into the block buffer 305e : 10bf007e sty CBUFAD ; re-init buffer address 3062 : b7ffdf sta SAMTYP+1 ; map out ROM, map in upper 32K RAM 3065 : a680 copy lda ,x+ 3067 : a7a0 sta ,y+ 3069 : 5a decb 306a : 26f9 bne copy 306c : af8c75 stx