All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Kotler <fbkotler@comcast.net>
To: Niel A <amerei@gmail.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: newbie
Date: Fri, 23 Dec 2005 04:56:48 -0500	[thread overview]
Message-ID: <43ABC9E0.3010409@comcast.net> (raw)
In-Reply-To: <20051223165014.3a1db406.amerei@gmail.com>

Niel A wrote:
> hello all!
> 
> i'm taking linux assembly as a hobby for christmas

... and for New Year you're doing micro-code? :)

> and i found your great site. the tutorials have been much helpful.
> 
> anyway, i meant to ask something.. 
> 
> section .data
> 	string: db "hi!",10
> 
> and i wanna capitalize the small letter 'h'.
> 
> at first i used
> 	mov di, string ; but di is 16 bits and ld complains

Right. As Fred explains, an address is 32 bits (or 64).

> so i eventually started using the 32 bit ones to do the capitalisation operation. but for some reason, i lose all other letters, including the linefeed.

Sounds like maybe you went too far. The address is 32 bits (or 64), but 
the characters of the string are only a byte (8 bits). If you tried to 
"uppercase" a whole 32 bits, you'd lose the whole thing, including the 
linefeed.

> please point me to the right direction.

Easy way:

sub byte [string], 32

maybe you'd write it as:

sub byte [string], 'a' - 'A'

to make it more "self-documenting". But a more flexible way, using some 
registers...

mov edi, string
mov al, [edi]
cmp al, 'a'  ; don't "uppercase" it unless
jb skip      ; it's lower case!
cmp al, 'z'
ja skip
sub al, 'a' - 'A'
mov [edi], al  ; store it back in "string"
skip:

...perhaps "inc edi", and loop back do do the next letter, or whatever...

inc edi
mov byte [edi], 'a'  ; change it to "Ha!"

Have fun.

> merry christmas,

Same to you and yours... and the rest of the list.

Best,
Frank


  parent reply	other threads:[~2005-12-23  9:56 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-23 16:50 newbie Niel A
2005-12-23  9:11 ` newbie Fred Marmond
2005-12-23  9:56 ` Frank Kotler [this message]
2005-12-24 23:16   ` newbie Niel A
  -- strict thread matches above, loose matches on Subject: below --
2023-04-25 14:52 newbie slack uj
2018-02-09 17:31 newbie yash omer
2018-02-09 17:36 ` newbie Ozgur Kara
     [not found]   ` <CADgbxGj6cKytp_ecE9m22tEf3zib1oEi2EMZDB1Vm_bxPiuc_A@mail.gmail.com>
     [not found]     ` <CADgbxGiaDkHj8oJmF2owbK_1wyVAj-S71U3Fe3Hyfh8D473sug@mail.gmail.com>
     [not found]       ` <380851518198509@web31o.yandex.ru>
     [not found]         ` <CADgbxGg2hdVSueX1hmLWPUr950z7WEsZOx+tUbLw7MoOaHLu3g@mail.gmail.com>
     [not found]           ` <CADgbxGii+2Qauei=35a30gi37fppi0NeeggD-jkMDLX6P3Qj_w@mail.gmail.com>
     [not found]             ` <CADgbxGgOJDX6t_pLwN65+zXPnd8BsZ3YZgym_Rg8DG6AY+DL5w@mail.gmail.com>
     [not found]               ` <1240171518199043@web36g.yandex.ru>
2018-02-09 18:01                 ` newbie Ozgur
2018-02-09 20:20                   ` newbie valdis.kletnieks at vt.edu
2018-02-09 20:24                     ` newbie Ozgur
2018-02-09 17:43 ` newbie valdis.kletnieks at vt.edu
2018-02-12 16:59 ` newbie Ruben Safir
2015-09-17  9:03 Newbie Lasya Venneti
2015-09-17 11:49 ` Newbie Wei Liu
2015-06-18 18:40 Newbie Abhinav Gupta
2015-06-18 18:44 ` Newbie Razvan Cojocaru
2015-06-18 18:46   ` Newbie Abhinav Gupta
2015-06-18 19:00     ` Newbie Razvan Cojocaru
2015-06-19  7:29     ` Newbie Razvan Cojocaru
2009-12-01  9:25 Newbie "svn update" question Mikko Oksalahti
2009-12-01  9:45 ` Howard Miller
2009-12-01 12:00   ` Newbie Mikko Oksalahti
2009-11-23  8:15 Newbie Niamathullah sharief
     [not found] ` <968530b20911230124ma2bb253odd7002ff3122db21@mail.gmail.com>
2009-11-24  5:58   ` Newbie Niamathullah sharief
2006-03-14 21:29 Newbie Eric Heim
2006-03-14 22:09 ` Newbie David Hawkins
2004-03-26 19:52 newbie IT Clown
2004-03-26 20:05 ` newbie David Cannings
2003-10-29 19:19 Newbie David C. Hart
2003-10-29 19:43 ` Newbie Jörg Schütter
2002-12-31  1:28 newbie Cagle, John (ISS-Houston)
2002-12-30 22:25 newbie Pawel S. Veselov
2002-10-04 22:44 newbie Venkat Raghu
2002-09-18  3:44 newbie Venkat Raghu
2002-09-18  4:04 ` newbie Charles Manning
2002-08-28 21:16 newbie Venkat Raghu
2002-08-28 21:27 ` newbie Scott Taylor
2002-08-28 21:28 ` newbie Richard Nairn
2002-08-30  0:54   ` newbie Keith Morse
2002-08-19 22:30 newbie Venkat Raghu
2002-08-19 22:30 ` newbie Venkat Raghu
2002-08-20  5:42 ` newbie Riley Williams
2002-08-20 18:41   ` newbie ichi
2002-08-20 19:53     ` newbie Riley Williams
2002-08-20  7:32 ` newbie Matti Aarnio
2002-08-20  7:32   ` newbie Matti Aarnio
     [not found] <15713.19246.732177.545746@cerise.nosuchdomain.co.uk>
2002-08-19 21:51 ` newbie Raghava Raju
2002-08-19 13:39 newbie Kirkwood, David A
2002-08-20 13:07 ` newbie Uma Shankar Kayarohanam
2002-08-20 19:11   ` newbie Glynn Clements
2002-08-17  1:31 newbie Venkat Raghu
2002-08-16 22:32 newbie Raghava Raju
2002-08-17 16:31 ` newbie Glynn Clements
2001-11-27  9:37 newbie Tolga KILICLI
2000-11-15 17:10 Newbie richardj_moore
2000-11-14  4:01 Newbie Aamir Dogar
2000-11-15 16:09 ` Newbie Tigran Aivazian
2000-11-15 16:43   ` Newbie John Levon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43ABC9E0.3010409@comcast.net \
    --to=fbkotler@comcast.net \
    --cc=amerei@gmail.com \
    --cc=linux-assembly@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.