Truncated match.
PICList
Thread
'No-assemble code'
1995\03\21@185217
by
James L. Johnson
|
Hi again,
Here's a real live example of Microchip code that won't assemble in
the Parallax PASM and I don't know why. The error I get is in the
first line of the "test program". The error says:
"data was already entered at 000h" and the line that generated it is:
"main movlw 0F3h"
So ... what data was already entered? There is no mention of a location
000h in the first place. Perhaps this is one of those instances where
the assembler is totally confused by something else, but prints that as
the error. You know how these software things are.
Any ideas?
Tnx,
Jim Johnson
spam_OUTjjohnsonTakeThisOuT
hpl.hp.com
;*******************************************************************
; include "mpreg.h"
include 'dbl_add.asm' ; JJ - attempt at including a file
include 'dbl_jj.asm' ; JJ - another include file
; org 0
;
LupCnt equ 10 ; Number of iterations
;
SqrtLo equ 10 ;ACCaLO
SqrtHi equ 11 ;ACCaHI
;
NumLo equ 1Dh
NumHi equ 1Eh
count equ 1Fh
;
;
init
movlw LupCnt
movwf count
movf NumHi,W
movwf SqrtHi
movf NumLo,W ; set initial guess root = NUM/2
movwf SqrtLo
bcf STATUS,CARRY
rrf SqrtHi
rrf SqrtLo
retlw 0
;
div2 bcf STATUS,CARRY
rrf 13,W ;ACCbHI
movwf SqrtHi
rrf 12,W ;ACCbLO
movwf SqrtLo
retlw 0
;
Sqrt call init
sloop movf NumLo,W
movwf 12 ;ACCbLO
movf NumHi,W
movwf 13 ;ACCbHI
;
call D_divS ; double precision division
call D_add ; double precision addition
; ; the above 2 routines are listed
; ; as seperate routines
call div2
decfsz count
goto sloop
goto over ; all iterations done
; ; branch back to desired location
;
;*************************************************************
; Test Program
;*************************************************************
;
main movlw 0F3h
movwf NumHi
movlw 0F6h ; Set input test number = 62454
movwf NumLo ; = F3F6h
;
goto Sqrt ; cannot use CALL : Math routines
; ; use up all the stack.
over nop ; all iterations done
;
self goto self ; result = 00F9h = 249
; ; exact sqrt(62454) = 249.9
;
org 0
goto main
;
END
1995\03\22@034410
by
Chuck McManis
|
Jim, your specific problem is this:
At the beginning of your code it starts out:
>> init
>> movlw LupCnt
>> movwf count
>> ...
Now you've commented out the org 0 so that was ignored, however
in the absence of any directive the assembler starts loading code
at location 0. (makes sense yes?)
Now later in your program you have:
>>;
>> org 0
>> goto main
>>;
>> END
Which re-sets the program counter to zero and trys to assemble the
'goto main' into that address. Which overwrites the 'movlw LupCnt'
that you had in init above.
The correct fix for this specific problem is that you should move
the 'goto main' to be the first statement in your program and then
it will assemble at location 0 and all will be well.
I both agree and disagree with what has been said about Parallax's
assembler. On the one hand, if you've got working MPASM code it can
be a real pain to get it to assemble correctly with the Parallax
assembler. On the other hand, if you learn the Parallax assemblers
quirks early on (and MPASM has its own) then writing new code from
scratch can be fairly easy in both.
The lack of a macro facility and conditional assembly in the Parallax
assembler hurt it, however if you are using Linux then you could always
run cpp over the code before feeding it to pasm.
--Chuck McManis All opinions in this message/article are
Sun Microsystems Inc. those of the author, who may or may not
Internet: .....cmcmanisKILLspam
@spam@Eng.sun.COM be who you think it is.
Crypto-puzzle: *0U0JPFPrWRN9PkWRKeP5WRmIR9wP5QAWuIQP9Pu9tnIZ7AD1SIS
More... (looser matching)
- Last day of these posts
- In 1995
, 1996 only
- Today
- New search...