Created
March 26, 2012 16:24
-
-
Save bobrik/2206313 to your computer and use it in GitHub Desktop.
lab1 unknown subject
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; calculate average of 4 numbers in registers 32-35 and write it to register 8 | |
; ivan bobrov 2012 | |
$MOD52 | |
CSEG | |
ORG 0016h | |
MAIN: | |
; write numbers to data registers | |
MOV 32,#05 | |
MOV 33,#02 | |
MOV 34,#03 | |
MOV 35,#01 | |
; calculate average of two | |
MOV A,32 | |
ADDC A,33 | |
; divide by 2 | |
RR A | |
; remove bit 7 | |
ANL A,#15 | |
; move to resulting register | |
MOV 8,A | |
; do the same again with different numbers | |
MOV A,34 | |
ADDC A,35 | |
RR A | |
ANL A,#15 | |
; do the same with two results we'we got before | |
ADDC A,8 | |
RR A | |
ANL A,#15 | |
; and write it down to register 8 | |
MOV 8,A | |
; here we go | |
JMP EXIT | |
RET | |
EXIT: | |
NOP | |
jmp EXIT | |
ret | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment