Uploading pretty much finished program...

This commit is contained in:
Ognjen Milan Robovic 2023-09-18 04:55:21 -04:00
parent 03cf02451a
commit e59bda0b16
5 changed files with 93 additions and 0 deletions

7
compile.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -xe
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -o xop xop.c
exit

BIN
example/heyo Executable file

Binary file not shown.

28
example/heyo.fasm Normal file
View File

@ -0,0 +1,28 @@
format ELF64 executable 3
segment readable executable
nop
mov rax, 1
nop
mov rdi, 1
nop
mov rsi, string
nop
mov rdx, [length]
nop
syscall
nop
mov rax, 60
nop
mov rdi, 0
nop
syscall
nop
segment readable writable
string db 'Heyo world!', 10
length dq 12

7
install.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -xe
cp xop /usr/bin/xop
exit

51
xop.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic
*
* Xop is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation.
* And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version.
* It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3.
*/
#include <xolatile/xtandard.h>
#include <xolatile/xtandard.c>
int main (int argc, char * * argv) {
int file = -1;
int size = 0;
int offset = 0;
unsigned char * buffer = NULL;
if (argc != 2) {
fatal_failure (1, "xop: xop input");
}
file = file_open (argv [1], O_RDONLY);
size = file_size (file);
buffer = allocate (size);
file_read (file, buffer, size);
file = file_close (file);
do {
int byte = (int) buffer [offset];
if (byte == 0X90) {
echo_new_line ();
terminal_style (EFFECT_NORMAL, COLOUR_YELLOW);
echo_byte ((int) buffer [offset]);
terminal_style (-1, -1);
} else {
echo_byte (buffer [offset]);
}
++offset;
} while (offset != size);
echo_new_line ();
buffer = deallocate (buffer);
return (EXIT_SUCCESS);
}