Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Question With Bx And Bl


1 reply to this topic

#1 Jeune

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 105 posts
  • Gender:Male
  • Location:Philippines

Posted 03 February 2007 - 04:42 AM

I have a dilema here.

How come I have to do this?
mov bx,0h
mov bl,curlen

and not this?
mov bx,0h
mov bx,curlen

variable curlen specifies the number of charachters the user has inputted into the computer.
Here is the rest of the code:

Thanks for helping out.

.model small
.stack
.data

message db "Enter Name: ","$"

inputLabel label byte
maxlen  db 20
curlen  db ?
inputData db  20 dup(?);

newline db 13,10,"$"

array db "1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j"

.code

main   proc
	  
  ;get address of message 
   mov ax, @data
   mov ds,ax
   mov dx, offset message
   
  ;print command
   mov ah,09h
   int 21h

   mov dx,offset inputLabel
   mov ah,0ah
   int 21h

   mov dx,offset newline
   mov ah,09h
   int 21h

   mov bx,0h
   mov bh,curlen

   mov dx,offset array[bx-1]
   mov ah,02h
   int 21h

   mov   ah,4ch
   int   21h


main   endp
end main


#2 ghostrider

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 398 posts
  • Gender:Male
  • Location:Wisconsin

Posted 03 February 2007 - 03:36 PM

You have to move curlen into bl because the bx register is 16-bits and curlen is a byte, meaning it is 8 bits. You can't move something bigger or smaller into a register without using a special instruction, which i forget at the moment. Hope this helps.




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users