Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6470439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:06:42+00:00 2026-05-25T06:06:42+00:00

I have been learning Assembly and I have a question. The textbook presents the

  • 0

I have been learning Assembly and I have a question. The textbook presents the following example:

Assume that the printer data port is memory-mapped to address 0FFE0h
and the printer status port is bit zero of memory-mapped port 0FFE2h.
The following code waits until the printer is ready to accept a byte
of data and then it writes the byte in the L.O. byte of ax to the
printer port:

0000:   mov     bx, [FFE2]
0003:   and     bx, 1
0006:   cmp     bx, 0
0009:   je      0000
000C:   mov     [FFE0], ax
         .       .
         .       .
         .       .

The first instruction fetches the data at the status input port. The
second instruction logically ands this value with one to clear bits
one through fifteen and set bit zero to the current status of the
printer port. Note that this produces the value zero in bx if the
printer is busy, it produces the value one in bx if the printer is
ready to accept additional data. The third instruction checks bx to
see if it contains zero (i.e., the printer is busy). If the printer is
busy, this program jumps back to location zero and repeats this
process over and over again until the printer status bit is one.

Why must we perform the second instruction, and bx, 1? Can’t we just go straight to cmp bx, 0?

Also, can you please clarify or reword “The second instruction logically ands this value with one to clear bits one through fifteen and set bit zero to the current status of the printer port“? I don’t understand what it means right now because English isn’t my first language.

Thank you for

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:06:42+00:00Added an answer on May 25, 2026 at 6:06 am

    Let’s say that memory address 0xFFE2 contains a byte with 8 bits, for instance something like this: 00010100.
    Only the last bit contains information about printer status. All other bits don’t matter for this purpose. How would you extract the last bit from this byte?

    The solution given by the book (and one that is used overall) is to zero out all bits that don’t matter by using bitwise and operator:

          00010100  # content of the memory cell (0x14)
    and   00000001  # 0x1
    ---------------
          00000000
    

    …or…

          00010101  # content of the memory cell (0x15)
    and   00000001  # 0x1
    ---------------
          00000001
    

    You see where this is going, don’t you? By comparing the result of the operation with 0, you can get definite answer if the last bit was 0 or not and hence if the printer is ready or not. Thus, in this case, and operator is just a way of extracting single bit from a byte, nothing more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been learning C++ for three months now and in that time created
I have been learning C++ with some books from school that are from the
I've been learning Lisp to expand my horizons because I have heard that it
So I have been learning assembly and came to the topic of stack, storing
I've been learning compiler theory and assembly and have managed to create a compiler
I am learning High Level Assembly language at the moment and have been going
I have been learning managed pointers lately and ran into the following scenario. I
I have been learning about the basics of C# but haven't come across a
I have been learning more and more javascript; it's a necessity at my job.
I have been learning to use Emacs for a little while now. So far

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.