lundi 23 mars 2015

Assembly Language Code Help


Part 1


Implement the following C++ code fragment in assembly language. Use the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit integers.



int array[] = {3,1,4,1,5,9,2,6, 5,3,5,8,9,7,9,3,2,3,8,4};
int lower = 3;
int upper = 8;
int ArraySize = sizeof array / sizeof lower;
int index = 0;
int sum = 0;
while( index < ArraySize )
{
if( array[index] >= lower && array[index] <= upper )
{
sum += array[index];
}
index++;
}


Your assembly language program must also display as output the number of times a member of ' array 'e qualified for inclusion into the ' sum 'e and what the final value of the variable ' sum 'e was. (Hint: you may have to add another variable.) Feel free to use the author's procedures in the book's link library. Use only the procedures that were introduced in chapter 5.


Part 2


Write a program that asks the user to enter an integer dollar amount between 1 and 5,000. Your program should display the corresponding class description using the following table. Write the program so that it executes until the user inputs some value that you determine to be the "stop value". Your program must guard against and provide user messages for input values that are outside the valid range.


Donation Amount (dollars) Class of Donation $4,000 to $5,000 Platinum $3,000 to $3,999 Gold $2,000 to $2,999 Silver $1,000 to $1,999 Bronze $1 to $999 Copper


This is what I have so far:


INCLUDE Irvine32.inc


.data


sum DWORD 0


index DWORD 0


array DWORD 3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4


lower DWORD 3


upper DWORD 8


ArraySize = ($ - Array) / TYPE array


message1 db "Enter an amount between $1 and $5000 (or enter 0 to quit): ", 0


message2 db "Class of Donation: ", 0


message3 db "Error:Donated amount must be between $1 and $5000!!", 0


.code main PROC


mov eax, 0


mov edx, lower


mov esi, 0


mov ebx, upper


mov ecx, ArraySize


L1 : cmp esi, ecx



jl L2

jmp L6


L2 : cmp array[esi * 4], edx



jg L3

jmp L5


L3 : cmp array[esi * 4], ebx



jl L4

jmp L5


L4 : add eax, array[esi * 4]



L5 : inc esi
jmp L1

L6 : mov sum, eax
; call ArraySize
; call sum
call DumpRegs

pushad
call Clrscr
mov edx, OFFSET message1
call WriteString
call ReadInt
call Crlf

.IF eax > 5000
mov edx, OFFSET message3
call WriteString
jmp quit
.ENDIF

cmp eax, 0
je quit

.IF eax >= 4000
mov al, "P"

.ELSEIF eax >= 3000
mov al, "G"
.ELSEIF eax >= 2000
mov al, "S"
.ELSEIF eax >= 1000
mov al, "B"
.ELSE
mov al, "C"
.ENDIF

mov edx, OFFSET message2
call WriteString
call WriteChar


call Crlf


Quit : popad ret


exit main ENDP END main


Someone Please help me complete this.. I am completely new to Assembly Language and I've been trying this for couple of days already. I don't know what's wrong with this code :( Help!!





Math Collaboration Opportunities for Software Engineer?


Everyone,


I am a former mathematics graduate student (MS Math, U. of Utah) looking to contribute to Mathematics in some auxillary but substantive way. In particular to the more constructive areas where a software engineer would feel at home. What collaborative opportunities might I draw on to become involved in the FOM community? Perhaps I could contribute LaTeX, help design a website, write exposition, or use my programming skills to contribute some code.


In short, mathoverflow has whetted my appetite and I want to get involved. Despite my academic career having reached it end.


My story must be typical: I choose my alma mater, the University of Utah, for practical reasons. Unfortunately, the Foundations of Mathematics (FOM) areas were completely unrepresented in the available coursework and faculty. I ended up focusing commutative algebra and dropped out with just an MS, unfulfilled. FOM was my first love, but it wasn't meant to be. Or so it seems.


My formal mathematical education has likely reached its end, but I want to stay involved. The question: how? I have a lot to leverage: software development skills, and mathematical mind, and MS in math, and a good 20/hrs a week of free time.


To paraphrase, I am willing to LaTeX for food.


About me: I currently earn a living programming in Scala, a programming language with a lot of support for functional programming constructs. I'm interested in Primitive Recursive Arithmetic, constructive mathematics, and low power category theory. In graduate school I chose the subject areas Topology/Geometry, Real/Complex Analysis, and Modern Algebra for my written exams. In retrospect, I would like to have studied Subsystems of Second Order Arithmetic, Realizability Theory, or something involving Type theory in graduate school.



  • Rex Butler


[Disclosure: this is an edited version of the same question posted to the FOM email list.] Also, if this question is inappropriate for this forum please suggest another forum where I might ask it. Thanks!





Does an unpublished document you upload to researchgate become 'published' in the sense of copyright once made public?


Apologies if this is a duplicate, I did search the forum.


On ResearchGate, if you upload something like a thesis, and then it says 'publish resources' does this mean the thesis becomes properly published in the sense of copyright infringement?


I ask as I'm drafting thesis chapters into journal articles and did not choose to publish the thesis as a whole work in order to do so, so I want to make sure that by clicking 'publish resources' I am not actually publishing the copy I've uploaded, I'm just making it publicly available? Does this mean it becomes published in accordance with copyright laws despite it not technically being a published work? (if so I'll just remove the copy I uploaded).





Will poor grades hurt my chances of getting a research job in a non-traditional setting? [on hold]


I have been pursuing a BSc in Political Science with Psychology during this time I held two jobs and a lot of personal responsibilities but due to my age did not want to defer studying. I have recently taken a semester break as every thing became too much. I simply wanted clear some tasks off my plate so to speak so I could concentrate and do the required reading to achieve better grades. I have 12 courses remaining to do and would like to achieve no lower than Bs for all of them. I am wondering if my poor grades will prevent me from having the opportunity to find a job doing research for a trade Union or Social Development type organisation.


To make myself clear, I mean to work researching information on the membership, eg. family structures within the organisation, etc. Levels of education and so on. Research the membership and they expectations etc





Can I refuse a stipend during a PhD program?


I was admitted to a US PhD program (in computer science, if that matters) with fellowship + stipend.


I am getting a separate stipend from my government (which is higher than the university stipend), but they forbid me from getting an additional stipend from the university.


Is it OK to ask the university to just pay for my tuition (with the fellowship), and refuse the stipend?





Is there a difference between Distinguished and Minimal graduation plans


I am attending a Texas public school and am wondering if it was possible for me as a high school junior to switch to the the Distinguished Foundation Plan form the Distinguished 4x4 plan.


According to this article, "[C]urrent high school students may pursue graduation under the new Foundation program if they choose to take courses in that program in 2014-15." Also this chart states that "Students who entered high school prior to 2014-2015 may opt in to this [Foundation Plan]"


However, I asked my counselor and she told me I could only switch to the minimum plan. I am currently on the Distinguished 4x4 plan and have all the necessary credits to graduate on time if I switch to the new plan or if stay on my current one.


My questions:



  1. Is it possible for me to switch to the new Distinguished Foundation Plan?

  2. Is there any real detriment to in terms of college acceptance to graduating under the minimum plan? As far as I know, I would already be accepted to college before I graduate, so I'd assume that colleges do not get to look at a high school diploma or see the graduation plan.


In case anyone is wondering, I am trying to avoid taking a class that would lower my GPA by switching graduation plans.





Can a Graduate Student With Deficiencies Get an Assistantship for the Needed Undergraduate Courses?


I see many graduate program informational pages listed by various schools.


Many of them require specific undergraduate degrees, but also have discretionary exceptions for those without them. Most of them say something like:



"An applicant without satisfactory undergraduate training may be admitted to the program, but will be required to remove deficiencies by completing the necessary undergraduate courses without receiving graduate credit for them." - UND Physics & Astrophysics M.S.



I understand that the answer to this question is probably not all or nothing. Has anyone reading this had experience in such a situation or have any suggestions for a person seeking a graduate degree in any program with similar deficiencies who is strongly against debt and aims to make it through a program with an assistantship?


Is it typical for one who begins a degree with an assistantship to maintain it until program completion provided that they maintain satisfactory performance in all facets of the assistantship ie. academic and duty performance?