Go Back   CodeCall Programming Forum > Software Development > Assembly
Register Blogs Search Today's Posts Mark Forums Read

Assembly A machine oriented language in which mnemonics are used to represent each machine language instruction.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-2009, 01:48 PM
Aereshaa's Avatar
Guru
 
Join Date: Apr 2008
Posts: 780
Aereshaa is just really niceAereshaa is just really niceAereshaa is just really niceAereshaa is just really niceAereshaa is just really nice
Can anyone tell why this doesn't work?

Okay, so I have some real-mode code that displays characters on the screen. It should work, but doesn't.
Code:
[BITS 16]
[ORG 1000h]
hello:
	mov BYTE al,[string]
	call charout
	call charout
.end	jmp .end
; outputs the character in al.
charout: 
	mov ah,0x0E
	mov bh,0x00
	mov bl,0x06
	int 0x10
	ret

string: db "HELLO WORLD",10,13,0 ; message to display
times (512*2)-($-$$) db 0		;512 bytes to a sector
It's really weird, becauseit works if I put a inline value into al, but not if I read from string.
__________________
Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz

Last edited by Aereshaa; 06-22-2009 at 03:42 PM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-25-2009, 03:51 AM
outsid3r's Avatar
Programming God
 
Join Date: Jul 2008
Location: Portugal
Posts: 504
outsid3r has a spectacular aura aboutoutsid3r has a spectacular aura about
Re: Can anyone tell why this doesn't work?

You're calling a bios function what writes a character in teletype mode, so following the logic of your program, it should put the first 2 characters from your string, the thing is, you're not moving the pointer to string so it always prints the first character. You're passing the value of the first character from your string to al, but u must instead pass the reference (remove the brackets) to a register like SI, DI, AX, BX, DX, ... and increment your pointer using INC instruction. Make a loop in a new function that iterates through the string until it finds a 0 (null).
I can help you with that if you need.

Check this reference: Interrupt Services DOS/BIOS/EMS/Mouse
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clipboard Game Jordan Games 3471 Today 12:14 AM
What do I need to change in order to get this to work using ajax? doheja07 AJAX 1 08-08-2009 08:59 PM
Multi-lingual Website - How To Work with Resources Files lartzi C# Programming 1 06-20-2008 12:39 PM
All url ports blocked at work.. phpforfun The Lounge 1 03-13-2008 08:42 PM


All times are GMT -5. The time now is 08:20 AM.


vBulletin v3.8.0 ©2010, Jelsoft Enterprises Ltd.


no new posts

LinkBacks Enabled by vBSEO 3.1.0