99 lines
1.9 KiB
NASM
99 lines
1.9 KiB
NASM
#define prgmloadersize prgmloaderend - prgmloader
|
|
#define prgmunloadersize prgmunloaderend - prgmunloader
|
|
#define prgm_to_usermem_size prgm_to_usermem_end - prgm_to_usermem
|
|
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, prgmmov_start
|
|
ld de, prgmloaderloc
|
|
ld bc, prgmloadersize
|
|
ldir
|
|
ld hl, prgmmov_start + prgmloadersize
|
|
ld de, prgmunloaderloc
|
|
ld bc, prgmunloadersize
|
|
ldir
|
|
ld hl, prgmmov_start + prgmloadersize + prgmunloadersize
|
|
ld de, prgm_to_usermem_loc
|
|
ld bc, prgm_to_usermem_size
|
|
ldir
|
|
ret
|
|
|
|
prgmmov_start:
|
|
|
|
.org SafeSScreen
|
|
|
|
prgmmov:
|
|
|
|
prgmloader:
|
|
ld a, 's'
|
|
call _PutC
|
|
call prgm_to_usermem_loc
|
|
ld hl, prgmunloader
|
|
push hl
|
|
set appAutoScroll,(iy + appflags)
|
|
jp userMem
|
|
prgmloaderend:
|
|
|
|
prgmunloader:
|
|
ld hl, prgmFsh
|
|
call _Mov9ToOP1
|
|
call prgm_to_usermem
|
|
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:
|
|
|
|
prgmFsh: .db ProgObj, "FSHA", 0
|
|
|
|
prgmmov_end:
|
|
|
|
.org prgmmov_start
|