November 2nd, 2013, 02:53 PM
Help with Arrays
I am a beginner in programming and I need little help.
I have to make a program in assembly but I don't know how. Here is what I need to do and what I know, I have to make a program that works with
array(s) of integer numbers. Program needs to load length of array and array from user, then it needs to calculate remainder of dividing (modulo) of
current element with previous element, And current element with next element of array. Then it needs to compare these numbers (modules) and if
they are equal, program should return values and positions of (original) elements. Program has do that from second element of array, to second to
last (n-1)th element. Also it needs to repeat these action until user doesn't enter wrong number for the length of array (eg. 0 or -1).
Assembly language is 16bit and it has three-address format. It has 64k bit memory buffer with maximal length of 16 for 1 word (command). First 8
places of memory (0-7) are reserved for variables so program should start from 8th position.
Commands that language supports are: MOV (for copy), ADD (for addition), SUB (for subtraction), MUL (for multiplication), DIV (for division),
BEQ (Branch if EQual, for comparison), BGT (Branch if Greater Than, for comparison), IN and OUT (for input from and output to user), JSR
(Jump to SubRoutine) , RTS (Return from subroutine), (I don't really know what are these for), STOP function for end of program, and ORG
function for determination where program should start (ORG 8 usually).
It uses a little weird way for memory locations: if I say X=1, it will put variable X in first memory location, that's what teachers say, direct
addressing; if I say #X it will return a number (constant) for location where X is placed, and if I say (X) it will do something to memory location
which value is in X, that's indirect addressing.
This assembly language is custom made by some teacher in my high school, so it's little... unusual.
Please Help me !!! :)
If there's any questions, I will try to answer.
Thanks in advance :)))
December 5th, 2013, 10:27 AM
still need help?
do you still need help, I've seen the date of this question and we are a month further