PC 80x86/68000 hybrid Assembler 
Author Message
 PC 80x86/68000 hybrid Assembler

                             Crossfire          
        PC  80x86/68000 hybrid Macro Assembler

If you want a 68k assembler or pine for the 68k chip then read this

A friend has written an assembler called 'Crossfire' which supports
both 680xx and a modified form of 8086 (actually 80386). It needs a
386 minimum but I guess thats no problem these days.

With output both for 68k and 80x86 - its goal was two fold:-

1) To allow you to write 68k programs using a PC for running on a 68k
   machine - (NOTE: It does not allow you to run them on a PC) The
   pattern was DEVPAC which it now surpasses IMHO.

2) To write 68K alike programs on the PC. Using pre{*filter*}ly 68k
   instructions and address modes, but 80x86 registers it is very
   similar to writing 68k code especially PMODE code (which is the
   prefered method)

; a nonsence example (and the .X's are not necessary - just habit)

        move.l  [esi],eax
        lsl.l   #1,eax
        move.l  eax,[edi]
        add.l   #4,edi          ; no post increment (YET!)
        swap    ebx             'pseudo op'
        clr.w   bx              'pseudo op'
        tst.w   ax              'pseudo op'                    
        beq.s   .skip
        not.l   eax
.skip   bsr     fred
        rts

That is not to say that a 80x86 programmer would be lost using
Crossfire.
It is not all things to all men - the decicated 80x86 programmer would
perhaps not appreciate some of the features. If you have 68k'ed at
one time and perhaps pine for those times this could be for you, or
maybe not - the extra modes, instructions and methods are optional
- you can even mix styles, though as you can imagine this looks rather
messy.

NOTE: I will not dwell on the basic 68k mode - it's just that - more
than
a match for most.  Suffice that it has Nested Macros, INCLUDE, INCBIN
String handling, opcode overides, repeat loops, conditional assembly
etc....

It is modified in the respect that it is geared for the 680xx
programmer
wanting to write 80x86.

Some of the more important features are:

        * allows operand reversal (for 68k alike):-

        Conventional    8086            mov     al,5
            reversed    8086            mov     5,al    

        * allows 68k instructions

                'MOVE' as well as 'MOV'
                'Bcc'  as well as 'Jcc'
                        + many others

        * optional pseudo instructions + address modes

                'CLR.W  [eax]'  
                'TST.B  DL
                'MOVE.B 3[ESI],2[EDI]'  
                'SWAP'

        * Uses .B/.W/.L/.D rather than byte_ptr word_ptr etc

                'ADD.W  #$1000,AX'
                'OR.L   #$101010,EDX'

        * immediate numbers specification preceeded with #

                'MOVE    #$20,AL'
                'MOVE.B  #$40,AL'  NOTE .B suffix optional      

------------------------------------------------------------------------------------
What follows is the begining of part of the docs written by Paz just
to give
you a little more.

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

                      CrossFire Assembler, By Mark Parry
                                  80x86.DOC

This document explains the Intel 80x86 processors/instruction set from
the
perspective of a Motorola 680x0 programmer. It is not a intended as a
complete
guide to programming the 80x86 range of processors. You should also
look at the
document "FILETYPE.DOC" to see how various output file formats are
supported,
especially for types ".COM", ".EXE", ".SYS" and ".EXL".

                                 Introduction

The reason for CrossFire? Originally, I wanted to write a 680x0
assembler on the
PC, to take advantage of the much faster processor speed. I could of
probably
have coped with the annoying quirks of PC assemblers, but I could just
not get
my head around the opposite syntax of the instructions. For this
reason, I had
to write an 80x86 assembler that I could work with. CrossFire's
version of 80x86
is as close to 680x0 as I could make it.

        Example: store value (41 hex) in memory on different
assemblers

                MOV     BYTE PTR [BX],41h       TASM/MASM/etc.
                MOV.B   [BX],41h                XFire 80x86 (normal
syntax)
                MOVE.B  [BX],#$41               XFire 80x86 (normal
syntax)

                MOVE.B  #$41,[BX]               XFire 80x86 (reverse
syntax)
                MOVE.B  #$41,(A0)               XFire 680x0

Being used to programming the 68000, it was a major culture shock
switching to
the 80x86. The assemblers do not help, they seem to be lumbered with a
lot of
unnecessary and awkward features.

I don't like having to keep modifying segment registers. Earlier
versions of the
assembler had to, and it was a nightmare. To try to make life easier
for myself,
I now program the 80x86 in one of two ways;

        if all the code, data and buffers will fit in 64k, I can write
the
        program in a 16-bit segment. ('.COM')

        if code, data and buffers will not fit in 64k, or I need to
use expanded
        memory, I will use a DOS extender and write the program in a
32-bit
        segment. I now tend to write all programs using this method,
as I have a
        library of routines that handle memory, input, output and
files. The DOS
        extender seems very stable, and works under DPMI, VCPI and
XMS. ('.EXE')

A 32-bit segment works similar to the 68000. With reverse syntax and
the
equivalent instructions (the branches, set conditionally, shifts, CLR,
TST,
SWAP, etc.) 80386 code can look remarkably similar to 68000. I find
68000
branches, set conditionally and shifts more logical, and CLR, TST and
SWAP make
source code more readable. Using
MOVE/MULU/MULS/DIVU/DIVS/ADDX/SUBX/JSR/EOR/EXG
instead of MOV/MUL/IMUL/DIV/IDIV/ADC/SBB/CALL/XOR/XCHG are just a
matter of
preference.

BTST, BCHG, BCLR and BSET (only with an immediate bit number) have
been included
from before 80386- instructions were added. However, I still only use
BT, BTC,
BTR and BTS if I use a bit field or a register bit number. xBCHG,
xBCLR and
xBSET are included because they take less than half the bytes of BCHG,
BCLR and
BSET (but they do not set the flags properly). xBTST is included for
parity.

Use of the extra instructions is optional, all of the 80x86
instructions can
still be used (I like having the choice). However, BSR (bit scan
reverse) and

the 680x0
instructions BSR (branch to subroutine) and LSL (logical shift left).
BTTST

added because I prefer the syntax.

I tried to make the assembler as flexible as possible. There are a lot
of
duplicate instructions, and the same address mode can be specified in
a number
of ways. There are a lot of ways to do the same thing, for example :-

        LODSD = LODS.D = LODSL = LODS.L
        [BX] = (BX)
        CS:[BX] = CS:(BX) = [CS:BX] = (CS:BX)
        offset[address] = [offset,address] = [offset+address]
        $12 = 12h = 12xh
        $ABCD = 0ABCDh = 0ABCDxh
        %100 = 100b = 100xb

Although the assembler will recognize round brackets on 80x86 address
modes,
(BX) is considered the same as [BX] for example, you can only use
square
brackets for direct memory addressing; [100] is allowed, (100) is not.
It is
therefore recommended that you use only square brackets for 80x86
address modes.

???????????????????????????????????????????????????????????????????????????????
3                 Differences Between CrossFire and MASM/TASM
3
??????????????????????????????????????????????????????????????????????????????

For the purposes of this document, MASM and TASM are considered the
same.

        CrossFire does not LINK.

        No need to define segments.
        No need to define procedures as near or far.
        BYTE PTR, WORD PTR, etc. are not used (.B/.W are).

        Immediate numbers need a hash (#) before them, for example :-
                ADD     AL,4                    (MASM/TASM)
                ADD     AL,#4                   (XFire, normal 80x86
syntax)

        Label offsets are handled differently :-
                MOV     AX,OFFSET LABEL         (MASM/TASM)
                MOV     AX,#LABEL               (XFire, normal 80x86
syntax)

The way you define a label on MASM/TASM affects the way it is used,
example:-

(MASM/TASM)
        LABEL   DB      0
                MOV     LABEL,1                 move byte to LABEL

        LABEL   DW      0
                MOV     LABEL,1                 move word to LABEL

                MOV     BYTE PTR LABEL,1        override LABEL type,
move byte
                MOV     WORD PTR LABEL,1        override LABEL type,
move word

(XFire, normal 80x86 syntax)
                MOV.B   [LABEL],#1              move byte to LABEL
                MOV.W   [LABEL],#1              move word to LABEL

- The file continues...........
----------------------------------------------------------------------------------

Now the thing is with all this is :-

The assembler is very much finished in the sense that we use it all
the time, but
more output filetypes and features could be added but as yet we don't
have any
use for them. Constant use means fewer (if any) bugs and many
improvements - this
is not just an end user product. Its a ongoing production tool. If you
can provide
the technical reference for filetypes or features - within reason
these can perhaps
be added.

I think that a fair few people would be interested in it, he does not.
Hence the
DOCs are not finished because he can't be bothered, he does however
have a working
evaluation copy running (limited source capacity). Okay okay so its
crippled, but
given the measly amout he wants for registration I think this is fair.

Penciled in is a provisional registration fee of only 10
(UK pounds about $7.50 US) or 25 including the full source code. This
is only
provisional - but no way is it not going to cost you 40 or more like
some s/w
apps.

Maybe some mail will arouse his interest again so:-



Note this is a quick lashup excuse spelling.



Thu, 17 Jun 1999 03:00:00 GMT  
 PC 80x86/68000 hybrid Assembler

Quote:

>                              Crossfire
>         PC  80x86/68000 hybrid Macro Assembler

< interesting >
I also have R3000<>x86 conversions if anyone is interested.

Paul



Thu, 17 Jun 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. PC 80x86/68000 hybrid Macro Assembler

2. PC 80x86/68000 hybrid Macro Assembler

3. Looking for 68000 to 80x86 conversion information

4. 68000 to 80x86 help please?

5. 68000 (amiga) to 80x86 translator

6. 68000 (amiga) to 80x86 translator

7. 68000 assembler help

8. ANN: Asm68k (68000 assembler for the PalmPilot)

9. 68000 Assembler source code?

10. F83 68000 Assembler Source ?

11. 68000/486 cross assembler

12. 68000 assembly codes and GNU assembler ...

 

 
Powered by phpBB® Forum Software