Still trying to get BOSshell to run programs...
Still not working.
EDIT: Updated Asm, still does not work.
This is what I have gotten to work so far:
After exiting ICE, the program pauses until [clear] is pressed.
Otherwise, if anyone knows what is going wrong with my code, please feel free to post it.
This is the code that is called first:
Code:
include 'include/ez80.inc'
include 'include/tiformat.inc'
;Move usermem up
ld hl,$D1A87F ; userMem
ld de,$D1A87F
ld bc,($D0118C) ; prgm Size
add hl,bc
ex hl,de
ld bc,($D0118F) ; shell size
add hl,bc
lddr
;Copy program to UserMem
ld de,$D1A87F
ld hl,($D01192) ; prgm Ptr
ld bc,($D0118C) ; prgm Size
ldir
;Stack Pusher
ld hl,$FFFFD3
add hl,sp
ld sp,hl
push hl
ex de,hl
ld hl,$D03110
ld bc,$00001B
ldir
jp $D1A881 ; userMem
And this is the code that is pushed to the stack: (the 'stub')
Code:
include 'include/ez80.inc'
include 'include/tiformat.inc'
di
ld bc,$000000
ld hl,$D1A87F ; userMem
ld de,$D1A87F
add hl,bc
ld bc,$000000
ldir
ld hl,$00002D
add hl,sp
ld sp,hl
ret
Note: the "$000000"s are replaced by the shell before the first code is called. I have verified using CEmu's memory viewing feature (Thanks Mateo), and the code is all there; at the adress it is copied to. (the stub is at $D03110 and the main asm is at $D03250)
My problem seems that after the user program is done being executed, the program counter is never loaded with the adress containing the stub.
I know how the error is happening, but I have no idea how to fix it.
Hopefuly someone can enlighten me as to what I am doing wrong.