diff --git a/include/rp6502.h b/include/rp6502.h index 53028c35a..7deeebc4c 100644 --- a/include/rp6502.h +++ b/include/rp6502.h @@ -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); diff --git a/libsrc/rp6502/xregn.c b/libsrc/rp6502/xregn.c new file mode 100644 index 000000000..ec040be20 --- /dev/null +++ b/libsrc/rp6502/xregn.c @@ -0,0 +1,19 @@ +#include +#include + +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); +}