Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Sphinx C-- source code available (Announce)

posted by georgpotthast(R) Homepage, Germany, 20.10.2015, 21:03

I have not yet wrote code for ROM-BIOS but here is the section from the manual which may give some clues:

12.7 Compiling ROM-BIOS extender code

ROM-BIOS extenders (BIOS video controllers, network cards, etc.) have a
specific structure and requirements. C-- now makes it easier to create
ROM-BIOS code. Start the compiler with the command-line switch /rom and it
will create a ROM-BIOS signature, fill the remaining free space to the
specified ROM size with filler bytes, and count and correct the ROM

There are several specific directives for this mode of compilation:

1. ?sizerom value - this directive tells the compiler the size of the
ROM in bytes. If not specified, the compiler will choose the smallest
proper ROM size from: 1024, 2048, 4096, 8192, 16384, 32762 or 65536. Space
not occupied by code or data will be filled up to the ROM size with a fill
byte specified by the directive ?aligner, which is by default 0. For type
27xxx ROM this byte should be 0xFF. The last ROM byte is corrected by the
compiler so that the checksum will be equal to zero.

2. ?movedatarom TRUE/FALSE - this directive tells the compiler whether
it must copy data from ROM to RAM. By default it is FALSE. If TRUE, the
compiler inserts into the initialization area code which copies data from
ROM to RAM. Register DS is set to a RAM segment. The stack is also set to
this segment. Thus 'main' obtains control over registers AX=ES=DS=SS=RAM
segment with data transferred to it. If this directive is set FALSE, DS is
still set to the address of the RAM segment, since your code will use this
segment for noninitialized global variables. Initialized variables will
remain in the ROM and all access to them will be via CS. The stack will not
be touched either (it will remain as it was set by the main BIOS).

3. ?dataseg value - this directive tells the compiler the segment
address of the RAM which may be used by the code, by default 0x70. To see
what this address is, you can read it from your code at offset 4. For
example: DS = CSWORD[4]

Some remarks:

1. At the time of initializing the ROM-BIOS, DOS has not yet been
loaded, and thus functions which use DOS calls will not work.

2. ABORT() or (EXIT() and the like cannot be used to terminate a
program. Operation of a ROM-BIOS extender can be terminated only by exiting

3. If the directive ?movedatarom is set to FALSE, be careful when
working with initialized variables. In this mode they are only accessible
for reading and they are addressed via register CS.


Complete thread:

Back to the forum
Board view  Mix view
15108 Postings in 1358 Threads, 245 registered users, 18 users online (0 registered, 18 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum