xixhxix
xixhxix

Reputation: 113

how to iterate a string in assembly?

my goal is to capitalize all of the word 'chain' but i have no idea how to move to the next letter i am still a beginner in this language i cant use loops so the number of characters is known for me

this is my code:

include io.h
data segment
  character db 'chain',0
  data ends
code segment
  start :
  assume cs:code,ds:data
  mov ax,seg data
  mov ds,ax
  sub character,20h
  output character
  mov ax,4c00h
  int 21h
data ends
end start

this code only capitalizes the first character, i can repeat this if i know how to move to the second character so any help is appreciated, thank you.

Upvotes: 0

Views: 1958

Answers (1)

Scott Hunter
Scott Hunter

Reputation: 49920

Load the address of character into a register, and use that register for the address of the letter you wish to operate on; then increment that register each time you want to move to the next letter; once you get a letter values of 0, you are done.

If you need help with coding this, either edit your question with your update & what specific problem you are having, or post a new question.

Upvotes: 1

Related Questions