Browse Source

Uploading pretty much finished program...

master
Ognjen Milan Robovic 7 months ago
parent
commit
e59bda0b16
5 changed files with 93 additions and 0 deletions
  1. +7
    -0
      compile.sh
  2. BIN
      example/heyo
  3. +28
    -0
      example/heyo.fasm
  4. +7
    -0
      install.sh
  5. +51
    -0
      xop.c

+ 7
- 0
compile.sh 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 View File


+ 28
- 0
example/heyo.fasm 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
- 0
install.sh View File

@@ -0,0 +1,7 @@
#!/bin/bash

set -xe

cp xop /usr/bin/xop

exit

+ 51
- 0
xop.c 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);
}

Loading…
Cancel
Save