]> git.sur5r.net Git - cc65/commitdiff
Add a macro for peekbsys
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 23:45:09 +0000 (23:45 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 23:45:09 +0000 (23:45 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1596 b7a2c559-68d2-44c3-8de9-860c34a00d81

include/cbm510.h
include/cbm610.h

index c429d80ecea1e442bce8c9a310ba90837eab34a9..9f03f121724a5934e2ac7a1861a8b65353e97f55 100644 (file)
@@ -95,6 +95,21 @@ unsigned __fastcall__ peekwsys (unsigned addr);
 void __fastcall__ pokebsys (unsigned addr, unsigned char val);
 void __fastcall__ pokewsys (unsigned addr, unsigned val);
 
+#if defined(__OPT_i__) && defined(__OPT_s__)
+#define peekbsys(addr)          \
+        __AX__ = (addr),        \
+        asm ("sta ptr1"),       \
+        asm ("stx ptr1+1"),     \
+        asm ("ldx $01"),        \
+        asm ("lda #$0F"),       \
+        asm ("sta $01"),        \
+        asm ("ldy #$00"),       \
+        asm ("lda (ptr1),y"),   \
+        asm ("stx $01"),        \
+        asm ("ldx #$00"),       \
+        __AX__
+#endif
+
 
 
 /* Define hardware */
index 416bcfa4bdce12cb2f0b7662b99ae18ef76963b9..723d876993a4e7826eea7f537c5e3e3e4ee3ae02 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 1998-2001 Ullrich von Bassewitz                                       */
+/* (C) 1998-2002 Ullrich von Bassewitz                                       */
 /*               Wacholderweg 14                                             */
 /*               D-70597 Stuttgart                                           */
 /* EMail:        uz@musoftware.de                                            */
 
 
 
-/* Special routines to write bytes and words in the system bank */
+/* Special routines to read/write bytes and words in the system bank */
 unsigned char __fastcall__ peekbsys (unsigned addr);
 unsigned __fastcall__ peekwsys (unsigned addr);
 void __fastcall__ pokebsys (unsigned addr, unsigned char val);
 void __fastcall__ pokewsys (unsigned addr, unsigned val);
 
+#if defined(__OPT_i__) && defined(__OPT_s__)
+#define peekbsys(addr)          \
+        __AX__ = (addr),        \
+        asm ("sta ptr1"),       \
+        asm ("stx ptr1+1"),     \
+        asm ("ldx $01"),        \
+        asm ("lda #$0F"),       \
+        asm ("sta $01"),        \
+        asm ("ldy #$00"),       \
+        asm ("lda (ptr1),y"),   \
+        asm ("stx $01"),        \
+        asm ("ldx #$00"),       \
+        __AX__
+
+#define pokebsys(addr,val)      \
+        __AX__ = (addr),        \
+        asm ("sta ptr1"),       \
+        asm ("stx ptr1+1"),     \
+        __AX__ = (val),         \
+        asm ("ldx $01"),        \
+        asm ("ldy #$0F"),       \
+        asm ("sty $01"),        \
+        asm ("ldy #$00"),       \
+        asm ("sta (ptr1),y"),   \
+        asm ("stx $01")
+
+#endif
+
 
 
 /* Define hardware */