Jump to content
IGNORED

DASM Macro Issue


Mikes360

Recommended Posts

Hi Guys,

 

I have started creating a few macros to tidy up some of my code and wrap up common routines. I have created a macro that copy a table of ROM addresses to RAM and for some reason its not assembling correctly in DASM.

 

MAC COPY_TO_RAM_BUFFER

.ADDRESS SET {1}
.INDEX SET {2}
.RAM_BUF SET {3}

ldy .INDEX
.copyLoop
lda .ADDRESS+1,y
sta .RAM_BUF+1,y
lda .ADDRESS,y
sta .RAM_BUF,y
dey
dey
bpl .copyLoop

ENDM

 

Example usage: COPY_TO_RAM_BUFFER PointZeroLogoTable, 12, spriteBuf

 

Can anyone see an obvious error looking at this?

 

Thanks,

Mike

Link to comment
Share on other sites

As soon as I posted this I thought it could be optimised better but it still wont actually work!

 

MAC COPY_TO_RAM_BUFFER

.ADDRESS  SET {1}
.INDEX   SET {2}
.RAM_BUF SET {3}

ldy .INDEX
.copyLoop
lda .ADDRESS,y
sta .RAM_BUF,y
dey
bpl .copyLoop

ENDM

 

Example usage: COPY_TO_RAM_BUFFER PointZeroLogoTable, 13, spriteBuf

Link to comment
Share on other sites

I have added the DASM output below. The first argument is a Table of addresses in ROM the second argument is the size of the table in bytes and the third is the location of the RAM buffer.

 

216 f89b CopyPointZeroLogoToSpriteBuf SUBROUTINE

217 f89b

0 f89b COPY_TO_RAM_BUFFER PointZeroLogoTable, 13, spriteBuf

1 f89b

2 f89b .ADDRESS SET PointZeroLogoTable

3 f89b .INDEX SET 13

4 f89b .RAM_BUF SET spriteBuf

5 f89b

6 f89b a4 0d ldy .INDEX

7 f89d .copyLoop

8 f89d b9 c3 f3 lda .ADDRESS,y

9 f8a0 99 dc 00 sta .RAM_BUF,y

10 f8a3 88 dey

11 f8a4 10 f7 bpl .copyLoop

12 f8a6

219 f8a6

220 f8a6 60 rts

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...