c - How I generate RAW BIN with declared segment offset using WatCom -
c - How I generate RAW BIN with declared segment offset using WatCom -
i wrote boot loader in nasm load 64kb programme info disk memory starts address 0060:0000 [seg:off]. had tested part of project writing code in assembly (nasm) , set disk. works fine!
the total project little bit complex totally writing in assembly. decide utilize c inline assembly further. download environment named open-watcom-c-win32-1.9. have simple c code testing watcom compiler , linker directives create raw bin file. bin file generated not runs after boot loader load memory. seek lot of wlink directives set segment , offset values not works.
void main() { __asm { mov ah, 0x0e mov al, '!' int 0x10 } }
i think problem compiler , linker uses wrong segment , offset addresses while code generating. because wlink drop next error in case.
warning! w1023 no starting address found, using 0000:0000
i not know how can set correctly segment offset addresses necceserly working program. questions kind of watcom directives utilize generating 16 bit real mode raw bin file c source code declared segment : offset? possible watcom or need utilize other stuff?
since order of c functions unpredictable special init code needed @ actual entry point. in case entry point in origin of file. encoded offset of initial code dictates offset of other addresses (the segemnt doesn't matter , compiler makes no assumptions it). want write own lean init code. default init code in file cstart_t.obj, need replace that. need set in there depends on need, if linker complains missing symbol might need throw in there. minimal 1 work illustration code might leave c functions unusable (written in nasm syntax):
global __stk extern main_ ; actual name of main function depends on memory model think. section _init class=code resb 0 ; expected offset of code. ..start: jmp main_ ; don't expect main() return. section _stack stack class=stack __stk: grouping dgroup _init _stack
c assembly watcom
Comments
Post a Comment