Microprocessor Simulator 0 Help



Download 1.18 Mb.
Page40/82
Date18.03.2021
Size1.18 Mb.
#56105
1   ...   36   37   38   39   40   41   42   43   ...   82
sms32v50 (3)
sms32v50 (3), sms32v50 (6)

Implied Addresses


Not available in this simulator.

In this case, memory locations are named. Address [50] might be called 'puppy'. This means that moves can be programmed like this.

MOV AL,puppy ; Copy the value in RAM at position puppy into the AL register.
MOV puppy,BL ; Copy BL into the RAM location that puppy refers to.


Example - 04IncJmp.asm - Counting


Contents


Example - 04IncJmp.asm

; ===== Counting ===================================

MOV BL,40 ; Initial value stored in BL
Rep: ; Jump back to this label

INC BL ; Add ONE to BL

JMP Rep ; Jump back to Rep
END ; Program Ends
; ===== Program Ends ===============================
TASK

=====


Rewrite the program to count backwards using DEC BL.

Rewrite the program to count in threes using ADD BL,3.

Rewrite the program to count 1 2 4 8 16 using MUL BL,2

Here is a more difficult task.

Count 0 1 1 2 3 5 8 13 21 34 55 98 overflow.

Here each number is the sum of the previous two.

You will need to use registers or RAM locations

for temporary storage of the numbers.

If you have never programmed before, this is a real brain teaser.

Remember that the result will overflow when it goes above 127.

This number sequence was first described by

Leonardo Fibonacci of Pisa (1170_1230)



The program counts up in steps of one until the total is too big to be stored in a single byte. At this point the calculation overflows. Watch the values in the registers. In particular, watch IP and SR. These are explained below.

Although this program is very simple, some new ideas are introduced.



Download 1.18 Mb.

Share with your friends:
1   ...   36   37   38   39   40   41   42   43   ...   82




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

    Main page