Help with macro


Closed Thread
Results 1 to 3 of 3

Thread: Help with macro

  1. #1
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94

    Default Help with macro

    I an trying to write a macro to replace several PBP statements.
    I want to replace this:

    Code:
    gl_x1 = 30
    gl_y1 = 45
    gl_x2 = 60
    gl_y2 = 45
    gosub gl_line
    with this:
    Code:
    @ glcdline(30,45,60,45)
    using this macro:

    Code:
    ASM	; glcdLine	'@ GLCD_line x1,y1,x2,y2
    #glcdline	macro x1,y1,x2,y2
    		MOVE?WW x1, _gl_x1
    		MOVE?WW y1, _gl_y1
    		MOVE?WW x2, _gl_x2
    		MOVE?WW y2, _gl_y2
            L?CALL _gl_line
    		endm
    #define glcdline(x1,y1,x2,y2)  #glcdline x1, y1, x2, y2  ; allows paretheses in macro
    ENDASM
    all vars are words.

    The PBP code works giving me a cross centered at x=45 y=45

    the macro gives me horizontal and vertical line of full screen size crossing about x=10, y = 10

    Thanks

    Dave

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Help with macro

    Dave,

    You are providing Constants to the macro, but are trying to move WORDs in the macro.

    Use MOVE?CW instead of MOVE?WW

    Are you using PBP3?
    Usercommands will allow it to use Constants, Bytes, Words, Longs ... whichever you pass to the command.
    DT

  3. #3
    Join Date
    Mar 2008
    Location
    Gerogetown, Texas
    Posts
    94


    Did you find this post helpful? Yes | No

    Default Re: Help with macro

    Thanks Darrel

    That worked. In this case I am using PBP 2.6, I am helping with a project that is written in 2.6

    Ideally I would like to pass variable like

    Code:
    glcdline(_xpos - 15, _ypos, _xpos + 15, _ypos)


    Dave

Similar Threads

  1. Replies: 6
    Last Post: - 4th November 2009, 13:36
  2. ERROR: Macro MOD?TCB not found in macro file.
    By JohnP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th February 2009, 19:10
  3. Error: macro COUNT?TCT nor found in macro file.
    By AMMOTT in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th November 2007, 05:05
  4. Macro CMPEQ?TTT not found in macro file
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 14th May 2006, 00:36
  5. Replies: 1
    Last Post: - 3rd October 2005, 15:19

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts