Assembler: please kick me in the right direction


Results 1 to 27 of 27

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    This page describes the 8051 registers, but the whole site is pretty good too.
    http://www.8052.com/tutbregs.phtml#R%20Registers

    The MUL?xxx macro usually has 3 paramaters, the third one is the result of multiplying the first two.

    For instance, if you had the following variables ...
    Code:
    A  VAR  BYTE
    B  VAR  BYTE
    Y  VAR  BYTE
    Z  VAR  WORD
    THEN ...
    Code:
      this ASM macro              is same as this PBP statement
      ---------------------       -------------------------
        MUL?BBB   _A, _B, _Y          Y = A * B
        MUL?BBW   _A, _B, _Z          Z = A * B
        MUL?BWW   _A, _Z, _Z          Z = A * Z
    And, you can see that often it's easier to just jump out of ASM and handle it in Basic.

    ------------------
    If you do use the MUL? macros, there's something else you have to do to get them to work. Since, they are from the PBPPIC14.MAC file, they don't automaticaly get included with the project. So you have to Trick PBP into thinking it needs those macros.

    This bit of code doesn't use any Program space since the ifdef keeps it from being compiled. But PBP sees the statements and includes any macros that are associated with them.
    Code:
    @  ifdef DoNotCompile                        ' Macro to include
           R0.LowByte = R0.LowByte * R0.LowByte  ' MUL?BBB
           R0 = R0.LowByte * R0.LowByte          ' MUL?BBW
           R0 = R0.LowByte * R0                  ' MUL?BWW
    @  endif
    But then, If you do it in Basic, you don't have to worry about it.

    Merry X-Mas,
    Darrel
    Last edited by Darrel Taylor; - 25th December 2005 at 21:52.

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. PIC assembler forum?
    By Lajko in forum Off Topic
    Replies: 1
    Last Post: - 29th September 2008, 05:34
  3. Assembler problem
    By om3bc in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th March 2008, 19:12
  4. Am I reading this assembler correctly?
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 13th November 2007, 12:20
  5. Which assembler are you using?
    By picnaut in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st November 2005, 20:34

Members who have read this thread : 0

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