Jump to content
Hello guys,

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 :)))

Link to comment
https://linustechtips.com/topic/71655-assemby-language-help/
Share on other sites

Link to post
Share on other sites

There are a lot of questions in there. I'm going to start off by saying that one the most important skills you can develop in solving computer science related problems is understanding the problem well enough to research it. For example you want to work with arrays? look up how arrays are implemented on that low of a level. Don't know how to implement a modulo? Do some research until you know the problem well enough to implement a solution. Once you understand those then you should be a reasonable hop from solving the assignment.

 

There are a few other pointers I have sitting in my back pocket but start with that. You can learn several awesome things reading up on subjects like this, reading up on memory addressing and data structures could steal a good chunk of time if you let it.

My rig: 2600k(4.2 GHz) w/ Cooler Master hyper 212+, Gigabyte Z68-UD3H-B3, Powercolor 7870 xt(1100/1500) w/AIO mod,

8GB DDR3 1600, 120GB Kingston HyperX 3K SSD, 1TB Seagate, Antec earthwatts 430, NZXT H2

Verified max overclock, just for kicks: http://valid.canardpc.com/show_oc.php?id=2609399

Link to comment
https://linustechtips.com/topic/71655-assemby-language-help/#findComment-982020
Share on other sites

Link to post
Share on other sites

Couldn't you maybe write it in C and then disassemble the result? If you use as few compiler optimizations as possible and maybe abstract user io to a simple varible you would get a result that you can more or less easily translate to your model asm language.

Link to comment
https://linustechtips.com/topic/71655-assemby-language-help/#findComment-984896
Share on other sites

Link to post
Share on other sites

Depends on the Tools you use. If you use Visual Studio there's features build in. If you use something else there's tools that disassemble .exe files. You will have to google that i have just done that once quite a while back.

 

Edit: This seems to be a decent resource http://www.developingthefuture.net/disassembling-decompiling-and-modifying-executables/

Link to comment
https://linustechtips.com/topic/71655-assemby-language-help/#findComment-985219
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×