Categories
Assembly Language

How to turn on the led using fasmarm and raspberry pi

How to turn on the led using fasmarm and raspberry pi

Categories
Assembly Language

Write an HLA Assembly language program that calculates the cost of various movie tickets. The cost will be based on a single 16-bit value entered by the value. The value will be used to specify a number of adult, senior citizen and children tickets. In addition, there might be matinee discount for each ticket sold

Write an HLA Assembly language program that calculates the cost of various movie tickets. The cost will be based on a single 16-bit value entered by the value. The value will be used to specify a number of adult, senior citizen and children tickets. In addition, there might be matinee discount for each ticket sold. There might be a blockbuster premium applied to each ticket sold. The format of this bit field is diagrammed below:
Three bits are being used to specify the number of child tickets, each costing $5. Three bits are being used to specify the number of adult tickets, each costing $10. Three bits are being used to specify the number of senior citizen tickets, each costing $7. Once all the costs are totaled, the matinee discount should save $2 per ticket. Once all the costs are totaled, add $1 per ticket for blockbuster premium.
Since 16 bits are being entered here, your program should expect to read 4 hexadecimal digits.
Below are some sample program dialogues that demonstrate these ideas.
(Hint: Do this in small steps, bit-by-bit. There’s alot to it… )
(Another Hint: HLA read in hex format when you read directly into a register. So do that…)
(Further Hint: The most important part of this assignment is to worked with the packed data field entered by the user to extract the sub-parts out of it. The overlapping design of the Intel registers helps you parse this kind of data field and you can shift the bits around to get the right part into BH or BL, for example… )
(Final Hint: Since we haven’t learned how to do multiplication yet, although it’s kinda painful, I was expecting that you would perform the multiplication by a looping set of addition instructions)
Feed me 4 hex digits: 0001
1 Children
0 Adult
0 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $5
Feed me 4 hex digits: 0049
1 Children
1 Adult
1 Senior Citizen
No Matinee Discount
No Blockbuster Premium
Total: $22
Feed me 4 hex digits: 025C
4 Children
3 Adult
1 Senior Citizen
Matinee Discount
No Blockbuster Premium
Total: $41
Feed me 4 hex digits: 045D
5 Children
3 Adult
1 Senior Citizen
No Matinee Discount
Blockbuster Premium
Total: $71

Categories
Assembly Language

Learning Goal: I’m working on a assembly language exercise and need an explanati

Learning Goal: I’m working on a assembly language exercise and need an explanation and answer to help me learn.Write a program to input n (input from keyboard) strings of characters with the length unlimited (it is defined by the program, not by the compiler). Sort them in descending or ascending order depending on the request input.Attention:These strings are sorted in ascending/descending by the order of dictionary with deleting redundant characters in each string: blank ‘ ‘, comma ‘,’ if they exist in string.The requirement for the project:1. Use subroutines as much as possible2. Create user interface as clear and beautiful as possible3. Check range for every value input and output appropriately4. The program should be organized so well for structure programming5. The program needs to comment as mamy as possible6. The file is .asm

Categories
Assembly Language

Learning Goal: I’m working on a assembly language test / quiz prep and need an e

Learning Goal: I’m working on a assembly language test / quiz prep and need an explanation and answer to help me learn.; This program prompts the user for certain amount of integers to enter and those numbers are ; stored in an array in memory. you are asked to implements several procedures in assembly language to work; with these numbers to produce the result as specified in the requirements for the particular procedures and; displays the results to user;;Grading Policy:; Use the right register for in your program10 points; Use the right movement statements10 points; Use the right addition statements10 points; Use the right Multiplication statements10 points; Use the right label and loop statements10 points; Use the right comparison and jump statements 10 points; Have coded right program logical10 points; Your program can compile and run10 points; You have the right result10 points; Good comments10 points; Pseudo code conversions 10 points; TO DO:; Write code to implement the requirements for procedures : ArrayMultiplicationDivision; Write code to implement the requirements for procedures : ArrayAverage; Write code to implement the requirements for procedure: ArraySumEven ; You also need to translate these three method to pseudo java or C++ code ; Make sure you can compile and run your code. ; You have to document your code with comments. INCLUDE Irvine32.incINTEGER_COUNT = 6.datastr1 BYTE “Enter a signed integer: “,0str2 BYTE “The result of the integers array calculation is: “,0array DWORD INTEGER_COUNT DUP(?)divider DWORD 2.code ;—————————————————————–; you do not need to change any code in the main procedure;——————————————————————-main PROC call Clrscr mov esi,OFFSET array mov ecx,INTEGER_COUNT call PromptForIntegers call ArraySum call DisplaySum mov esi,OFFSET array mov ecx,INTEGER_COUNT call ArrayMultiplicationDivision call DisplaySum mov esi,OFFSET array mov ecx,INTEGER_COUNT call ArrayAverage call DisplaySum mov esi,OFFSET array mov ecx,INTEGER_COUNT call ArraySumEven call DisplaySum exitmain ENDP;—————————————————–PromptForIntegers PROC USES ecx edx esi;; Prompts the user for an arbitrary number of integers ; and inserts the integers into an array.; Receives: ESI points to the array, ECX = array size; Returns: nothing;—————————————————– mov edx,OFFSET str1 ; “Enter a signed integer”L1: call WriteString ; display string call ReadInt ; read integer into EAX call Crlf ; go to next output line mov [esi],eax ; store in array add esi,TYPE DWORD ; next integer loop L1 retPromptForIntegers ENDP;—————————————————–ArraySum PROC USES esi ecx;; Calculates the sum of an array of 32-bit integers.; Receives: ESI points to the array, ECX = number ; of array elements; Returns: EAX = sum of the array elements;—————————————————– mov eax,0 ; set the sum to zeroL1: add eax,[esi] ; add each integer to sum add esi,TYPE DWORD ; point to next integer loop L1 ; repeat for array size ret ; sum is in EAXArraySum ENDP;——————————————————————————————-; Calculate the multiplications for an array of 32-bit integers; int the main procedure, we asked a user to enter numbers, the number of integer in the arrey.; is defined by INTEGER_COUNT.; For example: if user enters 1, 2, 3, 4, 5, 6. ; and the entered numbers are stored in the array and its address is loaded to ESI; you can use other registers in code.; You need to implement the code in this procedure to calculate products of all the numbers in the array and thendivided the result by the number of the data in the array.; Your final result has to be moved to EAX.; The final resutl should be like the eax = (1 * 2 *3 * 4 * 5 * 6)/ 6 (INTERGER_ACCOUNT, which is the number of data in the array); your program should still work if you changed the INTERGER_ACOUNT ; Please document your code with comments;——————————————————————————————————–ArrayMultiplicationDivision PROC USES esi ecx edx retArrayMultiplicationDivision ENDP;———————————————————————————————————;After your finished your assembly code for above, please create a pseudo code in Java or c language ;to implement the same calculations. NOTE: this pseudo code will not be compiled by the assembler, but ;to use it as documentation and showing your understanding between assembly language and high level computer ;language. Your high language pseudo code should be this in this comments section.;———————————————————————————————————;————————————your pseudocode for ArrayMultiplicationDivision procedure —————–; ;;;;;;;;——————————————————————————————————–;——————————————————————————————-; Calculate the average for an array of 32-bit integers; int the main procedure, we asked a user to enter numbers, the number of integer in the arrey; is defined by INTEGER_COUNT; For example: if user enters 1, 2, 3, 4, 5, 6 ; and the entered numbers are stored in the array and its address is loaded to ESI; you can use other registers in code; You need to implement the code in this procedure to calculate avarge of the array entered by the user; Your final result has to be moved to EAX.; The final result should be like the eax = (1 + 2 +3 + 4 + 5 + 6) /6; your program should still work if you changed the INTERGER_ACOUNT ; Please document your steps;——————————————————————————————————–ArrayAverage PROC USES esi ecx edxretArrayAverage ENDP;———————————————————————————————————;After your finished your assembly code for above, please create a pseudo code in Java or c language ;to implement the same calculations. NOTE: this pseudo code will not be compiled by the assembler, but ;to use it as documentation and showing your understanding between assembly language and high level computer ;language. Your high language pseudo code should be this in this comments section.;———————————————————————————————————;————————————your pseudocode for ArrayAverage procedure —————–; ;;;;;;;;——————————————————————————————————–;——————————————————————————————————–; calculate the sum of the array, only summarize the even numbers; int the main procedure, we asked a user to enter numbers, the times; of entering the number is defined by INTEGER_COUNT; and the entered numbers are stored in the array and its address is loaded to ESI; You can register in your code. ; You need to implement the code in this procedure to add up only the even numbers in this array; your final result must be moved to EAX; For example, if user enter number 3, 5, 6, 2, 11, 10, ther result = 6 +2 + 10, ignor 3, 5, and 11; your program should still work if you changed the INTERGER_ACOUNT ; Please document your steps;——————————————————————————————————-ArraySumEven PROC USES esi ecx edx retArraySumEven ENDP;——————————————————————————————————-;After your finished your assembly code for above, please create a pseudo code in Java or c language ;to implement the same calculations. NOTE: this pseudo code will not be compiled by the assembler, but ;to use as documentation and showing your understanding between assembly language and high level computer;language. Your high language pseudo code should be this in this comments section.;——————————————————————————————————-;————————————your pseudo code here for ArraySumEven Procedure——————–; ;;;;;;;;——————————————————————————————————–;——————————————————————–DisplaySum PROC USES edx;; Displays the sum on the screen; Receives: EAX = the sum; Returns: nothing;——————————————————————— mov edx,OFFSET str2 ; “The result of the…” call WriteString call WriteInt ; display EAX call Crlf retDisplaySum ENDPEND main