Microprocessor Simulator 0 Help



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

Your Task


Write all your future programs ...

Bad Comment - just repeats the code


        INC BL ; Add one to BL

Useful Comment - explains why the step is needed


        INC BL ; Make BL point to the next video RAM location


Example - 02tlight.asm - Traffic Lights


Contents


Example - 02tlight.asm


; ===== CONTROL THE TRAFFIC LIGHTS =============================


CLO ; Close unwanted windows.

Start:


; Turn off all the traffic lights.

MOV AL,0 ; Copy 00000000 into the AL register.

OUT 01 ; Send AL to Port One (The traffic lights).

; Turn on all the traffic lights.

MOV AL,FC ; Copy 11111100 into the AL register.

OUT 01 ; Send AL to Port One (The traffic lights).

JMP Start ; Jump back to the start.

END ; Program ends.

; ===== Program Ends ==========================================
YOUR TASK

=========

Use the help page on Hexadecimal and ASCII codes.

Work out what hexadecimal numbers will activate the

correct traffic lights. Modify the program to step

the lights through a realistic sequence.


 


To run the program press the Step button repeatedly or press the Run button.

To stop the program, press Stop. When the program is running, click the RAM-Source or RAM-Hex or RAM-ASCII tabs. These give alternative views of the contents of random access memory (RAM).

Also click the List File tab to see the machine code generated by the simulator and the addresses where the codes are stored.

Ports


The traffic lights are connected to port one. Imagine this as a socket on the back of the processor box. Data sent to port one goes to the traffic lights and controls them.

There are six lamps to control. Red, Amber and Green for a pair of lights. This can be achieved with a single byte of data where two bits are unused.

By setting the correct bits to One, the correct lamps come on.



Fill in the rest of this table to work out the Hexadecimal values
you need. Of course you need to know the sequence of lights
in your country.


Download 1.18 Mb.

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




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

    Main page