hello people. I am doing an "os" (small) that's mainly a menu. It just prints some strings and highlights some words when you pres 1,2 or 3. And by pressing enter while a option is selected, it has to do something.
The problem is that the program gets stuck in the beginning ... and i don't know where is the problem. Can't run a debug because it's a bootable bin file. Can some one please tell me where is the error?
I'm using linux+ nasm

[BITS 16]      
jmp 07C0h:start
	snd     db  'Sound'
	lsnd	equ	$-snd
	abt	db	'About'
	labt	equ	$-abt
	hlp	db	'Help'
	lhlp	equ	$-hlp

    start:

is1:
	call init
	;print "sound"
	mov	ax,1300h
	mov	bh,0
	mov	bl,2
	mov	cx,lsnd
	mov	dx,0
	push cs
	pop es
	mov bp,snd
	int 10h
wait_:
	mov	ah,00h
	int	16h

	cmp 	ah,13
	je	make_sound

	cmp	ah,49
	je	is1

	cmp	ah,50
	je	is2

	cmp	ah,51
	je	is3

	jmp	wait_
is2:	
	call init
	;print "About"
	mov	ax,1300h
	mov	bh,0
	mov	bl,2
	mov	cx,labt
	mov	dl,5
	push cs
	pop es
	mov bp,abt
	int 10h
	jmp	wait_

is3:	jmp	wait_
	
make_sound:
	mov	ax, 0E07h
	xor	bx, bx
	int	10h
	jmp	wait_
	
init:
	;print "sound"
	mov	ax,1300h
	mov	bh,0
	mov	bl,5
	mov	cx,lsnd
	mov	dx,0
	push cs
	pop es
	mov bp,snd
	int 10h
	;print "About"
	mov	ax,1300h
	mov	bh,0
	mov	cx,labt
	mov	dl,5
	push cs
	pop es
	mov bp,abt
	int 10h
	;print "Help"
	mov	ax,1300h
	mov	bh,0
	mov	cx,lhlp
	mov	dl,10
	push cs
	pop es
	mov bp,hlp
	int 10h
	ret


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

The attachment shows the result of the execution. To me, it looks like he executes init then ;print "sound" then gets stuck. Maybe the function that i use to wait for a char isn't the right one?

Recommended Answers

All 2 Replies

Review how VIDEO BIOS Interrupt 10h is suppose to function!

You indicate string doesn't contain attributes with AX,1300h
BUT Never set BL to indicate attribute to use!

ALSO DL=column DH=Row

Now check all your prints!

I don't understand: why not setting BL for an attribute? It works fine for me...

I managed to fix my error,however. I was comparing ah when the character returned was in al. *oops*

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.