F
F
from__another__planet2017-04-18 22:33:56
Programming
from__another__planet, 2017-04-18 22:33:56

"Hello World" in machine code?

Program "Hello, world!" for x86 processor (DOS, BIOS output Int 10h) looks like this (hexadecimal byte by byte):
BB 11 01 B9 0D 00 B4 0E 8A 07 43 CD 10 E2 F9 CD 20 48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21
How to run such a program
I downloaded fileinsight hex editor, I save it
in .com format, I tried to run it in DosBox - it hangs
Please help :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2017-04-18
@jcmvbkbc

How to run such a program?

Save to file with .com extension, run in DosBox
Did the same
works.
58e1b24bb3ee46a390e305568c9d2a18.png

K
Konstantin Tsvetkov, 2017-04-18
@tsklab

Maybe code 16 is not supported...

CODE
seg000:0100 ; Base Address: 1000h Range: 10100h-1011Fh Loaded length: 1Fh
seg000:0100
seg000:0100                 .686p
seg000:0100                 .mmx
seg000:0100                 .model tiny
seg000:0100
seg000:0100 ; ===========================================================================
seg000:0100
seg000:0100 ; Segment type: Pure code
seg000:0100 seg000          segment byte public 'CODE' use16
seg000:0100                 assume cs:seg000
seg000:0100                 org 100h
seg000:0100                 assume es:nothing, ss:nothing, ds:seg000, fs:nothing, gs:nothing
seg000:0100
seg000:0100 ; =============== S U B R O U T I N E =======================================
seg000:0100
seg000:0100 ; Attributes: noreturn
seg000:0100
seg000:0100                 public start
seg000:0100 start           proc near
seg000:0100                 mov     bx, 111h
seg000:0103                 mov     cx, 0Dh
seg000:0106                 mov     ah, 0Eh
seg000:0108
seg000:0108 loc_10108:                              ; CODE XREF: start+Dj
seg000:0108                 mov     al, [bx]
seg000:010A                 inc     bx
seg000:010B                 int     10h             ; - VIDEO - WRITE CHARACTER AND ADVANCE CURSOR (TTY WRITE)
seg000:010B                                         ; AL = character, BH = display page (alpha modes)
seg000:010B                                         ; BL = foreground color (graphics modes)
seg000:010D                 loop    loc_10108
seg000:010F                 int     20h             ; DOS - PROGRAM TERMINATION
seg000:010F start           endp                    ; returns to DOS--identical to INT 21/AH=00h
seg000:010F
seg000:010F ; ---------------------------------------------------------------------------
seg000:0111 aHelloWorld     db 'Hello, World!',0
seg000:0111 seg000          ends
seg000:0111
seg000:0111
seg000:0111                 end start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question