Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
FrankzeeTank wrote:
Sorry that I couldn’t be of much help. As you can see, I’m new at all of “this”. But I am looking forward to seeing how this turns out! PS: Can you help me in making a file system for my emulator project, as you have already done it?


What I did is not really a filesystem, more like an organizer. It only has one level, and does not have folders. The 'folders' are more like boxes or pages.

Code:
[2018-10-21 19:49:19] <MateoC> ld hl,-<ASM CODE SIZE + 18> \ add hl,sp \ ld sp,hl \ push hl \ ex de,hl \ ld hl,<ASM RETURN CODE PTR> \ ld bc,<ASM CODE SIZE> \ ldir
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.
That's not how you copy programs to usermem... Wink

You ignored my previous post on how to properly copy the stub too:

MateoConLechuga wrote:
MateoConLechuga wrote:

Code:
[2018-10-21 19:49:19] <MateoC> ld hl,-<ASM CODE SIZE + 18> \ add hl,sp \ ld sp,hl \ push hl \ ex de,hl \ ld hl,<ASM RETURN CODE PTR> \ ld bc,<ASM CODE SIZE> \ ldir


Your stub has to load your shell back into usermem and jump too it too. Smile
MateoConLechuga wrote:
That's not how you copy programs to usermem... Wink

You ignored my previous post on how to properly copy the stub too:

MateoConLechuga wrote:
MateoConLechuga wrote:

Code:
[2018-10-21 19:49:19] <MateoC> ld hl,-<ASM CODE SIZE + 18> \ add hl,sp \ ld sp,hl \ push hl \ ex de,hl \ ld hl,<ASM RETURN CODE PTR> \ ld bc,<ASM CODE SIZE> \ ldir


Your stub has to load your shell back into usermem and jump too it too. Smile


Oops, I did not realize that I had moved my program up by the wrong amount, as well as broke the stub. My bad

EDIT: how does the stub restore the Stack Pointer after the user program returns to it, and it is done copying the program back?
beckadamtheinventor wrote:
how does the stub restore the Stack Pointer after the user program returns to it, and it is done copying the program back?

By moving the stack up the same amount you allocated for the stub Razz That's all you need to do.

Call user program:


Code:
ld hl, - <ASM CODE SIZE + 18> \ add hl,sp \ ld sp,hl \ push hl \ ex de,hl \ ld hl,<ASM STUB CODE PTR> \ ld bc,<ASM STUB SIZE> \ ldir \ jp usermem


Stub jump to shell:


Code:
ld hl,<ASM CODE SIZE + 18> \ add hl,sp \ ld sp,hl \ jp usermem
can this open TI-BASIC programs?
De2290 wrote:
can this open TI-BASIC programs?

I haven't tested it, but I did add code for that.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 5 of 5
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement