diff --git a/labs/Solutions/Lab10_jl.nasm b/labs/Solutions/Lab10_jl.nasm new file mode 100755 index 0000000..d71034b --- /dev/null +++ b/labs/Solutions/Lab10_jl.nasm @@ -0,0 +1,44 @@ +bits 64 + +global first_func, second_func, third_func + +first_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Using the rdtsc instruction, +; 1.) Obtain the current timestamp +; 2.) Combine the low 32 bits (from RAX) +; and the high 32 bits (RDX), and +; return them. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + rdtsc + shl rdx, 32 + add rax, rdx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +second_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Using CPUID, get the vendor +; string, and copy each chunk +; returned into the buffer +; passed to your function. +; The buffer should be the +; first (and only) argument. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor rax, rax + cpuid + mov [rdi], ebx + mov [rdi+4], edx + mov [rdi+8], ecx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + diff --git a/labs/Solutions/Lab11_jl.nasm b/labs/Solutions/Lab11_jl.nasm new file mode 100755 index 0000000..f26299b --- /dev/null +++ b/labs/Solutions/Lab11_jl.nasm @@ -0,0 +1,67 @@ +bits 64 + +extern first_value +global first_func, second_func, third_func +global out1, out2 + +section .data + +firstfloat dd 1.2345 + +secondfloat dd 2.345 + +out1 dd 0x00 + + +out2 dq 0x00 + +tmp dq 0x00 + +section .text + +first_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This problem will require +; you to load both firstfloat +; and secondfloat (above) onto +; the floating point stack, add +; them together, and store the +; result in out1. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + fld dword [firstfloat] + fld dword [secondfloat] + faddp + fstp dword [out1] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +second_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This problem will require +; you to add the contents of +; firstfloat to an integer +; that is passed in as the +; first (and only) argument +; to your function. Store the +; result at out2. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + fld dword [firstfloat] + mov [tmp], rdi + fild qword [tmp] + fadd + fstp qword [out2] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + diff --git a/labs/Solutions/Lab12_jl.nasm b/labs/Solutions/Lab12_jl.nasm new file mode 100755 index 0000000..d50580a --- /dev/null +++ b/labs/Solutions/Lab12_jl.nasm @@ -0,0 +1,77 @@ +bits 64 + +global first_func, second_func, third_func + +firstdata dd 0x00 +seconddata dd 0x00 + +first_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This problem will require +; adding two vectors of numbers. +; A pointer to two unaligned +; vectors of 32-bit integers +; have been passed as the first +; two parameters to your function, +; and a pointer to an empty +; vector has been provided to store +; the result. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + movups xmm0, [rdi] + movups xmm1, [rsi] + addps xmm0, xmm1 + movups [rdx], xmm0 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +second_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This problem will require +; you to compare the values +; stored in the vector pointed +; to by parameter 1 with the +; values stored in the vector +; pointed to by parameter 2. +; Store the results of the +; comparison in the vector +; pointed to by parameter 3. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + movups xmm0, [rdi] + movups xmm1, [rsi] + cmpps xmm0, xmm1, 0 + movups [rdx], xmm0 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +third_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Given two scalar values, passed +; in as two parameters, find the max +; of the two, and return it as your +; result. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rdi + push rsi + sub rdi, rsi + js less_than + pop rdi + pop rax + jmp done +less_than: + pop rax + pop rdi +done: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret diff --git a/labs/Solutions/Lab1_jl.nasm b/labs/Solutions/Lab1_jl.nasm new file mode 100755 index 0000000..a2fa07e --- /dev/null +++ b/labs/Solutions/Lab1_jl.nasm @@ -0,0 +1,127 @@ +bits 64 + +extern value +extern buf +extern val1 +extern val2 +global first_func, second_func, third_func, fourth_func, fifth_func, sixth_func + +first_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; This is your first method for +; the lab. First problem: +; move the number 16 into +; the register RAX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, 16 +;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code. +; +;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +second_func: + mov rcx, 0x20 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; The second function in the lab +; involves moving a value from +; one register to another. +; Copy the contents of RCX into +; RAX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, rcx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + +third_func: + mov rcx, value + mov rax, 0x10 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; The third function involves +; moving a value from a register, +; to a location in memory. RCX +; currently contains a pointer +; to some data. Copy the value +; from RAX to the location +; RCX points to. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov [rcx], rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + +fourth_func: + mov rcx, value + xor rax, rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For the fourth function, copy +; the value stored in the +; location RCX points to into +; RAX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, [rcx] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +fifth_func: + mov rcx, buf +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this lab, you will need +; to use LEA to calculate the +; next address in a list of 8 byte +; elements, and then copy the value +; stored at that address into +; RAX. +; There is a a pointer to the +; beginning of the list stored +; in RCX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + lea rcx, [rcx + 8] + mov rax, [rcx] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +sixth_func: + mov rcx, val1 + mov rdx, val2 + xor rax, rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this lab, you will need to +; use XCHG to swap two values +; stored in addresses in memory. +; The first value is a pointer to +; some data, contained by RCX, and +; the second is a pointer stored in +; RDX. +; HINT: Two XCHGs may be required. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, [rcx] + xchg rax, [rdx] + mov [rcx], rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + diff --git a/labs/Solutions/Lab2_jl.nasm b/labs/Solutions/Lab2_jl.nasm new file mode 100755 index 0000000..28afcc0 --- /dev/null +++ b/labs/Solutions/Lab2_jl.nasm @@ -0,0 +1,40 @@ +bits 64 + +extern value +global first_func, second_func + +first_func: + mov rax, -1 + mov rcx, -1 + mov cl, 0x04 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this task, you must move +; the first byte of RCX into +; RAX, using zero extend. +; +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + movzx rax, cl +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + +second_func: + xor rax, rax + mov ah, 0x42 + mov al, 0x41 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this task, you must swap +; the contents of the first two +; bytes of RAX (ah/al). +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xchg al, ah +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret diff --git a/labs/Solutions/Lab3_jl.nasm b/labs/Solutions/Lab3_jl.nasm new file mode 100755 index 0000000..03f5139 --- /dev/null +++ b/labs/Solutions/Lab3_jl.nasm @@ -0,0 +1,91 @@ +bits 64 + +global first_func, second_func, third_func, fourth_func, fifth_func + + +first_func: + mov rax, 10 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this test, you will +; need to add 10 to the +; value stored in rax. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + add rax, 10 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +second_func: + mov rax, 30 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this test you will +; need to subtract 20 +; from the value in rax. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + sub rax, 20 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + + +third_func: + mov rax, 10 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this lab, you will +; need to multiply rax by +; 10. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + imul rax, 10 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +fourth_func: + mov rax, 10 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this lab, you will +; need to divide by 2, +; and return the quotient. +; hint: make sure you clear +; the high bits! +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + xor edx, edx + mov ecx, 2 + idiv ecx +;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +fifth_func: + mov rax, 7 +;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this lab, you will +; be required to divide +; by 2, and move the +; remainder into rax. +; hint: make sure you +; clear the high bits! +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + xor edx, edx + mov ecx, 2 + idiv ecx + mov eax, edx +;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;; + ret diff --git a/labs/Solutions/Lab4_jl.nasm b/labs/Solutions/Lab4_jl.nasm new file mode 100755 index 0000000..a47d065 --- /dev/null +++ b/labs/Solutions/Lab4_jl.nasm @@ -0,0 +1,80 @@ +bits 64 + +extern value +global first_func, second_func + +first_func: + push rbp + mov rbp, rsp + mov rcx, 0x10 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this task, you must allocate +; 8 bytes of space on the stack, and +; store the value of rcx there. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rcx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rax + pop rbp + ret + +second_func: + push rbp + mov rbp, rsp + mov rcx, value + mov rax, 1 + mov rdx, 2 + mov rsi, 3 + mov rdi, 4 + mov r8, 5 + mov r9, 6 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; For this task, you must allocate +; space to +; manage your registers and save them +; to the stack as needed. Divide the +; number stored where rcx points by 10, +; and place the value back at that address. +; Make sure all the register values are the +; same at the end of the call! +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rax + push rdx + push rcx + + xor edx, edx + mov eax, [rcx] + mov ecx, 10 + idiv ecx + pop rcx + mov [rcx], eax + + pop rdx + pop rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + cmp rax, 1 + jnz .fail + cmp rdx, 2 + jnz .fail + cmp rsi, 3 + jnz .fail + cmp rdi, 4 + jnz .fail + cmp r8, 5 + jnz .fail + cmp r9, 6 + jnz .fail + jmp .end +.fail: + mov rax, -1 +.end: + pop rbp + ret diff --git a/labs/Solutions/Lab5_jl.nasm b/labs/Solutions/Lab5_jl.nasm new file mode 100755 index 0000000..376dc36 --- /dev/null +++ b/labs/Solutions/Lab5_jl.nasm @@ -0,0 +1,161 @@ +bits 64 + +extern value, value_outbuf, second_value, second_outbuf +global first_func, second_func, third_func, fourth_func, fifth_func +global sixth_func, seventh_func + +first_func: + push rbp + mov rbp, rsp + mov rax, 0xfeedbeef +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Using the and instruction, +; check to see if the 8th bit +; is set in the value stored +; in rax. Set rax equal to 1 +; if the bit is set, and 0 if +; the bit is not set. Hint: +; setting a register equal to +; 1 and left shifting may help. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + and rax, 0x80 + shr rax, 7 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +second_func: + push rbp + mov rbp, rsp + mov rax, 0xdeadbeef + mov rdx, 0xc0ffee +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Find the union of bits that are +; set in both rdx and rax. +; That is to say, bits that are set in +; either register should be set in the +; result. +; Set rax equal to the result. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + or rax, rdx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +third_func: + push rbp + mov rbp, rsp + mov rax, 0x1000 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Without using the mov instruction, +; set rax equal to 0. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor rax, rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + + +fourth_func: + push rbp + mov rbp, rsp + mov rax, 0x08 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Using only bit shifts, +; multiply the value stored in +; rax by 8. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + shl rax, 3 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +fifth_func: + push rbp + mov rbp, rsp + mov rax, 32 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Using only bit shift +; instructions, divide the +; value in rax by 16. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + shr rax, 4 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +sixth_func: + push rbp + mov rbp, rsp + mov rax, second_value + mov rax, qword [rax] +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; The string Success! has been +; been stored in rax, but is +; slightly mangled ("ess!Succ"). +; Set it to +; the correct order via byte +; rotations (the result will +; print out in console). +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ror rax, 32 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rcx, second_outbuf + mov rcx, [rcx] + mov [rcx], rax + pop rbp + ret + +seventh_func: + push rbp + mov rbp, rsp + mov rax, value + mov rax, qword [rax] + mov rdx, 0xcc +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; An 8-byte message has been +; XOR-encoded with the key 0xCC, +; and stored in RAX. Using all +; of the knowledge you've gained +; so far, XOR each byte of RAX +; with 0xCC. The resulting message +; will print out in console. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rcx, 0xCCCCCCCCCCCCCCCC + xor rax, rcx +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rdi, value_outbuf + mov rdi, [rdi] + mov [rdi], rax + xor rax, rax + pop rbp + ret + diff --git a/labs/Solutions/Lab6_jl.nasm b/labs/Solutions/Lab6_jl.nasm new file mode 100755 index 0000000..2e86a7e --- /dev/null +++ b/labs/Solutions/Lab6_jl.nasm @@ -0,0 +1,56 @@ +bits 64 + +global first_func, second_func, third_func + +first_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set the carry flag. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, 0xFFFFFFFFFFFFFFFF + add rax, 1 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +second_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set the overflow flag. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, 1 + shl rax, 63 + add rax, rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +third_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Set both the carry and overflow +; flags. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + mov rax, 1 + shl rax, 63 + add rax, rax +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + + diff --git a/labs/Solutions/Lab7_jl.nasm b/labs/Solutions/Lab7_jl.nasm new file mode 100755 index 0000000..fd0c322 --- /dev/null +++ b/labs/Solutions/Lab7_jl.nasm @@ -0,0 +1,96 @@ +bits 64 + +global first_func, second_func, third_func + +first_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Two values have been provided, +; with the first stored in RDI, +; and the second in RSI. If the +; first is greater than the second, +; set RAX equal to 1, if the second +; is greater than the first, set +; RAX equal to -1. If they are +; both equal, set RAX to 0. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + sub rdi, rsi + jl less1 + jg greater1 + xor rax, rax + jmp end1 +less1: + mov rax, -1 + jmp end1 +greater1: + mov rax, 1 +end1: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +second_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; You have been provided with +; a pointer to the start of an +; array of numbers in RDI, and +; the number of elements in the +; array in RSI. Loop through the +; array, adding all the numbers +; together, and store the result +; in RAX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor rax, rax +loop2: + cmp rsi, 0 + je end2 + add eax, [rdi] + dec rsi + add rdi, 4 + jmp loop2 +end2: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +third_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Find the length of the +; provided, NULL-terminated +; string (a pointer to the +; beginning of which is +; currently stored in RDI), +; and store the result in RAX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor rax, rax + xor rcx, rcx +loop3: + mov cl, [rdi] + cmp rcx, 0 + je end3 + inc rax + inc rdi + jmp loop3 +end3: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + + diff --git a/labs/Solutions/Lab8_jl.nasm b/labs/Solutions/Lab8_jl.nasm new file mode 100755 index 0000000..2b3d5c4 --- /dev/null +++ b/labs/Solutions/Lab8_jl.nasm @@ -0,0 +1,92 @@ +bits 64 + +global first_func, second_func, third_func + +first_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Two values have been provided, +; a value (consisting of a single +; byte), which is stored in RSI, +; a buffer to initialize, a +; pointer to which is in RDI, +; and a number of bytes to set, +; which is stored in RDX. +; Implement a function that will +; set the buffer pointed to by RDI +; to the value stored in RSI. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +loop1: + dec rdx + cmp rdx, -1 + je end1 + mov byte [rdi+rdx], sil + jmp loop1 +end1: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +second_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; You have been provided with +; pointers to two buffers, one +; being the "source" (in RSI), +; and the other, in RDI, being +; the destination. Copy the values +; from source to destination. +; The size of both buffers is +; stored in RCX. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +loop2: + dec rdx + cmp rdx, -1 + je end2 + mov byte al, [rsi+rdx] + mov byte [rdi+rdx], al + jmp loop2 +end2: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + +third_func: + push rbp + mov rbp, rsp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Find the length of the +; provided, NULL-terminated +; string (a pointer to the +; beginning of which is +; currently stored in RDI), +; and store the result in RAX, +; using only string instructions. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + xor rax, rax ; scasb compares the bytes to AL, so we put null in AL + cld ; unset the direction flag to scan left-to-right + mov rcx, 0xFFFFFFFFFFFFFFFF ; a reverse counter for scasb + mov rsi, rdi ; scasb wants the pointer in rsi + repnz scasb ; scan and decrement ecx until you hit a null character or rcx reaches zero + not rcx ; flipping the bits tells you how many characters you scanned + mov rax, rcx ; put the answer in the right register + sub rax, 1 ; subtract one for the string length (not counting the null character) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + pop rbp + ret + + diff --git a/labs/Solutions/Lab9_jl.nasm b/labs/Solutions/Lab9_jl.nasm new file mode 100755 index 0000000..ab68f3a --- /dev/null +++ b/labs/Solutions/Lab9_jl.nasm @@ -0,0 +1,112 @@ +bits 64 + +global first_func, second_func, third_func + +extern printf +mystr db "Success!", 0xa, 0x00 + +first_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; The function printf has been +; externed in (above). Call it, +; passing mystr (also defined +; above), as its only argument. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rbp + mov rbp, rsp + + mov edi, mystr + mov esi, 1 + mov eax, 0 + call printf + + pop rbp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +extern strlen + +second_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Your function will be called +; with two arguments: a function +; pointer (the first parameter), +; and a string (the second). The +; function pointer takes two +; arguments: a string, and a length. +; You will need to call strlen +; (above), passing in the string, +; and pass the results to the +; function pointer (along with the +; string). Return the string you get +; back from the function. +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rbp + mov rbp, rsp + + push rdi + push rsi + mov rdi, rsi + call strlen + + pop rdi + pop rcx + mov rsi, rax + call rcx + + pop rbp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + +third_func: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; Calculate the Nth fibonacci +; number (where N is the value +; passed to your method as the +; only parameter). +; +; BEGIN student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + push rbp + mov rbp, rsp + +; base cases + cmp rdi, 0 + jz base_cases + cmp rdi, 1 + jz base_cases + +recurse3: + push rdi + ; call third_func for n-1 + dec rdi + call third_func + pop rdi + push rax ; store the value on the stack + + ; call third_func for n-2 + sub rdi, 2 + call third_func + pop rdi ; recall the answer for n-1 + add rax, rdi + jmp restore_stack3 + +base_cases: + mov rax, rdi + +restore_stack3: + pop rbp +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; END student code +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ret + + diff --git a/labs/Lab1/CMakeLists.txt b/labs/lab01/CMakeLists.txt similarity index 84% rename from labs/Lab1/CMakeLists.txt rename to labs/lab01/CMakeLists.txt index 9f7a277..4a7bcf4 100755 --- a/labs/Lab1/CMakeLists.txt +++ b/labs/lab01/CMakeLists.txt @@ -4,7 +4,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab1/Lab1.nasm b/labs/lab01/Lab1.nasm similarity index 100% rename from labs/Lab1/Lab1.nasm rename to labs/lab01/Lab1.nasm diff --git a/labs/Lab1/main.cpp b/labs/lab01/main.cpp similarity index 100% rename from labs/Lab1/main.cpp rename to labs/lab01/main.cpp diff --git a/labs/Lab2/CMakeLists.txt b/labs/lab02/CMakeLists.txt similarity index 84% rename from labs/Lab2/CMakeLists.txt rename to labs/lab02/CMakeLists.txt index e0fe917..bb59cf3 100755 --- a/labs/Lab2/CMakeLists.txt +++ b/labs/lab02/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab2/Lab2.nasm b/labs/lab02/Lab2.nasm similarity index 100% rename from labs/Lab2/Lab2.nasm rename to labs/lab02/Lab2.nasm diff --git a/labs/Lab2/main.cpp b/labs/lab02/main.cpp similarity index 100% rename from labs/Lab2/main.cpp rename to labs/lab02/main.cpp diff --git a/labs/Lab3/CMakeLists.txt b/labs/lab03/CMakeLists.txt similarity index 84% rename from labs/Lab3/CMakeLists.txt rename to labs/lab03/CMakeLists.txt index 73ab11b..d2c59b7 100755 --- a/labs/Lab3/CMakeLists.txt +++ b/labs/lab03/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab3/Lab3.nasm b/labs/lab03/Lab3.nasm similarity index 100% rename from labs/Lab3/Lab3.nasm rename to labs/lab03/Lab3.nasm diff --git a/labs/Lab3/main.cpp b/labs/lab03/main.cpp similarity index 100% rename from labs/Lab3/main.cpp rename to labs/lab03/main.cpp diff --git a/labs/Lab4/CMakeLists.txt b/labs/lab04/CMakeLists.txt similarity index 84% rename from labs/Lab4/CMakeLists.txt rename to labs/lab04/CMakeLists.txt index 748524e..1acfbbc 100755 --- a/labs/Lab4/CMakeLists.txt +++ b/labs/lab04/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab4/Lab4.nasm b/labs/lab04/Lab4.nasm similarity index 98% rename from labs/Lab4/Lab4.nasm rename to labs/lab04/Lab4.nasm index 7c15caf..2d0ca54 100755 --- a/labs/Lab4/Lab4.nasm +++ b/labs/lab04/Lab4.nasm @@ -22,7 +22,7 @@ first_func: pop rbp ret -second_func +second_func: push rbp mov rbp, rsp mov rcx, value diff --git a/labs/Lab4/main.cpp b/labs/lab04/main.cpp similarity index 100% rename from labs/Lab4/main.cpp rename to labs/lab04/main.cpp diff --git a/labs/Lab5/CMakeLists.txt b/labs/lab05/CMakeLists.txt similarity index 84% rename from labs/Lab5/CMakeLists.txt rename to labs/lab05/CMakeLists.txt index f14b803..b1afda5 100755 --- a/labs/Lab5/CMakeLists.txt +++ b/labs/lab05/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab5/Lab5.nasm b/labs/lab05/Lab5.nasm similarity index 100% rename from labs/Lab5/Lab5.nasm rename to labs/lab05/Lab5.nasm diff --git a/labs/Lab5/main.cpp b/labs/lab05/main.cpp similarity index 100% rename from labs/Lab5/main.cpp rename to labs/lab05/main.cpp diff --git a/labs/Lab6/CMakeLists.txt b/labs/lab06/CMakeLists.txt similarity index 84% rename from labs/Lab6/CMakeLists.txt rename to labs/lab06/CMakeLists.txt index cbf6888..f8ecb01 100755 --- a/labs/Lab6/CMakeLists.txt +++ b/labs/lab06/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab6/Lab6.nasm b/labs/lab06/Lab6.nasm similarity index 100% rename from labs/Lab6/Lab6.nasm rename to labs/lab06/Lab6.nasm diff --git a/labs/Lab6/help.nasm b/labs/lab06/help.nasm similarity index 100% rename from labs/Lab6/help.nasm rename to labs/lab06/help.nasm diff --git a/labs/Lab6/main.cpp b/labs/lab06/main.cpp similarity index 100% rename from labs/Lab6/main.cpp rename to labs/lab06/main.cpp diff --git a/labs/Lab7/CMakeLists.txt b/labs/lab07/CMakeLists.txt similarity index 84% rename from labs/Lab7/CMakeLists.txt rename to labs/lab07/CMakeLists.txt index 0f69b83..7e2e8ef 100755 --- a/labs/Lab7/CMakeLists.txt +++ b/labs/lab07/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab7/Lab7.nasm b/labs/lab07/Lab7.nasm similarity index 100% rename from labs/Lab7/Lab7.nasm rename to labs/lab07/Lab7.nasm diff --git a/labs/Lab7/main.cpp b/labs/lab07/main.cpp similarity index 96% rename from labs/Lab7/main.cpp rename to labs/lab07/main.cpp index c608b4d..687e7f2 100755 --- a/labs/Lab7/main.cpp +++ b/labs/lab07/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char** argv) EQ((size_t)150, second_func(values, 5)); printf("Preparing to run third function (String length)\n"); - EQ(strlen(buf), third_func(buf)); + EQ(third_func(buf), strlen(buf)); return 0; } diff --git a/labs/Lab8/CMakeLists.txt b/labs/lab08/CMakeLists.txt similarity index 84% rename from labs/Lab8/CMakeLists.txt rename to labs/lab08/CMakeLists.txt index c659e7b..5d45ae7 100755 --- a/labs/Lab8/CMakeLists.txt +++ b/labs/lab08/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab8/Lab8.nasm b/labs/lab08/Lab8.nasm similarity index 97% rename from labs/Lab8/Lab8.nasm rename to labs/lab08/Lab8.nasm index 19cc683..1ec011f 100755 --- a/labs/Lab8/Lab8.nasm +++ b/labs/lab08/Lab8.nasm @@ -12,7 +12,7 @@ first_func: ; a buffer to initialize, a ; pointer to which is in RDI, ; and a number of bytes to set, -; which is stored in RCX. +; which is stored in RDX. ; Implement a function that will ; set the buffer pointed to by RDI ; to the value stored in RSI. @@ -37,7 +37,7 @@ second_func: ; the destination. Copy the values ; from source to destination. ; The size of both buffers is -; stored in RCX. +; stored in RDX. ; ; BEGIN student code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/labs/Lab8/main.cpp b/labs/lab08/main.cpp similarity index 97% rename from labs/Lab8/main.cpp rename to labs/lab08/main.cpp index 83661a4..1c685dd 100755 --- a/labs/Lab8/main.cpp +++ b/labs/lab08/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char** argv) char fbuf[BUFF_SIZE+1] = {0}; char sbuf[BUFF_SIZE+1] = {0}; - memset(buf, 0x41, BUFF_SIZE); + memset(fbuf, 0x41, BUFF_SIZE); printf("Preparing to run second function (Copy memory)\n"); second_func(sbuf, fbuf, BUFF_SIZE); EQ((size_t)0, memcmp(fbuf, sbuf, BUFF_SIZE)); diff --git a/labs/Lab9/CMakeLists.txt b/labs/lab09/CMakeLists.txt similarity index 84% rename from labs/Lab9/CMakeLists.txt rename to labs/lab09/CMakeLists.txt index 3189dab..f73bc93 100755 --- a/labs/Lab9/CMakeLists.txt +++ b/labs/lab09/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab9/Lab9.nasm b/labs/lab09/Lab9.nasm similarity index 96% rename from labs/Lab9/Lab9.nasm rename to labs/lab09/Lab9.nasm index 0b9b8d8..a54aa32 100755 --- a/labs/Lab9/Lab9.nasm +++ b/labs/lab09/Lab9.nasm @@ -51,7 +51,8 @@ third_func: ; number (where N is the value ; passed to your method as the ; only parameter). -; +; Should return 0 for N=0 and +; 1 for N=1 ; BEGIN student code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/labs/Lab9/main.cpp b/labs/lab09/main.cpp similarity index 100% rename from labs/Lab9/main.cpp rename to labs/lab09/main.cpp diff --git a/labs/Lab10/CMakeLists.txt b/labs/lab10/CMakeLists.txt similarity index 84% rename from labs/Lab10/CMakeLists.txt rename to labs/lab10/CMakeLists.txt index 8f86854..0e60261 100755 --- a/labs/Lab10/CMakeLists.txt +++ b/labs/lab10/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab10/Lab10.nasm b/labs/lab10/Lab10.nasm similarity index 100% rename from labs/Lab10/Lab10.nasm rename to labs/lab10/Lab10.nasm diff --git a/labs/Lab10/main.cpp b/labs/lab10/main.cpp similarity index 97% rename from labs/Lab10/main.cpp rename to labs/lab10/main.cpp index 26a0e78..46c0a55 100755 --- a/labs/Lab10/main.cpp +++ b/labs/lab10/main.cpp @@ -51,8 +51,8 @@ int main(int argc, char** argv) char idbuf[13] = {0}; printf("Preparing to run first_func (Get timestamp)\n"); - first = gettsc(); - second = first_func(); + first = first_func(); + second = gettsc(); CLOSE(second, first); getvstr(&tmp); diff --git a/labs/Lab11/CMakeLists.txt b/labs/lab11/CMakeLists.txt similarity index 84% rename from labs/Lab11/CMakeLists.txt rename to labs/lab11/CMakeLists.txt index 56600f9..a4982a8 100755 --- a/labs/Lab11/CMakeLists.txt +++ b/labs/lab11/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab11/Lab11.nasm b/labs/lab11/Lab11.nasm similarity index 97% rename from labs/Lab11/Lab11.nasm rename to labs/lab11/Lab11.nasm index 6b7c114..df4f1f4 100755 --- a/labs/Lab11/Lab11.nasm +++ b/labs/lab11/Lab11.nasm @@ -43,7 +43,7 @@ second_func: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This problem will require ; you to add the contents of -; _firstfloat to an integer +; firstfloat to an integer ; that is passed in as the ; first (and only) argument ; to your function. Store the diff --git a/labs/Lab11/main.cpp b/labs/lab11/main.cpp similarity index 100% rename from labs/Lab11/main.cpp rename to labs/lab11/main.cpp diff --git a/labs/Lab12/CMakeLists.txt b/labs/lab12/CMakeLists.txt similarity index 84% rename from labs/Lab12/CMakeLists.txt rename to labs/lab12/CMakeLists.txt index 9eb584d..bd0e7bf 100755 --- a/labs/Lab12/CMakeLists.txt +++ b/labs/lab12/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab12/Lab12.nasm b/labs/lab12/Lab12.nasm similarity index 96% rename from labs/Lab12/Lab12.nasm rename to labs/lab12/Lab12.nasm index 1a2b4ae..b9f201b 100755 --- a/labs/Lab12/Lab12.nasm +++ b/labs/lab12/Lab12.nasm @@ -2,8 +2,8 @@ bits 64 global first_func, second_func, third_func -_firstdata dd 0x00 -_seconddata dd 0x00 +firstdata dd 0x00 +seconddata dd 0x00 first_func: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -58,4 +58,4 @@ third_func: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; END student code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ret \ No newline at end of file + ret diff --git a/labs/Lab12/main.cpp b/labs/lab12/main.cpp similarity index 100% rename from labs/Lab12/main.cpp rename to labs/lab12/main.cpp diff --git a/labs/Lab13/CMakeLists.txt b/labs/lab13/CMakeLists.txt similarity index 84% rename from labs/Lab13/CMakeLists.txt rename to labs/lab13/CMakeLists.txt index 3f369e3..8b10f5c 100755 --- a/labs/Lab13/CMakeLists.txt +++ b/labs/lab13/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(ASM_NASM) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g") +set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -g -felf64") file(GLOB LAB_ASM_FILES "*.nasm") file(GLOB LAB_CPP_FILES "*.cpp") diff --git a/labs/Lab13/Lab13.nasm b/labs/lab13/Lab13.nasm similarity index 100% rename from labs/Lab13/Lab13.nasm rename to labs/lab13/Lab13.nasm diff --git a/labs/Lab13/insertion_sort.c b/labs/lab13/insertion_sort.c similarity index 100% rename from labs/Lab13/insertion_sort.c rename to labs/lab13/insertion_sort.c diff --git a/labs/Lab13/main.cpp b/labs/lab13/main.cpp similarity index 100% rename from labs/Lab13/main.cpp rename to labs/lab13/main.cpp diff --git a/labs/Lab13/quicksort.c b/labs/lab13/quicksort.c similarity index 100% rename from labs/Lab13/quicksort.c rename to labs/lab13/quicksort.c