meow.git

meow.h

espurr
/* meow - 6502 assembler
 * Copyright (C) 2024-2025 ArcNyxx
 * see LICENCE file for licensing information */

#ifndef MEOW_H
#define MEOW_H

#include <stdbool.h>

typedef enum mne {
        LDA, LDX, LDY, STA, STX, STY,
        ADC, SBC,
        INC, INX, INY, DEC, DEX, DEY,
        ASL, LSR, ROL, ROR,
        AND, ORA, EOR,
        CMP, CPX, CPY, BIT,
        BCC, BCS, BNE, BEQ, BPL, BMI, BVC, BVS,
        TAX, TAY, TXA, TYA, TSX, TXS,
        PHA, PLA, PHP, PLP,
        JMP, JSR, RTS, RTI,
        CLC, SEC, CLD, SED, CLI, SEI, CLV,
        BRK, NOP,
        INVMNE
} mne_t;

typedef enum addr {
	IMP,
	IMM,  /*            #IMM */
	REL,  /* LABEL      IMM */ /* determined based on instruction */
	ABS,  /* LABEL      IMM */
	ABSX, /* LABEL,X    IMM,X */
	ABSY, /* LABEL,Y    IMM,Y */
	ABSI, /* (LABEL)    (IMM) */
	ZP,   /* !LABEL     !IMM */
	ZPX,  /* !LABEL,X   !IMM,X */
	ZPY,  /* !LABEL,Y   !IMM,Y */
	ZPXI, /* (!LABEL,X) (!IMM,X) */
	ZPYI, /* (!LABEL),Y (!IMM),Y */
	INVADDR
} addr_t;

typedef enum asiz {
	BIT16, BIT8, RELS
} asiz_t;

void meow(const char *msg, ...);
bool islabel(const char *label);
long strnum(const char *num, char **endptr);

#endif /* MEOW_H */