Re: sprites
> David,
> This is what i made with the source code you sent.
> For some strange reason the program just crash, and i
> don't have any idea why. Perhaps Robert Craig can explain
> this. I send the code and the CW.ERR file produced by
> Causeway. I guess the problem is just of Causeway, because
> there's no ex.err file generated (well, causeway didn't let
> the asm routine to finish).
> Rob, are you sure i can PUSH and POP?
Your problem is that Euphoria is running in 32-bit protected mode,
not real mode, and machine code instructions are processed
differently in this mode.
For example, the code #50 for which your comment shows : -- push ax
is actually executing the instruction: -- push eax!
The instruction to load the DX register is actually loading the EAX
register, which takes four bytes, so you will need some extra zeros.
Also, you want a TEST instruction, not an AND.
Lastly, there's no reason to waste precious DOS memory, when you can
use extended memory. Just use allocate() instead of allocate_low().
Like this:
include machine.e
sequence code
atom code_space
code = {
#50, -- push eax
#52, -- push edx
#BA, #DA, #03, #00,#00, -- mov edx,#3DA
#EC, -- loop: in al,edx
#A8, #08, -- test al,#8
#75, #FB, -- jnz loop
#EC, -- finish: in al,edx
#A8, #08, -- test al,#8
#74, #FB, -- jz finish
#5A, -- pop edx
#58, -- pop eax
#C3} -- ret
code_space = allocate(length(code))
poke(code_space,code)
puts(1,"\n Calling machine code routine for waiting retrace... \n ")
call(code_space)
free(code_space)
puts(1,"All done!\n")
Regards,
Michael Bolin
|
Not Categorized, Please Help
|
|