+ Reply to Thread
Results 1 to 2 of 2

Thread: Can anyone tell why this doesn't work?

  1. #1
    Guru Aereshaa is just really nice Aereshaa is just really nice Aereshaa is just really nice Aereshaa is just really nice Aereshaa is just really nice Aereshaa's Avatar
    Join Date
    Apr 2008
    Posts
    784
    Blog Entries
    5

    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.
    Last edited by Aereshaa; 06-22-2009 at 02:42 PM.
    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

  2. #2
    Programming God outsid3r has a spectacular aura about outsid3r has a spectacular aura about outsid3r's Avatar
    Join Date
    Jul 2008
    Location
    Portugal
    Posts
    564

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Clipboard Game
    By Jordan in forum Games
    Replies: 3479
    Last Post: 02-18-2010, 04:10 PM
  2. Replies: 1
    Last Post: 08-08-2009, 07:59 PM
  3. Replies: 1
    Last Post: 06-20-2008, 11:39 AM
  4. All url ports blocked at work..
    By phpforfun in forum The Lounge
    Replies: 1
    Last Post: 03-13-2008, 07:42 PM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts