Question With Bx And Bl

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > Assembler and Delphi

Question With Bx And Bl

Jeune
I have a dilema here.

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


and not this?
CODE
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.

CODE
.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

 

 

 


Reply

ghostrider
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



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : bx bl


    Looking for bx, bl

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for bx, bl

*MORE FROM TRAP17.COM*
advertisement



Question With Bx And Bl



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE