xop -- Echo highlighted unparsed 'nop' instruction in standard output.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

52 lignes
1.2KB

  1. /*
  2. * Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic
  3. *
  4. * Xop is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation.
  5. * 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.
  6. * 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.
  7. */
  8. #include <xolatile/xtandard.h>
  9. #include <xolatile/xtandard.c>
  10. int main (int argc, char * * argv) {
  11. int file = -1;
  12. int size = 0;
  13. int offset = 0;
  14. unsigned char * buffer = NULL;
  15. if (argc != 2) {
  16. fatal_failure (1, "xop: xop input");
  17. }
  18. file = file_open (argv [1], O_RDONLY);
  19. size = file_size (file);
  20. buffer = allocate (size);
  21. file_read (file, buffer, size);
  22. file = file_close (file);
  23. do {
  24. int byte = (int) buffer [offset];
  25. if (byte == 0X90) {
  26. echo_new_line ();
  27. terminal_style (EFFECT_NORMAL, COLOUR_YELLOW);
  28. echo_byte ((int) buffer [offset]);
  29. terminal_style (-1, -1);
  30. } else {
  31. echo_byte (buffer [offset]);
  32. }
  33. ++offset;
  34. } while (offset != size);
  35. echo_new_line ();
  36. buffer = deallocate (buffer);
  37. return (EXIT_SUCCESS);
  38. }