Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Question With Bx And Bl
Jeune
post Feb 3 2007, 04:42 AM
Post #1


Member [Level 2]
*****

Group: Members
Posts: 87
Joined: 20-October 05
From: Philippines
Member No.: 13,144



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
Go to the top of the page
 
+Quote Post
ghostrider
post Feb 3 2007, 03:36 PM
Post #2


Super Member
*********

Group: Members
Posts: 397
Joined: 9-June 06
From: Wisconsin
Member No.: 24,924



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 8th October 2008 - 04:18 AM