1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-22 12:30:41 +00:00

add rp6502 xregn

This commit is contained in:
rumbledethumps 2024-02-17 16:02:57 -08:00
parent f42e6a26b2
commit 4d3153e10e
2 changed files with 21 additions and 0 deletions

View File

@ -117,6 +117,8 @@ long __fastcall__ ria_call_long_errno (unsigned char op);
/* C API for the operating system. */
int __cdecl__ xregn (char device, char channel, unsigned char address, unsigned count,
...);
int __cdecl__ xreg (char device, char channel, unsigned char address, ...);
int phi2 (void);
int codepage (void);

19
libsrc/rp6502/xregn.c Normal file
View File

@ -0,0 +1,19 @@
#include <rp6502.h>
#include <stdarg.h>
int __cdecl__ xregn (char device, char channel, unsigned char address, unsigned count,
...)
{
va_list args;
va_start (args, count);
RIA.xstack = device;
RIA.xstack = channel;
RIA.xstack = address;
while (count--) {
unsigned v = va_arg (args, unsigned);
RIA.xstack = v >> 8;
RIA.xstack = v;
}
va_end (args);
return ria_call_int_errno (RIA_OP_XREG);
}