Jump to content
IGNORED

Assembly Language Programming - Lesson 1 - Bits!


Robert M

Recommended Posts

Assembly Language Programming - Lesson 1

 

This course assumes no prior knowledge of computer programming. While the examples given in the course are targeted at the 650X family of procesors, the ideas presented will apply to assembly language programming and often programming in general.

 

Please feel free to posts comments or questions into the Lesson threads. If you wish to ask a private question don't hesitate to send me a PM.

 

Materials needed:

 

- The assembler we will be using for this course is DASM. We won't need the assembler for the first several sessions, I will provide links for downloading and installing DASM. DASM is available for DOS, Windows (in a DOS window), Amiga, and Macintosh (OS-9 or OS-X). So the development tools will be available on many platforms.

 

Lesson 1: The Most Important Thing You Need to Know about Computers.

 

Imagine you have a black box with a single light bulb sticking out of it. Sometimes the light is on, sometimes it is off. Please answer these questions:

 

1. What does it mean when the light is on?

2. What does it mean when the light is off?

 

Until you can answer these questions, programming computers will never quite make sense. Everything else we do in this course will be built on this radical idea. Please take a moment to consider these questions, and try to answer them by responding within this thread. Please be sure to explain the reason for your answers? I will review your responses and provide a definitive answer on Tuesday evening (Central Time, U.S.A.). Hint: There are no wrong answers, its just a mental exercise to broaden your mind.

 

Regards,

Link to comment
Share on other sites

What does it mean when the light is on?

When the light is on, this means that our intended action is flagged to take place.

 

What does it mean when the light is off?

When the light is off, this means that our intended action is not flagged to take place.

 

Now in this case, I would say that our "machine" is limited in its capabilities. However, if we were to add more lights (bits), we could expand the features of our "machine". In this case, we could presume that by turning on various lights we could cause different lighting effects to happen throughout the room it is in.

 

This is much the way, that a computer is....that is, by turning on and off various "lights" we are able to perform various functions. The only difference is that with a computer, we may be performing some kind of arithmetic operation, drawing something, etc rather then lighting a room.....though in today's day and age....you COULD do that as well. :)

 

Still though, to a computer, all it sees are these "lights". When we program, be in assembly (as is the case with Robert's tutorial) or another language, we are using symbols to represent the actions we want to take.

It is the job of the compiler of our language to convert these symbols into the language that the computer will understand.

 

Cap

Link to comment
Share on other sites

1. What does it mean when the light is on?

 

It means that a condition has been set.

 

2. What does it mean when the light is off?

 

It means that a condition has been reset.

 

Note: There is no gradation of variety of intensity between conditions 1 and 2.

 

Rob Mitchell, Atlanta, GA

(everybody talks about digital .. but nobody talks about analog!)

Link to comment
Share on other sites

Alright! These are good responses. The key points that you need to take away from this exercise are:

 

1. The light is either on or off, there are only 2 possible conditions for the light. The light represents a single digital bit.

 

2. The two states of the bit can represent ANY TWO OPPOSING conditions:

 

1 or 0

YES or NO

"The Player is alive" or "The player is Dead"

"The Fire button is pressed" or "The fire button is not pressed"

 

3. All information in a digital computer at its lowest level is composed of bits. There is no piece of information smaller than a single bit.

 

 

So how does this relate back to the questions I asked above?

 

1. What does it mean when the light is on?

 

It means what ever you the programmer want it to mean is true.

 

2. What does it mean when the light is off?

 

The opposing condition for the meaning you give to the bit is true.

 

By common convention the values 1 and 0 are used to represent the states of bits. One usually means on, yes, or true. Zero usually means off, no, or false. Notice that I said "by convention" and "usually". You could just as well use "A" and "B" or "Zip" and "Zap", but this makes it hard to talk with others about bits, so we will use 1 and 0 in this class.

 

This is the great secret of all computers and computer programming in general. When you program in assembly language you have complete control/responsibility :P to provide the meaning of the values of the bits that make up your program. If you want a a bit to mean "The Dragon is awake" when it is 1 and "The dragon is asleep" when it is zero, that is fine. Just understand that the meaning you give to the bit is completely your own invention and when the user pulls out cartridge with your program and puts another one in, that program will apply a completely different meaning to the EXACT SAME BIT.

 

Alright let's move onto Lesson 2: Enumeration

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...