944,068 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 1141
  • Assembly RSS
Nov 3rd, 2009
0

Setting string colors in NASM

Expand Post »
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::

Assembly Syntax (Toggle Plain Text)
  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::

Assembly Syntax (Toggle Plain Text)
  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; Nov 3rd, 2009 at 8:43 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Goalatio is offline Offline
72 posts
since Oct 2009
Nov 3rd, 2009
0
Re: Setting string colors in NASM
Nevermind, I fixed this.

All I had to do was position the cursor ontop of the new colors.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Goalatio is offline Offline
72 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Help in using LDR and ADC in 8051
Next Thread in Assembly Forum Timeline: Need help with a mips program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC