Skip to content

Commit cedc205

Browse files
committed
revert(examples): the ones we accidentally removed.
1 parent 97b1e0b commit cedc205

File tree

29 files changed

+265
-0
lines changed

29 files changed

+265
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
section .data
2+
hello db 'Hello, World!',0
3+
4+
section .text
5+
global print_hello
6+
7+
print_hello:
8+
; Write the message to stdout
9+
mov eax, 1 ; Syscall number for write
10+
mov edi, 1 ; File descriptor 1: stdout
11+
mov rsi, hello ; Address of the string
12+
mov edx, 13 ; Length of the string
13+
syscall
14+
15+
ret
16+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
section .data
2+
extern hello
3+
4+
section .text
5+
extern print_hello
6+
7+
global _start
8+
9+
_start:
10+
; Call the print_hello function
11+
call print_hello
12+
13+
; Exit the program
14+
mov eax, 60 ; Syscall number for exit
15+
xor edi, edi ; Exit status 0
16+
syscall
17+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <stdio.h>
2+
3+
void printHello() {
4+
printf("Hello, World!\n");
5+
}
6+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef HELPER_H
2+
#define HELPER_H
3+
4+
void printHello();
5+
6+
#endif
7+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <stdio.h>
2+
#include "helper.h"
3+
4+
int main() {
5+
printHello();
6+
return 0;
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include <iostream>
2+
3+
void printHello() {
4+
std::cout << "Hello, World!" << std::endl;
5+
}
6+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#ifndef HELPER_H
2+
#define HELPER_H
3+
4+
void printHello();
5+
6+
#endif
7+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <iostream>
2+
#include "helper.h"
3+
4+
int main() {
5+
printHello();
6+
return 0;
7+
}
8+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
class Helper
4+
{
5+
public static void PrintHello()
6+
{
7+
Console.WriteLine("Hello, World!");
8+
}
9+
}
10+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
class Program
4+
{
5+
static void Main()
6+
{
7+
Helper.PrintHello();
8+
}
9+
}

0 commit comments

Comments
 (0)