Note that there are some explanatory texts on larger screens.

plurals
  1. POAssembly OS outputting text unreliable
    primarykey
    data
    text
    <p>I've been trying to increase my baseline knowledge of Intel x86 Nasm by working on outputting a hardcoded text string in an OS/Kernel real mode environment using BIOS interrupts.</p> <p>Here's my code:</p> <pre><code>top: [BITS 16] [ORG 7C00h] resb 56 ; Just for testing outStr db "This is a test string!", 10, 0 resb 56 .main: main: mov edi, outStr again: mov BYTE al, [edi] mov ah,0Eh int 10h inc edi cmp BYTE [edi], 0 jg again leaving: mov ah, 0Eh mov al,13 int 10h mov al,10 int 10h mov al,'Q' ; Using the distinct character Q to show that the code executed to this point int 10h complete: hlt times (510-($-top)) db 0 ; Pad the executable to act as the boot sector dw 0xAA55 </code></pre> <p>I have actually gotten it to work, but only with certain strings. Changing the contents of <code>outStr</code> will sometimes cause the code to not execute at all. At first I thought it was the length, but this proved not to be a determining factor; a small handful of random characters, "Gfd" for example, outputs fine, but "Gfd is awesome!" mysteriously does not work. On the other hand, "ABCDEFGH...Z" (the full capitalized alphabet) did work. To make things even weirder, the full lowercase alphabet did not work.</p> <p>Anytime it doesn't work, the confirmation character at the end ("Q") is not outputted, and non of the other expected behavior is observed, further leading me to believe that this has nothing to do with my executable code, but with something else.</p> <p><strong>Important:</strong> I've been doing my testing using QEMU. It seems to be a pretty commonly used tool and works for me (with the above exceptions), but I'll be interested to see if this could have some effect on the output. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload