Jump to content
xisto Community
Sign in to follow this  
Jeune

Question With Bx And Bl

Recommended Posts

I have a dilema here.

How come I have to do this?

mov bx,0hmov bl,curlen

and not this?
mov bx,0hmov 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.datamessage db "Enter Name: ","$"inputLabel label bytemaxlen  db 20curlen  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".codemain   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   21hmain   endpend main

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.