Author Topic: Unknown relocation type (1) error  (Read 355 times)

valentin68

  • Regular Member
  • *
  • Posts: 7
Unknown relocation type (1) error
« on: November 23, 2017, 03:08:42 AM »
 0
down vote
favorite
   

I am good with M68000 but X86 is diffficult for me. I am trying to assemble this simple program with MASM

.MODEL SMALL
.data?
  ONE  dB ?
  TWO  dB ?
  stack db  100 dup(?)

.data
  MSG  db 13,10, 'Enter deree of polynomials:  $'
  MSG2 db 13,10, 'Enter coefficient of x^ $'
  MSG3 db 13,10, 'The polynomial created is: $'
  MSG4 db 13,10, 'The first derivative is: $'
  STR1 db  255 DUP('$')

.code

_start:

            mov ax, offset MSG
            mov ds, ax 

end _start

and I keep getting the error Unknown relocation type (1) for symbol MSG. I know what this is (it happens when the displacement is bigger than that allowed by the model or something like this) but I do not know how to solve this error (I know MASM is a 32 bit assembler and I am trying to write a 16 bit code). What I am trying to do is to load the pointer to .data into ds register.

Pretty please, help me!

aw27

  • Member
  • ****
  • Posts: 961
  • Let's Make ASM Great Again!
Re: Unknown relocation type (1) error
« Reply #1 on: November 23, 2017, 03:15:36 AM »
try mov   ax, seg MSG instead of mov ax, offset MSG
(Untested)
And find a way to exit the program without crashing.

valentin68

  • Regular Member
  • *
  • Posts: 7
Re: Unknown relocation type (1) error
« Reply #2 on: November 23, 2017, 03:20:05 AM »
try mov   ax, seg MSG instead of mov ax, offset MSG
(Untested)
And find a way to exit the program without crashing.

I get a symbol type conflict
also with
mov ax, segment MSG
syntax error segment

aw27

  • Member
  • ****
  • Posts: 961
  • Let's Make ASM Great Again!
Re: Unknown relocation type (1) error
« Reply #3 on: November 23, 2017, 03:32:53 AM »

I told you SEG and why do you use SEGMENT?

valentin68

  • Regular Member
  • *
  • Posts: 7
Re: Unknown relocation type (1) error
« Reply #4 on: November 23, 2017, 03:36:04 AM »
I used both seg  and segment
mov ax, seg msg      (symbol type conflict)
mov ax, segment msg (told on stackexchange by someone  - syntax error segment)

None works
I know MASM is 32 bit compiler, I am trying now to use a 16 bit compiler.

jj2007

  • Member
  • *****
  • Posts: 7884
  • Assembler is fun ;-)
    • MasmBasic
Re: Unknown relocation type (1) error
« Reply #5 on: November 23, 2017, 03:36:51 AM »
No errors here 8)
Code: [Select]
*** Assemble 16-bit app using mlv614 /c  /Fo "NewFile" ***
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: tmp_file.asm

*** Link using link16   ***

Microsoft (R) Segmented Executable Linker  Version 5.60.339 Dec  5 1994
Copyright (C) Microsoft Corp 1984-1993.  All rights reserved.

LINK : warning L4021: no stack segment

Note that MSG is a structure defined in Windows.inc (which you don't include...):
Code: [Select]
MSG STRUCT
  hwnd      DWORD      ?
  message   DWORD      ?
  wParam    DWORD      ?
  lParam    DWORD      ?
  time      DWORD      ?
  pt        POINT      <>
MSG ENDS

Have you tried MSG1? Do you use link16.exe?

valentin68

  • Regular Member
  • *
  • Posts: 7
Re: Unknown relocation type (1) error
« Reply #6 on: November 23, 2017, 03:48:01 AM »
    Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

 Assembling: derivative 1.asm
derivative 1.asm(18) : error A2006: undefined symbol : DGROUP
_
Assembly Error
Press any key to continue . . .

I modified the MSG to MSG1  i still have errors
(MSG is a string in my program)


Can you paste please exactly the listing of the program that you have assembled?

jj2007

  • Member
  • *****
  • Posts: 7884
  • Assembler is fun ;-)
    • MasmBasic
Re: Unknown relocation type (1) error
« Reply #7 on: November 23, 2017, 03:56:29 AM »
Can you paste please exactly the listing of the program that you have assembled?
Code: [Select]
.MODEL SMALL
.data?
  ONE  dB ?
  TWO  dB ?
  stack db  100 dup(?)

.data
  MSG  db 13,10, 'Enter deree of polynomials:  $'
  MSG2 db 13,10, 'Enter coefficient of x^ $'
  MSG3 db 13,10, 'The polynomial created is: $'
  MSG4 db 13,10, 'The first derivative is: $'
  STR1 db  255 DUP('$')

.code

_start:

            mov ax, offset MSG
            mov ds, ax

end _start

You may notice that this is exactly your code 8)

I just copied & pasted it into a File/New text file in RichMasm, and then hit F6. That builds fine and produces an error message saying that 16-bit applications are not allowed on my machine. Check your commandline options...

qWord

  • Member
  • *****
  • Posts: 1471
  • The base type of a type is the type itself
    • SmplMath macros
Re: Unknown relocation type (1) error
« Reply #8 on: November 23, 2017, 04:05:20 AM »
valentin68,
you must use the 16 bit aware linker (link16.exe). Then the code from first post will build.
MREAL macros - when you need floating point arithmetic while assembling!

jj2007

  • Member
  • *****
  • Posts: 7884
  • Assembler is fun ;-)
    • MasmBasic
Re: Unknown relocation type (1) error
« Reply #9 on: November 23, 2017, 04:21:02 AM »
Warning: Proggie works fine on my WinXP VM but I had to move it to drive C: - "cannot execute xyz.exe" if it's a substituted drive.

aw27

  • Member
  • ****
  • Posts: 961
  • Let's Make ASM Great Again!
Re: Unknown relocation type (1) error
« Reply #10 on: November 23, 2017, 04:26:49 AM »
This builds fine and does not crash.
Tested in DosBox


Code: [Select]
.186

.model  small

.stack  100h

.data?
  ONE  dB ?
  TWO  dB ?
 

.data
  MSG  db 13,10, 'Enter deree of polynomials:  $'
  MSG2 db 13,10, 'Enter coefficient of x^ $'
  MSG3 db 13,10, 'The polynomial created is: $'
  MSG4 db 13,10, 'The first derivative is: $'
  STR1 db  255 DUP('$')

.code

_start:

            mov ax, seg MSG
            mov ds, ax
    mov  ax, 4c00h       ; terminate program
    int 21h
end _start

valentin68

  • Regular Member
  • *
  • Posts: 7
Re: Unknown relocation type (1) error
« Reply #11 on: November 23, 2017, 04:47:09 AM »
yes as someone above said I have to use the link16.exe
The same answer I've got from stackexchange.

Very hard to work on X86 (especially on 16 bit)

For those that do not know, I have written 10 000-20 000 pages (not lines) of M68000 code 25 years ago for UBISOFT (It took me half a year).
I was paid with 400 USD for this.
It was the game Celtic Legends for Atari 1000.

jj2007

  • Member
  • *****
  • Posts: 7884
  • Assembler is fun ;-)
    • MasmBasic
Re: Unknown relocation type (1) error
« Reply #12 on: November 23, 2017, 04:51:44 AM »
Atari 1000? Or rather 520ST? Compliments in any case ;-)

aw27

  • Member
  • ****
  • Posts: 961
  • Let's Make ASM Great Again!
Re: Unknown relocation type (1) error
« Reply #13 on: November 23, 2017, 05:09:35 AM »
Very hard to work on X86 (especially on 16 bit)
Indeed, and if you have more x86 hard nuts like these  :shock: to crack be aware that there is a subforum called "16 bit DOS Programming". Not really popular these days, the last post was 4 months ago.

qWord

  • Member
  • *****
  • Posts: 1471
  • The base type of a type is the type itself
    • SmplMath macros
Re: Unknown relocation type (1) error
« Reply #14 on: November 23, 2017, 05:27:07 AM »
for UBISOFT (It took me half a year).
I was paid with 400 USD for this.
Wow! 400$/(6*4*5*8h) = 42ct/h.
MREAL macros - when you need floating point arithmetic while assembling!