code:
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
AC_INIT(zasm, 0a, James Rubingh <james@wrive.com>)
AC_CONFIG_SRCDIR([src/zasm.c])
AC_CONFIG_HEADER([config.h])

# Checks for programs.
AC_ARG_WITH(cc,
[  --with-cc=xxx           use XXX as the C compiler],
CC=$with_cc)

AC_LANG(C)
AC_C_CONST
AC_C_INLINE

AC_PROG_CC

AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

#create some output makefiles yo
AC_OUTPUT(Makefile src/Makefile doc/Makefile lib/Makefile)

license: mit


code:
Principle Development:
 James Lee Rubingh <james@wrive.com>

Bugfixes:
 James Lee Rubingh <james@wrive.com>

path: doc/AUTHORS


code:
all:

clean:

distclean:
	rm -f Makefile

install:


code:
Zasm
z80 assembler
By james rubingh
http://www.wrive.com

Patches and comments are always welcome. I dont know much about
assembler design, so i'm sure it's pretty ugly.

Zasm is Copyright James Rubingh (2002) and released under the GPL.

path: doc/README


code:
/*

   This is a zasm header file.
   */

#ifndef ZASM_H
#define ZASM_H

#define INSTRUCTION_BUFFER_SIZE 1000
#define TABFILE_BUFFER_SIZE 500
#define MNUMONIC_TXT_LENGTH 16
#define whitespace " \t\r\n,"
#define comma ","
#define tab_whitespace " \t\r\n"
#define DEBUG
#define ERR_PARSE "Couldn't parse"
#define ERR_BADLABEL "Invalid Label"
#define ERR_MALLOC "Out of heap memory"

/* put a 4-byte integer into a byte array in LSB order or MSB order */
/* from Mark Adler's pigz source */
#define PUT2L(a,b) (*(a)=(b)&0xff,(a)[1]=(b)>>8)
#define PUT4L(a,b) (PUT2L(a,(b)&0xffff),PUT2L((a)+2,(b)>>16))
#define PUT4M(a,b) (*(a)=(b)>>24,(a)[1]=(b)>>16,(a)[2]=(b)>>8,(a)[3]=(b))

typedef unsigned char byte;

struct instruction {
    char mnumonic[MNUMONIC_TXT_LENGTH];
    char **operands;
    unsigned int opcode;
    unsigned int address;
    unsigned short int op_num;
    unsigned short int assembled;
    unsigned short int not_reduced;
    struct tab_entry *matched_tab;
    struct instruction *next, *previous;
} __attribute__((__packed__));

struct tab_entry {
    char mnumonic[MNUMONIC_TXT_LENGTH];
    char operands[10];
    char hex_code[10];
    int opcode;
    int size;
    /* NOP R1 COMBINE etc */
    int type;
    /* not sure what these do */
    unsigned int UNKNOWN_VALUE;
    int UNKNOWN_VALUE2;
    int UNKNOWN_VALUE3;
    struct tab_entry *next;
} __attribute__((__packed__));

struct symbol_entry {
    char *name;
    struct instruction *instruction;
    unsigned int address;
    struct symbol_entry *next;
} __attribute__((__packed__));

struct label_entry {
    char *name;
    struct instruction *instruction;
    struct label_entry *next;
} __attribute__((__packed__));

/* zasm.c */
extern int verbose;
extern int tiprog;
extern int tistring;
extern double linenumber;
extern struct label_entry *label_root;
extern struct label_entry *label_current;
extern struct symbol_entry *symbol_root;
extern struct symbol_entry *symbol_current;
extern struct tab_entry *read_table(FILE*);
extern void do_error_msg(char *);
extern void do_error();
static void free_lists();
struct tab_entry *new_tab_entry(char *);

/* pass.c */
extern unsigned int current_address;
extern void strip_comment(char *);
extern int assemble(struct tab_entry *, FILE *);
extern int write_to_file(struct instruction *);

/* shunt.c */
extern int shunt(char *);
extern int shunt_error;

/* help.c */
extern void show_help(int ) __attribute__((__noreturn__));

#endif


code:
OPTS =
CC = clang # or gcc

all:
	$(CC) $(CFLAGS) $(OPTS) -c pass.c -o pass.o
	$(CC) $(CFLAGS) $(OPTS) -c shunt.c -o shunt.o

clean:
	rm -f pass.o
	rm -f shunt.o

distclean: clean
	rm -f Makefile
	rm -f *.swp

install:


code:
/*  Zasm2 Z80 assembler
    by James Lee Rubingh
    james@wrive.com

    Copyright (2002) James Rubingh
    Released under the GPL v2

    査読お願いします!
    */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "../include/zasm.h"
#include "../config.h"
#include "pass.h"

void strip_comment(char *ptr)
{
    /*! replace any ; or \n with a terminating null */
    while (*ptr != '\0')
    {
        if ((*ptr == ';')||(*ptr == '\n')||(*ptr == ':')) {
            *ptr = '\0';
            break;
        }

        ptr++;
    }
}

/* starting new file */
int assemble(struct tab_entry *tabroot, FILE *infile)
{
    int result = 0;
    linenumber = 0;

    struct instruction *root;

    root = pass_first(infile, tabroot);
    result = pass_second(root);

    return result;
}

int write_to_file(struct instruction * root)
{
    struct instruction *instw;

    instw = root;

    while (instw) {
        instw = NULL;
    }
    return 0;
}

int check_for_register(const char *operand)
{
    int i;

    for (i=0; i<NUM_REGISTERS_TO_CHECK; i++)
    {
        if (strcmp(REGISTERS[i], operand) == 0) {
            return 1;
        }
    }

    return 0;
}

void append_string(char *target, const char *addition)
{
    char *tmp;

    tmp = target;
    while (*tmp)
    {
        tmp++;
    }

    //this is a potential buffer overflow but, oh well
    strcpy(tmp, addition);
}

char *capitalize(char *buf)
{
    char *tmp;

    tmp = buf;

    while (*tmp)
    {
        if (isalpha(*tmp))
            *tmp = toupper(*tmp);
        tmp++;
    }

    return buf;
}

/* Figure out the generic string representing the individual
 * instruction in the TABLE file. The instruction is already
 * matched so it's only the operands
 */
char *calculate_query_string(struct instruction *tmp_i, char *query)
{
    char tmp_str[10];
    int i;

    for (i = 0; i < tmp_i->op_num; i++)
    {
        if (i > 0)
            append_string(query, ",");

        if (check_for_register(tmp_i->operands[i])) {
            append_string(query, tmp_i->operands[i]);
        } else {
            //already know it's not a register, if alphanum its a label/var
            if (isalpha(tmp_i->operands[i][0])) {
                tmp_i->not_reduced =1;
                append_string(query, "*");
            } else if ((isdigit(tmp_i->operands[i][0])) || (tmp_i->operands[i][0] == '$')) {
                //if first char is digit or '$' assume it's a value
                append_string(query, "*");
            } else {
                //anything else, just copy. things like (HL) for example
                append_string(query,tmp_i->operands[i]);
            }
        }
    }

    return query;
}

struct tab_entry *match_operands_to_mnumonic(const char *query_string, struct tab_entry *tab_match)
{
    char current_mnumonic[MNUMONIC_TXT_LENGTH];
    struct tab_entry *tab_tmp;

    strncpy(current_mnumonic, tab_match->mnumonic, MNUMONIC_TXT_LENGTH);
    tab_tmp = tab_match;

    //loop until we get to the next mnumonic or the end
    while ((strcmp(current_mnumonic, tab_tmp->mnumonic) == 0) && (tab_tmp->next))
    {
        if (strcmp(tab_tmp->operands, query_string) == 0) {
            //return a matched instruction
            return tab_tmp;
        }
        tab_tmp = tab_tmp->next;
    }

    return NULL;
}

/* wasn't a label, so assume it's an instruction */
void calculate_opcode(struct tab_entry *tabroot, struct instruction *tmp_i)
{
    struct tab_entry *tab_match;
    struct tab_entry *tab_temp;
    char *query_string;

    if ((tab_match = match_mnumonic(tabroot, tmp_i))) {
        query_string = (char *) malloc(INSTRUCTION_BUFFER_SIZE);
        query_string[0] = '\0';
        //mnumonic is found in tab file
        query_string = calculate_query_string(tmp_i, query_string);

        //only if there are operands try to match them
        if (tmp_i->op_num)
            tab_match = match_mnumonic_with_query_string(query_string, tab_match);

        found_correct_tab_entry(tmp_i, tab_match);

        free(query_string);
    } else {
        // wasn't in tab file, preprocessor directive?
        set_not_reduced_flag(tmp_i);

        if ((strcmp(tmp_i->mnumonic, ".DW") == 0) ||
                (strcmp(tmp_i->mnumonic, ".WORD") == 0)) {

        } else if ((strcmp(tmp_i->mnumonic, ".DB") == 0) ||
                (strcmp(tmp_i->mnumonic, ".BYTE") == 0)) {

        } else if ((strcmp(tmp_i->mnumonic, ".INCLUDE") == 0) ||
                (strcmp(tmp_i->mnumonic, ".REQUIRE") == 0)) {

        } else if (strcmp(tmp_i->mnumonic, ".ORG") == 0) {
            //set assumed PC register value
        } else {
            if (add_symbol(tmp_i)) {
                //reached word not in table file, also not understood by zasm2
                printf("bad instruction: %s\n", tmp_i->mnumonic);
                do_error_msg(ERR_PARSE);
            }
        }
    }
}

void set_not_reduced_flag(struct instruction *tmp_i) {
      if (tmp_i->op_num)  {
        tmp_i->not_reduced = 1;
      } else {
          printf("bad instruction: %s\n", tmp_i->mnumonic);
          do_error_msg(ERR_PARSE);
      }
}

/* add symbol to symbol table (_textShadow = $f34e) etc */
int add_symbol(struct instruction *tmp_i)
{
    struct symbol_entry *cur;

    if (tmp_i->operands && (tmp_i->operands[0][0] == '=')) {
        if (validate_symbol(tmp_i->mnumonic)) {

            cur = new_symbol();
            cur->name = tmp_i->mnumonic;
            cur->instruction = tmp_i;

            //if first symbol, set it to root
            if (!symbol_root) {
                symbol_root = cur;
            } else {
                symbol_current->next = cur;
            }
                symbol_current = cur;
            return 0;
        }
    }

    return 1;
}

struct tab_entry *match_mnumonic_with_query_string(char *query_string, struct tab_entry *tab_match)
{
    if (!(tab_match = match_operands_to_mnumonic(query_string, tab_match ))) {
        //check if one operand is value or label
        printf("***query_string: %s\n", query_string);
        printf("something fell through - not good\n");
    }

    return tab_match;
}

struct tab_entry *match_mnumonic(struct tab_entry *tabroot, struct instruction *instruction)
{
    struct tab_entry *tmp_tab = NULL;

    tmp_tab = tabroot;

    while (tmp_tab)
    {
        if (strcmp(instruction->mnumonic, tmp_tab->mnumonic) == 0)
            return tmp_tab;

        tmp_tab = tmp_tab->next;
    }

    return NULL;
}

void found_correct_tab_entry(struct instruction *tmp_i, struct tab_entry *match)
{
    tmp_i->matched_tab = match;
}

struct symbol_entry *new_symbol()
{
    struct symbol_entry *tmp;

    if (!(tmp = (struct symbol_entry*) malloc(sizeof(struct symbol_entry)))) {
        do_error_msg(ERR_MALLOC);
    }
    memset(tmp, 0, sizeof(struct symbol_entry));
    return tmp;
}

struct label_entry *new_label()
{
    struct label_entry *tmp;

    if (!(tmp = (struct label_entry *) malloc(sizeof(struct label_entry)))) {
        do_error_msg(ERR_MALLOC);
    }
    memset(tmp, 0, sizeof(struct label_entry));
    return tmp;
}

struct instruction *new_instruction()
{
    struct instruction *cur;

    if (!(cur = (struct instruction *) malloc(sizeof(struct instruction)))) {
        do_error_msg(ERR_MALLOC);
    }

    memset(cur, 0, sizeof(struct instruction));

    return cur;
}

void remove_whitespace(char * buf)
{
    int i, t;
    char tmp[INSTRUCTION_BUFFER_SIZE];

    i = t = 0;
    while (buf[i])
    {
        if (!isblank(buf[i]))
            tmp[t++] = buf[i];

        i++;
    }
    tmp[t] = '\0';
    strcpy(buf, tmp);
}

/** go through the source file(s) and create a
 * data structure with all the info about instruction sizes
 * and opcodes for all instructions without labels
 */
struct instruction *pass_first(FILE *infile, struct tab_entry *tabroot)
{
    struct instruction *root = NULL;
    label_root = NULL;

    /** build up the basic tree from the source file(s)
     * descends recursively into included source files
     */
    root = parse_source(infile, root, tabroot);

    return root;
}

/* current line has first token removed (instruction) and comments
 * removed. Now go through the rest and assume they're instructions
 * separated with ','
 */
struct instruction *get_operands(struct instruction *cur)
{
    int cur_op_num;
    char *buf;

    /* check for operands */
    cur_op_num = 0;
    while ((buf = (char *) strtok(NULL, comma)))
    {
        remove_whitespace(buf); //remove any tabs etc.
        if (strlen(buf) > 0) {
            if (!cur->operands)
                cur->operands = (char **) malloc(sizeof( char *));
            else
                cur->operands = (char **) realloc(cur->operands, (sizeof(char *)*(cur_op_num+1)));

            capitalize(buf);
            cur->operands[cur_op_num] = (char *) malloc(strlen(buf) );
            strcpy(cur->operands[cur_op_num], buf);

            cur->op_num = ++cur_op_num;
        }
    }
    cur->op_num = cur_op_num;
    return cur;
}

/** Parse text file and create
 * list elements for each instruction
 * appends instructions to the end of the list it gets
 * so that you can call this more than once, to include
 * more than one file
 * if you call it passing a root that is null, it will return
 * the beginning of the list
 * if you pass it something other than null, it returns a pointer
 * to the last link of the list
 */
struct instruction *parse_source(FILE *infile, struct instruction* initial_root, struct tab_entry *tabroot)
{

    struct instruction *cur_old =NULL, *cur = NULL;
    struct instruction *inst_root;
    char buffer[INSTRUCTION_BUFFER_SIZE];
    char b[INSTRUCTION_BUFFER_SIZE];
    char *buf, *ptr;
    int instructions = 0;
    int cur_op_num;

    inst_root = initial_root;
    buf = b;

    while (fgets(buffer, INSTRUCTION_BUFFER_SIZE, infile))
    {
        strip_comment(buffer);
        linenumber++;

        if (cur == NULL)
            cur = new_instruction();

        if (isblank(buffer[0]) || (buffer[0] == '\n') || (buffer[0] == '#') || (buffer[0] == '.')) {
            if (buffer[0] == '#') //make preprocessor directives .<directive>
                buffer[0] = '.';

            /** split line, get instruction and operands */
            if ((buf = (char *) strtok(buffer, whitespace))) {
                instructions++;

                if (!inst_root)
                    inst_root = cur;

                if (cur_old)
                    cur_old->next = cur;

                capitalize(buf);

                strncpy(cur->mnumonic, buf, MNUMONIC_TXT_LENGTH);

                get_operands(cur);
            }

            calculate_opcode(tabroot, cur);

            cur_old = cur;
            cur = new_instruction();

        } else {
            /* see if it's a valid label */
            if (strlen(buffer) > 0) {
              if ((buf = (char *) strtok(buffer, whitespace))) {
                  instructions++;

                  if (!inst_root)
                      inst_root = cur;

                  if (cur_old)
                      cur_old->next = cur;

                  capitalize(buf);

                  strncpy(cur->mnumonic, buf, MNUMONIC_TXT_LENGTH);

                  get_operands(cur);
              }
              // buffer holds untokenized string with charcter at *[0]
                if (validate_label(buffer)) {
                    add_label(buffer, cur);
                } else {
                    do_error_msg(ERR_BADLABEL);
                }

            }
        }
    }

    /* return either the head or the tail */
    return initial_root == NULL ? inst_root : cur;
}

/*  add a label_entry to the big list */
void add_label(char *ptr, struct instruction *inst)
{
    struct label_entry *tmp;

    tmp = new_label();
    tmp->instruction = inst;

    if (label_root == NULL)
        label_root = tmp;
    else
        label_current->next = tmp;  //label_current is global extern'd

    label_current = tmp;
    tmp->name = (char *)malloc(strlen(ptr) * sizeof(char));
    strcpy(tmp->name, ptr);
}

int validate_label(char *ptr)
{
    int valid = 1;
    int tokens = 0;
    char *buf;

        /** split line, get instruction and operands */
        if ((buf = (char *) strtok(ptr, whitespace))) {
            tokens++;
            capitalize(buf);
            if (!validate_symbol(buf))
                valid = 0;

            if (tokens == 2 && (strncmp(buf, "=", 1) == 0))
                //valid = 0, so return valid = 1
                return !valid;

        }
    return valid;
}

/* make sure that the "symbol" (text) is a valid label with ascii chars
 * if it's not valid, return a false
 * */
int validate_symbol(char *ptr)
{
  //check for valid chars in normal labels
    int valid = 1;
    while (*ptr != '\0')
    {
        if (!(isalnum(*ptr) || (*ptr == '-') || (*ptr == '_') || (*ptr == '.') || (*ptr == '@')))
            valid = 0;
        ptr++;
    }
    return valid;
}

/**  Go back through the instruction tree and using the list of
 *  labels, patch up all the forward references
 */
int pass_second(struct instruction *root)
{
    struct label_entry *cur = NULL;
    struct symbol_entry *cur_sym = NULL;
    struct instruction *instd = NULL;
    int i = 0;

/* i.not_reduced set are instructions with labels in the operands
 * i.matched_tab == NULL are .DB, etc., non-instruction instructions
 */

#ifdef DEBUG
    instd = root;
    printf("reduced\n");
    //loop through instructions
    while (instd)
    {
        if (!instd->not_reduced) {
            printf("   inst: %s  : ", instd->mnumonic);
            printf("matched_tab: %p  :\n",  instd->matched_tab);
            for(i = 0; i < instd->op_num; i++)
                printf("\t:opnd: %s\n", instd->operands[i]);
        }
        if (instd->matched_tab)
            printf("\tsize: %d  : \n", instd->matched_tab->size);
        else
            printf("\tNOSIZE: inst %s, op_num %d : \n", instd->mnumonic, instd->op_num);

        instd = instd->next;
    }

    instd = root;
    printf("not_reduced\n");
    //loop through instructions
    while (instd)
    {
        if (instd->not_reduced) {
            printf("   inst: %s  :\n", instd->mnumonic);
            printf("    matched_tab: %p  :\n",  instd->matched_tab);
            for(i = 0; i < instd->op_num; i++)
                printf("\t:opnd: %s\n", instd->operands[i]);
        }
        instd = instd->next;
    }

    instd = root;
    printf("no matched_tab\n");
    //loop through instructions
    while (instd)
    {
        if (instd->matched_tab == NULL) {
            printf("   inst: %s  :\n", instd->mnumonic);
            printf("    matched_tab: %p  :\n",  instd->matched_tab);
            for(i = 0; i < instd->op_num; i++)
                printf("\t:opnd: %s\n", instd->operands[i]);
        }
        instd = instd->next;
    }

    printf("Labels\n");
    cur = label_root;
    while (cur)
    {
        instd = cur->instruction;

        //print all labels and operands
        printf("label: %s  :\n", cur->name);
        printf("   inst: %s  :\n", instd->mnumonic);
        for(i = 0; i < instd->op_num; i++)
            printf("\t:opnd: %s\n", instd->operands[i]);

        cur = cur->next;
    }
#endif

    if (symbol_root) {
        cur_sym = symbol_root;
        while (cur_sym)
        {
            printf("symbol: %s %s\n", cur_sym->name, cur_sym->instruction->operands[0]);
            cur_sym = cur_sym->next;
        }
    }

    return 0;
}


code:
/*  Zasm2 Z80 assembler
 *  by James Lee Rubingh
 *  james@wrive.com
 *
 *  Copyright (2002) James Rubingh
 *  Released under the GPL v2
 *
 *  査読お願いします!
 */

static char *calculate_query_string(struct instruction *, char *);

static int add_symbol(struct instruction *);
static int apply_table(struct instruction *, struct tab_entry*);
static int check_for_symbol(const char *);
static int pass_second(struct instruction *);
static int validate_label(char *);
static int validate_symbol(char *);

static struct instruction *get_operands(struct instruction *);
static struct instruction *new_instruction();
static struct label_entry *new_label();
static struct instruction *pass_first(FILE *, struct tab_entry*);
static struct instruction *parse_source(FILE *, struct instruction*, struct tab_entry*);
static struct symbol_entry *new_symbol();
static struct tab_entry *match_mnumonic(struct tab_entry *, struct instruction *);
static struct tab_entry *match_mnumonic_with_query_string(char *, struct tab_entry *);
static struct tab_entry *match_operands_to_mnumonic(const char *, struct tab_entry *);

static void append_string(char *, const char *);
static void add_label(char *, struct instruction *);
static void calculate_opcode(struct tab_entry*, struct instruction *);
static void found_correct_tab_entry(struct instruction *, struct tab_entry *);
static void set_not_reduced_flag(struct instruction *);
static void remove_whitespace(char *);

enum Z_DIRECTIVE {
    Z_DB,
    Z_DW,
    Z_ORG,
    Z_END
};

const char *REGISTERS[] = {
    //registers
    "A",
    "B",
    "C",
    "D",
    "E",
    "F",
    "G",
    "H",
    "I",
    "L",
    "BC",
    "DE",
    "HL",
    "AF",
    "IX",
    "IY",
    "IXL",
    "IYL",
    "IXH",
    "IYH",
    "PC",
    "SP",
    //flags
    "NC",
    "NZ",
    "Z",
    "R",
    "PE",
    "PO",
};

#define NUM_REGISTERS_TO_CHECK (sizeof(REGISTERS) / sizeof(REGISTERS[0]))


code:
/* Copyright (c) 2010 the authors listed at the following URL, and/or
   the authors of referenced articles or incorporated external code:
http://en.literateprograms.org/Shunting_yard_algorithm_(C)?action=history&offset=20080201043325

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Retrieved from: http://en.literateprograms.org/Shunting_yard_algorithm_(C)?oldid=12454

 ** edited by James Rubingh for zasm2 (git:9fef825b)
 */

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

#define MAXOPSTACK 64
#define MAXNUMSTACK 64

struct op_s *opstack[MAXOPSTACK];
int nopstack;

int numstack[MAXNUMSTACK];
int nnumstack;
int shunt_error;

enum {ASSOC_NONE=0, ASSOC_LEFT, ASSOC_RIGHT};

int eval_uminus(int a1, int a2)
{
    return -a1;
}
int eval_exp(int a1, int a2)
{
    return a2<0 ? 0 : (a2==0?1:a1*eval_exp(a1, a2-1));
}
int eval_mul(int a1, int a2)
{
    return a1*a2;
}
int eval_div(int a1, int a2)
{
    if(!a2) {
        fprintf(stderr, "ERROR: Division by zero\n");
        shunt_error=1;
        return EXIT_FAILURE;
    }
    return a1/a2;
}
int eval_mod(int a1, int a2)
{
    if(!a2) {
        fprintf(stderr, "ERROR: Division by zero\n");
        shunt_error=1;
        return EXIT_FAILURE;
    }
    return a1%a2;
}
int eval_add(int a1, int a2)
{
    return a1+a2;
}
int eval_sub(int a1, int a2)
{
    return a1-a2;
}

struct op_s {
    char op;
    int prec;
    int assoc;
    int unary;
    int (*eval)(int a1, int a2);
} ops[]={
    {'_', 10, ASSOC_RIGHT, 1, eval_uminus},
    {'^', 9, ASSOC_RIGHT, 0, eval_exp},
    {'*', 8, ASSOC_LEFT, 0, eval_mul},
    {'/', 8, ASSOC_LEFT, 0, eval_div},
    {'%', 8, ASSOC_LEFT, 0, eval_mod},
    {'+', 5, ASSOC_LEFT, 0, eval_add},
    {'-', 5, ASSOC_LEFT, 0, eval_sub},
    {'(', 0, ASSOC_NONE, 0, NULL},
    {')', 0, ASSOC_NONE, 0, NULL}
};

struct op_s *getop(char ch)
{
    int i;
    for(i=0; i<sizeof ops/sizeof ops[0]; ++i) {
        if(ops[i].op==ch) return ops+i;
    }
    return NULL;
}

void push_opstack(struct op_s *op)
{
    if(nopstack>MAXOPSTACK-1) {
        fprintf(stderr, "ERROR: Operator stack overflow\n");
        shunt_error=1;
        return;
    }
    opstack[nopstack++]=op;
}

struct op_s *pop_opstack()
{
    if(!nopstack) {
        fprintf(stderr, "ERROR: Operator stack empty\n");
        shunt_error=1;
        return NULL;
    }
    return opstack[--nopstack];
}

void push_numstack(int num)
{
    if(nnumstack>MAXNUMSTACK-1) {
        fprintf(stderr, "ERROR: Number stack overflow\n");
        shunt_error=1;
        return;
    }
    numstack[nnumstack++]=num;
}

int pop_numstack()
{
    if(!nnumstack) {
        fprintf(stderr, "ERROR: Number stack empty\n");
        shunt_error=1;
        return EXIT_FAILURE;
    }
    return numstack[--nnumstack];
}

void shunt_op(struct op_s *op)
{
    struct op_s *pop;
    int n1, n2;

    if(op->op=='(') {
        push_opstack(op);
        return;

    } else if(op->op==')') {
        while(nopstack>0 && opstack[nopstack-1]->op!='(') {
            pop=pop_opstack();
            n1=pop_numstack();

            if(pop->unary) push_numstack(pop->eval(n1, 0));
            else {
                n2=pop_numstack();
                push_numstack(pop->eval(n2, n1));
            }
        }

        if(!(pop=pop_opstack()) || pop->op!='(') {
            fprintf(stderr, "ERROR: Stack error. No matching \'(\'\n");
            shunt_error=1;
            return;
        }
        return;
    }

    if(op->assoc==ASSOC_RIGHT) {
        while(nopstack && op->prec<opstack[nopstack-1]->prec) {
            pop=pop_opstack();
            n1=pop_numstack();
            if(pop->unary) push_numstack(pop->eval(n1, 0));
            else {
                n2=pop_numstack();
                push_numstack(pop->eval(n2, n1));
            }
        }
    } else {
        while(nopstack && op->prec<=opstack[nopstack-1]->prec) {
            pop=pop_opstack();
            n1=pop_numstack();
            if(pop->unary) push_numstack(pop->eval(n1, 0));
            else {
                n2=pop_numstack();
                push_numstack(pop->eval(n2, n1));
            }
        }
    }
    push_opstack(op);
}

int shunt(char *expression)
{
    char *expr;
    char *tstart=NULL;
    struct op_s startop={'X', 0, ASSOC_NONE, 0, NULL};	/* Dummy operator to mark start */
    struct op_s *op=NULL;
    int n1, n2;
    struct op_s *lastop=&startop;

    nnumstack=0;
    nopstack=0;
    shunt_error=0;

    for(expr=expression; *expr; ++expr) {
        if(!tstart) {

            if((op=getop(*expr))) {

                if(lastop && (lastop==&startop || lastop->op!=')')) {
                    if(op->op=='-') op=getop('_');
                    else if(op->op!='(') {
                        fprintf(stderr, "ERROR: Illegal use of binary operator (%c)\n", op->op);
                        shunt_error=1;
                        return EXIT_FAILURE;
                    }
                }
                shunt_op(op);
                lastop=op;
            } else if(isdigit(*expr)) tstart=expr;
            else if(!isspace(*expr)) {
                fprintf(stderr, "ERROR: Syntax error\n");
                shunt_error=1;
                return EXIT_FAILURE;
            }
        } else {
            if(isspace(*expr)) {
                push_numstack(atoi(tstart));
                tstart=NULL;
                lastop=NULL;
            } else if((op=getop(*expr))) {
                push_numstack(atoi(tstart));
                tstart=NULL;
                shunt_op(op);
                lastop=op;
            } else if(!isdigit(*expr)) {
                fprintf(stderr, "ERROR: Syntax error\n");
                return EXIT_FAILURE;
            }
        }
    }
    if(tstart) push_numstack(atoi(tstart));

    while(nopstack) {
        op=pop_opstack();
        n1=pop_numstack();
        if(op->unary) push_numstack(op->eval(n1, 0));
        else {
            n2=pop_numstack();
            push_numstack(op->eval(n2, n1));
        }
    }

    if(nnumstack!=1) {
        fprintf(stderr, "ERROR: Number stack has %d elements after evaluation. Should be 1.\n", nnumstack);
        return EXIT_FAILURE;
    }

    return numstack[0];
}


code:
OBJS =  ../lib/pass.o\
	help.o\
	../lib/shunt.o\
	zasm.o
CFLAGS = -O2 -ffast-math -fomit-frame-pointer
CC = clang # or gcc
OPTS =

all:	help.o zasm.o
	$(CC) $(OPTS) -o zasm $(CFLAGS) $(OBJS)

clean:
	rm -f *.o
	rm -f *.swp
	rm -f *~
	rm -f *\#
	rm -f zasm
	rm -f woo

distclean: clean
	rm -f Makefile

install:
	cp -v ./zasm /usr/local/bin/
	mkdir /usr/local/share/zasm
	cp -v ./TASM80.TAB /usr/local/share/zasm

uninstall:
	rm -f /usr/local/bin/zasm
	rm -f /usr/local/share/zasm/TASM80.TAB
	rmdir /usr/local/share/zasm


code:
ADC  A,(HL)  8E   1 NOP 1
ADC  A,(IX*) 8EDD 3 NOP 1
ADC  A,(IY*) 8EFD 3 NOP 1
ADC  A,A     8F   1 NOP 1
ADC  A,B     88   1 NOP 1
ADC  A,C     89   1 NOP 1
ADC  A,D     8A   1 NOP 1
ADC  A,E     8B   1 NOP 1
ADC  A,H     8C   1 NOP 1

ADC  A,IXH   8CDD 2 NOP 1
ADC  A,IYH   8CFD 2 NOP 1

ADC  A,L     8D   1 NOP 1

ADC  A,IXL   8DDD 2 NOP 1
ADC  A,IYL   8DFD 2 NOP 1

ADC  A,*     CE   2 NOP 1
ADC  HL,BC   4AED 2 NOP 1
ADC  HL,DE   5AED 2 NOP 1
ADC  HL,HL   6AED 2 NOP 1
ADC  HL,SP   7AED 2 NOP 1

ADD  A,(HL)  86   1 NOP 1
ADD  A,(IX*) 86DD 3 NOP 1
ADD  A,(IY*) 86FD 3 NOP 1
ADD  A,A     87   1 NOP 1
ADD  A,B     80   1 NOP 1
ADD  A,C     81   1 NOP 1
ADD  A,D     82   1 NOP 1
ADD  A,E     83   1 NOP 1
ADD  A,H     84   1 NOP 1

ADD  A,IXH   84DD 2 NOP 1
ADD  A,IYH   84FD 2 NOP 1

ADD  A,L     85   1 NOP 1

ADD  A,IXL   85DD 2 NOP 1
ADD  A,IYL   85FD 2 NOP 1

ADD  A,*     C6   2 NOP 1
ADD  HL,BC   09   1 NOP 1
ADD  HL,DE   19   1 NOP 1
ADD  HL,HL   29   1 NOP 1
ADD  HL,SP   39   1 NOP 1
ADD  IX,BC   09DD 2 NOP 1
ADD  IX,DE   19DD 2 NOP 1
ADD  IX,IX   29DD 2 NOP 1
ADD  IX,SP   39DD 2 NOP 1
ADD  IY,BC   09FD 2 NOP 1
ADD  IY,DE   19FD 2 NOP 1
ADD  IY,IY   29FD 2 NOP 1
ADD  IY,SP   39FD 2 NOP 1

AND  (HL)    A6   1 NOP 1
AND  (IX*)   A6DD 3 NOP 1
AND  (IY*)   A6FD 3 NOP 1
AND  A       A7   1 NOP 1
AND  B       A0   1 NOP 1
AND  C       A1   1 NOP 1
AND  D       A2   1 NOP 1
AND  E       A3   1 NOP 1
AND  H       A4   1 NOP 1

AND  IXH     A4DD 2 NOP 1
AND  IYH     A4FD 2 NOP 1

AND  L       A5   1 NOP 1

AND  IXL     A5DD 2 NOP 1
AND  IYL     A5FD 2 NOP 1

AND  *       E6   2 NOP 1

BIT  *,(HL)  46CB 2 ZBIT 1
BIT  *,(IX*) CBDD 4 ZBIT 1 0 4600
BIT  *,(IY*) CBFD 4 ZBIT 1 0 4600
BIT  *,A     47CB 2 ZBIT 1
BIT  *,B     40CB 2 ZBIT 1
BIT  *,C     41CB 2 ZBIT 1
BIT  *,D     42CB 2 ZBIT 1
BIT  *,E     43CB 2 ZBIT 1
BIT  *,H     44CB 2 ZBIT 1
BIT  *,L     45CB 2 ZBIT 1

CALL C,*     DC   3 NOP 1
CALL M,*     FC   3 NOP 1
CALL NC,*    D4   3 NOP 1
CALL NZ,*    C4   3 NOP 1
CALL P,*     F4   3 NOP 1
CALL PE,*    EC   3 NOP 1
CALL PO,*    E4   3 NOP 1
CALL Z,*     CC   3 NOP 1
CALL *       CD   3 NOP 1

CCF  ""      3F   1 NOP 1

CP   (HL)    BE   1 NOP 1
CP   (IX*)   BEDD 3 NOP 1
CP   (IY*)   BEFD 3 NOP 1
CP   A       BF   1 NOP 1
CP   B       B8   1 NOP 1
CP   C       B9   1 NOP 1
CP   D       BA   1 NOP 1
CP   E       BB   1 NOP 1
CP   H       BC   1 NOP 1

CP   IXH     BCDD 2 NOP 1
CP   IYH     BCFD 2 NOP 1

CP   L       BD   1 NOP 1

CP   IXL     BDDD 2 NOP 1
CP   IYL     BDFD 2 NOP 1

CP   *       FE   2 NOP 1
CPD  ""      A9ED 2 NOP 1
CPDR ""      B9ED 2 NOP 1
CPIR ""      B1ED 2 NOP 1
CPI  ""      A1ED 2 NOP 1
CPL  ""      2F   1 NOP 1

DAA  ""      27   1 NOP 1

DEC  (HL)    35   1 NOP 1
DEC  (IX*)   35DD 3 NOP 1
DEC  (IY*)   35FD 3 NOP 1
DEC  A       3D   1 NOP 1
DEC  B       05   1 NOP 1
DEC  BC      0B   1 NOP 1
DEC  C       0D   1 NOP 1
DEC  D       15   1 NOP 1
DEC  DE      1B   1 NOP 1
DEC  E       1D   1 NOP 1
DEC  H       25   1 NOP 1

DEC  IXH     25DD 2 NOP 1
DEC  IYH     25FD 2 NOP 1

DEC  HL      2B   1 NOP 1
DEC  IX      2BDD 2 NOP 1
DEC  IY      2BFD 2 NOP 1
DEC  L       2D   1 NOP 1

DEC  IXL     2DDD 2 NOP 1
DEC  IYL     2DFD 2 NOP 1

DEC  SP      3B   1 NOP 1
DI   ""      F3   1 NOP 1
DJNZ *       10   2 R1  1
EI   ""      FB   1 NOP 1
EX   (SP),HL E3   1 NOP 1
EX   (SP),IX E3DD 2 NOP 1
EX   (SP),IY E3FD 2 NOP 1
EX   AF,AF'  08   1 NOP 1
EX   DE,HL   EB   1 NOP 1
EXX  ""      D9   1 NOP 1
HALT ""      76   1 NOP 1

IM   0       46ED 2 NOP 1
IM   1       56ED 2 NOP 1
IM   2       5EED 2 NOP 1

IN   A,(C)   78ED 2 NOP 1
IN   B,(C)   40ED 2 NOP 1
IN   C,(C)   48ED 2 NOP 1
IN   D,(C)   50ED 2 NOP 1
IN   E,(C)   58ED 2 NOP 1
IN   H,(C)   60ED 2 NOP 1
IN   L,(C)   68ED 2 NOP 1

INC  (HL)    34   1 NOP 1
INC  (IX*)   34DD 3 NOP 1
INC  (IY*)   34FD 3 NOP 1
INC  A       3C   1 NOP 1
INC  B       04   1 NOP 1
INC  BC      03   1 NOP 1
INC  C       0C   1 NOP 1
INC  D       14   1 NOP 1
INC  DE      13   1 NOP 1
INC  E       1C   1 NOP 1
INC  H       24   1 NOP 1

INC  IXH     24DD 2 NOP 1
INC  IYH     24FD 2 NOP 1

INC  HL      23   1 NOP 1
INC  IX      23DD 2 NOP 1
INC  IY      23FD 2 NOP 1
INC  L       2C   1 NOP 1

INC  IXL     2CDD 2 NOP 1
INC  IYL     2CFD 2 NOP 1

INC  SP      33   1 NOP 1

IN   A,*     DB   2 NOP 1

IND  ""      AAED 2 NOP 1
INDR ""      BAED 2 NOP 1
INI  ""      A2ED 2 NOP 1
INIR ""      B2ED 2 NOP 1

JP   (HL)    E9   1 NOP 1
JP   (IX)    E9DD 2 NOP 1
JP   (IY)    E9FD 2 NOP 1
JP   C,*     DA   3 NOP 1
JP   M,*     FA   3 NOP 1
JP   NC,*    D2   3 NOP 1
JP   NZ,*    C2   3 NOP 1
JP   P,*     F2   3 NOP 1
JP   PE,*    EA   3 NOP 1
JP   PO,*    E2   3 NOP 1
JP   Z,*     CA   3 NOP 1
JP   *       C3   3 NOP 1

JR   C,*     38   2 R1  1
JR   NC,*    30   2 R1  1
JR   NZ,*    20   2 R1  1
JR   Z,*     28   2 R1  1
JR   *       18   2 R1  1

LD   (BC),A  02   1 NOP 1
LD   (DE),A  12   1 NOP 1
LD   (HL),A  77   1 NOP 1
LD   (HL),B  70   1 NOP 1
LD   (HL),C  71   1 NOP 1
LD   (HL),D  72   1 NOP 1
LD   (HL),E  73   1 NOP 1
LD   (HL),H  74   1 NOP 1

LD  (HL),IXH 74DD 2 NOP 1
LD  (HL),IYH 74FD 2 NOP 1

LD   (HL),L  75   1 NOP 1

LD  (HL),IXL 75DD 2 NOP 1
LD  (HL),IYL 75FD 2 NOP 1

LD   (HL),*  36   2 NOP 1
LD   (IX*),A 77DD 3 NOP 1
LD   (IX*),B 70DD 3 NOP 1
LD   (IX*),C 71DD 3 NOP 1
LD   (IX*),D 72DD 3 NOP 1
LD   (IX*),E 73DD 3 NOP 1
LD   (IX*),H 74DD 3 NOP 1
LD   (IX*),L 75DD 3 NOP 1
LD   (IX*),* 36DD 4 COMBINE 1
LD   (IY*),A 77FD 3 NOP 1
LD   (IY*),B 70FD 3 NOP 1
LD   (IY*),C 71FD 3 NOP 1
LD   (IY*),D 72FD 3 NOP 1
LD   (IY*),E 73FD 3 NOP 1
LD   (IY*),H 74FD 3 NOP 1
LD   (IY*),L 75FD 3 NOP 1
LD   (IY*),* 36FD 4 COMBINE 1
LD   (*),A   32   3 NOP 1
LD   (*),BC  43ED 4 NOP 1
LD   (*),DE  53ED 4 NOP 1
LD   (*),HL  22   3 NOP 1
LD   (*),IX  22DD 4 NOP 1
LD   (*),IY  22FD 4 NOP 1
LD   (*),SP  73ED 4 NOP 1
LD   A,(BC)  0A   1 NOP 1
LD   A,(DE)  1A   1 NOP 1
LD   A,(HL)  7E   1 NOP 1
LD   A,(IX*) 7EDD 3 NOP 1
LD   A,(IY*) 7EFD 3 NOP 1
LD   A,A     7F   1 NOP 1
LD   A,B     78   1 NOP 1
LD   A,C     79   1 NOP 1
LD   A,D     7A   1 NOP 1
LD   A,E     7B   1 NOP 1
LD   A,H     7C   1 NOP 1

LD   A,IXH   7CDD 2 NOP 1
LD   A,IYH   7CFD 2 NOP 1

LD   A,I     57ED 2 NOP 1
LD   A,L     7D   1 NOP 1

LD   A,IXL   7DDD 2 NOP 1
LD   A,IYL   7DFD 2 NOP 1

LD   A,R     5FED 2 NOP 1
LD   A,(*)   3A   3 NOP 1
LD   A,*     3E   2 NOP 1
LD   B,(HL)  46   1 NOP 1
LD   B,(IX*) 46DD 3 NOP 1
LD   B,(IY*) 46FD 3 NOP 1
LD   B,A     47   1 NOP 1
LD   B,B     40   1 NOP 1
LD   B,C     41   1 NOP 1
LD   B,D     42   1 NOP 1
LD   B,E     43   1 NOP 1
LD   B,H     44   1 NOP 1

LD   B,IXH   44DD 2 NOP 1
LD   B,IYH   44FD 2 NOP 1

LD   B,L     45   1 NOP 1

LD   B,IXL   45DD 2 NOP 1
LD   B,IYL   45FD 2 NOP 1

LD   B,*     06   2 NOP 1
LD   BC,(*)  4BED 4 NOP 1
LD   BC,*    01   3 NOP 1
LD   C,(HL)  4E   1 NOP 1
LD   C,(IX*) 4EDD 3 NOP 1
LD   C,(IY*) 4EFD 3 NOP 1
LD   C,A     4F   1 NOP 1
LD   C,B     48   1 NOP 1
LD   C,C     49   1 NOP 1
LD   C,D     4A   1 NOP 1
LD   C,E     4B   1 NOP 1
LD   C,H     4C   1 NOP 1

LD   C,IXH   4CDD 2 NOP 1
LD   C,IYH   4CFD 2 NOP 1

LD   C,L     4D   1 NOP 1

LD   C,IXL   4DDD 2 NOP 1
LD   C,IYL   4DFD 2 NOP 1

LD   C,*     0E   2 NOP 1
LD   D,(HL)  56   1 NOP 1
LD   D,(IX*) 56DD 3 NOP 1
LD   D,(IY*) 56FD 3 NOP 1
LD   D,A     57   1 NOP 1
LD   D,B     50   1 NOP 1
LD   D,C     51   1 NOP 1
LD   D,D     52   1 NOP 1
LD   D,E     53   1 NOP 1
LD   D,H     54   1 NOP 1

LD   D,IXH   54DD 2 NOP 1
LD   D,IYH   54FD 2 NOP 1

LD   D,L     55   1 NOP 1

LD   D,IXL   55DD 2 NOP 1
LD   D,IYL   55FD 2 NOP 1

LD   D,*     16   2 NOP 1
LD   DE,(*)  5BED 4 NOP 1
LD   DE,*    11   3 NOP 1
LD   E,(HL)  5E   1 NOP 1
LD   E,(IX*) 5EDD 3 NOP 1
LD   E,(IY*) 5EFD 3 NOP 1
LD   E,A     5F   1 NOP 1
LD   E,B     58   1 NOP 1
LD   E,C     59   1 NOP 1
LD   E,D     5A   1 NOP 1
LD   E,E     5B   1 NOP 1
LD   E,H     5C   1 NOP 1

LD   E,IXH   5CDD 2 NOP 1
LD   E,IYH   5CFD 2 NOP 1

LD   E,L     5D   1 NOP 1

LD   E,IXL   5DDD 2 NOP 1
LD   E,IYL   5DFD 2 NOP 1

LD   E,*     1E   2 NOP 1

LD   H,(HL)  66   1 NOP 1
LD   H,(IX*) 66DD 3 NOP 1
LD   H,(IY*) 66FD 3 NOP 1
LD   H,A     67   1 NOP 1
LD   H,B     60   1 NOP 1
LD   H,C     61   1 NOP 1
LD   H,D     62   1 NOP 1
LD   H,E     63   1 NOP 1
LD   H,H     64   1 NOP 1
LD   H,L     65   1 NOP 1
LD   H,*     26   2 NOP 1

LD IXH,(HL)  66DD 2 NOP 1
LD IXH,A     67DD 2 NOP 1
LD IXH,B     60DD 2 NOP 1
LD IXH,C     61DD 2 NOP 1
LD IXH,D     62DD 2 NOP 1
LD IXH,E     63DD 2 NOP 1
LD IXH,H     64DD 2 NOP 1
LD IXH,L     65DD 2 NOP 1
LD IXH,*     26DD 3 NOP 1

LD IYH,(HL)  66FD 2 NOP 1
LD IYH,A     67FD 2 NOP 1
LD IYH,B     60FD 2 NOP 1
LD IYH,C     61FD 2 NOP 1
LD IYH,D     62FD 2 NOP 1
LD IYH,E     63FD 2 NOP 1
LD IYH,H     64FD 2 NOP 1
LD IYH,L     65FD 2 NOP 1
LD IYH,*     26FD 3 NOP 1

LD   HL,(*)  2A   3 NOP 1
LD   HL,*    21   3 NOP 1
LD   I,A     47ED 2 NOP 1
LD   IX,(*)  2ADD 4 NOP 1
LD   IX,*    21DD 4 NOP 1
LD   IY,(*)  2AFD 4 NOP 1
LD   IY,*    21FD 4 NOP 1

LD   L,(HL)  6E   1 NOP 1
LD   L,(IX*) 6EDD 3 NOP 1
LD   L,(IY*) 6EFD 3 NOP 1
LD   L,A     6F   1 NOP 1
LD   L,B     68   1 NOP 1
LD   L,C     69   1 NOP 1
LD   L,D     6A   1 NOP 1
LD   L,E     6B   1 NOP 1
LD   L,H     6C   1 NOP 1
LD   L,L     6D   1 NOP 1
LD   L,*     2E   2 NOP 1

LD IXL,(HL)  6EDD 2 NOP 1
LD IXL,A     6FDD 2 NOP 1
LD IXL,B     68DD 2 NOP 1
LD IXL,C     69DD 2 NOP 1
LD IXL,D     6ADD 2 NOP 1
LD IXL,E     6BDD 2 NOP 1
LD IXL,H     6CDD 2 NOP 1
LD IXL,L     6DDD 2 NOP 1
LD IXL,*     2EDD 3 NOP 1

LD IYL,(HL)  6EFD 2 NOP 1
LD IYL,A     6FFD 2 NOP 1
LD IYL,B     68FD 2 NOP 1
LD IYL,C     69FD 2 NOP 1
LD IYL,D     6AFD 2 NOP 1
LD IYL,E     6BFD 2 NOP 1
LD IYL,H     6CFD 2 NOP 1
LD IYL,L     6DFD 2 NOP 1
LD IYL,*     2EFD 3 NOP 1

LD   R,A     4FED 2 NOP 1
LD   SP,(*)  7BED 4 NOP 1
LD   SP,HL   F9   1 NOP 1
LD   SP,IX   F9DD 2 NOP 1
LD   SP,IY   F9FD 2 NOP 1
LD   SP,*    31   3 NOP 1
LDD  ""      A8ED 2 NOP 1
LDDR ""      B8ED 2 NOP 1
LDI  ""      A0ED 2 NOP 1
LDIR ""      B0ED 2 NOP 1
NEG  ""      44ED 2 NOP 1
NOP  ""      00   1 NOP 1

OR   (HL)    B6   1 NOP 1
OR   (IX*)   B6DD 3 NOP 1
OR   (IY*)   B6FD 3 NOP 1
OR   A       B7   1 NOP 1
OR   B       B0   1 NOP 1
OR   C       B1   1 NOP 1
OR   D       B2   1 NOP 1
OR   E       B3   1 NOP 1
OR   H       B4   1 NOP 1

OR IXH       B4DD 2 NOP 1
OR IYH       B4FD 2 NOP 1

OR   L       B5   1 NOP 1

OR IXL       B5DD 2 NOP 1
OR IYL       B5FD 2 NOP 1

OR   *       F6   2 NOP 1

OTDR ""      8BED 2 NOP 1
OTIR ""      B3ED 2 NOP 1

OUT  (C),A   79ED 2 NOP 1
OUT  (C),B   41ED 2 NOP 1
OUT  (C),C   49ED 2 NOP 1
OUT  (C),D   51ED 2 NOP 1
OUT  (C),E   59ED 2 NOP 1
OUT  (C),H   61ED 2 NOP 1
OUT  (C),L   69ED 2 NOP 1
OUT  (*),A   D3   2 NOP 1

OUTD ""      ABED 2 NOP 1
OUTI ""      A3ED 2 NOP 1

POP  AF      F1   1 NOP 1
POP  BC      C1   1 NOP 1
POP  DE      D1   1 NOP 1
POP  HL      E1   1 NOP 1
POP  IX      E1DD 2 NOP 1
POP  IY      E1FD 2 NOP 1

PUSH AF      F5   1 NOP 1
PUSH BC      C5   1 NOP 1
PUSH DE      D5   1 NOP 1
PUSH HL      E5   1 NOP 1
PUSH IX      E5DD 2 NOP 1
PUSH IY      E5FD 2 NOP 1

RES  *,(HL)  86CB 2 ZBIT 1
RES  *,(IX*) CBDD 4 ZBIT 1 0 8600
RES  *,(IY*) CBFD 4 ZBIT 1 0 8600
RES  *,A     87CB 2 ZBIT 1
RES  *,B     80CB 2 ZBIT 1
RES  *,C     81CB 2 ZBIT 1
RES  *,D     82CB 2 ZBIT 1
RES  *,E     83CB 2 ZBIT 1
RES  *,H     84CB 2 ZBIT 1
RES  *,L     85CB 2 ZBIT 1

RET  ""      C9   1 NOP 1
RET  C       D8   1 NOP 1
RET  M       F8   1 NOP 1
RET  NC      D0   1 NOP 1
RET  NZ      C0   1 NOP 1
RET  P       F0   1 NOP 1
RET  PE      E8   1 NOP 1
RET  PO      E0   1 NOP 1
RET  Z       C8   1 NOP 1
RETI ""      4DED 2 NOP 1
RETN ""      45ED 2 NOP 1

RL   (HL)    16CB 2 NOP 1
RL   (IX*)   CBDD 4 NOP 1 0 1600
RL   (IY*)   CBFD 4 NOP 1 0 1600
RL   A       17CB 2 NOP 1
RL   B       10CB 2 NOP 1
RL   C       11CB 2 NOP 1
RL   D       12CB 2 NOP 1
RL   E       13CB 2 NOP 1
RL   H       14CB 2 NOP 1

RL   L       15CB 2 NOP 1
RLA  ""      17   1 NOP 1

RLC  (HL)    06CB 2 NOP 1
RLC  (IX*)   CBDD 4 NOP 1 0 0600
RLC  (IY*)   CBFD 4 NOP 1 0 0600
RLC  A       07CB 2 NOP 1
RLC  B       00CB 2 NOP 1
RLC  C       01CB 2 NOP 1
RLC  D       02CB 2 NOP 1
RLC  E       03CB 2 NOP 1
RLC  H       04CB 2 NOP 1
RLC  L       05CB 2 NOP 1
RLCA ""      07   1 NOP 1
RLD  ""      6FED 2 NOP 1

RR   (HL)    1ECB 2 NOP 1
RR   (IX*)   CBDD 4 NOP 1 0 1E00
RR   (IY*)   CBFD 4 NOP 1 0 1E00
RR   A       1FCB 2 NOP 1
RR   B       18CB 2 NOP 1
RR   C       19CB 2 NOP 1
RR   D       1ACB 2 NOP 1
RR   E       1BCB 2 NOP 1
RR   H       1CCB 2 NOP 1
RR   L       1DCB 2 NOP 1
RRA  ""      1F   1 NOP 1
RRC  (HL)    0ECB 2 NOP 1
RRC  (IX*)   CBDD 4 NOP 1 0 0E00
RRC  (IY*)   CBFD 4 NOP 1 0 0E00
RRC  A       0FCB 2 NOP 1
RRC  B       08CB 2 NOP 1
RRC  C       09CB 2 NOP 1
RRC  D       0ACB 2 NOP 1
RRC  E       0BCB 2 NOP 1
RRC  H       0CCB 2 NOP 1
RRC  L       0DCB 2 NOP 1
RRCA ""      0F   1 NOP 1
RRD  ""      67ED 2 NOP 1

RST  00H     C7   1 NOP 1
RST  08H     CF   1 NOP 1
RST  10H     D7   1 NOP 1
RST  18H     DF   1 NOP 1
RST  20H     E7   1 NOP 1
RST  28H     EF   1 NOP 1
RST  30H     F7   1 NOP 1
RST  38H     FF   1 NOP 1

SBC  A,(HL)  9E   1 NOP 1
SBC  A,(IX*) 9EDD 3 NOP 1
SBC  A,(IY*) 9EFD 3 NOP 1
SBC  A,A     9F   1 NOP 1
SBC  A,B     98   1 NOP 1
SBC  A,C     99   1 NOP 1
SBC  A,D     9A   1 NOP 1
SBC  A,E     9B   1 NOP 1
SBC  A,H     9C   1 NOP 1

SBC IXH      9CDD 2 NOP 1
SBC IYH      9CFD 2 NOP 1

SBC  A,L     9D   1 NOP 1

SBC IXL      9DDD 2 NOP 1
SBC IYL      9DFD 2 NOP 1

SBC  HL,BC   42ED 2 NOP 1
SBC  HL,DE   52ED 2 NOP 1
SBC  HL,HL   62ED 2 NOP 1
SBC  HL,SP   72ED 2 NOP 1
SBC  A,*     DE   2 NOP 1
SCF  ""      37   1 NOP 1

SET  *,(HL)  C6CB 2 ZBIT 1
SET  *,(IX*) CBDD 4 ZBIT 1 0 C600
SET  *,(IY*) CBFD 4 ZBIT 1 0 C600
SET  *,A     C7CB 2 ZBIT 1
SET  *,B     C0CB 2 ZBIT 1
SET  *,C     C1CB 2 ZBIT 1
SET  *,D     C2CB 2 ZBIT 1
SET  *,E     C3CB 2 ZBIT 1
SET  *,H     C4CB 2 ZBIT 1
SET  *,L     C5CB 2 ZBIT 1

SLA  (HL)    26CB 2 NOP 1
SLA  (IX*)   CBDD 4 NOP 1 0 2600
SLA  (IY*)   CBFD 4 NOP 1 0 2600
SLA  A       27CB 2 NOP 1
SLA  B       20CB 2 NOP 1
SLA  C       21CB 2 NOP 1
SLA  D       22CB 2 NOP 1
SLA  E       23CB 2 NOP 1
SLA  H       24CB 2 NOP 1
SLA  L       25CB 2 NOP 1

SRA  (HL)    2ECB 2 NOP 1
SRA  (IX*)   CBDD 4 NOP 1 0 2E00
SRA  (IY*)   CBFD 4 NOP 1 0 2E00
SRA  A       2FCB 2 NOP 1
SRA  B       28CB 2 NOP 1
SRA  C       29CB 2 NOP 1
SRA  D       2ACB 2 NOP 1
SRA  E       2BCB 2 NOP 1
SRA  H       2CCB 2 NOP 1
SRA  L       2DCB 2 NOP 1

SRL  (HL)    3ECB 2 NOP 1
SRL  (IX*)   CBDD 4 NOP 1 0 3E00
SRL  (IY*)   CBFD 4 NOP 1 0 3E00
SRL  A       3FCB 2 NOP 1
SRL  B       38CB 2 NOP 1
SRL  C       39CB 2 NOP 1
SRL  D       3ACB 2 NOP 1
SRL  E       3BCB 2 NOP 1
SRL  H       3CCB 2 NOP 1
SRL  L       3DCB 2 NOP 1

SUB  (HL)    96   1 NOP 1
SUB  (IX*)   96DD 3 NOP 1
SUB  (IY*)   96FD 3 NOP 1
SUB  A       97   1 NOP 1
SUB  B       90   1 NOP 1
SUB  C       91   1 NOP 1
SUB  D       92   1 NOP 1
SUB  E       93   1 NOP 1
SUB  H       94   1 NOP 1

SUB IXH      94DD 2 NOP 1
SUB IYH      94FD 2 NOP 1

SUB  L       95   1 NOP 1

SUB IXL      95DD 2 NOP 1
SUB IYL      95FD 2 NOP 1

SUB  *       D6   2 NOP 1

XOR  (HL)    AE   1 NOP 1
XOR  (IX*)   AEDD 3 NOP 1
XOR  (IY*)   AEFD 3 NOP 1
XOR  A       AF   1 NOP 1
XOR  B       A8   1 NOP 1
XOR  C       A9   1 NOP 1
XOR  D       AA   1 NOP 1
XOR  E       AB   1 NOP 1
XOR  H       AC   1 NOP 1

XOR IXH      ACDD 2 NOP 1
XOR IYH      ACFD 2 NOP 1

XOR  L       AD   1 NOP 1

XOR IXL      ADDD 2 NOP 1
XOR IYL      ADFD 2 NOP 1

XOR  *       EE   2 NOP 1


code:
/*  Zasm2 Z80 assembler
 *  by James Lee Rubingh
 *  james@wrive.com
 *
 *  Copyright (2002) James Rubingh
 *  Released under the GPL v2
 *
 *  査読お願いします!
 */

#include <stdio.h>
#include <stdlib.h>
#include "../include/zasm.h"

#include "../config.h"

void show_help(int returncode)
{
    puts("(C) 2002 James Lee Rubingh");
    printf("Zasm %s\n",PACKAGE_VERSION);
    puts("zasm (switches) [infile] [outfile]");
    puts("-v\tbe --verbose");
    puts("-V\tshow program --version");
    puts("-t\tcreate a ti86 program");
    puts("-s\tcreate a ti86 string");
    puts("-p\t(default) create flat binary, no formatting");
    exit (returncode);
}


code:
;test.asm

_textShadow = $9f00
#origin = _textShadow

.org origin

starting:
  ld a, b
  xor a ; xx
  rl l
  rla
  rl a
label1:
label2:
  ld (hl),  a
  add a,b
  add a, 15 ;(3*5) no preprocessing yet
  ret;fuck this
  ld	b	,	5
  .db 0, 1, 3, 4, 5, 6, 7, 8

;David Phillip's RLE decompress routine
DispRLE:
 ld bc,1024			; we need to copy
DispRLEL:
 ld a,(hl)			; get the next byte
 cp $91				; is it a run?
 jr z,DispRLERun	; then we need to decode the run
 ldi				; copy the byte, and update counters
DispRLEC:
 ld a,b				; check the low byte and
 or c				; the high byte for 0
 jr nz,DispRLEL		; if not, then we're not done either
 ret				; if it's zero, we're done
DispRLERun:
 inc hl				; move to the run value
 ld a,(hl)			; get the run value
 inc hl				; move to the run count
 push hl			; save source pointer
 ld h,(hl)			; get the run count
 ex de,hl			; swap source and destination pointers
DispRLERunL:
 ld (hl),a			; copy the byte
 inc hl				; increase destination pointer
 dec bc				; decrease byte count
 dec d				; decrease run count
 jr nz,DispRLERunL	; if we're not done, then loop
 ex de,hl			; swap pointers back
 pop hl				; recover source pointer
 inc hl				; advance the source pointer
 jr DispRLEC		; check to see if we should loop


code:
/*  Zasm2 Z80 assembler
    by James Lee Rubingh
    james@wrive.com

    Copyright (2002) James Rubingh
    Released under the GPL v2

    査読お願いします!
    */

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
#include <errno.h>
#include <ctype.h>
#include "../config.h"

#include "../include/zasm.h"

//global variables, extern'd in zasm.h
int verbose = 0;
int tistring = 0;
int tiprog = 0;
double linenumber = 0;
unsigned int current_address = 0;
struct label_entry* label_root = NULL; //data segment should be initialized to 0, but lets not assume
struct label_entry *label_current = NULL;
struct symbol_entry* symbol_root = NULL;
struct symbol_entry* symbol_current = NULL;

void do_error()
{
    printf("Error: line %f - Closing\n", linenumber);
    exit(EIO);
}

void do_error_msg(char *message)
{
    printf("Error: line %.0f - %s\n", linenumber, message);
    exit(EIO);
}

void free_lists()
{
    /* can't free symbol_root before instruction_root because
     * s references i
     */

}

struct tab_entry* new_tab_entry(char *buf)
{
    struct tab_entry *new_tab_entry;

    new_tab_entry =    (struct tab_entry *) malloc(sizeof(struct tab_entry));
    memset(new_tab_entry, 0, sizeof(struct tab_entry));
    strcpy(new_tab_entry->mnumonic, buf);
    new_tab_entry->opcode = -1;
    new_tab_entry->size = -1;
    return new_tab_entry;
}

/*! parse the table file and create a list
  with all of the possible instructions */
struct tab_entry *read_table(FILE *tabfile)
{
    struct tab_entry *root = NULL;
    struct tab_entry *temp = NULL;
    struct tab_entry *old_tmp = NULL;
    char buffer[TABFILE_BUFFER_SIZE];
    char hexbuf[TABFILE_BUFFER_SIZE];
    char *buf, *endptr;

    while (fgets(buffer, TABFILE_BUFFER_SIZE, tabfile))
    {
        if ((buf = (char *) strtok(buffer, tab_whitespace))) {
            temp = new_tab_entry(buf);
            strcpy(hexbuf,"0x");

            while ((buf = (char *) strtok(NULL, tab_whitespace)))
            {
                if (*temp->operands == 0) {
                    strcpy(temp->operands, buf);
                } else if (*temp->hex_code == 0) {
                    //fill in hex code and opcode
                    strcpy(temp->hex_code, buf);
                    strcpy(hexbuf+2, buf);
                    temp->opcode = (unsigned int)strtol(hexbuf, (char **)NULL, 16);
                } else if (temp->size == -1){
                    temp->size = atoi(buf);
                }
            }

#ifdef DEBUG2
            printf("mnumonic: %s\n operand: %s\n hexcode: %s\n opcode: %d\n size: %d\n",
                    temp->mnumonic, temp->operands, temp->hex_code, temp->opcode, temp->size);
#endif
            /* start linked list, or add to it  */
            if (root == NULL) {
                root = temp;
                old_tmp = temp;
            } else {
                old_tmp->next = temp;
                old_tmp = temp;
            }
        }
    }

    return root;
}

int main(int ac, char **av)
{
    int c;
    FILE *infile=NULL, *outfile=NULL, *tabfile=NULL;
    struct instruction *root=NULL;
    struct tab_entry *tab_root=NULL;

    while (1)
    {
        int option_index=0;
        static struct option long_options[] = {
            {"version", 0, 0, 'V'},
            {"tabfile", 1, 0, 'T'},
            {"verbose", 0, 0, 'v'},
            {"help", 0, 0, 'h'},
            {"tiprog", 0, 0, 't'},
            {"tistrng", 0, 0, 's'},
            {0, 0, 0, 0}
        };

        c = getopt_long (ac, av, "vVdtsT:hp",
                long_options, &option_index);
        if (c == -1)
            break;

        switch (c) {
            case 'h':
            case 'V':
                show_help(0);
                break;
            case 'v':
                verbose = 420;
                break;
            case 's':
                tistring = 420;
                break;
            case 'T':
                /* set up table file handle */
                if (!(tabfile = fopen(optarg, "r"))) {
                    printf("Error opening tabfile: %s\n", optarg);
                    exit(1);
                }
                break;
            default:
                /* invalid switch, so failing */
                exit(1);
        }
    }

    /* check if tabflie is open, if not use default */
    if (!tabfile){
        if ((tabfile=fopen("./TASM80.TAB","r"))){
            if ((verbose))
                puts("using default tab file TASM80.TAB");
        } else {
            puts("Can't open TASM80.TAB file");
            exit(1);
        }
    }

    if (!(infile = fopen(av[optind], "r"))) {
        printf("error: with source file \"%s\"\n", av[optind]);
        exit(1);
    }

    if (!(outfile = fopen(av[optind+1], "w"))) {
        printf("error: with output file %s\n", av[optind+1]);
        exit(1);
    }

    if (verbose) {
        printf("infile:  %s\n", av[optind]);
        printf("outfile: %s\n", av[optind+1]);
    }

    /* read table file */
    tab_root = read_table(tabfile);

    assemble(tab_root, infile);

    if (write_to_file(root)) {
        printf("error\n");
    }

    return 0;
}


code:
!_TAG_FILE_FORMAT	2	/extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED	1	/0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR	Darren Hiebert	/dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME	Exuberant Ctags	//
!_TAG_PROGRAM_URL	http://ctags.sourceforge.net	/official site/
!_TAG_PROGRAM_VERSION	5.8	//
ASSOC_LEFT	lib/shunt.c	/^enum {ASSOC_NONE=0, ASSOC_LEFT, ASSOC_RIGHT};$/;"	e	enum:__anon1	file:
ASSOC_NONE	lib/shunt.c	/^enum {ASSOC_NONE=0, ASSOC_LEFT, ASSOC_RIGHT};$/;"	e	enum:__anon1	file:
ASSOC_RIGHT	lib/shunt.c	/^enum {ASSOC_NONE=0, ASSOC_LEFT, ASSOC_RIGHT};$/;"	e	enum:__anon1	file:
DEBUG	include/zasm.h	/^#define DEBUG$/;"	d
DispRLE	src/test.asm	/^DispRLE:$/;"	l
DispRLEC	src/test.asm	/^DispRLEC:$/;"	l
DispRLEL	src/test.asm	/^DispRLEL:$/;"	l
DispRLERun	src/test.asm	/^DispRLERun:$/;"	l
DispRLERunL	src/test.asm	/^DispRLERunL:$/;"	l
ERR_BADLABEL	include/zasm.h	/^#define ERR_BADLABEL /;"	d
ERR_MALLOC	include/zasm.h	/^#define ERR_MALLOC /;"	d
ERR_PARSE	include/zasm.h	/^#define ERR_PARSE /;"	d
INSTRUCTION_BUFFER_SIZE	include/zasm.h	/^#define INSTRUCTION_BUFFER_SIZE /;"	d
MAXNUMSTACK	lib/shunt.c	/^#define MAXNUMSTACK /;"	d	file:
MAXOPSTACK	lib/shunt.c	/^#define MAXOPSTACK /;"	d	file:
MNUMONIC_TXT_LENGTH	include/zasm.h	/^#define MNUMONIC_TXT_LENGTH /;"	d
NUM_REGISTERS_TO_CHECK	lib/pass.h	/^#define NUM_REGISTERS_TO_CHECK /;"	d
PUT2L	include/zasm.h	/^#define PUT2L(/;"	d
PUT4L	include/zasm.h	/^#define PUT4L(/;"	d
PUT4M	include/zasm.h	/^#define PUT4M(/;"	d
REGISTERS	lib/pass.h	/^const char *REGISTERS[] = {$/;"	v
TABFILE_BUFFER_SIZE	include/zasm.h	/^#define TABFILE_BUFFER_SIZE /;"	d
UNKNOWN_VALUE	include/zasm.h	/^    unsigned int UNKNOWN_VALUE;$/;"	m	struct:tab_entry
UNKNOWN_VALUE2	include/zasm.h	/^    int UNKNOWN_VALUE2;$/;"	m	struct:tab_entry
UNKNOWN_VALUE3	include/zasm.h	/^    int UNKNOWN_VALUE3;$/;"	m	struct:tab_entry
ZASM_H	include/zasm.h	/^#define ZASM_H$/;"	d
Z_DB	lib/pass.h	/^    Z_DB,$/;"	e	enum:Z_DIRECTIVE
Z_DIRECTIVE	lib/pass.h	/^enum Z_DIRECTIVE {$/;"	g
Z_DW	lib/pass.h	/^    Z_DW,$/;"	e	enum:Z_DIRECTIVE
Z_END	lib/pass.h	/^    Z_END$/;"	e	enum:Z_DIRECTIVE
Z_ORG	lib/pass.h	/^    Z_ORG,$/;"	e	enum:Z_DIRECTIVE
_textShadow	src/test.asm	/^_textShadow = $9f00$/;"	d
add_label	lib/pass.c	/^void add_label(char *ptr, struct instruction *inst)$/;"	f
add_symbol	lib/pass.c	/^int add_symbol(struct instruction *tmp_i)$/;"	f
address	include/zasm.h	/^    unsigned int address;$/;"	m	struct:instruction
address	include/zasm.h	/^    unsigned int address;$/;"	m	struct:symbol_entry
append_string	lib/pass.c	/^void append_string(char *target, const char *addition)$/;"	f
assemble	lib/pass.c	/^int assemble(struct tab_entry *tabroot, FILE *infile)$/;"	f
assembled	include/zasm.h	/^    unsigned short int assembled;$/;"	m	struct:instruction
assoc	lib/shunt.c	/^    int assoc;$/;"	m	struct:op_s	file:
byte	include/zasm.h	/^typedef unsigned char byte;$/;"	t
calculate_opcode	lib/pass.c	/^void calculate_opcode(struct tab_entry *tabroot, struct instruction *tmp_i)$/;"	f
calculate_query_string	lib/pass.c	/^char *calculate_query_string(struct instruction *tmp_i, char *query)$/;"	f
capitalize	lib/pass.c	/^char *capitalize(char *buf)$/;"	f
check_for_register	lib/pass.c	/^int check_for_register(const char *operand)$/;"	f
comma	include/zasm.h	/^#define comma /;"	d
current_address	src/zasm.c	/^unsigned int current_address = 0;$/;"	v
do_error	src/zasm.c	/^void do_error()$/;"	f
do_error_msg	src/zasm.c	/^void do_error_msg(char *message)$/;"	f
eval	lib/shunt.c	/^    int (*eval)(int a1, int a2);$/;"	m	struct:op_s	file:
eval_add	lib/shunt.c	/^int eval_add(int a1, int a2) $/;"	f
eval_div	lib/shunt.c	/^int eval_div(int a1, int a2) $/;"	f
eval_exp	lib/shunt.c	/^int eval_exp(int a1, int a2)$/;"	f
eval_mod	lib/shunt.c	/^int eval_mod(int a1, int a2) $/;"	f
eval_mul	lib/shunt.c	/^int eval_mul(int a1, int a2) $/;"	f
eval_sub	lib/shunt.c	/^int eval_sub(int a1, int a2) $/;"	f
eval_uminus	lib/shunt.c	/^int eval_uminus(int a1, int a2) $/;"	f
found_correct_tab_entry	lib/pass.c	/^void found_correct_tab_entry(struct instruction *tmp_i, struct tab_entry *match)$/;"	f
free_lists	src/zasm.c	/^void free_lists()$/;"	f
get_operands	lib/pass.c	/^struct instruction *get_operands(struct instruction *cur)$/;"	f
getop	lib/shunt.c	/^struct op_s *getop(char ch)$/;"	f
hex_code	include/zasm.h	/^    char hex_code[10];$/;"	m	struct:tab_entry
instruction	include/zasm.h	/^    struct instruction *instruction;$/;"	m	struct:label_entry	typeref:struct:label_entry::instruction
instruction	include/zasm.h	/^    struct instruction *instruction;$/;"	m	struct:symbol_entry	typeref:struct:symbol_entry::instruction
instruction	include/zasm.h	/^struct instruction {$/;"	s
label1	src/test.asm	/^label1:$/;"	l
label2	src/test.asm	/^label2:$/;"	l
label_current	src/zasm.c	/^struct label_entry *label_current = NULL;$/;"	v	typeref:struct:label_entry
label_entry	include/zasm.h	/^struct label_entry {$/;"	s
label_root	src/zasm.c	/^struct label_entry* label_root = NULL; \/\/data segment should be initialized to 0, but lets not assume$/;"	v	typeref:struct:label_entry
labil	src/test2.asm	/^labil:$/;"	l
linenumber	src/zasm.c	/^double linenumber = 0;$/;"	v
main	src/zasm.c	/^int main(int ac, char **av)$/;"	f
match_mnumonic	lib/pass.c	/^struct tab_entry *match_mnumonic(struct tab_entry *tabroot, struct instruction *instruction)$/;"	f
match_mnumonic_with_query_string	lib/pass.c	/^struct tab_entry *match_mnumonic_with_query_string(char *query_string, struct tab_entry *tab_match)$/;"	f
match_operands_to_mnumonic	lib/pass.c	/^struct tab_entry *match_operands_to_mnumonic(const char *query_string, struct tab_entry *tab_match)$/;"	f
matched_tab	include/zasm.h	/^    struct tab_entry *matched_tab;$/;"	m	struct:instruction	typeref:struct:instruction::tab_entry
mnumonic	include/zasm.h	/^    char mnumonic[MNUMONIC_TXT_LENGTH];$/;"	m	struct:instruction
mnumonic	include/zasm.h	/^    char mnumonic[MNUMONIC_TXT_LENGTH];$/;"	m	struct:tab_entry
name	include/zasm.h	/^    char *name;$/;"	m	struct:label_entry
name	include/zasm.h	/^    char *name;$/;"	m	struct:symbol_entry
new_instruction	lib/pass.c	/^struct instruction *new_instruction()$/;"	f
new_label	lib/pass.c	/^struct label_entry *new_label()$/;"	f
new_symbol	lib/pass.c	/^struct symbol_entry *new_symbol()$/;"	f
new_tab_entry	src/zasm.c	/^struct tab_entry* new_tab_entry(char *buf)$/;"	f
next	include/zasm.h	/^    struct instruction *next, *previous;$/;"	m	struct:instruction	typeref:struct:instruction::instruction
next	include/zasm.h	/^    struct label_entry *next;$/;"	m	struct:label_entry	typeref:struct:label_entry::label_entry
next	include/zasm.h	/^    struct symbol_entry *next;$/;"	m	struct:symbol_entry	typeref:struct:symbol_entry::symbol_entry
next	include/zasm.h	/^    struct tab_entry *next;$/;"	m	struct:tab_entry	typeref:struct:tab_entry::tab_entry
nnumstack	lib/shunt.c	/^int nnumstack;$/;"	v
nopstack	lib/shunt.c	/^int nopstack;$/;"	v
not_reduced	include/zasm.h	/^    unsigned short int not_reduced;$/;"	m	struct:instruction
numstack	lib/shunt.c	/^int numstack[MAXNUMSTACK];$/;"	v
op	lib/shunt.c	/^    char op;$/;"	m	struct:op_s	file:
op_num	include/zasm.h	/^    unsigned short int op_num;$/;"	m	struct:instruction
op_s	lib/shunt.c	/^struct op_s {$/;"	s	file:
opcode	include/zasm.h	/^    int opcode;$/;"	m	struct:tab_entry
opcode	include/zasm.h	/^    unsigned int opcode;$/;"	m	struct:instruction
operands	include/zasm.h	/^    char **operands;$/;"	m	struct:instruction
operands	include/zasm.h	/^    char operands[10];$/;"	m	struct:tab_entry
ops	lib/shunt.c	/^} ops[]={$/;"	v	typeref:struct:op_s
opstack	lib/shunt.c	/^struct op_s *opstack[MAXOPSTACK];$/;"	v	typeref:struct:op_s
parse_source	lib/pass.c	/^struct instruction *parse_source(FILE *infile, struct instruction* initial_root, struct tab_entry *tabroot)$/;"	f
pass_first	lib/pass.c	/^struct instruction *pass_first(FILE *infile, struct tab_entry *tabroot)$/;"	f
pass_second	lib/pass.c	/^int pass_second(struct instruction *root)$/;"	f
pop_numstack	lib/shunt.c	/^int pop_numstack()$/;"	f
pop_opstack	lib/shunt.c	/^struct op_s *pop_opstack()$/;"	f
prec	lib/shunt.c	/^    int prec;$/;"	m	struct:op_s	file:
previous	include/zasm.h	/^    struct instruction *next, *previous;$/;"	m	struct:instruction	typeref:struct:instruction::
push_numstack	lib/shunt.c	/^void push_numstack(int num)$/;"	f
push_opstack	lib/shunt.c	/^void push_opstack(struct op_s *op)$/;"	f
read_table	src/zasm.c	/^struct tab_entry *read_table(FILE *tabfile)$/;"	f
remove_whitespace	lib/pass.c	/^void remove_whitespace(char * buf)$/;"	f
set_not_reduced_flag	lib/pass.c	/^void set_not_reduced_flag(struct instruction *tmp_i) {$/;"	f
show_help	src/help.c	/^void show_help(int returncode) $/;"	f
shunt	lib/shunt.c	/^int shunt(char *expression)$/;"	f
shunt_error	lib/shunt.c	/^int shunt_error;$/;"	v
shunt_op	lib/shunt.c	/^void shunt_op(struct op_s *op)$/;"	f
size	include/zasm.h	/^    int size;$/;"	m	struct:tab_entry
starting	src/test.asm	/^starting:$/;"	l
strip_comment	lib/pass.c	/^void strip_comment(char *ptr)$/;"	f
symbol_current	src/zasm.c	/^struct symbol_entry* symbol_current = NULL;$/;"	v	typeref:struct:symbol_entry
symbol_entry	include/zasm.h	/^struct symbol_entry {$/;"	s
symbol_root	src/zasm.c	/^struct symbol_entry* symbol_root = NULL;$/;"	v	typeref:struct:symbol_entry
tab_entry	include/zasm.h	/^struct tab_entry {$/;"	s
tab_whitespace	include/zasm.h	/^#define tab_whitespace /;"	d
tiprog	src/zasm.c	/^int tiprog = 0;$/;"	v
tistring	src/zasm.c	/^int tistring = 0;$/;"	v
type	include/zasm.h	/^    int type;$/;"	m	struct:tab_entry
unary	lib/shunt.c	/^    int unary;$/;"	m	struct:op_s	file:
validate_label	lib/pass.c	/^int validate_label(char *ptr)$/;"	f
validate_symbol	lib/pass.c	/^int validate_symbol(char *ptr)$/;"	f
verbose	src/zasm.c	/^int verbose = 0;$/;"	v
whitespace	include/zasm.h	/^#define whitespace /;"	d
write_to_file	lib/pass.c	/^int write_to_file(struct instruction * root)$/;"	f

path: tags


code:
# Ignore all files
*.*

# File Types
!*.mps
!*.dat
!*.json
!*.txt
!*.project
!*.js
!*.zip
!*.7z
!*.csv
!*.ain
!*.fnl
!*.ks
!*.tjs
!*.yaml
!*.rb
!*.rvdata2

# Other Needed Files
!.gitignore
!README.md
!patch-config.txt
!GameUpdate*
!patch*
!Game.dat
!bsxx.dat*
!game.ini

# Ignore
previous_patch_sha.txt
kabe3_save.dat
kabe3_system.dat
psbpack.dat
Save*
cg.dat
scene.dat
BSXScript_*

# Images
!img/pictures/state/*

repo_name: agatutya/country

path: .gitignore

license: unknown


code:
@echo off
setlocal

REM Copy GAMEUPDATE.bat to a new file
copy patch.bat patch2.bat

REM Run the new file
call patch2.bat

REM Delete the new file
del patch2.bat

endlocal
@echo on


code:
#!/bin/bash

# Enable error handling
set -e

# Copy patch.bat to a new file
cp patch.sh patch2.sh

# Run the new file
bash patch2.sh

# Delete the new file
rm patch2.sh


code:
Loop Infomation
StartTime=0.000000	EndTime=68.572000
StartPcmOffset=0	EndPcmOffset=3024025


code:
Loop Infomation
StartTime=0.000000	EndTime=96.001000
StartPcmOffset=0	EndPcmOffset=4233644


code:
Loop Infomation
StartTime=0.000000	EndTime=116.364000
StartPcmOffset=0	EndPcmOffset=5131652


code:
Loop Infomation
StartTime=0.000000	EndTime=105.001000
StartPcmOffset=0	EndPcmOffset=4630544


code:
Loop Infomation
StartTime=0.000000	EndTime=72.001000
StartPcmOffset=0	EndPcmOffset=3175244


Mayu

characterName: hokou mayu

faceName: mayu kao1

note:
<desc1:A girl living in a small rural village.
She lives with her mother and grandfather as a family of three. She respects her father, who works alone in the city.
Since there's nothing to do in the countryside, she seems bored and tired of her monotonous days.

“Wouldn’t something interesting happen already~”>

<desc2:Following her curiosity, she ended up being attacked by a plant monster lurking in the forest.
She managed to fight back and barely survived, but it's still a dangerous situation.
There may be even more terrifying creatures waiting for her, but she has no choice but to keep moving forward through the forest.>


打撃/物理

effectName: HitPhysical

打撃/エフェクト

effectName: HitEffect

打撃/炎

effectName: HitFire

打撃/氷

effectName: HitIce

打撃/雷

effectName: HitThunder

斬撃/物理

effectName: SlashPhysical

斬撃/エフェクト

effectName: SlashEffect

斬撃/炎

effectName: SlashFire

斬撃/氷

effectName: SlashIce

斬撃/雷

effectName: SlashThunder

刺突/物理

effectName: PiercePhysical

刺突/エフェクト

effectName: PierceEffect

刺突/炎

effectName: PierceFire

刺突/氷

effectName: PierceIce

刺突/雷

effectName: PierceThunder

爪/物理

effectName: ClawPhysical

爪/エフェクト

effectName: ClawEffect

爪/炎

effectName: ClawFire

爪/氷

effectName: ClawIce

爪/雷

effectName: ClawThunder

爪/必殺技

effectName: ClawSpecial

矢/必殺技

effectName: ArrowSpecial

息

effectName: Breath

花粉

effectName: Pollen

超音波

effectName: SonicWave

霧

effectName: Fog

歌

effectName: Song

咆哮

effectName: Shout

足払い

effectName: Sweep

体当たり

effectName: Bodyslam

閃光

effectName: Flash

呪縛

effectName: Bind

吸収

effectName: Absorb

毒

effectName: Poison

暗闇

effectName: Blind

沈黙

effectName: Silence

睡眠

effectName: Sleep

混乱

effectName: Confusion

麻痺

effectName: Paralyze

即死

effectName: Death

銃撃/単発

effectName: ShootNormal

銃撃/連発

effectName: ShootBarrage

銃撃/全体

effectName: ShootAll

銃撃/必殺技

effectName: ShootSpecial

レーザー/単発

effectName: LaserOne

レーザー/全体

effectName: LaserAll

光の弾

effectName: BallsOfLight

放射線

effectName: Radiation

プロテクション

effectName: Protection

矢通常攻撃

effectName: Arrow

斧通常攻撃

effectName: Axe

鞭通常攻撃

effectName: Whip

杖通常攻撃

effectName: Rod

フレイル通常攻撃

effectName: Flail

鎌通常攻撃

effectName: Scythe

本通常攻撃

effectName: Book

盾

effectName: Shield

花吹雪

effectName: Flowers

花吹雪斬撃

effectName: FlowersSlash

花吹雪打撃

effectName: FlowersHit

花吹雪刺突

effectName: FlowersPierce

花吹雪爪

effectName: FlowersClaw

十字架エフェクト

effectName: Cross

十字架斬撃

effectName: CrossSlash

十字架打撃

effectName: CrossHit

十字架刺突

effectName: CrossPierce

十字架爪

effectName: CrossClaw

クロススマッシュ

effectName: CrossSP

星斬撃

effectName: StarsSlash

星打撃

effectName: StarsHit

星刺突

effectName: StarPierce

星爪

effectName: StarClaw

炎のブレス

effectName: BreathFire

氷のブレス

effectName: BreathIce

雷のブレス

effectName: BreathThunder

水のブレス

effectName: BreathWater

土のブレス

effectName: BreathEarth

風のブレス

effectName: BreathWind

光のブレス

effectName: BreathLight

闇のブレス

effectName: BreathDarkness

大声

effectName: ShoutSP

煙幕

effectName: Smokescreen

毒魔法

effectName: PoisonAll

リフレクション

effectName: Reflection


Mayu's Clothes

description: Mayu's everyday clothes.

School Swimsuit

description: School swimsuit. Tight and snug.

Adventurer's Clothes

description: [General Equipment] Sturdy clothes that can withstand harsh journeys.

Shrine Maiden Outfit

description:
Mayu's work outfit. Wearing this makes her feel a little more grown
up.

Someone's Necklace

description:
An ornament that belonged to someone, stored in a box. It was said to
grant hidden power to those who are compatible.

Shrine Maiden's Necklace

description:
A necklace passed down through generations in a shrine maiden family.
It grants hidden power to those who are compatible.

Cloth Armor

description: [Light Armor] Armor made from sturdy cloth.

Leather Armor

description: [Light Armor] Armor made by layering tanned leather.

Bronze Breastplate

description: [Light Armor] Bronze breastplate.

Iron Breastplate

description: [Light Armor] Steel breastplate.

Mithril Breastplate

description: [Light Armor] Breastplate made of mithril.

Dragon Breastplate

description: [Light Armor] Breastplate made from dragon scales.

Bronze Armor

description: [Heavy Armor] Bronze armor.

Iron Armor

description: [Heavy Armor] Steel armor.

Mithril Armor

description: [Heavy Armor] Armor made of mithril.

Dragon Armor

description: [Heavy Armor] Armor made from dragon scales.

Cotton Robe

description: [Magic Equipment] A common robe widely used.

Silk Mantle

description: [Magic Equipment] A high-quality cloak made of silk.

Sorcerer's Robe

description: [Magic Equipment] Robe engraved with rune letters.

Sage's Robe

description: [Magic Equipment] Robe woven with magical power.

Elemental Mantle

description:
[Magic Equipment] The ultimate cloak imbued with the power of the
Spirit King.

Buckler

description: [Small Shield] A small shield for deflecting attacks.

Round Buckler

description: [Small Shield] Wooden round shield reinforced with an iron frame.

Spike Buckler

description: [Small Shield] Round shield with offensive spikes on the surface.

Mithril Buckler

description: [Small Shield] Small shield made of mithril.

Dragon Buckler

description: [Small Shield] Small shield made from dragon scales.

Wooden Shield

description: [Large Shield] A very ordinary large wooden shield.

Bronze Shield

description: [Large Shield] Large shield made from bronze plates.

Iron Shield

description: [Large Shield] A large shield made of steel.

Mithril Shield

description: [Large Shield] A large shield made of mithril.

Dragon Shield

description: [Large Shield] A large shield made from dragon scales.

Wood Bangle

description: [Magic Equipment] A bracelet enchanted with protective magic.

Bandana

description: [General Equipment] A cloth headband that protects the forehead.

Leather Bandana

description: [General Equipment] A leather headband that protects the forehead.

Leather Hat

description: [General Equipment] A hat made of leather.

Turban

description: [General Equipment] Thick cloth wrapped in layers to protect the head.

Feathered Hat

description: [General Equipment] A stylish hat adorned with bird feathers.

Leather Cap

description: [Light Equipment] A hat made of tanned leather.

Wood Cap

description: [Light Equipment] A lightweight helmet made of wood.

Bronze Cap

description: [Light Equipment] A lightweight helmet reinforced with copper plates.

Iron Cap

description: [Light Equipment] A lightweight helmet reinforced with iron plates.

Mithril Cap

description: [Light Equipment] A lightweight helmet reinforced with mithril.

Dragon Cap

description: [Light Equipment] A lightweight helmet reinforced with dragon scales.

Chain Coif

description: [Heavy Equipment] A hood made from finely woven chains.

Bronze Helm

description: [Heavy Equipment] A helmet made of thick bronze plates.

Iron Helm

description: [Heavy Equipment] A helmet made of thick steel plates.

Mithril Helm

description: [Heavy Equipment] A helmet made of mithril.

Dragon Helm

description: [Heavy Equipment] A helmet made from dragon scales.

Pointed Hat

description:
[Magic Equipment] A wide-brimmed triangular hat made of tanned
leather.

Circlet

description: [Magic Equipment] A simple crown enchanted with protective magic.

Silver Circlet

description: [Magic Equipment] A silver crown enchanted with protective magic.

Gold Circlet

description: [Magic Equipment] A pure gold crown enchanted with protective magic.

Mithril Circlet

description: [Magic Equipment] A mithril crown enchanted with protective magic.

Master Circlet

description: [Magic Equipment] A sage's crown enchanted with protective magic.

Guard Stone

description: [Accessory] A charm that increases defense.

Guard Ring

description: [Accessory] A ring that increases defense.

Power Stone

description: [Accessory] A charm that increases attack.

Power Ring

description: [Accessory] A ring that increases attack.

Speed Stone

description: [Accessory] A charm that increases agility.

Speed Ring

description: [Accessory] A ring that increases agility.

Lucky Stone

description: [Accessory] A charm that increases luck.

Lucky Ring

description: [Accessory] A ring that increases luck.

Magical Stone

description: [Accessory] A charm that increases magic power.

Magical Ring

description: [Accessory] A ring that increases magic power.

Shooter Stone

description: [Accessory] A charm that increases attack accuracy.

Master Stone

description: [Accessory] A charm that reduces MP consumption by 20%.

Master Ring

description: [Accessory] A ring that reduces MP consumption by 50%.

Poison Guard

description:
[Accessory] A ring that makes you less susceptible to poison and
paralysis.

Poison Guard S

description: [Accessory] A ring that completely prevents poison and paralysis.

Mental Guard

description:
[Accessory] A ring that makes you less susceptible to sleep, silence,
confusion, charm, and rage.

Mental Guard S

description:
[Accessory] A ring that completely prevents sleep, silence, confusion,
charm, and rage.

Enemy Radar

description:
[Accessory] An accessory that increases the chance of preemptive
attacks.

Warning Bell

description: [Accessory] An accessory that prevents surprise attacks.

TP Stocker

description: [Accessory] An accessory that carries over TP to the next battle.

Guts Ring

description: [Accessory] A ring that increases TP charge rate.

MP Keeper

description: [Accessory] A bracelet that reduces MP consumption rate.

Elemental Guard

description:
[Accessory] Blessed by the four great spirits, this accessory halves
damage from fire, water, wind, and earth attacks.

Spectacle

description: [Accessory] An accessory that increases accuracy.


メモを読む

parameters:
To get through the forest path, you need to choose the correct route.
Starting from the first fork, if you go \C[24]east, south, west, west, north,
west, north, north\C[0], you should be able to make it through.

parameters:
If you get lost, just head south a few times and you'll end up at the
mushroom colony. No one really knows why, but it's probably some kind of
sorcery. Once that happens, just start over from the beginning.


Goblin

battlerName: Goblin

Gnome

battlerName: Gnome

Crow

battlerName: Crow

Treant

battlerName: Treant


-----Spare

description: A slot for items you want to display above recovery items.

Some Kind of Key

description:
A key that was dropped in front of a giant flower. I wonder what it
opens?

Stinky Mushroom

description:
A super stinky, sketchy-looking mushroom. I really don't want to carry
it around.

Phantom Mushroom

description:
An ultra-rare mushroom you hardly ever see. It's so delicious you'll
pass out after eating it.

Sticky Mushroom

description:
A mushroom that's all slimy and gross. The texture is absolutely the
worst.

Forest Path Memo

description: A memo with instructions on how to get through the forest path.

Someone's Necklace

description:
Someone's ornament that was stored in a box. It says it grants hidden
power to those who are compatible.

Shrine Maiden's Necklace

description:
A necklace passed down through generations of shrine maidens. It's a
hassle to wear, so I usually just carry it around.

Magic Water

description: Restores 300 MP.

Stimulant

formula: b.mhp / 2

description: Revives from incapacitation. (Restores half HP)

Dispel Herb

description: Cures all status ailments except incapacitation.

Antidote

description: Cures poison and paralysis.

Miracle Drop

description: Restores half HP and MP.

Elixir

description: Fully restores HP and MP.

Encounter Downer

description: Halves enemy encounter rate for a while.

Drop Upper

description:
Increases the drop rate of items and prize money from battles for a
while.

Life Up

description: Raises max HP by 50 points.

Mana Up

description: Raises max MP by 10 points.

Power Up

description: Raises attack by 3 points.

Guard Up

description: Raises defense by 3 points.

Magic Up

description: Raises magic power by 3 points.

Resist Up

description: Raises magic defense by 3 points.

Speed Up

description: Raises agility by 3 points.

Luck Up

description: Raises luck by 3 points.


displayName: Home

扉（一般家庭）

selfSwitchCh: A

parameters: It's a little early, but should I take a bath?

parameters: Yes No

text: \F[huku_def] \FH[ON]

parameters: I can change clothes here. What should I wear?

parameters:
Casual Clothes
School Swimsuit
Naked

parameters: ステータス画面アクター画像変更

parameters: Yeah, this one feels the most comfortable after all~.

parameters: ステータス画面アクター画像変更

parameters: ステータス画面アクター画像変更

parameters: N-no, no, no way. There's no way I can go outside like this...

移動（関所）

characterName: original/syokusyu

parameters: ...W-What am I even doing?! I need to get dressed, quick...

parameters:
Ah... I knew the pool was closed today after all... Oh well. Guess I'll
just change~

text: \F[huku_kowai] \FH[ON]

parameters: It's an old TV. Unfortunately, this is all we've got...

text: \FH[OFF]

text: \F[huku_def]  \FH[ON]

parameters: This is the bed I begged my mom to buy for me.

parameters:
I used to just have a futon on the floor, but it looked so old-fashioned
and country...

parameters:
...Actually, lately I've gotten hooked on touching myself down there before
bed... Ah, wait!? Why did I just say that out loud!?

text: \FH[OFF]

parameters: In a certain rural town, there was a girl.

text: \F[huku_def]  \FH[ON]

parameters: Her name was Mayu. She was full of curiosity, but also a bit precocious.

parameters:
She was bored with her everyday country life. Day after day with nothing to
do. Time just passed by lazily...

parameters: For a girl in her adolescence, it just wasn't stimulating enough.

text: \FH[OFF]

parameters:
But then, one day, she heard an interesting rumor. Someone claimed to have
found a mysterious lifeform in the big forest behind her house.

parameters:
That was a place she'd been strictly forbidden to enter since she was
little. They said anyone who went into that forest would disappear without
a trace... Apparently, that legend had been around for ages.

parameters:
She thought, 'Who would be reckless enough to go in there...' But even so,
Mayu couldn't stop thinking about the story.

parameters:
"A mysterious lifeform, huh... Could it be an alien invasion? No, maybe
it's a cryptid like a tsuchinoko... Or maybe it's a brand new species...!"

parameters:
...No, no, it's probably just a made-up story anyway. She was interested in
that kind of thing, but it usually turned out to be someone's tall tale or
a big fat lie.

parameters:
Even though she thought that, her heart was stirred. She couldn't suppress
her curiosity. If she went into that forest, she'd know the truth...

parameters:
・\.・\.・\|If she's just going to spend every day bored, she'd rather find
out the truth. She'd probably get in big trouble later, but if it's just
checking it out a little, it should be fine.

parameters:
"Alright, I'm going!! I'm heading into that suspicious forest to
investigate!!"

parameters: With her mind made up, Mayu set off for the forbidden forest...

text: \F[huku_iya]  \FH[ON]

parameters:
Fuaaah~~... Finally done with my homework... Ugh, why do I even have to do
this stuff...

parameters:
Well, whatever. Today I'm different...! I'm heading for that forest I've
always been told to stay away from!

parameters: Just you wait, cryptid! I'm gonna find you!

text: \FH[OFF]

parameters:
A mysterious lifeform... Maybe something like a tsuchinoko or a skyfish,
some kind of UMA. Or maybe it's a new species altogether...

text: \F[huku_def]  \FH[ON]

parameters:
It's a bookshelf. I keep my textbooks, manga, and animal encyclopedias
here.

parameters:
And in this corner...\! there's a dirty magazine I found at the dump...
N-Never mind that...

text: \FH[OFF]

text: \F[huku_def]  \FH[ON]

parameters:
It's a bookshelf. I keep textbooks, manga, and animal encyclopedias in
here.

text: \FH[OFF]

text: \F[huku_def]  \FH[ON]

parameters:
I used to just have a futon on the floor, but it looked so old and country,
you know...

parameters:
...Actually, lately I've gotten hooked on touching myself down there before
bed... Ah, wait!? My mouth just blurted that out!?

text: \FH[OFF]

characterName: !Flame

parameters:
I used to sleep on a futon, but it was so old-fashioned and totally
screamed countryside...

parameters:
...Actually, lately I've gotten hooked on masturbating here... Ah, wait!?
Why did I just say that out loud!?

parameters:
R-right now, there's no one home... A-am I really going to do it in my
school swimsuit...?

parameters: Masturbate Stop

parameters: Haa... haa... I-I'm about to... masturbate... now...

parameters: Ah... ahh... r-right here...♡ Rubbing it... feels so good...♡

parameters:
I wonder if everyone does this... something this naughty...♡ I-it's not
like I'm perverted or anything... right...? Y-yeah... there's no way...
probably not...♡

parameters:
Haa...♡ haa...♡ I want to feel even better...♡ M-my finger... maybe a
little deeper...♡ Can it go in...?♡ M-maybe I'll just try it a little...♡

parameters: Nnnnnngh～～～～～！！！！！！！！♡♡♡♡♡♡

parameters:
Haaaahhh♡♡ haaaahhh...♡♡♡ S-so good...♡♡ T-this...♡♡ I'm going to get
addicted to this...♡♡♡

parameters: I-I got my swimsuit dirty... I have to make sure Mom doesn't find out...

parameters: N-no, no, I really should stop! ...I should stop...

parameters: N-no one’s home right now... right? A-are we really doing this?

parameters: Haa... haa... I-I’m about to... start... masturbating...

parameters:
I wonder if everyone does this... something this naughty...♡ I-it’s not
like I’m just a pervert or anything... right...? Y-yeah... there’s no
way... probably not...♡

parameters:
Haa...♡ haa...♡ I want to feel even better...♡ M-my finger... maybe a
little deeper...♡ Can it go in...?♡ M-maybe I’ll just try it a little...♡

parameters:
Ahhh!!!♡♡ T-this...!♡ This might be bad...!♡ Inside... it’s all wet and
squishy...♡ It feels so good...♡♡ My head is tingling...♡

parameters:
Haa... haa...♡ Inside my pussy...♡ My finger is being squeezed tight...♡ If
it were real, a guy’s thing would be...♡ This is where it would go in...
right here...♡ S-somehow... my body’s getting so hot...♡♡

parameters:
Haaah...♡ haaah...♡ W-wow...♡ I only put it in a little and I’m already
this wet... it’s even stringing out♡ Haa... but this still isn’t enough for
me...♡♡

parameters:
...I think it has to be rougher than this...♡ Just putting it in deep felt
so good earlier...♡ If I do that over and over, it’ll feel even better,
right...?♡

parameters:
...If it wasn’t my finger, but a guy’s thing instead...♡ There’s no way it
would end after just one time...♡♡ He’d thrust deep inside me, over and
over...♡♡

parameters:
Haaaahhh♡♡♡ haaaahhh...♡♡♡ S-so amazing...♡♡ T-this...♡♡ I’m going to get
addicted to this...♡♡♡

parameters: Haa... I wonder why... I always feel a little guilty after doing this...

parameters: Eh... we just did it a little while ago...♡ You want to go again...?♡

parameters: Haa... haa... O-okay... I'm going to... masturbate now...

parameters: Ah... ahh... r-right here...♡ When I rub it... it feels... so good...♡

parameters: Ah...! Uah...!! Feels so good...!♡ My body... it's so hot...!♡ Amazing...♡♡

parameters:
Uuu...!♡ Nn...!!♡♡ I-I might... cum again...!♡ The pleasure... it's
coming!♡ I'm gonna cum!♡♡

parameters: Nnnnnnnn～～～～～！！！！！！！！♡♡♡♡♡♡

parameters:
Haaaaa♡♡♡ Haaaaa...♡♡♡ S-so, so good...♡♡ Th-this...♡♡ I'm getting addicted
to it...♡♡♡

parameters: I-I did it again... Am I really that perverted...?

parameters: N-no, no, I should stop! ...I should stop...

parameters: Haa... haa... o-okay, here I go... I'm going to... masturbate now...

parameters: Ah... aaah... r-right here...♡ When I rub it... it feels... so good...♡

parameters:
Uuu...!♡ Nn...!!♡♡ I-I might... cum... again...!♡ The pleasure... it's
coming!♡ I'm gonna cum!♡♡

parameters: Nnnnnnnn～～～～～！！！！！！！！♡♡♡♡♡♡

parameters:
Haaaahhh♡♡♡ Haaaahhh...♡♡♡ S-so, so good...♡♡ Th-this...♡♡ I'm getting
addicted to it...♡♡♡

parameters: N-no, no, I-I should stop! ...I should stop...


displayName: Outside

characterName: ozi

text: \F[huku_otituku]  \FH[ON]

text: \FH[OFF]

parameters:
Good to see you so lively~. But listen, don't go near the forest, alright?
You never know what might be out there.

text: \F[huku_uso]  \FH[ON]

parameters:
Ugh... O-of course I know that~! You're such a worrywart~ hahaha~. (I'll go
while he's not looking...)

text: \FH[OFF]

text: \F[huku_def]  \FH[ON]

parameters: I was so bored about three days ago that I dug a pitfall.

parameters: My mom fell in and got insanely mad at me...

parameters: She confiscated my favorite shovel... so sad...

text: \FH[OFF]

parameters:
It's Grandpa's old pickup truck. It's so beat up, I really don't want to
ride in it...

text: \F[huku_otituku]  \FH[ON]

parameters: ...Nothing to do here. Let's head into the forest.

text: \FH[OFF]

text: \F[huku_otituku]  \FH[ON]

text: \FH[OFF]

text: \F[huku_otituku]  \FH[ON]

text: \FH[OFF]

characterName: Nature

text: \F[huku_def]  \FH[ON]

parameters:
It's a stray cat that started living here at some point. But honestly, it's
pretty much like we're keeping it as a pet now.

parameters:
Its name is Shepherd. ...Well, it's a cat, but I call it that because it
sounds cool.

parameters:
But my mom calls it Kuro, and my grandpa calls it Whiskers. Seriously, none
of them have any sense...

text: \FH[OFF]

宝箱（おじいの秘蔵えっちぶっく）

characterName: !Chest

text: \F[huku_hazu]  \FH[ON]

text: \FH[OFF]

通行負荷

characterName: original/a


displayName: Forest Entrance

text: \F[huku_def] \FH[ON]

parameters:
\>There are so many trees... I've never been here before... It's got quite
\>the atmosphere~!

parameters:
But I shouldn't do anything too reckless... Maybe I should check things out
around here first.

text: \FH[OFF]

text: \F[huku_def] \FH[ON]

parameters: It's dark and looks dangerous over here. I really don't want to go...

text: \FH[OFF]

text: \F[huku_oya] \FH[ON]

parameters:
Hmm... looks like this is the only path deeper in. The atmosphere over here
feels kinda dangerous...

parameters:
...But even more than that, I'm actually excited! I've never experienced
anything like this before!

parameters:
Besides, places like this are where unknown creatures tend to hide. Danger
is just part of any adventure... This is a wall I have to overcome! Yeah,
that's right!

parameters:
...If anything happens, I can just head back right away. I'll just go a
little bit, just a tiny bit further.

text: \FH[OFF]

text: \F[huku_utumuku3] \FH[ON]

parameters:
"Whoa, what is this? Looks like a sign, but it's totally falling apart. I
can barely make out the letters, but let's see..."

parameters:
"Danger ahead. No one is allowed to enter. The forest's... demon...
something...? Hmm, is that a bug? What is this character...?"

parameters:
"No good. Some of the letters are too messed up to read. It says 'demon' or
something, but are there really demons or monsters here? Yeah, right..."

parameters:
"Well, whatever. Looks like I can't go any further this way. Guess I'll
look for another path."

text: \FH[OFF]

parameters: Can't go this way... Let's look for another path.

text: \F[huku_def] \FH[ON]

parameters:
There might be a path this way... but it's so overgrown, I don't think I
can get through.

text: \FH[OFF]


displayName: Forest Path

text: \F[huku_def]  \FH[ON]

parameters: \>Whoa... it's so dark... Even I have to admit, this is a little scary...

parameters:
I guess I should really turn back here... But my legs just keep moving
forward on their own. Curiosity really is scary...

text: \FH[OFF]

parameters:
...!! Wh-What was that? That sound just now... It came from behind me... Is
something there?

parameters:
No way, a demon... N-No, no, there's no way something like that would be
here. I should go check it out just in case.

text: \F[huku_ase]  \FH[ON]

parameters:
...!! Wh-What was that? That sound just now...! It came from behind me...
Is something there...?

parameters:
Could it really be some unknown lifeform...? I should go check it out just
in case...!

text: \FH[OFF]

text: \F[huku_ase]  \FH[ON]

text: \FH[OFF]


displayName: Forest -Flower Colony

characterName: original/$hana

characterName: original/$hae

text: \F[yabure_aseri] \FH[ON]

parameters:
"!!!!!!?? Wh-What the...!? What is this thing!? A giant fly...? Is this
thing a monster too...?"

text: \FH[OFF]

text: \F[yabure_aseri2] \FH[ON]

parameters:
"It's definitely after me...! S-So scary...! I'm scared, but if I just sit
here, it'll get me...!! I still have a chance... I-I have to run!!"

text: \FH[OFF]

parameters:
The chase will begin now. If you get caught, you'll be forced into the Fly
Breeding Ground End, but if you escape, you can proceed to the next route.

parameters:
"What the... that's a huge flower... I think it's called a Rafflesia,
right? Why is it blooming here? This isn't the kind of place you'd expect
to see one..."

parameters:
"Ugh... it stinks... If I stay here too long, I'm gonna feel sick... The
path doesn't go any further, so I guess I'll head back for now."

parameters:
"...? What's that sound... insect wings? I have a bad feeling about this. I
should get out of here quick―"

parameters:
"!!!!?? Wh-What the hell is that!!? It's huge... an insect...? Is this
thing a monster too...!?"

parameters:
"This bastard is definitely after me...! I'm scared...! I'm scared, but if
I just stand here, I'm done for...! I can still make it if I run now―gotta
get out fast!!"

parameters:
*A chase will now begin. If you get caught, the Fly Rape story will start.
If you escape, you'll move on to the next route. Run to the exit without
letting the fly catch you.

characterName: hokou hadaka

parameters: \I[89]\C[16]Obtained some kind of key\C[0].

text: \F[yabure_mmm] \FH[ON]

parameters:
"A key... Why is it in a place like this? I don't think there's anywhere
around here to use it..."

text: \FH[OFF]

text: \F[yabure_utumuku3] \FH[ON]

parameters:
"Still, what the heck is this... That's a huge flower. If I remember right,
it's a rafflesia? But this kind of thing shouldn't be blooming in a place
like this, right? Why is it here..."

parameters:
"Ugh... it stinks... If I stay here too long, I'm going to feel sick... The
path doesn't go any further, so maybe I should head back for now."

text: \FH[OFF]

text: \F[yabure_ase] \FH[ON]

parameters:
"...? What's that sound... Insect wings? I have a bad feeling about this. I
should get out of here quick\OW[0]――"

text: \FH[OFF]

parameters: I have a bad feeling about what's ahead... Are we really going?

parameters: Yes No

parameters:
"Hmm... Looks like I'm lost. Seems like this is a dead end... I've walked
quite a bit, so maybe I'll take a little break."

parameters:
"...But, what's this? There wasn't any water around here before, but
there's a puddle right here... Did it rain recently?"

parameters:
"I don't know if that's why, but it's weirdly damp and uncomfortable
here... I wanted to rest a bit more, but maybe I should start looking for
another path soon..."

parameters: "Hm...? What was that? I think I just heard something..."

parameters:
"It's coming from above...? Wait, this puddle... could it be some kind of
creature's bodily fluid!? That means there's something up in the tree...!!"

parameters:
Suddenly, a giant slug attacked Mayu from above. Its massive body covered
her, and she disappeared from sight in an instant.

parameters:
The giant slug began absorbing Mayu into its body. It all happened in a
flash, and the girl vanished from the forest.


おじ

text: \F[huku_otituku]  \FH[ON]

text: \FH[OFF]

parameters:
Good to see you so lively. But listen, don't go near the forest, alright?
You never know what might be out there.

text: \F[huku_uso]  \FH[ON]

parameters:
Ugh... O-of course I know that~! You're such a worrywart, haha~. (I'll go
while he's not looking...)

text: \FH[OFF]

parameters:
"Mayu...! Oh, Mayu...! I'm so glad you're safe... really... thank
goodness...!"

parameters: "I'm sorry...! I'm so sorry...! I broke my promise... I'm a bad girl...!"

parameters:
"No, Mayu... it's not your fault...! If only I had explained things
properly...!"

parameters:
"Thank goodness... really, I'm so glad you're safe...! Neither of you did
anything wrong, you both did your best...!"

parameters: "Sniff...! Sniff...! Grandpa... Shepherd..."

parameters:
"Welcome home, Mayu... You must be hungry, right? There might be a lot to
talk about, but... let's eat first. We can talk after that, there's no
rush."

parameters:
"That's right... Mayu, shall we have dinner? Though, since we've been
searching for you all this time, I haven't made anything yet..."

parameters:
"...Mom! I'll help too! Let's make it together, and then I want to talk a
lot with you!"

parameters:
"...! Mayu...! Yes, let's do that! Let's make your favorite hamburg steak
tonight!"

parameters:
After that, Mayu told her family everything. About what happened in the
forest, and the monsters she met...

parameters:
It was a series of unbelievable experiences, hard to believe it all
happened in just one day.

parameters:
While eating dinner, they celebrated Mayu's safe return from that
terrifying forest and enjoyed some precious family time together.

母

characterName: original/haha


note: <PsensorF:20 Ld60>

selfSwitchCh: D

parameters: "Kyaaaaahhh!!!!!! No, noooooo!!!! Let go of me!! Stop ittttttt!!!!!!!!!"


text: \F[miko_nico]  \FH[ON]

parameters: Good morning, Grandpa! I'm super energetic as always!

text: \FH[OFF]

parameters:
Being a shrine maiden must be tough... You're doing great, you know. But
don't push yourself too hard.

text: \F[miko_otituku]  \FH[ON]

parameters:
Thank You~~... Grandpa~~... (Talking with Grandpa makes it feel like time
slows down~)

text: \FH[OFF]

parameters: It's Grandpa's old pickup. The other day it finally started smoking...

text: \F[miko_wahaha]  \FH[ON]

parameters: "Oh~! Shepherd~! Good boy, good boy, you look lively today too!"

text: \FH[OFF]

宝箱（おじいの秘蔵えっちぶっく）

text: \F[miko_hazu]  \FH[ON]

parameters: "Th-there's even more than last time...!!"

text: \FH[OFF]


displayName: Outside Settlement

parameters:
―Hall of Memories― You might catch a glimpse of the many pasts you could
have walked.

text: \F[miko_hatena] \FH[ON]

parameters: "What is this? Did we have something like this in my village?"

text: \FH[OFF]

text: \F[miko_nico] \FH[ON]

parameters: "Ohh~ good boy, doggy~! You look lively today too~"

text: \FH[OFF]

parameters: "Hey! If it isn't Mayu! Working at the shrine again today?"

text: \F[miko_otituku] \FH[ON]

parameters: "Oh~! Bearded old man~! Nope, I'm already done with work for today~"

text: \FH[OFF]

parameters:
"Is that so, is that so! Man, you're still so little, but you're doing
great! But don't push yourself too hard! Work's all about slacking off, you
know! Gahaha!!"

text: \F[miko_wahaha] \FH[ON]

parameters: "Oh~! You should try working a little harder, old man! Ahaha!"

text: \FH[OFF]

text: \F[miko_def] \FH[ON]

parameters: "Huh? Kentaro! Morning―well, I guess it's already afternoon~"

text: \FH[OFF]

parameters:
"Whoa!? Wh-what the... Mayu, it's you... That outfit, were you working at
the shrine just now?"

text: \F[miko_otituku] \FH[ON]

parameters:
"Yeah, something like that. But it's not like I was doing anything
important."

text: \FH[OFF]

parameters: "I see... Hey, Mayu. So, we really can't play together as much anymore...?"

text: \F[miko_hatena] \FH[ON]

parameters:
"Huh? I don't think that's true... If you invite me, I'll play
hide-and-seek or tag or whatever you want!"

text: \FH[OFF]

parameters:
"R-really...!? \} That's a relief... \{L-let's all play together again
sometime!"

text: \F[miko_nico] \FH[ON]

text: \FH[OFF]

parameters: "Hey there! Mayu! You look energetic as always!"

text: \F[miko_nico] \FH[ON]

text: \FH[OFF]

parameters:
"Mayu, you were working again today, huh~? That sounds tough... What kind
of things does a shrine maiden do?"

text: \F[miko_huu] \FH[ON]

parameters:
"Hmm~ Nothing special, really~? Just sweeping the shrine, and sometimes
praying..."

text: \FH[OFF]

parameters: "Praying! Wow... that's so shrine maiden-like..."

text: \F[miko_doya] \FH[ON]

parameters: "And sometimes, I use magic to defeat monsters~"

text: \FH[OFF]

parameters:
"!!? Suddenly a magical girl!? So that's what shrine maidens do...!? \}I
knew it! In anime, shrine maidens always fight evil and stuff. Maybe you'll
be like that too, Mayu... mmm..."

text: \F[miko_ahaha] \FH[ON]

parameters: "Ah... she's off in her own world again..."

text: \FH[OFF]


parameters: ステータス画面アクター画像変更

髪留め

characterName: hokou saimin


displayName: Forest -Outside the Cabin

text: \F[nure_aseri] \FH[ON]

parameters: "Thank goodness... Now I can wash off all this slime."

text: \FH[OFF]

text: \F[nure_aseri] \FH[ON]

text: \FH[OFF]

text: \F[nure_sakebi] \FH[ON]

parameters:
"Eek! Hiiiiiiiiiiiiii!!!!!! Monster!!!! Stay away!!!!!! Get away from
me!!!!!!"

text: \FH[OFF]

text: \F[nure_naki] \FH[ON]

text: \FH[OFF]

text: \F[nure_kya] \FH[ON]

parameters:
"Wah! Wh-what the―! That tickles! What are you doing? What is this? It
feels like a dog is licking me..."

parameters:
"Wait, are you maybe cleaning off the slime for me? Maybe you're not a bad
guy after all...? You look kinda gross, though..."

text: \FH[OFF]

text: \F[nure_ayasi] \FH[ON]

parameters:
"...? Are you telling me to come inside the hut? Hmm... Is it really safe?
You didn't attack me right away, but that doesn't mean you're not
dangerous..."

text: \FH[OFF]

text: \F[nure_waa] \FH[ON]

parameters: "Wah! Hey...! Don't pull me! Fine, fine, I'll go in, okay!?"

text: \F[nure_ayasiS] \FH[ON]

parameters:
"Sigh... I'm still nervous, but it doesn't look like you'll let go. Well,
compared to that monster from before, you're way smaller, and if it comes
down to it, I can just bite again... No, no, that was just a fluke last
time. Assuming I can fight it off is a bit much... Hmm..."

parameters: "If things get bad, I'll just run for it. Yeah, that's the plan."

text: \FH[OFF]

移動（森　細道4）

parameters: "I don't want to go any further this way... Let's look for another path."

parameters: "I don't want to go any further... Let's look for another way."

text: \F[yabure_ikigire] \FH[ON]

parameters:
"I-I somehow managed to shake them off...! *sniff*... *sniff*... I-I
thought I was gonna die...!! ...S-So scary... What the hell was that just
now...!"

parameters:
"Haa... haa... I-I never want to go back there again. Oh, right, I picked
up a key... Maybe I can use it somewhere... I hope there's another path..."

text: \FH[OFF]

parameters: ステータス画面アクター画像変更