Porting assembler code from Keil to SDCC

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi there,

I am trying to port some 8051 assembler code from Keil A51 to SDCC
asx8051 and got some problems:

1) EQU
     ABC        EQU    8000h
     FLAG_RS0   EQU    PSW.3
...
     mov        dptr, #ABC
...
     jb         FLAG_RS0, somewhere

How to convert the EQU to asx8051 syntax?

2) Macro
DELAY  MACRO
        nop
        nop
        nop
        ENDM

Does asx8051 support macros?

3) Any other gotchas I have to aware of? :-)

Thanks

Joe


Re: Porting assembler code from Keil to SDCC
Joe,

Quoted text here. Click to load it

I don't know the asx8051 assembler but what error messages to you get on
this?
Anyhow, try putting  0D3h instead of PSW.3 and then see what error messages
you get.

Dave Bardon, Avocet.

Quoted text here. Click to load it



Re: Porting assembler code from Keil to SDCC
Quoted text here. Click to load it

Hi Dave,

asx8051 is the 8051 assembler comes with the SDCC package.
Currently I am trying to write a simple perl script to convert
my old assembler files for Keil a51 to the asx8051, but I am
completely stuck at this moment.  I havn't get to the stage
of debuggin the above code yet, even the following simple code
give me problem:

<simple.asm>
.area CODE (ABS)

.org    0h000     
    jmp    start


.org 0h100
start:
   nop
   nop
   nop
   jmp start

end

$> asx8051 simple.asm

?ASxxxx-Error-<a> in line 4 of simple.asm
               <a> machine specific addressing or addressing mode error
?ASxxxx-Error-<a> in line 12 of simple.asm
               <a> machine specific addressing or addressing mode error
removing
$>

Both line that get the errors are the jmp instructions.
Anyone know what I am doing wrong?

Thanks for your help in advance.
Joe

Re: Porting assembler code from Keil to SDCC
Quoted text here. Click to load it

Problem solved (partially):
==================================
It seems the jmp instruction in keil a51 need to be replaced with
ljmp/sjmp instructions.
==================================

 >>> 1) EQU
 >>>     ABC        EQU    8000h
 >>>     FLAG_RS0   EQU    PSW.3
 >>> ...
 >>>     mov        dptr, #ABC
 >>> ...
 >>>     jb         FLAG_RS0, somewhere

This becomes:

   ABC      = 0h8000    ; note the value syntax changed (Doop!)
   FLAG_RS0 = PSW.3     ; this works
...
   mov  dptr, #ABC      ; this works
   mov  dptr, #0h8000   ; or if I put the value,
                        ; the value syntax changed in asx8051

...
   jb   FLAG_RS0, somewhere

==================================
The "end" at the end of assembly file need to be removed.
==================================
Still couldn't find any way to replace MACRO :-(

So my script will need to convert all the values from Keil A51 syntax to
asx8051 syntax.

Joe


Site Timeline