Oberon/ETH Oberon/InitStrings

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Init Configuration Strings

Q.: What is the meaning of the line such as Init="b8024fbb1441cd10b8014fb91401cd10268b4d28268b552a" which can be seen along with other configuration strings in the early stage of booting?

A.: Really not so daunting. The string is machine code which is interpreted when the processor is in real mode before switching to protected mode, V86 mode or long mode. This is a simple and direct means to configure the display by setting up registers, writing to the low-memory setup area, and doing BIOS calls.

When the system is installed with Oberon0, an Init string is provided by Config.Mod. Then whenever the system is started, the boot loader allows the user to change the string.

To understand a specific string, apply a disassembler. Then google to understand what is done with the video processor. Specifications for VESA 2.0 and VESA 3.0 are available as PDF files.

Begin with the simple case, Init="b81200cd10". Here are three methods to disassemble the Init string.

1) You can use this web-based disassembler online: https://www.onlinedisassembler.com/odaweb/. For "Arch" choose "i8086" (the processor is in real mode) and paste the hex bytes of the Init string into the window below the platform setting. On the right hand side find the disassembled code.

.data:00000000 b81200      mov $0x12,%ax
.data:00000003 cd10        int $0x10

2) We want a file Init.o containing these bytes. An obvious if not efficient method is to use Edit or ET to put any 5 characters in Init.o. Then Hex.Open Init.o, replace the characters with B8 12 00 CD 10 and Store. Move Init.o to a Linux system. There apply objdump.

objdump -b binary -m i8086 -D Init.o

Init.o:     file format binary

Disassembly of section .data:

0000000000000000 <.data>: 
  0:   b8 12 00                mov    $0x12,%ax 
  3:   cd 10                   int    $0x10

3) Kees C. suggests the libdisasm x86dis tool.

$ echo -e '\xb8\x12\x00\xcd\x10' | x86dis -r 0 5 -s att 
00000000 B8 12 00             mov     $0x0012, %ax 
00000003 CD 10                int     $0x10

Each method can be applied to any of the strings.

Init="b81200cd10"
Machine Code Operation Operands Explanation
b81200 mov $0x12,%ax Put 12h into register ax
cd10 int $0x10 Given the content of ax,[1] the video BIOS interrupt call will set 640 x 480 pixels x 24 colors.[2]
Init="b8024fbb1441cd10b8014fb91401cd10268b4d28268b552a"
Machine Code Operation Operands Explanation
b8024f mov $0x4f02,%ax Put 4f02H in register ax.
bb1441 mov $0x4114,%bx Put 4114H in register bx.
cd10 int $0x10 For these values in ax and bx, the video BIOS will set 800 x 600 pixels x ?? colors.
b8014f mov $0x4f01,%ax Put 4f01H in ax.
b91401 mov $0x114,%cx Put 114H in cx to indicate 800 x 600 x 16 bit color.
cd10 int $0x10 Video mode is queried.[3] and es:di contains the returned information.[4]
268b4d28 mov %es:0x28(%di),%cx rWinBAttrs[8] = 0 or 1 according to window A or B supported.
268b552a mov %es:0x2a(%di),%dx rWinBAttrs[a] = 1 or 0 according to window is writable or not.

References[edit | edit source]