blog

Assemble Language Programming with x86 – PDF wit problem Attached.

Assemble Language Programming with x86 – PDF wit problem Attached.

Check PDF for problem, data and Book. I posted a source file for ast05 so that you have an idea how the structure of the text file or .asm file should be. Stuff in it is more like a sand box from previous assignment, yet it might be helpfull to create the source file. I’m a Nice Kid, so if you give me a good solution I will post more for you and increase the price each time as it gets harder. I am still waiting on a solution for #5, which must be used for #6, so if you want to make 100 bucks, come up with a solution for #5 , then use it for 6 which shouldnt take much…. and collect your money. Thanks!

; *********************************************************************************************

;  Must include:

;           name: Newton NiceKid

;           assignmnet #

;           section #CS 218

 

; —–

;a simple assembly language program to calculate the some geometric information for each

;rectangular prism1 in a series of rectangular prism’s. The program should find the base

;area, volume, and surface area for each rectangular prism. Once the base area, volume,

;and surface area are computed, the program should find the minimum, maximum, middle value,

;sum, and average for the base area, volume, and surface area. All data must be treated as

;unsigned values (i.e., use of MUL and DIV, not IMUL or IDIV). The JA/JB/JAE/JBE must be used

;(as they are for unsigned data).

; *********************************************************************************************

;  Data Declarations (provided).

 

; *****************************************************************

 

section           .data

 

; —–

;  Define constants.

 

NULL              equ     0                                  ; end of string

 

TRUE             equ     1

FALSE                       equ     0

 

EXIT_SUCCESS     equ     0                                  ; successful operation

SYS_exit       equ     60                                ; call code for terminate

 

; —–

;  Data Set

 

widths                        dw       148,  194,  162,  163,  118

dw       161,  145,  152,  129,  165

dw       112,  100,  185,  163,  125

dw       176,  147,  155,  110,  113

dw       108,  145,  161,  164,  165

dw       177,  120,  156,  147,  161

dw       152,  119,  165,  161,  131

dw       165,  114,  123,  115,  114

 

heights                       dw       233,  214,  223,  211,  234

dw       212,  200,  285,  263,  205

dw       264,  213,  224,  213,  265

dw       244,  212,  213,  212,  223

dw       265,  264,  273,  216,  234

dw       253,  213,  243,  213,  235

dw       244,  169,  234,  233,  232

dw       234,  223,  215,  214,  201

 

lengths                       dd        1145, 1134, 1123, 1123, 1123

dd        1153, 1153, 1243, 1153, 1135

dd        1134, 1134, 1156, 1164, 1142

dd        1153, 1153, 1184, 1142, 1134

dd        1145, 1134, 1123, 1123, 1123

dd        1134, 1134, 1156, 1164, 1142

dd        1153, 1153, 1184, 1142, 1134

dd        1156, 1164, 1142, 1134, 1001

 

length             dd        40

 

baMin             dd        0

baEstMed      dd        0

baMax                        dd        0

baSum                       dd        0

baAve             dd        0

 

vMin               dd        0

vEstMed                     dd        0

vMax               dd        0

vSum              dd        0

vAve               dd        0

 

saMin             dd        0

saEstMed      dd        0

saMax                        dd        0

saSum                       dd        0

saAve             dd        0

 

; —–

; Additional variables (if any)

 

 

; ————————————————————–

; Uninitialized data

 

section           .bss

 

baseAreas     resd    40

volumes                     resd    40

surfaceAreas            resd    40

 

; *****************************************************************

 

section           .text

global _start

_start:

 

; ——————— – [ BEGINNING CODE] – ———————-

 

;           Code from last assignment

 

mov ecx, 0

mov eax, dword [lst]

mov dword [lstMin], eax

mov dword [lstMax], eax

mov dword [lstSum], 0

 

;Start loop

StatLoop:

mov eax, dword [lst + ecx*4]

add dword [lstSum], eax

cmp eax, dword [lstMin]

jae checkMax

mov dword [lstMin], eax

 

; Check Max number

checkMax:

cmp eax, dword [lstMax]

jbe CheckMin

mov dword [lstMax], eax

 

;Check Min number

CheckMin:

mov ebx, 2

mov edx, 0

div ebx

cmp edx, 0

je NotOdd

add dword [oddCnt], edx

mov eax, dword [lst + ecx*4]

add dword [oddSum], eax

 

; If not odd

NotOdd:

mov ebx, 9

mov edx, 0

div ebx

cmp edx, 0

jne NotInNine

 

add dword [nineCnt], 1

mov eax, dword [lst + ecx*4]

add dword [nineSum], eax

 

; If # is not divisible by 9

NotInNine:

inc ecx

cmp ecx, dword [length]

jne StatLoop

 

; Calculate the median value

; eax = 1/2 length

; ecx = lst length

; edx = 0 -> even

; edx = 1 -> odd

 

mov ebx, 2                             ; Set ebx -> 2

mov edx, 0                             ; Set edx -> 0

mov eax, dword [length]

div ebx                                               ; ebx is 2, so get estMed

mov dword [estMed], edx

 

dec ecx                                              ; Decrement length for ecx

dec eax                                              ; Decrement length for eax

mov ebx, 0

add ebx, dword [lst]

add ebx, dword [lst + 4*ecx]

 

cmp edx, 0                             ; Compare edx

jne Next

 

; Even List

add ebx, dword [lst + 4*eax]

inc eax

add ebx, dword [lst + 4*eax]

mov dword[estMed], ebx

mov ecx, 4

mov edx, 0

mov eax, dword[estMed]

div ecx

mov dword [estMed], eax

jmp Avg

 

Next:

; Odd list

inc eax

add ebx, dword [lst + 4*eax]

mov dword[estMed], ebx

mov ecx, 3

mov edx, 0

mov eax, dword[estMed]

div ecx

mov dword [estMed], eax

 

; Calculate the Average number for lst, oddAve, nineAve

 

Avg:

 

; lst

mov edx, 0

mov eax, dword[lstSum]

div dword [length]

mov dword [lstAve], eax                  ; lst Ave

; oddAve

mov edx, 0

mov eax, dword[oddSum]

div dword [oddCnt]

mov dword [oddAve], eax               ; oddAve

; nineAve

mov edx, 0

mov eax, dword[nineSum]

div dword [nineCnt]

mov dword [nineAve], eax  ; nineAve

 

; ———————– – [END CODE] – ————————–

 

;************************* START – Sand BoX ***********************

; Summation loop.

;

;           mov ecx, dword [length]      ; get length value

;           mov rsi, 0                               ; index=0

;sumLoop:

;           mov eax, dword [lst+(rsi*4)]            ; get lst[rsi]

;           add dword [sum], eax                      ; update sum

;           inc rsi                                     ; next item

;           loop sumLoop

;

;Sum of odd numbers

;

;           mov ecx, qword [length]      ; loop counter

;           mov eax, 1                             ; odd integer counter

;

;sumLoop:

;           add dword [oddSum], eax   ; sum current odd integer

;           add eax, 2                              ; set next odd integer dec

;           ecx                                          ; decrement loop counter

;           cmp ecx, 0

;           jne sumLoop

;************************* END – Sand BoX *************************

 

; *****************************************************************

;           Done, terminate program.

 

last:

mov     eax, SYS_exit                       ; call call for exit (SYS_exit)

mov     ebx, EXIT_SUCCESS         ; return code of 0 (no error)

syscall

Is this the question you were looking for? If so, place your order here to get started!

×