#define prgmloadersize prgmloaderend - prgmloader #define prgmunloadersize prgmunloaderend - prgmunloader prgmloaderloc equ SafeSScreen prgmunloaderloc equ SafeSScreen + prgmloadersize prgmbasic: prgmasm: call _clrtxtshdw call _homeup call _runindicon call _apdsetup call _enableapd jp prgmloaderloc prgmloader: call prgm_to_usermem 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 call _runindicoff jp Fin prgmunloaderend: prgminstallload: ld hl, prgmloader ld de, prgmloaderloc ld bc, prgmloadersize ldir ld hl, prgmunloader ld de, prgmunloaderloc ld bc, prgmunloadersize ldir ret 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 ; return