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

TASM for 6800 assembly

Expand Messages
  • B Degnan
    Hi all, I am trying to format a piece of 6800 code I found on Michael Holley s web site
    Message 1 of 8 , Jun 22, 2013
    View Source
    • 0 Attachment

      Hi all,

      I am trying to format a piece of 6800 code I found on Michael Holley’s web site

      http://www.swtpc.com/mholley/MicroWorks/U2708_SWT.TXT

       

      I saved file as U2708_SWT.ASM

       

      Using TASM ran tasm -68 -x U2708_SWT.ASM

       

      Bombs.

       

      I believe that there is a problem with the format of the file.

       

      Questions – why is the code in this format?  Is there a specific assembler for 6800 code in this format?  Example – comments with no semi-colon. 

       

      I know that you need to put a semi colon in front of comments, so I assume if I run though this code and insert ; marks in front of these lines or columns it will work, but I’d like to locate a complete list of dos and don’ts for TASM, the 6800 ASM code example that comes with TASM is way different than the code on swtpc.com.  It compiles just fine though.

       

      Just trying to understand why things are the way they are.  I understand the assembly itself, but I am getting tired of assembling by hand, and I want to start doing more complex things or downloading asm from the web.

       

      Side note – I found a 2708 eProm programmer for my SWTPc 6800, but chicken and egg I need to first load a software into the system to run the programmer.

       

      Thanks.

    • Dan Roganti
      ... First, no Assemblers are created equal. There have been so many flavors of Assemblers - where the syntax between them can be different even for the same
      Message 2 of 8 , Jun 22, 2013
      View Source
      • 0 Attachment
        On Sat, Jun 22, 2013 at 3:53 PM, B Degnan <billdeg@...> wrote:


        Hi all,

        I am trying to format a piece of 6800 code I found on Michael Holley’s web site

        http://www.swtpc.com/mholley/MicroWorks/U2708_SWT.TXT

         

        I saved file as U2708_SWT.ASM

        Using TASM ran tasm -68 -x U2708_SWT.ASM


        Bombs.

         

        I believe that there is a problem with the format of the file.

         


         
        First, no Assemblers are created equal. 
        There have been so many flavors of Assemblers - where the syntax between them can be different even for the same processor. This source code is for the MIKBUG Assembler. If you like to use TASM, then you have to convert many of the Assembler directives and mnemonics used in the code. I suppose you already have the -68 option used in your make file. Then you only need the following files in your project dir.
        tasm.exe
        tasm68.tab

        There is a "moto.h" packaged with TASM which helps to define the mikbug directives to help convert programs. You can use the include directive to help with this. But since half of the problem - and just as big - is that not everyone uses the same assembly mnemonics, which makes it a pain in the ass. You can look up the the conversions for 6800 mnemonics from TASM in the "TASMTABS.HTM" file.

        For example, [files attached]
        ------------------------------------------------------                     
        MIKBUG                  TASM
        ------------------------------------------------------                     
        ORG                   .ORG                period before the assembler directive
        OFFSET RMB 2          OFFSET .BLOCK 2     reserves # of memory locations, 
        FCB $D,$A,0,0         .BYTE $D,$A,0,0     constants

        and the following changes are needed because TASM is just stupid
        LDA A                 LDAA                
        LDA A                 LDAB                
        STA A                 STAA                
        STA B                 STAB                
        LDA B                 LDAB
        CMP A                 CMPA
        EOR A                 EORA
        AND A                 ANDA
        ORA A                 ORAA
        SUB A                 SUBA
        SUB B                 SUBB
        SBC A                 SBCA
        DEC A                 DECA
        DEC B                 DECB
        ASL A                 ASLA

        and here the kicker, 
        TASM isn't completely Endian-aware. The 6800 is a big-endian processor (Hi Btye first). It's only good for instructions , so you can't use the .WORD directive to store the address - for index address operations. This is the other problem with the "moto.h" header file. Even though the *.tab file for the 6800 has a directive for big-endian, it's only good for instructions and not constants.
        FDB                   .WORD                  ***does not work***

        this is what it would look like in the listing file
        <MIKBUG>
        0149   7126 42          TABLE   FCC "B"
        0150   7127 70 20        FDB BURN

        <TASM>
        0149   7126 42          TABLE   .TEXT "B"
        0150   7127 20 70        .WORD BURN

        so a patch in this section would be needed to use TASM, to convert it to support big-endian for then index addressing
        <MIKBUG>
        POUNCE  INX            ;CLIMB ONTO ADDR
        LDX 0,X        ;GET IT
        JMP 0,X        ;AND GO

        <TASM>
        POUNCE  INX            ;CLIMB ONTO ADDR
                LDAA 0,X
        LDX 0,X        ;GET IT
        JMP 0,X        ;AND GO

         or you can use another 6800 Assembler such as AS68. Almost 95% of the syntax is compatible. This one is case sensitive, so you have to convert it all to lowercase.  But at least it supports big-endian.

        Dan





      • Dan Roganti
        oops, pressed Enter too soon....[files attached] POUNCE INX ;CLIMB ONTO ADDR LDAB 0,X ;GET LO-BYTE INX ;INC X TO POINT TO HI-BYTE LDAA 0,X
        Message 3 of 8 , Jun 22, 2013
        View Source
        • 0 Attachment
          oops, pressed Enter too soon....[files attached]

          POUNCE  INX             ;CLIMB ONTO ADDR
          LDAB 0,X       ;GET LO-BYTE
          INX ;INC X TO POINT TO HI-BYTE
          LDAA 0,X ;GET HI-BYTE
          STAB 0,X ;PUT THE HI-BYTE IN BIG-ENDIAN
          DEX ;DEC TO POINT TO LO-BYTE
          STAA 0,X ;PUT THE LO-BYTE IN BIG-ENDIAN
          ;
          LDX 0,X         ;GET INDEX ADDR IN BIG-ENDIAN
          JMP 0,X         ;AND GO

        • Dan Roganti
          it s getting late.... the patch should go in the beginning ... ;CONVERT TABLE TO BIG-ENDIAN ;ONLY DONE ONCE IN PROGRAM ; LDX #TABLE ;GET POINTER TO TABLE
          Message 4 of 8 , Jun 22, 2013
          View Source
          • 0 Attachment
            it's getting late....
            the patch should go in the beginning

            ----------------------------------------------------------
            ;CONVERT TABLE TO BIG-ENDIAN
            ;ONLY DONE ONCE IN PROGRAM
            ;
            LDX #TABLE     ;GET POINTER TO TABLE
            INX ;INC X TO POINT TO LO-BYTE
            CONVRT LDAB 0,X       ;GET LO-BYTE
            INX ;INC X TO POINT TO HI-BYTE
            LDAA 0,X ;GET HI-BYTE
            STAB 0,X ;PUT THE LO-BYTE IN BIG-ENDIAN
            DEX ;DEC TO POINT TO LO-BYTE
            STAA 0,X ;PUT THE HI-BYTE IN BIG-ENDIAN
            ;
            CPX #TABLAST    ;LAST ENTRY ?
            BEQ U2708       ;YES, EXIT LOOP
            INX             ;POINT TO NEXT ENTRY
            INX
            INX
            BRA CONVRT      ;LOOP FOR NEXT ENTRY
            ;----------------------------------------------------------
            ; START
            U2708 LDS #$A042 ;GET STACKED
            .
            .
            .
            This line gets a new label
            TABLAST .WORD TABEND  ; NEW LABEL FOR LAST ENTRY OF TABLE
            .
            .
            .
            ;----------------------------------------------------------



          • B Degnan
            Dan Thank you very much. Now I understand. I thought TASM was the go-to assembler for any processor, I see at least for 6800 s it s simply easier to use
            Message 5 of 8 , Jun 23, 2013
            View Source
            • 0 Attachment

              Dan

              Thank you very much.  Now I understand.  I thought TASM was the go-to assembler for any processor, I see at least for 6800’s  it’s simply easier to use something more MIKBUG compatible, and now I understand why things are the way they are.  I only know the coding part, how to read the instructions themselves. 

               

              6800 itself is pretty easy to work with, a good language to learn assembly.  I am making a primitive monitor extension for SWTBUG to make it easier to load and run TSC BASIC on eProm by storing it in C100 and moving to 0100.  I also want to put in a simple memory dump array program.  This way, when I am using a teletype I only have to load and save BASIC programs themselves, not wait 25 minutes to load BASIC by tape before I can even start working on something. 

              Bill

               

              From: midatlanticretro@yahoogroups.com [mailto:midatlanticretro@yahoogroups.com] On Behalf Of Dan Roganti
              Sent: Sunday, June 23, 2013 12:55 AM
              To: midatlanticretro@yahoogroups.com
              Subject: Re: [midatlanticretro] TASM for 6800 assembly

               



              it's getting late....

              the patch should go in the beginning

               

              ----------------------------------------------------------

              ;CONVERT TABLE TO BIG-ENDIAN

              ;ONLY DONE ONCE IN PROGRAM

              ;

                   LDX #TABLE         ;GET POINTER TO TABLE

                   INX       ;INC X TO POINT TO LO-BYTE

              CONVRT    LDAB 0,X           ;GET LO-BYTE

                   INX       ;INC X TO POINT TO HI-BYTE

                   LDAA 0,X  ;GET HI-BYTE

                   STAB 0,X  ;PUT THE LO-BYTE IN BIG-ENDIAN

                   DEX       ;DEC TO POINT TO LO-BYTE

                   STAA 0,X  ;PUT THE HI-BYTE IN BIG-ENDIAN

              ;

                   CPX #TABLAST    ;LAST ENTRY ?

                   BEQ U2708          ;YES, EXIT LOOP

                   INX                ;POINT TO NEXT ENTRY

                   INX

                   INX

                   BRA CONVRT      ;LOOP FOR NEXT ENTRY

              ;----------------------------------------------------------

              ; START

              U2708     LDS #$A042    ;GET STACKED

              .

              .

              .

              This line gets a new label

              TABLAST   .WORD TABEND  ; NEW LABEL FOR LAST ENTRY OF TABLE

              .

              .

              .

              ;----------------------------------------------------------

               

               

               




            • joshbensadon
              Hi Bill, I ve used many different cross assemblers and it seems like every one does something different. One point you should beware of. Sometimes the
              Message 6 of 8 , Jun 23, 2013
              View Source
              • 0 Attachment
                Hi Bill,

                I've used many different cross assemblers and it seems like every one does something different. One point you should beware of. Sometimes the assembler tries to be "smart" by saving you a byte when you do a Long Call or Long Branch (3 bytes) when a relative call/branch (2 bytes) would work. Normally this is not a problem but if your code is timing sensitive (like in a bit bang), you'll want to watch the output like a hawk!

                :)J


                --- In midatlanticretro@yahoogroups.com, "B Degnan" <billdeg@...> wrote:
                >
                > Dan
                >
                > Thank you very much. Now I understand. I thought TASM was the go-to
                > assembler for any processor, I see at least for 6800's it's simply easier
                > to use something more MIKBUG compatible, and now I understand why things are
                > the way they are. I only know the coding part, how to read the instructions
                > themselves.
                >
                >
                >
                > 6800 itself is pretty easy to work with, a good language to learn assembly.
                > I am making a primitive monitor extension for SWTBUG to make it easier to
                > load and run TSC BASIC on eProm by storing it in C100 and moving to 0100. I
                > also want to put in a simple memory dump array program. This way, when I am
                > using a teletype I only have to load and save BASIC programs themselves, not
                > wait 25 minutes to load BASIC by tape before I can even start working on
                > something.
                >
                > Bill
                >
                >
                >
                > From: midatlanticretro@yahoogroups.com
                > [mailto:midatlanticretro@yahoogroups.com] On Behalf Of Dan Roganti
                > Sent: Sunday, June 23, 2013 12:55 AM
                > To: midatlanticretro@yahoogroups.com
                > Subject: Re: [midatlanticretro] TASM for 6800 assembly
                >
                >
                >
                >
                >
                > it's getting late....
                >
                > the patch should go in the beginning
                >
                >
                >
                > ----------------------------------------------------------
                >
                > ;CONVERT TABLE TO BIG-ENDIAN
                >
                > ;ONLY DONE ONCE IN PROGRAM
                >
                > ;
                >
                > LDX #TABLE ;GET POINTER TO TABLE
                >
                > INX ;INC X TO POINT TO LO-BYTE
                >
                > CONVRT LDAB 0,X ;GET LO-BYTE
                >
                > INX ;INC X TO POINT TO HI-BYTE
                >
                > LDAA 0,X ;GET HI-BYTE
                >
                > STAB 0,X ;PUT THE LO-BYTE IN BIG-ENDIAN
                >
                > DEX ;DEC TO POINT TO LO-BYTE
                >
                > STAA 0,X ;PUT THE HI-BYTE IN BIG-ENDIAN
                >
                > ;
                >
                > CPX #TABLAST ;LAST ENTRY ?
                >
                > BEQ U2708 ;YES, EXIT LOOP
                >
                > INX ;POINT TO NEXT ENTRY
                >
                > INX
                >
                > INX
                >
                > BRA CONVRT ;LOOP FOR NEXT ENTRY
                >
                > ;----------------------------------------------------------
                >
                > ; START
                >
                > U2708 LDS #$A042 ;GET STACKED
                >
                > .
                >
                > .
                >
                > .
                >
                > This line gets a new label
                >
                > TABLAST .WORD TABEND ; NEW LABEL FOR LAST ENTRY OF TABLE
                >
                > .
                >
                > .
                >
                > .
                >
                > ;----------------------------------------------------------
                >
              • Dan Roganti
                ... You should get the AS68 cross-assembler, I posted it online. Plus a nice Motorola book about 6800 programming. http://www.rogtronics.net/blog/?p=255 Dan On
                Message 7 of 8 , Jun 23, 2013
                View Source
                • 0 Attachment
                  On Sun, Jun 23, 2013 at 9:28 AM, B Degnan <billdeg@...> wrote:


                  Dan

                  Thank you very much.  Now I understand.  I thought TASM was the go-to assembler for any processor, I see at least for 6800’s  it’s simply easier to use something more MIKBUG compatible, and now I understand why things are the way they are.  I only know the coding part, how to read the instructions themselves. 

                   

                  6800 itself is pretty easy to work with, a good language to learn assembly.  I am making a primitive monitor extension for SWTBUG to make it easier to load and run TSC BASIC on eProm by storing it in C100 and moving to 0100.  I also want to put in a simple memory dump array program.  This way, when I am using a teletype I only have to load and save BASIC programs themselves, not wait 25 minutes to load BASIC by tape before I can even start working on something. 



                  You should get the AS68 cross-assembler, I posted it online. Plus a nice Motorola book about 6800 programming.

                  Dan 

                • s100doctor
                  ... I have also found that not all assemblers are equal. It s convenient to have an assembler in source form, so it can be modified to suit a particular bunch
                  Message 8 of 8 , Jun 23, 2013
                  View Source
                  • 0 Attachment
                    > On Sun, Jun 23, 2013 at 9:28 AM, B Degnan <billdeg@...> wrote:
                    >
                    > > Thank you very much. Now I understand. I thought TASM was the go-to
                    > > assembler for any processor, I see at least for 6800's it's simply easier
                    > > to use something more MIKBUG compatible, and now I understand why things
                    > > are the way they are. I only know the coding part, how to read the
                    > > instructions themselves.

                    Dan Roganti <ragooman@...> wrote:
                    > >
                    > You should get the AS68 cross-assembler, I posted it online. Plus a nice
                    > Motorola book about 6800 programming.
                    > http://www.rogtronics.net/blog/?p=255
                    >
                    > Dan

                    I have also found that not all assemblers are equal. It's convenient to have an assembler in source form, so it can be modified to suit a particular bunch of code that's written for some particular assembler not available now.

                    Blah blah blah...

                    http://www.retrotechnology.com/aux/swtp6800.html

                    has a section "Web links to related 6800" where I point to my version of an AS68 assembler in C, which I compiled for MS-DOS. "I took some time in Nov 2011, to revive William Colley's 6800 cross assembler A68..."

                    http://www.retrotechnology.com/restore/a68_0.zip

                    I also tinkered with a general cross-assembler in C, with macro support, which covers several microprocessors, and which I've also compiled for MS-DOS, called ASMX:

                    http://www.retrotechnology.com/memship/asmx.html

                    OK? C compilers for old 16-bit MSDOS include Turbo C. 32-bit MS-DOS (for Win 2K's DOS box) is supported by lcc-win32. These are freely available.

                    Herb Johnson
                    retrotechnology.com
                  Your message has been successfully submitted and would be delivered to recipients shortly.