"Don't tell me how hard you work. Tell me how you get done."
- James J. Ling

Toupper

July 26, 2006

lea si, msg                  ; ds:si points to message
mov cx, 7                    ; cx holds message length

toupper:
       mov al, [si]          ; al holds current letter      
      
       cmp al, 97          
       jb skip                
      
       cmp al, 122       
       ja skip                       

       sub al, 32            ; capitalize letter
       mov [si], al          ; replace letter
skip:
       inc si                   ; move to next letter
loop    toupper            ; loop 7 times
 
       mov ah, 09          ; print function
       lea dx, MSG         ; load string to be printed
       int 21h                ; call DOS
       int 20h                ; exit to DOS

MSG DB “GraInNe$”      ; define message

 

Posted by phengpheng at 3:59 pm | permalink

Previous Comments

Accordingly you can also do this to determine string length

MSG DB "gRAinNE$" ; define message
EMSG EQU $-MSG-1 ; msg length - 1

lea si, msg
mov cx, EMSG ; cx holds message length

The line "EMSG EQU $-MSG-1". EQU is an assembler directive similar to the "db" instruction (db stands for declare byte) EQU declares constants, that is, after you've used EQU to assign a value to a variable, you cannot change the variable's value afterwards.

Refer to $-MSG-1. Aside from '$' being string terminator, it can also signify "your location in the program". So basically, "$-MSG-1" signifies the current location minus the (MSG) start of string, which is consequently, the length of the string! -1, because string starts from 0 to length-1.

Posted by phengpheng at August 6, 2006, 12:46 pm

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment








     

July 2006
M T W T F S S
« May   Aug »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

About Me

A Computer Science graduate who is a fanatic in assembly, java, and j2me programming. Developed BlueVoice system (Direct Voice Communication in Mobile Phones), this system allows mobile users to experience FREE VOICE CALLS

Subscribe

Technorati
Bloglines

Tagboard

tinnitus treatment:

thanks You sure do know what your’e talking about. Man, this blog is just great! I cant wait to read more of what youv’e got to say. Im really happy that I came across this when I did because I was really starting

phengpheng:

Haven’t managed my blog for a long time already because I’m so busy now… Sorry to cause you guyz trouble…

Jun Mark:

hoW tO creaTE a PrOGram thAT woULD oUTpuT ascii table???

Jun Mark:

pLZ anSwer mY qUEstions

cutieGurl:

how to convert binary to hexadecimal, decimal and octal?????????please. answer me??????????

mary ann:

kuya, ung binary to decimal converter nyo. mali man? ung sa mga compare mo. ung may 0,9,A,F etc… bad character lumalabaspls rep asap po. tnx

carol:

how to convert decimal to binary to octal and hexadecimal

Galwin:

been here!

galwin:

nice site. hope you could visit mine, too.

pathy:

FRIENDS FOREVER!! Miss you na!!!

ridvan:

aus, i seldom see lady programmers. hehe. keep it up. and oh yeah, i guess i saw you during the MICT Quiz Show held in cdo. :)
keep up the codes!

phengpheng:

I miss updating this blog… Sana may time and pc ako to learn new stuffs aside from my work…

support:

Congratulations, you’ve just completed the installation of this shoutbox.

pheng:

uy! you’re here again!

Jay:

Woooohhhh orange…sweat… nakakasilaw! hehe :)

jay:

tagboard flood hehe sensya… had nothing fun to do. :)

pheng:

jaaaaayyyyy….:) ketal man?:)

niel:

no spamming please :p hehehe joke lang jay.

Jay:

Uyyyyyy!!!! Grraaaaaaaiiiinnnneeee
:)
Sssshhhh, el sikret! :)
Niiiiiiiiiiiiieeeeeel
Sup dude!!!!
Paaaaaaaaaaaaaathy
Ketal!?

niel:

ei pheng! :D slick-elegant layout! love it!

Leave a message ▼