From: cuz Date: Fri, 22 Nov 2002 23:45:09 +0000 (+0000) Subject: Add a macro for peekbsys X-Git-Tag: V2.12.0~2041 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4800f0d2a74e6f33a5e73f0d9b01b372d44f0642;p=cc65 Add a macro for peekbsys git-svn-id: svn://svn.cc65.org/cc65/trunk@1596 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/include/cbm510.h b/include/cbm510.h index c429d80ec..9f03f1217 100644 --- a/include/cbm510.h +++ b/include/cbm510.h @@ -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 */ diff --git a/include/cbm610.h b/include/cbm610.h index 416bcfa4b..723d87699 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -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 */ @@ -75,12 +75,40 @@ -/* 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 */