~rabbits/lin6

f04c1eb5508d829068db590ebdf6c8f3bf5fd612 — Devine Lu Linvega 3 years ago 3fd0b16
Fixed build issue with plan9
3 files changed, 15 insertions(+), 9 deletions(-)

M build.sh
M lin6.c
M source.asm
M build.sh => build.sh +7 -1
@@ 4,13 4,19 @@ rm ./lin6

clang-format -i lin6.c

# Gnu/Linux
cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined lin6.c -o lin6

# Rpi
# tcc -Wall lin6.c -o lin6

# Plan9
# pcc lin6.c -o lin6

./lin6
./lin6 -?
./lin6 -v
./lin6 source.asm
./lin6 -i source.asm
./lin6 -i -d source.asm
\ No newline at end of file
./lin6 -i -d source.asm


M lin6.c => lin6.c +7 -7
@@ 1,5 1,5 @@
/* Lin6
  Version 1.1
  Version 1.2
  https://wiki.xxiivv.com/lin6
*/



@@ 24,14 24,15 @@
*/

#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define VERSION "1.1"
#define VERSION "1.2"
#define BUFLEN 512

typedef enum { false, true } bool;

char *OPCODES[] = {"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI",
                   "BNE", "BPL", "BRK", "BVC", "BVS", "CLC", "CLD", "CLI",
                   "CLV", "CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR",


@@ 285,7 286,6 @@ void lint(char *filepath, char *output, bool do_debug) {
        strcat(output, "\n");
      }
      if (has_comment(line)) {
        fillstr(key, 30, ' ');
        strcat(output, key);
        strcat(output, " ");
        strcat(output, comment);


@@ 400,9 400,9 @@ void lint(char *filepath, char *output, bool do_debug) {
  fclose(fr);
}

void show_version() { puts("Lin6 " VERSION); }
void show_version(void) { puts("Lin6 " VERSION); }

void show_help() {
void show_help(void) {
  show_version();
  puts("");
  puts("A tool to format 6502 assembly code.\n");


@@ 447,4 447,4 @@ int main(int argc, char *argv[]) {
    }
  }
  return 0;
}
}
\ No newline at end of file

M source.asm => source.asm +1 -1
@@ 22,7 22,7 @@ NMI:

;; Routines

CheckCollision:                ; Routine comment
CheckCollision: ; Routine comment
	LDA pos_y
	CMP #$88                     ; Opcode comment
	BCC @done