MaximuS I post too much
Reputation: 3
Joined: 05 Apr 2007 Posts: 3212 Location: ......
|
Posted: Thu Oct 15, 2015 2:46 pm Post subject: Desperately need help with assembly language |
|
|
I have this assignment due in about 7 hours.
I desperately need help, if anybody can help please do so.
This involves OpenGL
Assignment Source file .asm: https://www.dropbox.com/s/vkh29z69ue6rag3/ast10.asm?dl=0
Assignment PDF:https://www.dropbox.com/s/q0v0jkrxc8c3o4k/asst10.pdf?dl=0
Compile/Assemble/Link Script + Test script:https://www.dropbox.com/s/yivata3eq12xu4n/asm10.rar?dl=0
OpenGL test:
https://www.dropbox.com/s/9glt46xknpcttg3/a10openGLtest.zip?dl=0
I need this two functions finished
| Code: | ; ******************************************************************
; Function getParams()
; Get, check, convert, verify range, and return the
; A value, B value, draw color, and draw speed.
; Example HLL call:
; stat = getParams(argc, argv, &aValue, &bValue,
; &drawSpeed, &drawColor)
; This routine performs all error checking, conversion of ASCII/Vegismal
; to integer, verifies legal range of each value.
; For errors, applicable message is displayed and FALSE is returned.
; For good data, all values are returned via addresses with TRUE returned.
; Command line format (fixed order):
; -a <vegismalNumber> -b <vegismalNumber> -ds <vegismalNumber>
; dc <vegismalNumber>
; -----
; Arguments:
; 1) ARGC, value
; 2) ARGV, address
; 3) a value (dowrd), address
; 4) b value (dword), address
; 5) draw color (dword), address
; 6) draw speed (dword), address
;WRITE CODE HERE
;getParams
;*checkrgc
; if(argc == 1)
; display use msg
; return no success
; if(argc != 9)
; display err msg, return NOSUCCESS
; .
; .
; .
cmp rdi, 1
jne NxtChr
mov rdi, useMsg
call printString
jmp exitFail
exitFail:
mov rax, NOSUCCESS
; .
; .
; .
;*check argv[1]
if (argv[1] != 'a' NULL)
error, return NOSUCCESS
mov rbx, qword[rsi+8]
cmp byte[rbx], '-'
jne errOnA
cmp byte[rbx], 'a'
jne errOnA
cmp byte [rbx+2], NULL
jne errOnA
;*check argv[2]
mov r12, rsi
mov rdi, qword[r12+12]
mov rsi, tmpNum
call vegismal2int
cmp rax, TRUE
jne errOnAvalue
pops
ret
; ****************************************************************** |
and this plot function
| Code: | ; ******************************************************************
; Plot Function.
; Note, function is called by openGL
; Compute and plot the points.
; x = cos (((2.0 * Pi) / (a+speed)) * t)
; y = sin (((2.0 * Pi) / b) * t)
; -----
; Gloabal variables accessed.
; Globals are set via provided main.
common aValue 1:4 ; A value
common bValue 1:4 ; B value
common drawColor 1:4 ; draw color
common drawSpeed 1:4 ; draw speed
common stop 1:1
global plotLissajou
plotLissajou:
; save preserved registers
; -----
; Prepare for drawing
; glClear(GL_COLOR_BUFFER_BIT);
mov rdi, GL_COLOR_BUFFER_BIT
call glClear
; -----
; set draw color(r,g,b)
; glColor3ub(r,g,b)
; glBegin(GL_POINTS);
; -----
; Set speed based on user entered drawSpeed
; speed = drawSpeed / scale
; -----
; Get and convert aValue and bValue from int to float.
; -----
; Set lpMax based on largest of a or b.
movsd xmm0, qword [a]
movsd xmm1, qword [b]
ucomisd xmm0, xmm1
jb useB
movsd qword [lpMax], xmm0
jmp setMdone
useB: movsd qword [lpMax], xmm1
setMdone:
; -----
; Adjust a based on calculated speed value.
; -----
; Check for animation stop.
; -----
; Main plot loop.
mainPlotLoop:
; iterate:
; x = cos (((2.0 * Pi) / (a+speed)) * t)
; y = sin (((2.0 * Pi) / b) * t)
; plot (x,y)
; t = t + step
; -----
; plotting done, show image
call glEnd
call glFlush
call glutPostRedisplay
; -----
; if t > circle degrees
; resset t to 0.0
movsd xmm0, qword [t]
movsd xmm1, qword [myPi]
mulsd xmm1, qword [circleDegrees]
ucomisd xmm0, xmm1
jb plotDone
movsd xmm0, qword [fZero]
movsd qword [t], xmm0
; -----
; done
plotDone:
pop r12
pop r15
pop rbp
ret
; ****************************************************************** |
|
|