[stella] common macro.h submission

Subject: [stella] common macro.h submission
From: Manuel Rotschkar <cybergoth@xxxxxxxx>
Date: Wed, 12 Nov 2003 23:31:19 +0100
Hi there!

I have written a macro that sets a pointer.

Instead of writing:

LDA   #<mrdotune3
STA   musicPtr3
LDA   #>mrdotune3
STA   musicPtr3+1

You can now just write this:

SET_POINTER musicPtr3, mrdotune3

using this little macro:

;-------------------------------------------------------
; SET_POINTER
; Original author: Manuel Rotschkar
;
; Sets a 2 byte RAM pointer to an absolute address.
;
; Usage: SET_POINTER pointer, address
; Example: SET_POINTER SpritePTR, SpriteData
;
; Note: Alters the accumulator
; IN 1: 2 byte RAM location reserved for pointer
; IN 2: absolute address

            MAC SET_POINTER
.POINTER    SET {1}
.ADDRESS    SET {2}

                LDA #<.ADDRESS  ; Get Lowbyte of Address
                STA .POINTER    ; Store in pointer
                LDA #>.ADDRESS  ; Get Hibyte of Address
                STA .POINTER+1  ; Store in pointer+1

            ENDM

Greetings,
	Manuel

----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread