Home |
RTTarget-32 Programming Manual Running Win32 Programs without Win32 InitCode Commands Running a Program on the Target Compiling and Linking with On Time RTOS-32 |
InitCode CommandsFor advanced initializations, the following commands can be used to have the boot code execute additional code on the target: InitCode InitCode Filename InitCodeB Value [,Value...] InitCodeW Value [,Value...] InitCodeD Value [,Value...] InitCodeS "String" [,"String"...] Each of these commands emit code to be executed by the boot code. Code sequences are grouped in InitCode sections. The order of OUT... and InitCode sections is observed. All adjacent InitCode commands contribute to the same InitCode section. If the command InitCode (without parameters) or another command except InitCode is specified, the current InitCode section is closed. The InitCode Filename command always creates a unique InitCode section which is not concatenated with other sections. When a section is closed, RTLoc will append a jmp [e]bx instruction to the section, since register [e]bx contains the return address. InitCode Filename appends the content of the MS-DOS .EXE file Filename to the InitCode data. The program must not contain fixups and its entry point must be the start of the program. InitCodeB/W/D emit bytes, word, or dwords, respectively. InitCodeS writes strings to the InitCode data and interprets embedded escape sequences following the C/C++ rules for string constants (e.g. \n, \r, \x123, etc). No zero byte is appended to such strings. The offset within the InitCode data to receive the next emitted code can be changed with command: InitCodeOrg Value Pseudo symbol $ can be used to determine the current offset. Example:Macro LONG_DELAY COUNT InitCodeB 66h 8Bh C1h ; mov eax, ecx ; save ecx InitCodeB 66h B9h ; mov ecx, <dword> InitCodeD COUNT #defineN LDL $ InitCodeB 67h E2h LDL-$-3 ; loop $ ; use ecx InitCodeB 66h 8Bh C8h ; mov ecx, eax ; restore ecx #undef LDL EndM Boot.exe and Biosboot.exe invoke InitCode sections in 16-bit real mode with the following register context. Pmboot.exe invokes InitCode sections in 32-bit protected mode:
Registers es and ecx are not modified by the boot code while it processes InitCode commands. They can be used to pass information from one InitCode section to another. Note that RAM might not be usable as long as the chipset initialization has not been completed. In this case, not even the stack can be used. The boot code itself will not use the stack or any other RAM until all OUT... and InitCode commands have been processed.
|