Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PutTile16x16 Pixels + Attributes
#14
britlion Wrote:Wait, wait....

Boriel - the "attradrress" function you timed there is actually the SCREEN address code I listed above, not the attribute code...
Not exactly. I just copied by mistake the comment line of the SCREEN address function, but the function body is actually the ATTR address.

Quote:I'm actually also still hopelessly confused with the changes you made to get the values out with pop. I've stared at that stack, and I don't see how two pops gets you values 5,6 and 7,8. Surely that gets you values 1,2 and 3,4.

Guess I still haven't quite got the hang of how you stack variables. To the point where I'm writing putTile, and poking the screen address into a memory value instead of try to work out where it is. (in IX-3,4 apparently...)
By values 5,6 etc... you mean (IX + 5) and (IX + 6)... don't you? :roll:
Well, I think I've somewhat already explained it here.

Now, this is important:
FASTCALL convention call is like STDCALL but:
  • The 1st parameter will be passed in the registers following the register convention (A => 8 bits, HL => 16 bits, DEHL => 32 bits AEDCB => 5 bytes, Float)
  • If more parameters are specified, the compiler will issue a warning, and will push them onto the stack in *reverse order as in STDCALL.
  • Finally the routine is called. But in the entry point, NOTHING is done to the IX register. Everything must be done by the user.
FASTCALL routines are ideal for single/none parameter functions and routines not having local variables and mainly done in ASM. When there are more than 1 parameters, the user *must* clean up the stack on return or the program might crash, etc.... That's why on normal functions you have to go to the LEAVE point (the end of the function) instead of directly using an asm RET. If you cleanup the stack at the beginning, you can RET at any point. On STDCALL The compiler will write everything required to pop out parameters and returning safe.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)