Author Topic: can't assemble x86, 32 bit code to rdoff format using versions above 2.12.02  (Read 4964 times)

Offline johntk123

  • Jr. Member
  • *
  • Posts: 5
  I am writing my own operating system for fun.  I have only gotten
as far as writing chars. and strings on the screen in 80 X 25 text
mode.  I run the OS in the Bochs emulator.  The only thing that I can
tell you is that I have no problem with it when I use an earlier
version of Nasm, 2.12.02.  I was just trying out the latest version
and it did not work.  ELF. format does work on all versions of Nasm.
It is just standard x86, 32 bit assembly code.  I will include the
batch file that I cooked up below for reference.  If you need any
additional info.  I will try to provide it for you.  I am pretty much
on my own with this.  I do this as a hobby on my spare time.  There is
a lot of stuff on the internet about OS. development but specific
problem help is sometimes hard to find.
I just joined the Nasm forum maybe they can help me too.  I have
looked into the Fasm assembler and it looks pretty cool but its ELF.
object file output is the only one that I can use for my OS.  I was
just comparing ELF. and RDF. formats.

   The problem is in the assembly steps not the linking steps after
it, it never gets that far.

   nasm: panic: rdf segment numbers not allocated as expected (0,0,0)

Filed as bug 3392412

@echo off
color 1f
rem Folder tells which bit version I am working on.
rem Folder is .\MyOS-32bit
rem or use .\MyOS-x86
rem Filename also has the x86 bit version suffix name in it too.
rem Filename is "myos-x86-rdf-build.bat"
rem rdoff or rdf is relocatable object file format.
rem This is to build a x86, 32 bit version.
rem echo. is a blank line.

echo starting build script.
echo.
rem run my own compiler written in python that I am experimenting
with, it generates a  main-hlctest.asm file which is an include file,
rem included in the main.asm file.  Later on it will be linked to the
main.asm file using the linker.
my_compiler_x86_nasm.py ./kernel/include/main-hlctest.hlc
echo.

nasm .\kernel\bootloader.asm -o .\rdf\bootloader.bin -f bin
echo bootloader.bin created.
echo.

nasm .\kernel\main.asm -o .\rdf\main.rdf -f rdf
echo main.rdf created.
echo.

rem --------------------------------------------------------------------
rem error message here:
rem nasm: panic: rdf segment numbers not allocated as expected (0,0,0)
rem Filed as bug 3392412
rem --------------------------------------------------------------------

nasm .\kernel\linktest.asm -o .\rdf\linktest.rdf -f rdf
echo linktest.rdf created.
echo.

rem --------------------------------------------------------------------
rem error message here:
rem nasm: panic: rdf segment numbers not allocated as expected (0,0,0)
rem Filed as bug 3392412
rem --------------------------------------------------------------------

rem "ldrdf -r" gives version number. -output file, then input files.
ldrdf -o .\rdf\kernel.rdf ^
.\rdf\main.rdf ^
.\rdf\linktest.rdf
rem .\rdf\interpreter.rdf and etc. later on.
echo all kernel *.rdf files linked to form the kernel.rdf file.
echo.

rem input file, then output file.
rdf2bin -o 0x1000 -f bin .\rdf\kernel.rdf .\rdf\kernel.bin
echo added relocation info to the ".\rdf\kernel.rdf" file.
echo kernel.bin file created.
echo.

copy /b .\rdf\bootloader.bin + .\rdf\kernel.bin .\rdf\myos-x86-rdf.img
echo combined the bootloader.bin and the kernel.bin files to
echo created the myos-x86-rdf.img os image file.

pause

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Hi johntk123,

Welcome to the Forum. I hope that we can help you... but I doubt it. I don't think that "-f rdf" was ever used much. Yuri Zaparogets (if I remember his name right) used it for "RadiOS" (good luck googling for that!). I found it here: http://radios.sourceforge.net/ It does not seem to be in development since 2004.

I would suggest you stick to "-f elf", unless "-f rdf" is the only output format that suits your needs. If you wish to use "-f rdf", we can discuss it further - I don't mean to blow you off - but I don't know much about it and I'm not sure anybody does, at this point. Source code is available - we can at least look at what's changed. Good luck!

Best,
Frank