1 year ago

#388648

test-img

freewill

Strange BIOS int 10h ah=0eh teletype output on Sony Vaio

I am having something bizarre on a Sony Vaio when playing with a boot sector. I am compiling some code with nasm, copying it to a usb stick and booting that on the Vaio.

I am running this code:

[ORG 7c00h]
cld
cli

mov bh, 0
mov ah, 0Eh
mov al, '0'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '1'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '2'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '3'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '4'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '5'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '6'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '7'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '8'
int 10h
mov bh, 0
mov ah, 0Eh
mov al, '9'
int 10h

mov cl, 192
loop:
    mov al, cl
    add al, 32
    int 10h
    dec cl
    jne loop

    hlt

times 510-($-$$) db 0
dw 0AA55h

Qemu outputs this:

SeaBIOS (version rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+07F8F390+07EEF390 CA00



Booting from Hard Disk...
0123456789α▀▐▌▄█┌┘╪╫╓╒╘╙╥╤╨╧╬═╠╦╩╔╚╟╞┼─├┬┴└┐╛╜╝╗║╣╕╖╢╡┤│▓▒░»«¡¼½¬⌐¿ºªÑñúóíáƒ₧¥£¢
ÜÖÿùûòöôÆæÉÅÄìîïèëêçåàäâéüÇȣ~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLK
JIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"!

However, the Vaio does this: Photo of Vaio screen

The start of the output (0122256789) is incorrect. Also, it seems to be timing dependent. For example, if I add a bunch moves after the outputting of 1:

...
mov al, '1'
int 10h

mov ax, 0
mov ax, 0
mov ax, 0
mov ax, 0
mov ax, 0

mov bh, 0
mov ah, 0Eh
mov al, '2'
...

Then the output is 01456789...

What is going on?

Edit:

Indeed, as mentioned in the comments, this was related to a missing Boot Parameter Block (BPB). Running the code from Custom bootloader booted via USB drive produces incorrect output on some computers, I got this:

7C00: EB 3C 90 AA AA AA AA AA
7C08: AA AA AA AA AA AA AA AA
7C10: AA AA AA AA AA AA AA AA
7C18: AA AA AA AA 00 00 00 00
7C20: AA AA AA AA 00 AA AA AA
7C28: AA AA AA AA AA AA AA AA
7C30: AA AA AA AA AA AA AA AA
7C38: AA AA AA AA AA AA

To confirm, I edited the boot sector, put zeros in the places where the Vaio BIOS would and disassembled the code. The result confirmed that, with the code above, the instructions that load the character values were getting nuked. So this explains everything.

assembly

x86

x86-16

bootloader

bios

0 Answers

Your Answer

Accepted video resources