Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working on an Operating System. I create a print function in assembly for this. When i try to print '----' with this. it does not work. My code is available on this url: ThunderEagle/printf.asm at master · Sansoft500/ThunderEagle · GitHub[^]

please help me to solve

What I have tried:

The url is shown before is the only but when i use

mov al,'-'
int 10h
int 10h
int 10h

it works. how i use this with my function?

[EDIT by Jochen Arndt: Inserted code from GitHub]
printf:
	mov ah,0x0e
	mov bh,0x00
	mov bl,0x07
	next:
		mov al,[si]
		or al,al
		jz done
		int 0x10
		inc si
		jmp next
	done:
		ret

[EDIT]
Posted
Updated 13-Mar-17 1:48am
v2

To print a character using BIOS interrupt 10h, you first have to set the function in AH...
C++
mov ah, 0x0e
mov al, '-'
int 0x10

If you wish us to examine your code, please paste it in to your question instead of adding a link...
 
Share this answer
 
Code from the GitHub URL:
printf:
	mov ah,0x0e
	mov bh,0x00
	mov bl,0x07
	next:
		mov al,[si]
		or al,al
		jz done
		int 0x10
		inc si
		jmp next
	done:
		ret

The above requires that DS:SI is pointing to a null terminated string. So you need something like this:
SECTION .data
minus3: db "---", 0

    SECTION .TEXT

; ...
; DS must be .data which it usually is 
    mov si,minus3
    call printf
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900