Re: [cc65] Please be patient... More questions

From: Oliver Schmidt <ol.sc1web.de>
Date: 2010-04-22 23:10:51
Hi,

> If you remember not to use the high byte when calling the function, you can
> even go without inline assembly:
>
>    #define SCRORG 0xFFED
>    #define getScreenSize   ((unsigned char (*)()) (SCRORG))
>
> then, use it as you would do with a function:
>
>    unsigned char foo = getScreenSize ();

And by declaring the function pointer as __fastcall__ you can pass
parameters in the A and X register to ROM routines. Here's an Apple2
example with the A register (using a function pointer variable instead
of a macro):

void (__fastcall__ *cout)(unsigned char c)
  = (void (__fastcall__ *)(unsigned char))0xFDED;

can be used as

cout('A');

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu Apr 22 23:11:55 2010

This archive was generated by hypermail 2.1.8 : 2010-04-22 23:11:57 CEST