Jump to content

Module:GameboyAssembler/data

From Wikiversity

Documentation for this module may be created at Module:GameboyAssembler/data/doc

return {
	mnemonics = {
		-- Special operations
		noop = "nop",
		enable_int = "ei",
		disable_int = "di",
		halt = "halt",
		stop = "stop",
		reset = "rst",
		-- Memory operations
		load = "ld",
		load_dec = "ldd",
		load_inc = "ldi",
		load_ffxx = "ldh", -- Load/store to/from 0xFFxx
		push = "push",
		pop = "pop",
		-- Arithmetic operations
		add = "add",
		add_carry = "adc",
		sub = "sub",
		sub_carry = "sbc",
		instr_and = "and",
		instr_or = "or",
		instr_xor = "xor",
		cmp = "cp",
		incr = "inc",
		decr = "dec",
		-- Misc
		swap_nibble = "swap",
		dec_adjust = "daa",
		complement = "cpl",
		cmpl_carry = "ccf",
		set_carry = "scf",
		-- Bit operations
		rotl_a_wc = "rlca", -- Rot into carry
		rotl_a_tc = "rla", -- Rot through carry 
		rotr_a_wc = "rrca", 
		rotr_a_tc = "rra",
		rotl_wc = "rlc",
		rotl_tc = "rl",
		rotr_wc = "rrc",
		rotr_tc = "rr",
		shl_wc = "sla",
		shr_wc = "sra",
		shr_msb_wc = "srl",
		test_bit = "bit",
		reset_bit = "res",
		-- Jumps
		jump = "jp",
		call = "call",
		ret = "ret",
		reti = "reti",
		data_byte = "db", -- 8 bits
		data_word = "dw", -- 16 bits
		data_dword = "dd", -- 32 bits
		data_qword = "dq", -- 64 bits
	},
	condition_codes = {
		nz = "nz", --Not zero
		ne = "nz", --Not Equal
		z = "z", --Zero
		e = "z", --Equal
		nc = "nc", --No carry
		no = "nc", --No overflow
		c = "c", --Carry
		o = "c", --Overflow
	},
	registers = {
		a = "data",
		b = "data",
		c = "data",
		d = "data",
		e = "data",
		f = "flags",
		h = "data",
		l = "data",
		pc = "pc",
		sp = "sp",
	},
	regpairs = {
		"af",
		"bc",
		"de",
		"hl",
	}
}