1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Embedded 8088 bootup string problem - with the correct email address!

Discussion in 'Embedded' started by Eddie Fowlkes, Oct 21, 2003.

  1. Greeting all,
    I have an embedded system that I have to maintain now which had it's
    last changes put in over ten years ago. I am not a programmer by any
    means but I need to solve a simple problem: The bootup string has to
    be put into the prom manually and I think the assembler can do it and
    save a lot of time. Here's the scoop as I inherited the thing.

    The processor is an 8088.
    The prom is a 27C512.
    The assembler is a Borland TASM 2.0
    Program code is written in six modules totaling about 0.5mb and is
    assembled by running a batch file in DOS. This creates an EXE file
    which is converted to a BIN by the DOS EXE2BIN utility. The resulting
    BIN file has to be blown into a prom and then read back out of the
    prom as a hex file. This, of course, provides the fill for the prom
    so the boot up string can be installed by editing the HEX file. The
    bytes at the boot location must be as follows:

    fff0 = ea
    fff1 = 00
    fff2 = 00
    fff3 = 00
    fff4 = f0

    Damn! Surely this can't be the only way!! If I try to put the bootup
    code in the code at the location specified I get a out of segment
    error. I think this is because it is being put into an EXE instead of
    a BIN file and the headers etc run the code past the segment. That's
    my guess. I do have the documentation for this assembler and, if they
    thought anyone would ever write anything but PC code, you would never
    guess it so there is nothing for me there. Sorry people, only the
    ancient among us may have knowledge about this assembler now. Anyone?
    And again, many Thanks!
     
    Eddie Fowlkes, Oct 21, 2003
    #1
    1. Advertisements

  2. Eddie Fowlkes

    Tauno Voipio Guest

    Your bootup string is a far jump to the real start of the code,

    jmp far 0xf000:0

    A 80x86 starts at reset at a location 16 bytes down from the very top of the
    memory, i.e. 0xffff:0 in an 8088.

    Your problem lies probably in the tool you're using in converting the
    executable to ROM image: EXE2BIN.EXE is not able to locate the target
    position freely - it creates a monilithic chunk of binary code. The program
    strips the .exe file header off the exeutable and relocates any segment
    references in the code. This is what for it requests the segment (actually
    section, see later) base address.

    It seems that your program size is the count of bytes in the source files -
    there's 64 kbytes of space in your EPROM.

    It seems that your memory layout has ROM at 0xf0000 to 0xfffff and RAM from
    0 upward. The code may be using the RAM as being located above the ROM area
    so that the address arithmetic in the 8088 wraps the addresses when
    addressed above the one megabyte limit. This method has the advantage of
    having both ROM and RAM data accessible with the same segment register as
    long as the total data length is belog 64 kbytes.

    There's no simple instruction how to generate the far jump without knowing
    how the program sections (called segments in assemnler documentation - an
    unfortunate term to mix up with the hardware segment registers) are
    organised - the problem is to locate the jump at EPROM offset 0xfff0.

    There are better tools to do the ROM image conversion - I have used
    Paradigm's Locate to create ROM images from Borland C 2.5 and 4.0 with the
    accompanying assemblers. The difference between EXE2BIN and Locate is that
    Locate is able to use several section base addresses, but EXE2BIN uses only
    one.

    Even with the DOS tools, there is an easier way: the DEBUG utility can be
    used as a binary editor to patch the ROM image directly in binary format -
    there is indeed little sense to visit the EPROM chip just to get a patchable
    file.

    IMHO, the easiest way may be to get a hex editor for your Windows and use it
    to insert the bytes.

    HTH

    Tauno Voipio
    tauno voipio @ iki fi
     
    Tauno Voipio, Oct 21, 2003
    #2
    1. Advertisements

  3. Eddie Fowlkes

    Jim Stewart Guest

    Eddie Fowlkes wrote:

    Some snippage...
    It's pretty much the best way. You can make it
    look nicer by coding it like this:

    db 0EAh ; far jump opcode
    dw vector_offset
    dw vector_segment

    And if you have a stack, which you probably
    don't, this will work:

    mov ax,vector_segment
    push ax
    mov ax,vector_offset
    push ax
    retf
     
    Jim Stewart, Oct 21, 2003
    #3
  4. Eddie Fowlkes

    Android Cat Guest

    On power-on reset, you certainly can't count on the stack segment/pointer.

    vector SEGMENT para public 'vect'
    ASSUME cs:vector
    jmp far ptr ProgStart
    db 'Muppet Labs'
    vector ends

    You really don't need the 'Muppet Labs', but I always slip that into
    EPROMs. :^P

    Paradigm Locate would then arrange the segments:
    \pclocate\loc sign.exe PROG FE000 DATA 00100 VECT FFFF0 F FE000

    (RAM at the bottom, 2764 at the top.)

    This was using MASM/link to create the "exe".
     
    Android Cat, Oct 21, 2003
    #4
  5. Eddie Fowlkes

    CBFalconer Guest

    He already has one, in \windows\command. It is called debug.
     
    CBFalconer, Oct 21, 2003
    #5
  6. Eddie Fowlkes

    Tauno Voipio Guest

    Did you read the whole post? Just one paragraph earlier I recommended the
    DOS DEBUG (which is the thing with the Windowses). A graphical hex editor
    is still, IMHO, easier to use.

    TV
     
    Tauno Voipio, Oct 21, 2003
    #6
  7. Eddie Fowlkes

    CBFalconer Guest

    Guilty. Sorry.
     
    CBFalconer, Oct 22, 2003
    #7
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.