#define prgmloadersize prgmloaderend - prgmloader #define prgmunloadersize prgmunloaderend - prgmunloader #define prgm_to_usermem_size prgm_to_usermem - prgm_to_usermem_end prgmloaderloc equ SafeSScreen prgmunloaderloc equ SafeSScreen + prgmloadersize prgm_to_usermem_loc equ SafeSScreen + prgmloadersize + prgmunloadersize prgmbasic: prgmasm: call _ClrTxtShdw call _HomeUp call _RunIndicOn call _APDSetup call _EnableAPD jp prgmloaderloc prgminstallload: ld hl, prgmloader ld de, prgmloaderloc ld bc, prgmloadersize ldir ld hl, prgmunloader ld de, prgmunloaderloc ld bc, prgmunloadersize ldir ld hl, prgm_to_usermem ld de, prgm_to_usermem_loc ld bc, prgm_to_usermem_size ldir ret prgmmov_start: ;.org SafeSScreen prgmmov: prgmloader: call prgm_to_usermem_loc ld hl, prgmunloaderloc push hl set appAutoScroll,(iy + appflags) jp userMem prgmloaderend: prgmunloader: ld hl, Fsh ld de, OP1 call strcpy call prgm_to_usermem_loc call _RunIndicOff jp Fin prgmunloaderend: prgm_to_usermem: ld a,$9 ; 'add hl,bc' ld (prgm_to_usermem.smc),a call _ChkFindSym call _ChkInRam ex de,hl jr z, prgm_to_usermem.in_ram xor a,a ld (prgm_to_usermem.smc),a ld de,9 add hl,de ld e,(hl) add hl,de inc hl prgm_to_usermem.in_ram: ; hl -> size bytes call _LoadDEInd_s inc hl inc hl ; bypass tExtTok, tAsm84CECmp push hl push de ex de,hl call _ErrNotEnoughMem ; check and see if we have enough memory pop hl ld (asm_prgm_size),hl ; store the size of the program ld de,userMem push de call _InsertMem; insert memory into usermem pop de pop hl ; hl -> start of program ld bc,(asm_prgm_size) ; load size of current program prgm_to_usermem.smc equ $ add hl,bc ; if not in ram smc it so it doesn't execute ldir ; copy the program to userMem ret prgm_to_usermem_end: prgmmov_end: ;.org prgmmov_start+prgmmov_end-prgmmov