Skip to main content

Untitled

Sep 27, 2024popeyevn
Loading...

More Plaintext Posts

x86 MASM C Linking

Jun 30, 2021LeifMessinger

0 likes • 2 views

;Main.asm
.386
.model small,c ;This bit is important, I think.
.stack 1000h
.data
hello db "Hello world!",0
.code
;includelib libucrt.lib ;All this shit is already here if you have a C object file
includelib legacy_stdio_definitions.lib ;Except for this. Basically printf, puts etc
;includelib libcmt.lib
;includelib libvcruntime.lib ;Visual Studio exception handling and type checking. Not needed otherwise
extrn printf:near ;Extern everything you are gonna use from the c obj files
extrn plusTwo:near
extrn exit:near
public plusOne ;Have to declare it public for the linker to see it. In NASM, it's .globl or global
plusOne proc ;Our int plusOne(int) function.
pop eax ;Parameters are stored on the stack.
add eax, 1
ret ;eax is whatever is returned from functions. Also why you can only return one thing.
plusOne endp
public main
main proc
push offset hello
call printf
push 1
call plusTwo
push 0
call exit
main endp
end ;End of file, not program
//bruh.c
//#include <stdio.h> Has to be included with "includelib legacy_stdio_definitions.lib" in the asm file for some reason.
//int printf(const char* format, ...);
extern int plusOne(int); //Extern everything you are gonna use from the asm obj files
int plusTwo(int num) {
return plusOne(plusOne(num)); //Plus one is defined in the assembly.
}

Wing Data

Oct 31, 2021aedrarian

0 likes • 3 views

##README: Rename file to "data" (no extension) and delete this line
4 4.55
5 5.70
6 6.80
7 7.95
8 9.10
9 10.20
10 11.35
11 12.50
12 13.60
13 14.75
14 15.90
15 17
16 18.15
17 19.30
18 20.40
19 21.55
20 22.70
21 23.80
22 24.95
23 26.10
24 27.25
25 27.80
26 28.95
27 30.10
28 31.20
29 32.35
30 33.50
35 39.15
40 44.80
45 50.50
50 55.60
60 67
70 78.30
75 83.45
80 89.10
90 100.45
100 111.25
125 139
150 166.85
200 222.50

Untitled

Aug 7, 2024naiferomar366-60ef

0 likes • 1 view

aaaa

Untitled

Aug 7, 2024naiferomar366-60ef

0 likes • 1 view

gggg

default netplan

Nov 18, 2022AustinLeath

0 likes • 0 views

# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: yes
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2

Untitled

Aug 27, 2024vercetti322

0 likes • 4 views

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <ctime>
using namespace std;
// Function to generate random numbers
vector<int> generateRandomNumbers(int count, int minValue, int maxValue) {
vector<int> numbers;
for (int i = 0; i < count; ++i) {
numbers.push_back(rand() % (maxValue - minValue + 1) + minValue);
}
return numbers;
}
// Function to print a vector of integers
void printVector(const vector<int>& vec) {
for (int num : vec) {
cout << num << " ";
}
cout << endl;
}
// Function to sort and display numbers
void sortAndDisplayNumbers(vector<int>& numbers) {
sort(numbers.begin(), numbers.end());
cout << "Sorted numbers: ";
printVector(numbers);
}
int main() {
// Seed the random number generator
srand(static_cast<unsigned int>(time(0)));
int count, minValue, maxValue;
cout << "Enter the number of random numbers to generate: ";
cin >> count;
cout << "Enter the minimum value: ";
cin >> minValue;
cout << "Enter the maximum value: ";
cin >> maxValue;
// Generate random numbers
vector<int> numbers = generateRandomNumbers(count, minValue, maxValue);
// Display unsorted numbers
cout << "Unsorted numbers: ";
printVector(numbers);
// Sort and display sorted numbers
sortAndDisplayNumbers(numbers);
return 0;
}