CPU-Z80-Disassembler

 view release on metacpan or  search on metacpan

t/dis_zx48.t  view on Meta::CPAN


	# constants
	$addr = 0x32C5;
	$addr = dis_float_const($self, $addr, 'stk_zero');
	$addr = dis_float_const($self, $addr, 'stk_one');
	$addr = dis_float_const($self, $addr, 'stk_half');
	$addr = dis_float_const($self, $addr, 'stk_pi_2');
	$addr = dis_float_const($self, $addr, 'stk_ten');
}

#------------------------------------------------------------------------------
sub dis_char_set {
	my($self) = @_;
	my $addr = 0x3D00;
	$self->labels->add($addr, 'char_set');
	for (0x3D00 .. 0x3FFF) {
		$self->defb($addr++)->format->{N} = sub { format_bin8($_[0]) };
	}
}

#------------------------------------------------------------------------------
sub dis_system_vars {
	my($self) = @_;
	
	$self->labels->add(0x5C00, 'KSTATE'    )->comment("Used in reading the keyboard.");
	$self->labels->add(0x5C01, 'KSTATE1'   )->comment("");
	$self->labels->add(0x5C02, 'KSTATE2'   )->comment("");
	$self->labels->add(0x5C03, 'KSTATE3'   )->comment("");
	$self->labels->add(0x5C04, 'KSTATE4'   )->comment("");
	$self->labels->add(0x5C05, 'KSTATE5'   )->comment("");
	$self->labels->add(0x5C06, 'KSTATE6'   )->comment("");
	$self->labels->add(0x5C07, 'KSTATE7'   )->comment("");
	$self->labels->add(0x5C08, 'LAST_K'    )->comment("Stores newly pressed key.");
	$self->labels->add(0x5C09, 'REPDEL'    )->comment("Time (in 50ths of a second in 60ths of a second in\n".
													  "N. America) that a key must be held down before it\n".
													  "repeats. This starts off at 35, but you can POKE\n".
													  "in other values.");
	$self->labels->add(0x5C0A, 'REPPER'    )->comment("Delay (in 50ths of a second in 60ths of a second in\n".
													  "N. America) between successive repeats of a key\n".
													  "held down: initially 5.");
	$self->labels->add(0x5C0B, 'DEFADD'    )->comment("Address of arguments of user defined function if\n".
													  "one is being evaluated; otherwise 0.");
	$self->labels->add(0x5C0D, 'K_DATA'    )->comment("Stores 2nd byte of colour controls entered\n".
													  "from keyboard .");
	$self->labels->add(0x5C0E, 'TVDATA'    )->comment("Stores bytes of coiour, AT and TAB controls going\n".
													  "to television.");
	$self->labels->add(0x5C10, 'STRMS'     )->comment("Addresses of channels attached to streams.");
	$self->labels->add(0x5C36, 'CHARS'     )->comment("256 less than address of character set (which\n".
													  "starts with space and carries on to the copyright\n".
													  "symbol). Normally in ROM, but you can set up your\n".
													  "own in RAM and make CHARS point to it.");
	$self->labels->add(0x5C38, 'RASP'      )->comment("Length of warning buzz.");
	$self->labels->add(0x5C39, 'PIP'       )->comment("Length of keyboard click.");
	$self->labels->add(0x5C3A, 'ERR_NR'    )->comment("1 less than the report code. Starts off at 255 (for 1)\n".
													  "so PEEK 23610 gives 255.");
	$self->labels->add(0x5C3B, 'FLAGS'     )->comment("Various flags to control the BASIC system.");
	$self->labels->add(0x5C3C, 'TV_FLAG'   )->comment("Flags associated with the television.");
	$self->labels->add(0x5C3D, 'ERR_SP'    )->comment("Address of item on machine stack to be used as\n".
													  "error return.");
	$self->labels->add(0x5C3F, 'LIST_SP'   )->comment("Address of return address from automatic listing.");
	$self->labels->add(0x5C41, 'MODE'      )->comment("Specifies K, L, C. E or G cursor.");
	$self->labels->add(0x5C42, 'NEWPPC'    )->comment("Line to be jumped to.");
	$self->labels->add(0x5C44, 'NSPPC'     )->comment("Statement number in line to be jumped to. Poking\n".
													  "first NEWPPC and then NSPPC forces a jump to\n".
													  "a specified statement in a line.");
	$self->labels->add(0x5C45, 'PPC'       )->comment("Line number of statement currently being executed.");
	$self->labels->add(0x5C47, 'SUBPPC'    )->comment("Number within line of statement being executed.");
	$self->labels->add(0x5C48, 'BORDCR'    )->comment("Border colour * 8; also contains the attributes\n".
													  "normally used for the lower half of the screen.");
	$self->labels->add(0x5C49, 'E_PPC'     )->comment("Number of current line (with program cursor).");
	$self->labels->add(0x5C4B, 'VARS'      )->comment("Address of variables.");
	$self->labels->add(0x5C4D, 'DEST'      )->comment("Address of variable in assignment.");
	$self->labels->add(0x5C4F, 'CHANS'     )->comment("Address of channel data.");
	$self->labels->add(0x5C51, 'CURCHL'    )->comment("Address of information currently being used for\n".
													  "input and output.");
	$self->labels->add(0x5C53, 'PROG'      )->comment("Address of BASIC program.");
	$self->labels->add(0x5C55, 'NXTLIN'    )->comment("Address of next line in program.");
	$self->labels->add(0x5C57, 'DATADD'    )->comment("Address of terminator of last DATA item.");
	$self->labels->add(0x5C59, 'E_LINE'    )->comment("Address of command being typed in.");
	$self->labels->add(0x5C5B, 'K_CUR'     )->comment("Address of cursor.");
	$self->labels->add(0x5C5D, 'CH_ADD'    )->comment("Address of the next character to be interpreted:\n".
													  "the character after the argument of PEEK, or\n".
													  "the NEWLINE at the end of a POKE statement.");
	$self->labels->add(0x5C5F, 'X_PTR'     )->comment("Address of the character after the ? marker.");
	$self->labels->add(0x5C61, 'WORKSP'    )->comment("Address of temporary work space.");
	$self->labels->add(0x5C63, 'STKBOT'    )->comment("Address of bottom of calculator stack.");
	$self->labels->add(0x5C65, 'STKEND'    )->comment("Address of start of spare space.");
	$self->labels->add(0x5C67, 'BREG'      )->comment("Calculator's b register.");
	$self->labels->add(0x5C68, 'MEM'       )->comment("Address of area used for calculator's memory.\n".
													  "(Usually MEMBOT, but not always.)");
	$self->labels->add(0x5C6A, 'FLAGS2'    )->comment("More flags.");
	$self->labels->add(0x5C6B, 'DF_SZ'     )->comment("The number of lines (including one blank line)\n".
													  "in the lower part of the screen.");
	$self->labels->add(0x5C6C, 'S_TOP'     )->comment("The number of the top program line in automatic\n".
													  "listings.");
	$self->labels->add(0x5C6E, 'OLDPPC'    )->comment("Line number to which CONTINUE jumps.");
	$self->labels->add(0x5C70, 'OSPCC'     )->comment("Number within line of statement to which\n".
													  "CONTINUE jumps.");
	$self->labels->add(0x5C71, 'FLAGX'     )->comment("Various flags.");
	$self->labels->add(0x5C72, 'STRLEN'    )->comment("Length of string type destination in assignment.");
	$self->labels->add(0x5C74, 'T_ADDR'    )->comment("Address of next item in syntax table (very unlikely\n".
													  "to be useful).");
	$self->labels->add(0x5C76, 'SEED'      )->comment("The seed for RND. This is the variable that is set\n".
													  "by RANDOMIZE.");
	$self->labels->add(0x5C78, 'FRAMES'    )->comment("3 byte (least significant first), frame counter.\n".
													  "Incremented every 20ms. See Chapter 18.");
	$self->labels->add(0x5C7A, 'FRAMES3'   )->comment("3rd byte of FRAMES");
	$self->labels->add(0x5C7B, 'UDG'       )->comment("Address of 1st user defined graphic You can change\n".
													  "this for instance to save space by having fewer\n".
													  "user defined graphics.");
	$self->labels->add(0x5C7D, 'COORDS'    )->comment("x-coordinate of last point plotted.");
	$self->labels->add(0x5C7E, 'COORDS_hi' )->comment("y-coordinate of last point plotted.");
	$self->labels->add(0x5C7F, 'P_POSN'    )->comment("33 column number of printer position");
	$self->labels->add(0x5C80, 'PR_CC'     )->comment("Full address of next position for LPRINT to print at\n".
													  "(in ZX printer buffer). Legal values 5B00 - 5B1F.\n".
													  "[Not used in 128K mode or when certain peripherals\n".
													  "are attached]");
	$self->labels->add(0x5C82, 'ECHO_E'    )->comment("33 column number and 24 line number (in lower half)\n".
													  "of end of input buffer.");
	$self->labels->add(0x5C84, 'DF_CC'     )->comment("Address in display file of PRINT position.");
	$self->labels->add(0x5C86, 'DFCCL'     )->comment("Like DF CC for lower part of screen.");
	$self->labels->add(0x5C88, 'S_POSN'    )->comment("33 column number for PRINT position");
	$self->labels->add(0x5C89, 'S_POSN_hi' )->comment("24 line number for PRINT position.");
	$self->labels->add(0x5C8A, 'SPOSNL'    )->comment("Like S POSN for lower part");
	$self->labels->add(0x5C8C, 'SCR_CT'    )->comment("Counts scrolls: it is always 1 more than the number\n".
													  "of scrolls that will be done before stopping with\n".
													  "scroll? If you keep poking this with a number\n".
													  "bigger than 1 (say 255), the screen will scroll\n".
													  "on and on without asking you.");
	$self->labels->add(0x5C8D, 'ATTR_P'    )->comment("Permanent current colours, etc (as set up by colour\n".
													  "statements).");
	$self->labels->add(0x5C8E, 'MASK_P'    )->comment("Used for transparent colours, etc. Any bit that\n".
													  "is 1 shows that the corresponding attribute bit\n".
													  "is taken not from ATTR P, but from what is already\n".
													  "on the screen.");
	$self->labels->add(0x5C8F, 'ATTR_T'    )->comment("Temporary current colours, etc (as set up by\n".
													  "colour items).");
	$self->labels->add(0x5C90, 'MASK_T'    )->comment("Like MASK P, but temporary.");
	$self->labels->add(0x5C91, 'P_FLAG'    )->comment("More flags.");
	$self->labels->add(0x5C92, 'MEMBOT'    )->comment("Calculator's memory area; used to store numbers\n".



( run in 1.121 second using v1.01-cache-2.11-cpan-39bf76dae61 )