/*
 * input_int.h
 *
 *  Created on: 2016/11/24
 *      Author: takayun
 */

#ifndef SWITCHES_INT_H_
#define SWITCHES_INT_H_

/**************************************************
 *						Defines
 **************************************************/

#define switches (volatile int *) 0x0005090
#define push_switches (volatile char *) 0x0005080

typedef union {
	int sw;
	struct {
		unsigned int run_mode : 1;
		unsigned int rw_mode : 1;
		unsigned int program_selecter : 4;
		unsigned int memory_index : 4;
		unsigned int register_index : 4;
		unsigned int instruction_code : 4;
	} splited;
	struct {
		unsigned int : 10;
		unsigned int value : 8;
	} data;
} sw_t;

enum PushEvent{
	PUSH_NONE,
	PUSH_ANY,
	PUSH_VALSTR,
	PUSH_INSSTR,
	PUSH_RUN
};

/**************************************************
 *						Variables
 **************************************************/

extern unsigned char PUSH_EVENT;

/**************************************************
 *						Functions
 **************************************************/

/* Function: in_int
 * Sammary:
 *  全ての入力割り込みを行う
 * */
void in_int();

void push_int();

#endif /* SWITCHES_INT_H_ */
