0

I want to show the value of the register al without using any library, what should I do? Which interrupt should I use? I'm using assembly language (masm) and my program is in real mode.

for example in protected mode we use Irvine32 library:

mov bl , al
mov eax , 0
mov al , bl
call WriteInt    ; (showing the value of al)
rkhb
  • 14,159
  • 7
  • 32
  • 60
H.sm
  • 5
  • 3
  • There's no DOS interrupt for printing numbers. You'll have to convert the number into a string yourself, and then print the string. This has been [asked several times before](http://stackoverflow.com/search?q=%5Bassembly%5D+print+decimal). – Michael Nov 19 '15 at 09:42
  • Isn't there any interrupt If I want to show it in hexadecimal not decimal? – H.sm Nov 19 '15 at 09:48
  • No. There's no such interrupt regardless of base (well, unless you count ASCII as base128). – Michael Nov 19 '15 at 09:51
  • What operating system are you programming for? I assume it's DOS, can you confirm? – fuz Nov 19 '15 at 11:40

1 Answers1

1

If you already have installed the files of Irvine, you can use the irvine16.lib library, the 16 bit linker link16.exe in the same folder and the MASM assembler ml.exe of Visual Studio.

test.asm:

INCLUDE (Full Path to)\Irvine16.inc
INCLUDELIB (Full Path to)\Irvine16.lib

.code
main PROC
    mov ax,@data
    mov ds,ax

    mov al, 123

    mov bl , al
    mov eax , 0
    mov al , bl
    call WriteInt

    mov ax, 4C00h
    int 21h
main ENDP

build.cmd:

@ECHO OFF
SET LIB=
PATH Path\to\VisualStudio\bin;Path\to\Irvine32

ml.exe /c /omf test.asm
link16.exe test.obj, test.exe;

Build it in a command prompt window of Windows just by entering build.cmd. To run it, you have eventually change to DOSBox or a similar DOS emulator.

rkhb
  • 14,159
  • 7
  • 32
  • 60