Microprocessor Simulator 0 Help



Download 1.18 Mb.
Page37/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   33   34   35   36   37   38   39   40   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)
Red

Amber

Green

Red

Amber

Green

Not
used


Not
used


Hex

1

0

0

0

0

1

0

0

84

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



 

What you need to know

Labels and Jumps


Labels mark positions that are used by Jump commands. All the commands in this program are repeated for ever or until Stop is pressed. Label names must start with a letter or _ character. Label names must not start with a digit. The line

JMP Start

causes the program to jump back and re-do the earlier commands.

Destination labels end in a colon. For example


Start:

Controlling the Lights


If you look carefully at the traffic lights display, you can see which bit controls each light bulb. Work out the pattern of noughts and ones needed to turn on a sensible set of bulbs. Use the Hexadecimal and Binary numbers table to work out the hexadecimal equivalent. Move this hexadecimal number into AL.

OUT 01


This command copies the contents of the AL register to Output Port One. The traffic lights are connected to port one. A binary one causes a bulb to switch on. A nought causes it to turn off.




Example - 03move.asm - Data Moves


Contents


Example - 03move.asm

; ---------------------------------------------------------------

; A program to demonstrate MOV commands. Mov is short for move.

; ---------------------------------------------------------------

CLO ; Close unwanted windows.

; ===== IMMEDIATE MOVES =====

MOV AL,15 ; Copy 15 HEX into the AL register

MOV BL,40 ; Copy 40 HEX into the BL register

MOV CL,50 ; Copy 50 HEX into the CL register

MOV DL,60 ; Copy 60 HEX into the DL register

Foo:

INC AL ; Increment AL for no particular reason.



; ===== INDIRECT MOVES =====

MOV [A0],AL ; Copy value in AL to RAM location [40]

MOV BL,[40] ; Copy value in RAM location [A0] into BL

; ===== REGISTER INDIRECT MOVES =====

MOV [CL],AL ; Copy the value in AL to the RAM

; location that CL points to.

MOV BL,[CL] ; Copy the RAM location that CL points

; to into the BL register.

JMP Foo ; PRESS ESCAPE TO STOP THE PROGRAM

END


; ---------------------------------------------------------------

TASK


====

Look up the ASCII codes of the letters in H,E,L,L,O and move

these ASCII codes to RAM addresses [C0], [C1], [C2], [C3]

and [C4]. Run the program and watch how the text appears on

the simulated VDU display. This is very much the same as what

happens in the IBM PC running MS DOS. The program you write

should work but if you continue to study low level programming,

you will find much more efficient and flexible ways of solving

this problem.


Step through the program and watch the register values changing. In particular, look at the RAM-Hex display and note the way that values in RAM change. Addresses [50] and [A0] are altered. You can copy the example program from the help page and paste it into the source code editor.


Download 1.18 Mb.

Share with your friends:
1   ...   33   34   35   36   37   38   39   40   ...   82




The database is protected by copyright ©ininet.org 2024
send message

    Main page