Jump to content
IGNORED

Question about MADS macro syntax


Recommended Posts

I've tried looking around for documentation on a bit of syntax in some MADS code I'm reading, and I am stumped. Could someone interpret it?

 

I'm talking specifically about the expression: ":>:num  iny" in the following macro (5th line).

 

.macro @ADD_BIT num
            bcc skip
            adc #<:num
  .if :num < $4FF
    :>:num  iny
    .if :num > $4F
            bcc skip
            iny
    .endif
  .else
  ...
  .endif
skip
.endm

 

Looking through the MADS manual, the closest I could get talks about :repeat, except it says that typically, a colon followed by a number refers to a parameter in a macro, if it's in decimal. Though, the inputs for @ADD_BIT are in hex.

 

Is that line getting the high-byte of the parameter (:num) and then using that as a counter for how many times to repeat "iny"?

Link to comment
Share on other sites

What it's doing is using the high byte of the WORD num to produce the

number of repeats for the instruction "iny"

 

So for example if num=$400 then it will produce 4 iny instructions

 

Hope that makes sense :)

 

  • Thanks 1
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...