File:  [Infocom source] / coco / bugger.src
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Fri Mar 20 10:19:50 2020 UTC (20 months, 2 weeks ago) by root
Branches: infocom, MAIN
CVS tags: tandy, makefile, lwasm, VERSION_D, HEAD
Patches for lwasm

	PAGE
	;SBTTL "--- DEBUGGER ---"

	; --------
	; DEBUGGER
	; --------

	; ENTRY: BREAKPOINT # IN [B]

DOBUG:	LDX	#SCREEN+64	; BEGINNING OF LINE
	LDA	#'B'		; "BUG:"
	STA	,X+
	LDA	#'P'
	STA	,X+
	JSR	COLON

	STB	,X+		; SHOW BREAKPOINT ID
	JSR	BUGSP		; SPACE

	LDA	OPCODE
	BPL	P2OP		; 2-OP IF POSITIVE
	CMPA	#176
	BLO	P1OP		; 1-OP
	CMPA	#192
	BLO	POP0		; 0-OP
	CMPA	#224
	BLO	POPE		; EXTENDED 2-OP

	LDA	#'X'		; OR X-OP
	BRA	POPC

P2OP:	LDA	#'2'
	BRA	POPC

P1OP:	LDA	#'1'
	BRA	POPC

POP0:	LDA	#'0'
	BRA	POPC

POPE:	LDA	#'E'

POPC:	STA	,X+		; PRINT OP-TYPE

	LDA	#'-'		; "-OP:"
	STA	,X+
	LDA	#'O'
	STA	,X+
	LDA	#'P'
	STA	,X+
	BSR	COLON

	LDA	OPCODE		; SHOW OPCODE
	BSR	INHEX
	BSR	BUGSP

	LDA	#'P'		; "PC:"
	STA	,X+
	LDA	#'C'
	STA	,X+
	BSR	COLON

	TST	ZPCH		; IF ZPCH <> 0
	BEQ	DOBZ		; PRINT "0"
	LDA	#'1'		; ELSE PRINT "1"
	BRA	TOPPC

DOBZ:	LDA	#'0'
TOPPC:	STA	,X+

	LDA	ZPCM		; PRINT ZPCM & L
	BSR	INHEX
	LDA	ZPCL
	BSR	INHEX
	BSR	BUGSP

	; INVERT THE DEBUG LINE

	LDX	#SCREEN+96
BUGL2:	LDA	,-X
	ANDA	#%10111111	; CLEAR BIT 6
	STA	,X
	CMPX	#SCREEN+64
	BHI	BUGL2
	RTS

	; -------------
	; PRINT A COLON
	; -------------

COLON:	LDA 	#':'
	BRA	POOP

	; -------------
	; PRINT A SPACE
	; -------------

BUGSP:	LDA	#$20
	BRA	POOP

	; ----------------
	; PRINT [A] IN HEX
	; ----------------

INHEX:	TFR	A,B
	LSRA			; SHIFT HIGH NIBBLE INTO PLACE
	LSRA
	LSRA
	LSRA

	BSR	TOASC		; CONVERT HIGH NIBBLE & SHOW
	TFR	B,A

TOASC:	ANDA	#%00001111
	CMPA	#10		; CONVERT LOW NIBBLE & SHOW
	BLO	IH1
	ADDA	#7
IH1:	ADDA	#$30

POOP:	STA	,X+
	RTS

	;END


unix.superglobalmegacorp.com