Microprocessor Simulator 0 Help



Download 1.18 Mb.
Page44/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   40   41   42   43   44   45   46   47   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)

Fetch Execute Cycle


Fetch the instruction. IP points to it. This is called the operator.
If necessary, fetch data. IP + 1 points to it. This is the first operand.
If necessary, fetch data. IP + 2 points to it. This is the second operand.
Execute the command. This may involve more fetching or putting of data.
Increase IP to point to the next command or calculate IP for Jump commands.
Repeat this cycle.

Every machine cycle has one operator or instruction. There could be zero, one or two operands depending on the instruction. OP Codes are the machine codes that correspond to the operators and operands.






Example - 05keyb-in.asm - Keyboard Input


Contents


Example - 05keyb-in.asm


 

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

; Input key presses from the keyboard until Enter is pressed.

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

CLO ; Close unwanted windows.

Rep:

IN 00 ; Wait for key press - Store it in AL.



CMP AL,0D ; Was it the Enter key? (ASCII 0D)

JNZ Rep ; No - jump back. Yes - end.


END

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

TASK
11) Easy! Display each character at the top left position of the

VDU by copying them all to address [C0].


12) Harder Use BL to point to address [C0] and increment BL after

each key press in order to see the text as you type it.


13) Harder! Store all the text you type in RAM when you type it in.

When you press Enter, display the stored text on the VDU display.


14) Difficult Type in text and store it. When Enter is pressed,

display it on the VDU screen in reverse order. Using the stack

makes this task easier.


You can copy this example program from the help page and paste it into the source code editor.

IN 00


Input from port zero. In this simulator, port zero is wired to the keyboard hardware. The simulator waits for a key press and copies the ASCII code of the key press into the AL register. This is not very realistic but is easy to program. There is a more realistic keyboard on port 07 and interrupt 03 but this is for more advanced programmers.


Download 1.18 Mb.

Share with your friends:
1   ...   40   41   42   43   44   45   46   47   ...   82




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

    Main page