From: Shawn Jefferson (sjefferson_at_sd62.bc.ca)
Date: 2003-02-25 22:32:46
>There may be problems with some runtime functions. The compiler has knowledge >about the register usage of most runtime (not C) functions, and register usage >may be different for a few functions when compiled for the 65C02. If you're >experiencing difficulties, look out for this. Could you clarify this for me? I am running into some problems, namely that simple code that looks good (to me) will not run in Handy. Sometimes turning on optimizations -O will cause it to start functioning. Should I compile the runtime stuff without the --cpu 65C02 switch? Maybe it's time I actually find out the difference between the 6502 and the 65c02. :) >First rule when interfacing with assembly functions: Use __fastcall__ whenever >possible. This will pass the rightmost parameter in registers instead over the >stack. In the assembly function it is often simpler to use popa/popax, but the >overhead associated with the function call is also larger. So if you're >hunting for cycles you should access the stack directly and use incsp() later >if the alternative is two or more calls to popa/popax. Most of the lynx library functions are graphics related, so reducing overhead in these would probably be appropriate. That said, I think I will keep it simple until I have everything ported. It's at least teaching me a lot about assembly and the Lynx. >You can also replace >two calls to popa by one call to popax (the high byte is then in the X >register). So if I have a function that is somefunc(char a, char b) and use popax I can get both arguments with one call? The arguements are pushed on the stack a, b so would I be right in assuming that the A register contains b and the X register contains a? Hmmmm, any reason *not* to use __fastcall__ ? Another question: I have setup a _mikey.h and _suzy.h file with a struct layout of the hardware address used by those chips (as per the _antic.h file) and I have a #define SUZY (*(struct __suzy *) 0xFC00) in my lynx.h file. How do I use this structure? If I do var = SUZY.joystick in my code the compiler complains bitterly. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-02-25 22:33:30 CET