; Addressing mode action address table.address:	dw add_0-1	dw add_1-1	dw add_2-1	dw add_3-1	dw add_4-1	dw add_5-1	dw add_6-1	dw add_7-1	dw add_8-1	dw add_9-1	dw add_10-1	dw add_11-1	dw add_12-1; Mostek 6502 Opcode table.opcodes:	db o_end-o_starto_start:	db 0,1,5,6,8,9,&a,&d,&e	db &10,&11,&15,&16,&18,&19,&1d,&1e	db &20,&21,&24,&25,&26,&28,&29,&2a,&2c,&2d,&2e	db &30,&31,&35,&36,&38,&39,&3d,&3e	db &40,&41,&45,&46,&48,&49,&4a,&4c,&4d,&4e	db &50,&51,&55,&56,&58,&59,&5d,&5e	db &60,&61,&65,&66,&68,&69,&6a,&6c,&6d,&6e	db &70,&71,&75,&76,&78,&79,&7d,&7e	db &81,&84,&85,&86,&88,&8a,&8c,&8d,&8e	db &90,&91,&94,&95,&96,&98,&99,&9a,&9d	db &a0,&a1,&a2,&a4,&a5,&a6,&a8,&a9,&aa,&ac,&ad,&ae	db &b0,&b1,&b4,&b5,&b6,&b8,&b9,&ba,&bc,&bd,&be	db &c0,&c1,&c4,&c5,&c6,&c8,&c9,&ca,&cc,&cd,&ce	db &d0,&d1,&d5,&d6,&d8,&d9,&dd,&de	db &e0,&e1,&e4,&e5,&e6,&e8,&e9,&ea,&ec,&ed,&ee	db &f0,&f1,&f5,&f6,&f8,&f9,&fd,&feo_end:; Mnemonic number table, used as index into Mnemonic table.mnems:	db 10,34,34,2,36,34,2,34,2	db 9,34,34,2,13,34,34,2	db 28,1,6,1,39,38,1,39,6,1,39	db 7,1,1,39,44,1,1,39	db 41,23,23,32,35,23,32,27,23,32	db 11,23,23,32,15,23,23,32	db 42,0,0,40,37,0,40,27,0,40	db 12,0,0,40,46,0,0,40	db 47,49,47,48,22,53,49,47,48	db 3,47,49,47,48,55,47,54,47	db 31,29,30,31,29,30,51,29,50,31,29,30	db 4,29,31,29,30,16,29,52,31,29,30	db 19,17,19,17,20,26,17,21,19,17,20	db 8,17,17,20,14,17,17,20	db 18,43,18,43,24,25,43,33,18,43,24	db 5,43,43,24,45,43,43,24,56; Addressing mode table, used as index into Addressing mode action table.addrs:	db 0,5,1,1,0,2,3,4,4	db 11,6,7,7,0,9,8,8	db 4,5,1,1,1,0,2,3,4,4,4	db 11,6,7,7,0,9,8,8	db 0,5,1,1,0,2,3,4,4,4	db 11,6,7,7,0,9,8,8	db 0,5,1,1,0,2,3,10,4,4	db 11,6,7,7,0,9,8,8	db 5,1,1,1,0,0,4,4,4	db 11,6,7,7,12,0,9,0,8	db 2,5,2,1,1,1,0,2,0,4,4,4	db 11,6,7,7,12,0,9,0,8,8,9	db 2,5,1,1,1,0,2,0,4,4,4	db 11,6,7,7,0,9,8,8	db 2,5,1,1,1,0,2,0,4,4,4	db 11,6,7,7,0,9,8,8,0; Mnemonic table, all three characters long.mnemonics:	db 'ADCANDASLBCCBCSBEQBIT'	db 'BMIBNEBPLBRKBVCBVSCLC'	db 'CLDCLICLVCMPCPXCPYDEC'	db 'DEXDEYEORINCINXINYJMP'	db 'JSRLDALDXLDYLSRNOPORA'	db 'PHAPHPPLAPLPROLRORRTI'	db 'RTSSBCSECSEDSEISTASTX'	db 'STYTAXTAYTSXTXATXSTYA'	db '---'; Instruction lengths.oplens:	db 1,2,2,1,3,2	db 2,2,3,3,3,2,2,1; Print current address as two hexadecimal bytes.print_addr:	lda pc_value+1	; print high byte.	jsr print_hex		;	lda pc_value		; print low byte.	jsr print_hex		;	lda #':'		; print separators.	jsr oswrch		;; Print a single space on screen.print_space:	lda #' '		; load space and print it.	bne print_it		;; Print byte in A in hexadecimal.print_hex:	pha		; save byte.	lsr a		;	lsr a		; get top	lsr a		; nibble down.	lsr a		;	jsr nibble		; print upper nibble.	pla		; get byte back and	and #&f		; get lower nibble.nibble:	cmp #10		; see if between 0 and 9.	bcc decimal		; if not then add offset	adc #6		; to get A - F.decimal:	adc #'0'		; convert to decimalprint_it:	jmp oswrch		; and print it.; Print number of spaces on screen as specified in A.multi_space:	tay		; count into Y.	lda #' '		; load space.more_spaces:	jsr oswrch		; print one and repeat	dey		; until count = 0.	bne more_spaces	;	rts		;; Print a character on screen. But if less than 32 or = 127; then print as a full stop. Also ignore parity.print_ascii:	and #%01111111	; remove parity bit.	cmp #&7f		; check for delete.	beq not_ascii		;	cmp #' '		; check for control char.	bcs not_control	;not_ascii:	lda #'.'		; print a dot.not_control:	jmp oswrch		; print the character.; Get hexadecimal number from the command line skipping; any spaces first. Return number in X and Y.get_hex:	ldy line_ptr		; get line index.	lda (os_ptr),y	; next character from line.	cmp #' '		; check for blank.	bne no_space		;	inc line_ptr		; move to next character.	bne get_hex		;no_space:	lda #0		; clear the number.	sta number		;	sta number+1		;next_char:	lda (os_ptr),y	; get next character from line.	sec		; convert to	sbc #'0'		; decimal.	bcc end_number	; check digit to	cmp #10		; be between 0 and 9,	bcc char_ok		; or between &A and &F.	sbc #7		; subtract offset for hex.	cmp #10		; 	bcc end_number	;	cmp #16		;	bcs end_number	;char_ok:	ldx #4		;	asl number		; multiply number	rol number+1		; by sixteen.	dex		;	bne char_ok+2		;	clc		; add current digit	adc number		; to the result.	sta number		;	bcc no_carry		;	inc number+1		;no_carry:	iny		; move to next character	bne next_char		; and process it.end_number:	cpy line_ptr		; check for number on	sty line_ptr		; the command line.	php		;	ldx number		; get number into	ldy number+1		; X and Y registers.	plp		;	rts		; Z=1 if no number present.; Read byte from memory, using ROM number in case address is over &8000.read_byte:	stx x_temp		; save X register.	lda pc_value		; set up O.S.	sta os_address	; address pointer.	lda pc_value+1	;	sta os_address+1	;	ldy rom_number	; get rom number and	jsr osrdrm		; read the byte.	ldx x_temp		; get X reg. back.	inc pc_value		; move address on	bne no_cyaddr		; by one byte.	inc pc_value+1	;no_cyaddr:	rts		;	END		; that's all folks.