From: Bernard Blackham Date: Sun, 20 Jun 2004 15:30:07 +0000 (+0000) Subject: A better fix for wacky gcc weirdness. X-Git-Tag: ROMW~43 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=ffaed3398a8ed1c381f0f3f316b4720caf025d22;p=uccvend-snackrom.git A better fix for wacky gcc weirdness. --- diff --git a/ROM2/asm.h b/ROM2/asm.h index 601c569..0dac1b0 100644 --- a/ROM2/asm.h +++ b/ROM2/asm.h @@ -16,10 +16,10 @@ extern inline void bset(const void* addr, const u8 mask) { asm volatile ( "ldx %0\n" "bset 00,x,%1\n" - : /* outputs */ - : "m" (addr), "g" (mask) /* inputs */ + : "=m" (addr) /* outputs */ + : "g" (mask) /* inputs */ : "x" /* altered registers */ - ); + ); } extern inline void bclr(const void* addr, const u8 mask) { @@ -28,10 +28,10 @@ extern inline void bclr(const void* addr, const u8 mask) { asm volatile ( "ldx %0\n" "bclr 00,x,%1\n" - : /* outputs */ - : "m" (addr), "g" (mask) /* inputs */ + : "=m" (addr) /* outputs */ + : "g" (mask) /* inputs */ : "x" /* altered registers */ - ); + ); } extern inline void lock() { diff --git a/ROM2/vend.h b/ROM2/vend.h index 11c483d..03d8c9e 100644 --- a/ROM2/vend.h +++ b/ROM2/vend.h @@ -11,16 +11,10 @@ */ #define buffered_addr(a) \ extern volatile u8 _##a; \ - u8 a; \ + volatile u8 a; \ extern inline void set_##a(u8 b) { a = b; _##a = b; } \ - extern inline void bset_##a(const u8 m) { \ - bset(&a, m); \ - asm volatile ( "ldab %1\nstab %0\n" \ - : "=m"(_##a) : "m"(a) : "d"); } \ - extern inline void bclr_##a(const u8 m) { \ - bclr(&a, m); \ - asm volatile ( "ldab %1\nstab %0\n" \ - : "=m"(_##a) : "m"(a) : "d"); } + extern inline void bset_##a(const u8 m) { bset((void*)&a, m); _##a = a; } \ + extern inline void bclr_##a(const u8 m) { bclr((void*)&a, m); _##a = a; } buffered_addr(changer_output); buffered_addr(misc_output);