Metropoli BBS
VIEWER: hack.doc MODE: TEXT (ASCII)
							23.11.1996
							Mika Heiskanen
							mheiskan@delta.hut.fi

			Hack Library v9.2

This library is a collection of various utilities I've programmed myself or
saved from various sources over the years. All the commands work in SX
and GX unless otherwise noted. All commands also work from covered ports.

Many of the common 'hacking'-library commands are directly from various
sources, such as <-LIB-> by Detlef Mueller, Rick Grevelle's Tools library and
Mario Mikocevic's personal hacking library. Credits for whom they belong,
I've lost the information a long time ago as this library started out just as
a personal collection of favourite hacking programs. I have mentioned
original authors though when I've been sure about them.

Suggested key bindings:

		Command		Key
		-------		---
		COERCE		[->NUM]
		PG		[PURGE]
		XRCL		[RCL]
		XSTO		[STO]
		STOX		[DEF]
		UP		[UP]


			Command Index
			---------------

COERCE		- Perform object conversions
XRCL		- General RCL replacement
XSTO		- General STO replacement
TIM		- High precision timer
USEND		- Fast IR send
URECV		- Fast IR receive
BZ		- Compressor
RFU		- RF uncompressor
SYS		- Floating point number conversions + SYSEVAL
COD		- Convert hex data to object
DCOD		- Convert object to hex data
OBJFIX		- Fix bad download (by HP)
VARS		- Fast VARS replacement
VARS2		- Fast VARS which lists nullids too
PG		- General PURGE replacement
PG0		- Purge everything in port0
ORD		- Fast ORDER replacement
REN		- Rename variable
TB		- Tabify srpl/ml source code
FMT		- Format data in a hex string into readable form
ITYPE		- Get type number of object
CTIM		- Measure cycle count for instruction		(Requires Jazz)
DTEMP		- Dump non-bints from tempob area
GRX2		- Double the size of a grob
CDHD		- Change into hidden directory
WKEY		- Wait for key press, get corresponding object
SC		- Memory scanner by Rick Grevelle		(Requires UFL)
->ASC		- Convert object to hex chars
USE		- Subroutine usage analyzer
PMEM		- Return free memory in port by Christophe Meynard
D->LIB		- Library builder by Rick Grevelle
L->DIR		- Library splitter by Rick Grevelle
OB->		- Object splitter
->DIR		- Directory builder by Rick Grevelle
->PRG		- Program builder
->XLIB		- Romptr builder
->ALG		- Symbolic builder
->BAK		- Backup object builder
->ID		- Identifier builder
ADDR		- Returns address of object
LBCRC		- Recalculate library CRC
RHASH		- Recall library hash table
RLINK		- Recall library link table
RMSG		- Recall library message table
RTITLE		- Recall library title
XGET		- XRECV replacement (fixes the memory bug)	(GX only)
USES		- Subroutine usage analyzer
USED		- Subroutine usage analyzer
BY		- BYTES command
STOX		- Store variable to desired position
UP		- Replacement for UPDIR


		Syntax Descriptions
		-------------------

COERCE		%		--> #
		hxs		--> #
		#		--> %
		%%		--> %
		C%%		--> C%
		chr		--> $
		other		--> [->NUM]
XRCL		$bz		--> ob		(Convenient key for BZ)
		id		--> ob
		lam		--> ob
		PICT		--> grob
		romptr		--> ob
		hxs_adr		--> ob
		#addr		--> ob
		acptr		--> ob
		%port		--> Pvars	(All objects in port)
		%lid		--> Libs	(With port numbers)
		:&:lid		--> lib		(Works for unprologed libs too)
		tagged		--> ob
		{seco}		--> seco
		{romptr}	--> ob
		{path}		--> ob
XSTO		ob tag		-->		Libraries will be installed
		ob id		-->		into use automatically.
		ob lam		-->		Reports if config object
		ob symb		-->		bypass was suspect.
		grob PICT	-->
		backup %port	-->
		lib %port	-->
USEND		ob	-->
		{names}	-->
URECV			--> ?
BZ		ob	--> $bz
		$bz	--> ob
RFU		$rf	--> ob
SYS		hxs_addr--> ?		(SYSEVAL)
		%	--> %%		(also arrays)
		C%	--> C%%
		%%	--> %		(also arrays)
		C%%	--> C%
COD		$	--> ob		(whitespace is ignored)
DCOD		ob	--> $		(whitespace shows rpl structure)
OBJFIX		$	--> ob
VARS			--> {ids}
VARS2			--> {ids}
PG		id	-->
		tagged	-->
		PICT	-->
		%lid	-->		(purges active lib)
		{ob}	-->		(containing any of above types)
PG0			-->		( 0 PVARS PG )
ORD		{ids}	-->
REN		old new	-->		(Renames variable)
TB		$	--> $'
ITYPE		ob	--> #type
DTEMP			--> ob1 .. obn
CDHD			-->
WKEY			--> ob %keycode
->ASC		ob	--> $
PMEM		%port	--> %bytesfree
FMT		$ %nibbles %columns	--> $		
OB->		arry	--> obs {dims}
		seco	--> obs %n		->PRG is reverse
		symb	--> obs %n		->ALG is reverse
		romp	--> %lid %cmd		->XLIB is reverse
		rrp	--> obs %n		->DIR is reverse
		backup	--> ob id		->BAK is reverse
		id	--> $			->ID is reverse
		#addr	--> ob
		acptr	--> ob
		+ default OBJ-> stuff
ADDR		ob	--> hxs_addr
LBCRC		lib	--> lib'
RHASH		%lid	--> hash table
RLINK		%lid	--> link table
RCFG		%lid	--> config object
RMSG		%lid	--> message table
RTITLE		%lid	--> library title

STOX		ob id		-->
		Keys:	VAR, UP		= page 1
			NXT, RIGHT	= next page
			LEFT		= previous page
			DOWN		= last page
			Menu keys	= insert variable
			ON		= abort

UP		-->
		UPDIR replacement which goes to the page in which the old
		directory was

USE		rrp --> { name1 { name1_calls } ..
		 ob --> { name1 { name1_calls } ..
USED		rrp --> { name1 { calls_name1 } ..
USES		rrp id --> { calls_id }


D->LIB		rrp	--> lib
			--> lib		(Uses current directory)
L->DIR		lib	--> rrp
		%lid	--> rrp		(Cannot handle internal libs!)
		hxs_lid	--> rrp

TIM		ob		--> :ticks: %time_unit

		Returns time in seconds if time >= 0.1s, else in milliseconds.
		"Accuracy" is 0.02 ticks in GX, 0.03 ticks in SX. The high
		accuracy becomes meaningless for long execution times due
		to CPU speed variations.

CTIM		$instr	--> %nibbles %cycles_even %cycles_odd

		Measures cycle count for opcode(s) at even and odd addresses.
		Details on proper use:
		    1) Special instructions such as CONFIG, PC=A etc cannot
		       be measured directly.
		    2) Register D is used as a loop counter during the
		       measurement and cannot thus be used.
		    3) D0 and D1 are initialized to point inside IRAMBUFF
		       so that on SX D0 = #70100 and D1 = #70101, on GX
		       D0 = #80100 and D1 = #80101.
		    4) Accuracy may be lost if measuring long opcode
		       sequences.

		Examples on GX:			SASM.DOC cycles

		"A=DAT1	A"	  -> 18.00  19.50	18
		"SETDEC"	  ->  2.75   3.00	 3
		"A=R0"		  -> 11.00  12.25	19
		"ASRB"		  -> 11.50  12.75	20
		"A=A+1	A"	  ->  4.75   5.00	 7
		"A=A+1	X"	  ->  4.50   5.75	 6
		"P= 4"		  ->  2.50   2.50	 2
		"P= 4\n A=A+1 WP" ->  8.00   9.25	10 (2+8)


SC			-->		(Start at address #00100)
		#addr	-->
		hxs_adr	-->

		Key		Description
		^^^		^^^^^^^^^^^

		[Cursor keys]	Move cursor
		[0-9A-F]	Poke nibble
		[-]		Previous nibble
		[+]		Next nibble
		[*]		Skip #100 nibbles
		[/]		Back #100 nibbles
		[+/-]		Toggle ascii/hex
		[ENTER]		Go to address #100
		[<==]		Go to address of RAM
		[DEL]		Go to address #C0000
		[EEX]		Go to address #80000
		[SIN]		Go to TEMPTOP address	\ Left to right
		[COS]		Go to RSKTOP address		=
		[TAN]		Go to DSKTOP address	  Low mem to hi mem
		[SQRT]		Go to ROMPARTS address	/
		[1/X]		Jump to address at cursor
		[y^x]		Skip object
		[EVAL]		Evaluate RPL at cursor
		[SPC]		Dump 32Kb starting at cursor

[ RETURN TO DIRECTORY ]