

; --------------= Print Breakpoint Table Sub =-------------
; yeah, I know this is out of place!
; ---------------------------------------------------------
						; kills content in all of the registers it seems
***
;print_bkpt_sub: "m_bptbl.asm"
;	Prints out the breakpoint table. First the address of the breakpoint, then the
;	Data that the breakpoint replaced. Destroys content in all registers.
;	Reg Input:
;		None
;	Reg Output:
;		none
***

print_bkpt_sub:
	ldy		#newline		; loads a new line string
	jsr		print_string		; and then prints it

	ldab		#$05			; load the bkpt counter
	
	ldx		#bkpt_table		; loads the address of the table
	ldy		#bkpt_tbl_code		; loads the address of the code in the table
	
pb_loop1:
	pshb					; save the counter
	ldd		0,x			; load the address in the table
	xgdx					; d <-> x
	jsr		print_address		; print the address
	xgdx					; x <-> d

	ldaa		#32			; space
	jsr		put_char		; prints the space
	
	ldaa		0,y			; a is now the code it replaced
	jsr		print_number		; print it

	pshy					; saves state of y
	ldy		#newline		; loads new line string
	jsr		print_string		; then prints it
	puly					; restores state of y

	inx					; X needs to increment two each time
	inx
	iny					; Y only needs to increment once

	pulb					; get the counter back
	
	decb					; decrement the counter
	beq		pb_done			; if the counter is zero, end
	bra		pb_loop1		; otherwize print the rest of the breakpoint table
pb_done:
	rts					; returns

