Loading ...
Sorry, an error occurred while loading the content.

Re: [TI-99/4A] AL Question

Expand Messages
  • Sullivan, Bill
    Thanks Jeff, Once again, you don t disappoint, but you do deliver a total response. I only hope that I can retain this information in the gray matter and the
    Message 1 of 55 , May 1, 2006
    View Source
    • 0 Attachment
      Thanks Jeff,

      Once again, you don't disappoint, but you do deliver a total response.
      I only hope that I can retain this information in the gray matter and
      the post itself (I have lost important e-mails before), so that I can
      refresh the gray matter as necessary.

      Bill

      Jeff White wrote:

      >Sullivan, Bill wrote:
      ><snip>
      >
      >
      >>How about the one regarding the following:
      >>
      >>LABEL EQU $
      >>LABEL BSS 0
      >>
      >>Which is better?
      >>
      >>
      ><snip>
      >
      >If I had to choose one of them, I would use the first. However, there
      >is nothing wrong with the second. You also have the following options:
      >
      >LABEL
      >LABEL BES 0
      >LABEL EVEN (which Matthew has described)
      >
      >My preference would be for the LABEL on a line by itself, unless it is
      >following BYTE or TEXT values and I want to force it to a word boundary,
      >in which case I would end with EVEN on a line by itself followed by
      >LABEL by itself.
      >
      >H20 BYTE >20
      > EVEN
      >LABEL
      >
      >All that said, EQU and BSS are not equivalent. Typically, equates are
      >used to map values, such as memory-mapped ports or standard memory
      >addresses:
      >
      >SOUND EQU >8400
      >GPLWS EQU >83E0
      >
      >BSS is used when you want to reserve blocks of memory:
      >
      >MYWS BSS 32
      >...
      > LWPI MYWS
      >
      >You can also use EQU when you are using memory that normally cannot be
      >reserved by the loader, such as CPU PAD.
      >
      > AORG >8300
      >FASTWS
      >RECLEN EQU $+32
      >RECBUF EQU $+33
      >...
      >
      >which could also be:
      >
      >FASTWS EQU >8300
      >RECLEN EQU >8320
      >RECBUF EQU >8321
      >
      >However, with the first option you can move the area by changing the
      >address after AORG.
      >
      >It is much better to use DORG instead:
      >
      > DORG >8300
      >FASTWS BSS 32
      >RECLEN BYTE 0
      >RECBUF BSS 80
      >...
      >
      >I seem to recall that GenProg does not support DORG, but I could be
      >wrong about that.
      >
      >These things are more a matter of style and using syntax that you (and
      >your assembler/linker) understand.
      >
      >If you want to see an example of BES usage, look at my CPUID routine in
      >the TI Hardware Compendium file of the articles folder at ftp.whtech.com:
      >
      >ftp://ftp.whtech.com/articles/TI%20Hardware%20Compendium.txt
      >
      >Jeff White
      >jhwhite@...
      >
      >
      >
      >For users/owners of TI-99/4A Geneve 9640 computers everywhere!
      > Visit the TI99'ers Hall of Fame at http://www.ti99hof.org
      > Check out the TI99ers On-Line User Group at http://www.ti99ers.org/home/.
      > Send abuse reports to abuse@...
      >Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
      >
      >
    • Sullivan, Bill
      Hi Jeff, I just went back and read the full explanation you provided in response to my question about how the code that Tony provided to me could use ... and
      Message 55 of 55 , May 4, 2006
      View Source
      • 0 Attachment
        Hi Jeff,

        I just went back and read the full explanation you provided in response
        to my question about how the code that Tony provided to me could use
        >0460 for B (BRANCH) instead of >0440 as indicated in the E/A Manual
        and Quick Reference Guide. Once again, I found the explanation to be
        clear and easy to understand. Even for a 'bozo' like me.

        Thanks again.

        Bill

        Sullivan, Bill wrote:

        >Wow! Thanks Jeff,
        >
        >If only I could learn and understand all aspects of AL programing to the
        >degree of clarity that you have provided here in this explanation I
        >would be a very happy camper. Too bad there's no money to be made in
        >this community or I would suggest you write an entire book on TI AL
        >programing as I would certainly buy it.
        >
        >Bill
        >
        >Jeff White wrote:
        >
        >
        >
        >>Sullivan, Bill wrote:
        >>
        >>
        >>
        >>
        >>>So "style" is the answer to my original question? Not that one or the
        >>>other is a better solution? Nor any of the other solutions that were
        >>>offered up?
        >>>
        >>>
        >>>
        >>>
        >>I would say the way I would do is the best solution, but that is because
        >>it is the way that makes sense to me. And I am always open to learning
        >>a better way.
        >>
        >>In the case of "EQU $" versus "BSS 0" the final object code will be not
        >>be different. My preference would be for the "EQU $" if I were to use
        >>either, and I think TI would teach you the same. Here is how TI
        >>describes them on page 7-8 in the book MMSD
        >>(Microprocessors/Microcomputers/System Design, 8 used copies available
        >>through www.amazon.com with 3 copies under $5):
        >>
        >> BSS Define bytes of storage beginning with symbol
        >> EQU Assign a value to a label or a data name
        >>
        >>The primary function of BSS is to reserve memory. The only function of
        >>EQU is to assign a value to a label. In fact, of all the assembler
        >>directives the only one which requires a label is EQU. When any other
        >>directive uses a label, there is a built-in EQU. Page 7-8 also states:
        >>
        >> When a label is used (except in an EQU directive) the label is
        >>assigned the current value of the location counter.
        >>
        >>The $ represents the current value of the location counter. But you
        >>could adopt a style such that labels are only used with EQU. This might
        >>be because you have created your own assembler and want to simplify its
        >>syntax. Here is an example:
        >>
        >>
        >>FASTWS EQU >8300
        >> DORG >2010
        >>*
        >>$BUFF EQU $
        >> BSS 5*>404
        >>$LO EQU $
        >> BSS 0
        >>*
        >> AORG $LO
        >>START EQU $
        >> LWPI FASTWS
        >> LI R0,$BUFF
        >> LI R1,$LO-$BUFF
        >>AGAIN EQU $
        >> CLR *R0+
        >> DECT R1
        >> JNE AGAIN
        >> END
        >>
        >>It would be rather simple to locate all the labels by looking for EQU
        >>with an editor search function. You could also rid yourself of EQU and
        >>that pesky space requirement by starting directives or assembler
        >>mnemonics in column 1.
        >>
        >>FASTWS >8300
        >>DORG >2010
        >>*
        >>$BUFF $
        >>BSS 5*>404
        >>$LO $
        >>BSS 0
        >>*
        >>AORG $LO
        >>START $
        >>LWPI FASTWS
        >>LI R0,$BUFF
        >>LI R1,$LO-$BUFF
        >>AGAIN $
        >>CLR *R0+
        >>DECT R1
        >>JNE AGAIN
        >>END
        >>
        >>I left the "$" in just for easy location of the labels, but it could be
        >>assumed unless there was a value declared.
        >>
        >>
        >>
        >>>Could there be a speed or memory issue amongst all these
        >>>possibilities?
        >>>
        >>>
        >>Program execution speed will not be affected, because assembler
        >>directives are instructions to the assembler. Assembler speed will
        >>certainly be affected by directives used and assembler mnemonics used,
        >>and you want to minimize these as much as you can.
        >>
        >>You could throw a label on every line of code just like TI BASIC needs
        >>line numbers. But the assembler will have to keep track of all these
        >>and locate any unresolved references or replicate labels (or perhaps use
        >>the most recently defined). The labels themselves are not stored in the
        >>object code unless DEFined or REFerenced. This is for the convenience
        >>of the linker. Once the program is in image format, the labels are
        >>gone, which is why disassemblers come up with such non-descript labels
        >>(if any).
        >>
        >>Back to your Forth source example, it could be done simplest:
        >>
        >> DORG >2010
        >>*
        >>$BUFF BSS 5*>404
        >>$LO AORG $
        >>
        >>
        >>
        >>>Is it any wonder that I don't choose to do more AL coding than
        >>>absolutely necessary?
        >>>
        >>>
        >><snip>
        >>
        >>I think that goes without saying for most of us.
        >>
        >>Jeff White
        >>jhwhite@...
        >>
        >>
        >>For users/owners of TI-99/4A Geneve 9640 computers everywhere!
        >>Visit the TI99'ers Hall of Fame at http://www.ti99hof.org
        >>Check out the TI99ers On-Line User Group at http://www.ti99ers.org/home/.
        >>Send abuse reports to abuse@...
        >>Yahoo! Groups Links
        >>
        >>
        >>
        >>
        >>
        >>
        >>
        >>
        >>
        >>
        >>
        >
        >
        >For users/owners of TI-99/4A Geneve 9640 computers everywhere!
        > Visit the TI99'ers Hall of Fame at http://www.ti99hof.org
        > Check out the TI99ers On-Line User Group at http://www.ti99ers.org/home/.
        > Send abuse reports to abuse@...
        >Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.