Setting string colors in NASM

Thread Solved

Join Date: Oct 2009
Posts: 24
Reputation: Goalatio is an unknown quantity at this point 
Solved Threads: 0
Goalatio Goalatio is offline Offline
Newbie Poster

Setting string colors in NASM

 
0
  #1
24 Days Ago
Hey all, I've been trying to get my int 10h to set the color for a STRING, not just a single character.

Here's my code, i'm running windows XP and using NASM16 assembler.

So, what I want it to do is display something like "Hello world", instead of just.. "a", etc.

the macro::

  1. %macro color 3
  2. mov cx,%1 ;CX value = amount of chars to print
  3. mov bl,%2 ;BL value = HEXI color attr
  4. mov al,%3 ;AL value = character to print
  5. mov ah,9 ;Function 9, display char
  6. int 10h ;Call the SCREEN vector
  7.  
  8. %endmacro


the code::

  1. [org 0100h]
  2. %include "Library.asm"
  3.  
  4. [section .text]
  5.  
  6. color 1,6ah,hello ;Use library to attempt to display string
  7. string eol
  8. exit 0
  9.  
  10. [section .data]
  11. hello db "Hello, world.", 13, 10, "$"
  12. eol db 13, 10, "$"

Any help would be great, thanks.
Last edited by Goalatio; 24 Days Ago at 8:43 pm.
It's passion that drives me.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 24
Reputation: Goalatio is an unknown quantity at this point 
Solved Threads: 0
Goalatio Goalatio is offline Offline
Newbie Poster
 
0
  #2
24 Days Ago
Nevermind, I fixed this.

All I had to do was position the cursor ontop of the new colors.
It's passion that drives me.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC