
;  GNU C 2.7.2 [AL 1.1, MM 40] RISC NEWS-OS compiled by CC

;  Cc1 defaults:
;  -mmemcpy

;  Cc1 arguments (-G value = 0, Cpu = 3000, ISA = 1):
;  -quiet -dumpbase -O2 -Wall -o

gcc2_compiled.:
__gnu_compiled_c:
	.global	tia_grayscale_table
	.code
	.align	2
tia_grayscale_table:
	.byte	15
	.byte	11
	.byte	9
	.byte	7
	.byte	5
	.byte	3
	.byte	2
	.byte	1
	.byte	11
	.byte	10
	.byte	8
	.byte	6
	.byte	5
	.byte	4
	.byte	2
	.byte	1
	.byte	12
	.byte	10
	.byte	9
	.byte	7
	.byte	6
	.byte	5
	.byte	4
	.byte	3
	.byte	12
	.byte	10
	.byte	9
	.byte	8
	.byte	6
	.byte	5
	.byte	4
	.byte	3
	.byte	13
	.byte	11
	.byte	9
	.byte	8
	.byte	7
	.byte	5
	.byte	4
	.byte	3
	.byte	12
	.byte	11
	.byte	9
	.byte	8
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	13
	.byte	11
	.byte	10
	.byte	8
	.byte	7
	.byte	6
	.byte	5
	.byte	4
	.byte	14
	.byte	12
	.byte	10
	.byte	9
	.byte	8
	.byte	6
	.byte	5
	.byte	4
	.byte	14
	.byte	12
	.byte	11
	.byte	9
	.byte	8
	.byte	7
	.byte	5
	.byte	4
	.byte	13
	.byte	12
	.byte	10
	.byte	8
	.byte	7
	.byte	6
	.byte	5
	.byte	4
	.byte	13
	.byte	11
	.byte	9
	.byte	8
	.byte	7
	.byte	5
	.byte	4
	.byte	3
	.byte	13
	.byte	11
	.byte	9
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	2
	.byte	13
	.byte	11
	.byte	9
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	2
	.byte	13
	.byte	11
	.byte	9
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	2
	.byte	13
	.byte	11
	.byte	9
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	2
	.byte	12
	.byte	11
	.byte	9
	.byte	7
	.byte	6
	.byte	4
	.byte	3
	.byte	2
	.global	tia_div3_table
	.align	2
tia_div3_table:
	.byte	0
	.byte	0
	.byte	0
	.byte	1
	.byte	1
	.byte	1
	.byte	2
	.byte	2
	.byte	2
	.byte	3
	.byte	3
	.byte	3
	.byte	4
	.byte	4
	.byte	4
	.byte	5
	.byte	5
	.byte	5
	.byte	6
	.byte	6
	.byte	6
	.byte	7
	.byte	7
	.byte	7
	.byte	8
	.byte	8
	.byte	8
	.byte	9
	.byte	9
	.byte	9
	.byte	10
	.byte	10
	.byte	10
	.byte	11
	.byte	11
	.byte	11
	.byte	12
	.byte	12
	.byte	12
	.byte	13
	.byte	13
	.byte	13
	.byte	14
	.byte	14
	.byte	14
	.byte	15
	.byte	15
	.byte	15
	.byte	16
	.byte	16
	.byte	16
	.byte	17
	.byte	17
	.byte	17
	.byte	18
	.byte	18
	.byte	18
	.byte	19
	.byte	19
	.byte	19
	.byte	20
	.byte	20
	.byte	20
	.byte	21
	.byte	21
	.byte	21
	.byte	22
	.byte	22
	.byte	22
	.byte	23
	.byte	23
	.byte	23
	.byte	24
	.byte	24
	.byte	24
	.byte	25
	.byte	25
	.byte	25
	.byte	26
	.byte	26
	.byte	26
	.byte	27
	.byte	27
	.byte	27
	.byte	28
	.byte	28
	.byte	28
	.byte	29
	.byte	29
	.byte	29
	.byte	30
	.byte	30
	.byte	30
	.byte	31
	.byte	31
	.byte	31
	.byte	32
	.byte	32
	.byte	32
	.byte	33
	.byte	33
	.byte	33
	.byte	34
	.byte	34
	.byte	34
	.byte	35
	.byte	35
	.byte	35
	.byte	36
	.byte	36
	.byte	36
	.byte	37
	.byte	37
	.byte	37
	.byte	38
	.byte	38
	.byte	38
	.byte	39
	.byte	39
	.byte	39
	.byte	40
	.byte	40
	.byte	40
	.byte	41
	.byte	41
	.byte	41
	.byte	42
	.byte	42
	.byte	42
	.byte	43
	.byte	43
	.byte	43
	.byte	44
	.byte	44
	.byte	44
	.byte	45
	.byte	45
	.byte	45
	.byte	46
	.byte	46
	.byte	46
	.byte	47
	.byte	47
	.byte	47
	.byte	48
	.byte	48
	.byte	48
	.byte	49
	.byte	49
	.byte	49
	.byte	50
	.byte	50
	.byte	50
	.byte	51
	.byte	51
	.byte	51
	.byte	52
	.byte	52
	.byte	52
	.byte	53
	.byte	53
	.byte	53
	.byte	54
	.byte	54
	.byte	54
	.byte	55
	.byte	55
	.byte	55
	.byte	56
	.byte	56
	.byte	56
	.byte	57
	.byte	57
	.byte	57
	.byte	58
	.byte	58
	.byte	58
	.byte	59
	.byte	59
	.byte	59
	.byte	60
	.byte	60
	.byte	60
	.byte	61
	.byte	61
	.byte	61
	.byte	62
	.byte	62
	.byte	62
	.byte	63
	.byte	63
	.byte	63
	.byte	64
	.byte	64
	.byte	64
	.byte	65
	.byte	65
	.byte	65
	.byte	66
	.byte	66
	.byte	66
	.byte	67
	.byte	67
	.byte	67
	.byte	68
	.byte	68
	.byte	68
	.byte	69
	.byte	69
	.byte	69
	.byte	70
	.byte	70
	.byte	70
	.byte	71
	.byte	71
	.byte	71
	.byte	72
	.byte	72
	.byte	72
	.byte	73
	.byte	73
	.byte	73
	.byte	74
	.byte	74
	.byte	74
	.byte	75
	.byte	75
	.byte	75
	.byte	76
	.byte	76
	.byte	76
	.byte	77
	.byte	77
	.byte	77
	.byte	78
	.byte	78
	.byte	78
	.byte	79
	.byte	79
	.byte	79
	.byte	80
	.byte	80
	.byte	80
	.byte	81
	.byte	81
	.byte	81
	.byte	82
	.byte	82
	.byte	82
	.byte	83
	.byte	83
	.byte	83
	.byte	84
	.byte	84
	.byte	84
	.byte	85
	.global	tia_priority_table
	.align	2
tia_priority_table:
	.byte	3
	.byte	2
	.byte	2
	.byte	2
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	0
	.byte	3
	.byte	2
	.byte	2
	.byte	2
	.byte	1
	.byte	2
	.byte	2
	.byte	2
	.byte	1
	.byte	2
	.byte	2
	.byte	2
	.byte	1
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.byte	0
	.byte	2
	.byte	2
	.byte	2
	.global	tia_collision_table
	.align	2
tia_collision_table:
	.half	0
	.half	0
	.half	0
	.half	8192
	.half	0
	.half	2048
	.half	1024
	.half	11264
	.half	0
	.half	128
	.half	64
	.half	8384
	.half	4
	.half	2180
	.half	1092
	.half	11460
	.half	0
	.half	512
	.half	256
	.half	8960
	.half	16384
	.half	18944
	.half	17664
	.half	28416
	.half	2
	.half	642
	.half	322
	.half	9154
	.half	16390
	.half	19078
	.half	17734
	.half	28614
	.half	0
	.half	32
	.half	16
	.half	8240
	.half	8
	.half	2088
	.half	1048
	.half	11320
	.half	32768
	.half	32928
	.half	32848
	.half	41200
	.half	32780
	.half	34988
	.half	33884
	.half	44284
	.half	1
	.half	545
	.half	273
	.half	9009
	.half	16393
	.half	18985
	.half	17689
	.half	28473
	.half	32771
	.half	33443
	.half	33107
	.half	41971
	.half	49167
	.half	51887
	.half	50527
	.half	61439
	.align	2
__LXC0:				; __LC0:
	.ascii	"cliptia.$(%d)\000"
	.code
	.align	1
	.global	tia_reset
tia_reset:
;	.frame	%sp,24,$31		# vars= 0, regs= 4/0, args= 8, extra= 0
;	.mask	0x80070000,-4
;	.fmask	0x00000000,0
	pushn	%r2
	sub	%sp,0x2		; 	xsub	%sp,%sp,8
	ld.w	%r1,%r12
	ld.w	%r2,%r13
	ext	tia+0x0@h	; 	xld.w	%r0,tia
	ext	tia+0x0@m
	ld.w	%r0,tia+0x0@l
	ld.w	%r12,%r0
	ld.w	%r13,0x0
	ext	0x2		; 	xld.w	%r14,0x000000a4		; 164
	ld.w	%r14,0x24
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
	ld.w	[%r0],%r1	; 	xld.w	[%r0],%r1
	ext	tia+0x1c@ah	; 	xld.w	[tia+28],%r2
	ext	tia+0x1c@al
	ld.w	[%r8],%r2
	ld.w	%r10,0x1	; 	xld.w	%r10,0x00000001		; 1
	ext	tia+0x6b@ah	; 	xld.b	[tia+107],%r10
	ext	tia+0x6b@al
	ld.b	[%r8],%r10
	ext	tia+0x6a@ah	; 	xld.b	[tia+106],%r10
	ext	tia+0x6a@al
	ld.b	[%r8],%r10
	ld.w	%r11,0x1	; 	xld.w	%r11,0x00000001		; 1
	ext	tia+0x68@ah	; 	xld.h	[tia+104],%r11
	ext	tia+0x68@al
	ld.h	[%r8],%r11
	ext	tia+0x7b@ah	; 	xld.b	[tia+123],%r10
	ext	tia+0x7b@al
	ld.b	[%r8],%r10
	ext	tia+0x7a@ah	; 	xld.b	[tia+122],%r10
	ext	tia+0x7a@al
	ld.b	[%r8],%r10
	ext	tia+0x78@ah	; 	xld.h	[tia+120],%r11
	ext	tia+0x78@al
	ld.h	[%r8],%r11
	add	%sp,0x2		; 	xadd	%sp,%sp,8
	popn	%r2
	ret
	.align	1
tia_write_VSYNC:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x80@ah	; 	xld.ub	%r10,[tia+128]
	ext	tia+0x80@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX76		; 	xjreq	__L76
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x80@ah	; 	xld.b	[tia+128],%r0
	ext	tia+0x80@al
	ld.b	[%r8],%r0
__LX76:				; __L76:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_VBLANK:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000c2
	and	%r0,0x2
	ext	tia+0x81@ah	; 	xld.ub	%r10,[tia+129]
	ext	tia+0x81@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX84		; 	xjreq	__L84
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x81@ah	; 	xld.b	[tia+129],%r0
	ext	tia+0x81@al
	ld.b	[%r8],%r0
	ext	tia+0x1a@ah	; 	xld.ub	%r12,[tia+26]
	ext	tia+0x1a@al
	ld.ub	%r12,[%r8]
	ext	tia+0x1b@ah	; 	xld.ub	%r13,[tia+27]
	ext	tia+0x1b@al
	ld.ub	%r13,[%r8]
	ext	tia_set_i4_i5@rm	; 	xcall	tia_set_i4_i5
	call	tia_set_i4_i5@rl
__LX84:				; __L84:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_WSYNC:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0xc@ah	; 	xld.w	%r11,[tia+12]
	ext	tia+0xc@al
	ld.w	%r11,[%r8]
	cmp	%r11,0x0
	jreq	__LX89		; 	xjreq	__L89
	ext	0x3		; 	xld.w	%r10,0x000000e4		; 228
	ld.w	%r10,0x24
	sub	%r10,%r11
	ld.w	%r11,%r10
	ext	tia_div3_table+0x0@h	; 	xld.ub	%r11,[%r11+tia_div3_table]
	ext	tia_div3_table+0x0@m
	ld.w	%r9,tia_div3_table+0x0@l
	add	%r9,%r11
	ld.ub	%r11,[%r9]
__LX89:				; __L89:
	ld.w	%r10,%r11
	ret
	.align	1
tia_write_RSYNC:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ld.w	%r11,0x0
	ext	tia+0xc@ah	; 	xld.w	[tia+12],%r11
	ext	tia+0xc@al
	ld.w	[%r8],%r11
	ext	tia+0x4@ah	; 	xld.w	[tia+4],%r11
	ext	tia+0x4@al
	ld.w	[%r8],%r11
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_NUSIZ0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x0		; 	xand	%r0,%r0,0x00000037
	and	%r0,0x37
	ext	tia+0x82@ah	; 	xld.ub	%r10,[tia+130]
	ext	tia+0x82@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX95		; 	xjreq	__L95
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x82@ah	; 	xld.b	[tia+130],%r0
	ext	tia+0x82@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	and	%r10,0x7	; 	xand	%r10,%r10,0x00000007
	ext	tia+0x39@ah	; 	xld.b	[tia+57],%r10
	ext	tia+0x39@al
	ld.b	[%r8],%r10
	ld.w	%r10,%r0
	srl	%r10,0x4	; 	xsrl	%r10,4
	ext	tia+0x49@ah	; 	xld.b	[tia+73],%r10
	ext	tia+0x49@al
	ld.b	[%r8],%r10
__LX95:				; __L95:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_NUSIZ1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x0		; 	xand	%r0,%r0,0x00000037
	and	%r0,0x37
	ext	tia+0x83@ah	; 	xld.ub	%r10,[tia+131]
	ext	tia+0x83@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX103		; 	xjreq	__L103
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x83@ah	; 	xld.b	[tia+131],%r0
	ext	tia+0x83@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	and	%r10,0x7	; 	xand	%r10,%r10,0x00000007
	ext	tia+0x41@ah	; 	xld.b	[tia+65],%r10
	ext	tia+0x41@al
	ld.b	[%r8],%r10
	ld.w	%r10,%r0
	srl	%r10,0x4	; 	xsrl	%r10,4
	ext	tia+0x4d@ah	; 	xld.b	[tia+77],%r10
	ext	tia+0x4d@al
	ld.b	[%r8],%r10
__LX103:				; __L103:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_COLUP0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000fe
	and	%r0,0x3e
	ext	tia+0x84@ah	; 	xld.ub	%r10,[tia+132]
	ext	tia+0x84@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX111		; 	xjreq	__L111
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x84@ah	; 	xld.b	[tia+132],%r0
	ext	tia+0x84@al
	ld.b	[%r8],%r0
	sra	%r0,0x1		; 	xsra	%r0,1
	ext	tia_grayscale_table+0x0@h	; 	xld.ub	%r0,[%r0+tia_grayscale_table]
	ext	tia_grayscale_table+0x0@m
	ld.w	%r9,tia_grayscale_table+0x0@l
	add	%r9,%r0
	ld.ub	%r0,[%r9]
	ext	tia+0x14@ah	; 	xld.b	[tia+20],%r0
	ext	tia+0x14@al
	ld.b	[%r8],%r0
__LX111:				; __L111:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_COLUP1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000fe
	and	%r0,0x3e
	ext	tia+0x85@ah	; 	xld.ub	%r10,[tia+133]
	ext	tia+0x85@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX119		; 	xjreq	__L119
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x85@ah	; 	xld.b	[tia+133],%r0
	ext	tia+0x85@al
	ld.b	[%r8],%r0
	sra	%r0,0x1		; 	xsra	%r0,1
	ext	tia_grayscale_table+0x0@h	; 	xld.ub	%r0,[%r0+tia_grayscale_table]
	ext	tia_grayscale_table+0x0@m
	ld.w	%r9,tia_grayscale_table+0x0@l
	add	%r9,%r0
	ld.ub	%r0,[%r9]
	ext	tia+0x15@ah	; 	xld.b	[tia+21],%r0
	ext	tia+0x15@al
	ld.b	[%r8],%r0
__LX119:				; __L119:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_COLUPF:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000fe
	and	%r0,0x3e
	ext	tia+0x86@ah	; 	xld.ub	%r10,[tia+134]
	ext	tia+0x86@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX127		; 	xjreq	__L127
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x86@ah	; 	xld.b	[tia+134],%r0
	ext	tia+0x86@al
	ld.b	[%r8],%r0
	sra	%r0,0x1		; 	xsra	%r0,1
	ext	tia_grayscale_table+0x0@h	; 	xld.ub	%r0,[%r0+tia_grayscale_table]
	ext	tia_grayscale_table+0x0@m
	ld.w	%r9,tia_grayscale_table+0x0@l
	add	%r9,%r0
	ld.ub	%r0,[%r9]
	ext	tia+0x16@ah	; 	xld.b	[tia+22],%r0
	ext	tia+0x16@al
	ld.b	[%r8],%r0
__LX127:				; __L127:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_COLUBK:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000fe
	and	%r0,0x3e
	ext	tia+0x87@ah	; 	xld.ub	%r10,[tia+135]
	ext	tia+0x87@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX135		; 	xjreq	__L135
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x87@ah	; 	xld.b	[tia+135],%r0
	ext	tia+0x87@al
	ld.b	[%r8],%r0
	sra	%r0,0x1		; 	xsra	%r0,1
	ext	tia_grayscale_table+0x0@h	; 	xld.ub	%r0,[%r0+tia_grayscale_table]
	ext	tia_grayscale_table+0x0@m
	ld.w	%r9,tia_grayscale_table+0x0@l
	add	%r9,%r0
	ld.ub	%r0,[%r9]
	ext	tia+0x17@ah	; 	xld.b	[tia+23],%r0
	ext	tia+0x17@al
	ld.b	[%r8],%r0
__LX135:				; __L135:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_CTRLPF:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x0		; 	xand	%r0,%r0,0x00000037
	and	%r0,0x37
	ext	tia+0x88@ah	; 	xld.ub	%r10,[tia+136]
	ext	tia+0x88@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX143		; 	xjreq	__L143
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x88@ah	; 	xld.b	[tia+136],%r0
	ext	tia+0x88@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	and	%r10,0x1	; 	xand	%r10,%r10,0x00000001
	ext	tia+0x58@ah	; 	xld.b	[tia+88],%r10
	ext	tia+0x58@al
	ld.b	[%r8],%r10
	ld.w	%r10,%r0
	srl	%r10,0x4	; 	xsrl	%r10,4
	ext	tia+0x51@ah	; 	xld.b	[tia+81],%r10
	ext	tia+0x51@al
	ld.b	[%r8],%r10
__LX143:				; __L143:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_REFP0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x8		; 	xand	%r0,%r0,0x00000008
	ext	tia+0x89@ah	; 	xld.ub	%r10,[tia+137]
	ext	tia+0x89@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX151		; 	xjreq	__L151
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x89@ah	; 	xld.b	[tia+137],%r0
	ext	tia+0x89@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x3	; 	xsra	%r10,3
	ext	tia+0x3a@ah	; 	xld.b	[tia+58],%r10
	ext	tia+0x3a@al
	ld.b	[%r8],%r10
__LX151:				; __L151:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_REFP1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x8		; 	xand	%r0,%r0,0x00000008
	ext	tia+0x8a@ah	; 	xld.ub	%r10,[tia+138]
	ext	tia+0x8a@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX159		; 	xjreq	__L159
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x8a@ah	; 	xld.b	[tia+138],%r0
	ext	tia+0x8a@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x3	; 	xsra	%r10,3
	ext	tia+0x42@ah	; 	xld.b	[tia+66],%r10
	ext	tia+0x42@al
	ld.b	[%r8],%r10
__LX159:				; __L159:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_PF0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	0x3		; 	xand	%r0,%r0,0x000000f0
	and	%r0,0x30
	ext	tia+0x8b@ah	; 	xld.ub	%r10,[tia+139]
	ext	tia+0x8b@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX167		; 	xjreq	__L167
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x8b@ah	; 	xld.b	[tia+139],%r0
	ext	tia+0x8b@al
	ld.b	[%r8],%r0
	ext	mirror_table+0x0@h	; 	xld.ub	%r11,[%r0+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r0
	ld.ub	%r11,[%r9]
	sll	%r11,0x8	; 	xsll	%r11,16
	sll	%r11,0x8
	ext	tia+0x8c@ah	; 	xld.ub	%r10,[tia+140]
	ext	tia+0x8c@al
	ld.ub	%r10,[%r8]
	sll	%r10,0x8	; 	xsll	%r10,8
	or	%r11,%r10
	ext	tia+0x8d@ah	; 	xld.ub	%r10,[tia+141]
	ext	tia+0x8d@al
	ld.ub	%r10,[%r8]
	ext	mirror_table+0x0@h	; 	xld.ub	%r10,[%r10+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r10
	ld.ub	%r10,[%r9]
	or	%r11,%r10
	ext	tia+0x5c@ah	; 	xld.w	[tia+92],%r11
	ext	tia+0x5c@al
	ld.w	[%r8],%r11
__LX167:				; __L167:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_PF1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.ub	%r0,%r12
	ext	tia+0x8c@ah	; 	xld.ub	%r10,[tia+140]
	ext	tia+0x8c@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX175		; 	xjreq	__L175
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x8c@ah	; 	xld.b	[tia+140],%r0
	ext	tia+0x8c@al
	ld.b	[%r8],%r0
	ext	tia+0x8b@ah	; 	xld.ub	%r10,[tia+139]
	ext	tia+0x8b@al
	ld.ub	%r10,[%r8]
	ext	mirror_table+0x0@h	; 	xld.ub	%r10,[%r10+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r10
	ld.ub	%r10,[%r9]
	sll	%r10,0x8	; 	xsll	%r10,16
	sll	%r10,0x8
	ld.w	%r11,%r0
	sll	%r11,0x8	; 	xsll	%r11,8
	or	%r10,%r11
	ext	tia+0x8d@ah	; 	xld.ub	%r11,[tia+141]
	ext	tia+0x8d@al
	ld.ub	%r11,[%r8]
	ext	mirror_table+0x0@h	; 	xld.ub	%r11,[%r11+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r11
	ld.ub	%r11,[%r9]
	or	%r10,%r11
	ext	tia+0x5c@ah	; 	xld.w	[tia+92],%r10
	ext	tia+0x5c@al
	ld.w	[%r8],%r10
__LX175:				; __L175:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_PF2:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.ub	%r0,%r12
	ext	tia+0x8d@ah	; 	xld.ub	%r10,[tia+141]
	ext	tia+0x8d@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX183		; 	xjreq	__L183
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x8d@ah	; 	xld.b	[tia+141],%r0
	ext	tia+0x8d@al
	ld.b	[%r8],%r0
	ext	tia+0x8b@ah	; 	xld.ub	%r10,[tia+139]
	ext	tia+0x8b@al
	ld.ub	%r10,[%r8]
	ext	mirror_table+0x0@h	; 	xld.ub	%r11,[%r10+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r10
	ld.ub	%r11,[%r9]
	sll	%r11,0x8	; 	xsll	%r11,16
	sll	%r11,0x8
	ext	tia+0x8c@ah	; 	xld.ub	%r10,[tia+140]
	ext	tia+0x8c@al
	ld.ub	%r10,[%r8]
	sll	%r10,0x8	; 	xsll	%r10,8
	or	%r11,%r10
	ext	mirror_table+0x0@h	; 	xld.ub	%r10,[%r0+mirror_table]
	ext	mirror_table+0x0@m
	ld.w	%r9,mirror_table+0x0@l
	add	%r9,%r0
	ld.ub	%r10,[%r9]
	or	%r11,%r10
	ext	tia+0x5c@ah	; 	xld.w	[tia+92],%r11
	ext	tia+0x5c@al
	ld.w	[%r8],%r11
__LX183:				; __L183:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_RESP0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0xc@ah	; 	xld.w	%r10,[tia+12]
	ext	tia+0xc@al
	ld.w	%r10,[%r8]
	sub	%r10,0x3f	; 	xsub	%r10,%r10,63
	ext	tia+0x38@ah	; 	xld.b	[tia+56],%r10
	ext	tia+0x38@al
	ld.b	[%r8],%r10
	ld.ub	%r10,%r10
	ext	0x2		; 	xcmp	%r10,159
	cmp	%r10,0x1f
	jrule	__LX188		; 	xjrule	__L188
	ld.w	%r11,0x0
	ext	tia+0x38@ah	; 	xld.b	[tia+56],%r11
	ext	tia+0x38@al
	ld.b	[%r8],%r11
__LX188:				; __L188:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_RESP1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0xc@ah	; 	xld.w	%r10,[tia+12]
	ext	tia+0xc@al
	ld.w	%r10,[%r8]
	sub	%r10,0x3f	; 	xsub	%r10,%r10,63
	ext	tia+0x40@ah	; 	xld.b	[tia+64],%r10
	ext	tia+0x40@al
	ld.b	[%r8],%r10
	ld.ub	%r10,%r10
	ext	0x2		; 	xcmp	%r10,159
	cmp	%r10,0x1f
	jrule	__LX190		; 	xjrule	__L190
	ld.w	%r11,0x0
	ext	tia+0x40@ah	; 	xld.b	[tia+64],%r11
	ext	tia+0x40@al
	ld.b	[%r8],%r11
__LX190:				; __L190:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_RESM0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0xc@ah	; 	xld.w	%r10,[tia+12]
	ext	tia+0xc@al
	ld.w	%r10,[%r8]
	ext	0x1		; 	xsub	%r10,%r10,64
	sub	%r10,0x0
	ext	tia+0x48@ah	; 	xld.b	[tia+72],%r10
	ext	tia+0x48@al
	ld.b	[%r8],%r10
	ld.ub	%r10,%r10
	ext	0x2		; 	xcmp	%r10,159
	cmp	%r10,0x1f
	jrule	__LX192		; 	xjrule	__L192
	ld.w	%r11,0x0
	ext	tia+0x48@ah	; 	xld.b	[tia+72],%r11
	ext	tia+0x48@al
	ld.b	[%r8],%r11
__LX192:				; __L192:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_RESM1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0xc@ah	; 	xld.w	%r10,[tia+12]
	ext	tia+0xc@al
	ld.w	%r10,[%r8]
	ext	0x1		; 	xsub	%r10,%r10,64
	sub	%r10,0x0
	ext	tia+0x4c@ah	; 	xld.b	[tia+76],%r10
	ext	tia+0x4c@al
	ld.b	[%r8],%r10
	ld.ub	%r10,%r10
	ext	0x2		; 	xcmp	%r10,159
	cmp	%r10,0x1f
	jrule	__LX194		; 	xjrule	__L194
	ld.w	%r11,0x0
	ext	tia+0x4c@ah	; 	xld.b	[tia+76],%r11
	ext	tia+0x4c@al
	ld.b	[%r8],%r11
__LX194:				; __L194:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_RESBL:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0xc@ah	; 	xld.w	%r10,[tia+12]
	ext	tia+0xc@al
	ld.w	%r10,[%r8]
	ext	0x1		; 	xsub	%r10,%r10,64
	sub	%r10,0x0
	ext	tia+0x50@ah	; 	xld.b	[tia+80],%r10
	ext	tia+0x50@al
	ld.b	[%r8],%r10
	ld.ub	%r10,%r10
	ext	0x2		; 	xcmp	%r10,159
	cmp	%r10,0x1f
	jrule	__LX196		; 	xjrule	__L196
	ld.w	%r11,0x0
	ext	tia+0x50@ah	; 	xld.b	[tia+80],%r11
	ext	tia+0x50@al
	ld.b	[%r8],%r11
__LX196:				; __L196:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDC0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0xf	; 	xand	%r12,%r12,0x0000000f
	ext	tia+0x8e@ah	; 	xld.ub	%r10,[tia+142]
	ext	tia+0x8e@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX202		; 	xjreq	__L202
	ext	tia+0x8e@ah	; 	xld.b	[tia+142],%r12
	ext	tia+0x8e@al
	ld.b	[%r8],%r12
__LX202:				; __L202:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDC1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0xf	; 	xand	%r12,%r12,0x0000000f
	ext	tia+0x8f@ah	; 	xld.ub	%r10,[tia+143]
	ext	tia+0x8f@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX210		; 	xjreq	__L210
	ext	tia+0x8f@ah	; 	xld.b	[tia+143],%r12
	ext	tia+0x8f@al
	ld.b	[%r8],%r12
__LX210:				; __L210:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDF0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0x1f	; 	xand	%r12,%r12,0x0000001f
	ext	tia+0x90@ah	; 	xld.ub	%r10,[tia+144]
	ext	tia+0x90@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX218		; 	xjreq	__L218
	ext	tia+0x90@ah	; 	xld.b	[tia+144],%r12
	ext	tia+0x90@al
	ld.b	[%r8],%r12
	ext	0x1		; 	xadd	%r10,%r12,1
	add	%r10,%r12
	ext	tia+0x61@ah	; 	xld.b	[tia+97],%r10
	ext	tia+0x61@al
	ld.b	[%r8],%r10
__LX218:				; __L218:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDF1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0x1f	; 	xand	%r12,%r12,0x0000001f
	ext	tia+0x91@ah	; 	xld.ub	%r10,[tia+145]
	ext	tia+0x91@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX226		; 	xjreq	__L226
	ext	tia+0x91@ah	; 	xld.b	[tia+145],%r12
	ext	tia+0x91@al
	ld.b	[%r8],%r12
	ext	0x1		; 	xadd	%r10,%r12,1
	add	%r10,%r12
	ext	tia+0x71@ah	; 	xld.b	[tia+113],%r10
	ext	tia+0x71@al
	ld.b	[%r8],%r10
__LX226:				; __L226:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDV0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0xf	; 	xand	%r12,%r12,0x0000000f
	ext	tia+0x92@ah	; 	xld.ub	%r10,[tia+146]
	ext	tia+0x92@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX234		; 	xjreq	__L234
	ext	tia+0x92@ah	; 	xld.b	[tia+146],%r12
	ext	tia+0x92@al
	ld.b	[%r8],%r12
	ext	tia+0x60@ah	; 	xld.b	[tia+96],%r12
	ext	tia+0x60@al
	ld.b	[%r8],%r12
__LX234:				; __L234:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_AUDV1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	and	%r12,0xf	; 	xand	%r12,%r12,0x0000000f
	ext	tia+0x93@ah	; 	xld.ub	%r10,[tia+147]
	ext	tia+0x93@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX242		; 	xjreq	__L242
	ext	tia+0x93@ah	; 	xld.b	[tia+147],%r12
	ext	tia+0x93@al
	ld.b	[%r8],%r12
	ext	tia+0x70@ah	; 	xld.b	[tia+112],%r12
	ext	tia+0x70@al
	ld.b	[%r8],%r12
__LX242:				; __L242:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_GRP0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	tia+0x3c@ah	; 	xld.ub	%r10,[tia+60]
	ext	tia+0x3c@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jrne	__LX247		; 	xjrne	__L247
	ext	tia+0x45@ah	; 	xld.ub	%r11,[tia+69]
	ext	tia+0x45@al
	ld.ub	%r11,[%r8]
	ext	tia+0x44@ah	; 	xld.ub	%r10,[tia+68]
	ext	tia+0x44@al
	ld.ub	%r10,[%r8]
	cmp	%r11,%r10
	jreq	__LX246		; 	xjreq	__L246
__LX247:				; __L247:
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x3c@ah	; 	xld.b	[tia+60],%r0
	ext	tia+0x3c@al
	ld.b	[%r8],%r0
	ext	tia+0x44@ah	; 	xld.ub	%r10,[tia+68]
	ext	tia+0x44@al
	ld.ub	%r10,[%r8]
	ext	tia+0x45@ah	; 	xld.b	[tia+69],%r10
	ext	tia+0x45@al
	ld.b	[%r8],%r10
__LX246:				; __L246:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_GRP1:
;	.frame	%sp,12,$31		# vars= 0, regs= 3/0, args= 0, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	ld.w	%r1,%r12
	ext	tia+0x0@h	; 	xld.w	%r0,tia
	ext	tia+0x0@m
	ld.w	%r0,tia+0x0@l
	ext	tia+0x44@ah	; 	xld.ub	%r10,[tia+68]
	ext	tia+0x44@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r1
	jrne	__LX250		; 	xjrne	__L250
	ext	tia+0x3d@ah	; 	xld.ub	%r11,[tia+61]
	ext	tia+0x3d@al
	ld.ub	%r11,[%r8]
	ext	tia+0x3c@ah	; 	xld.ub	%r10,[tia+60]
	ext	tia+0x3c@al
	ld.ub	%r10,[%r8]
	cmp	%r11,%r10
	jrne	__LX250		; 	xjrne	__L250
	ext	tia+0x54@ah	; 	xld.ub	%r11,[tia+84]
	ext	tia+0x54@al
	ld.ub	%r11,[%r8]
	ext	tia+0x53@ah	; 	xld.ub	%r10,[tia+83]
	ext	tia+0x53@al
	ld.ub	%r10,[%r8]
	cmp	%r11,%r10
	jreq	__LX249		; 	xjreq	__L249
__LX250:				; __L250:
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	0x44		; 	xld.b	[%r0+68],%r1
	ld.b	[%r0],%r1
	ext	0x3c		; 	xld.ub	%r10,[%r0+60]
	ld.ub	%r10,[%r0]
	ext	0x3d		; 	xld.b	[%r0+61],%r10
	ld.b	[%r0],%r10
	ext	0x53		; 	xld.ub	%r10,[%r0+83]
	ld.ub	%r10,[%r0]
	ext	0x54		; 	xld.b	[%r0+84],%r10
	ld.b	[%r0],%r10
__LX249:				; __L249:
	ld.w	%r10,0x0
	popn	%r1
	ret
	.align	1
tia_write_ENAM0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x94@ah	; 	xld.ub	%r10,[tia+148]
	ext	tia+0x94@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX255		; 	xjreq	__L255
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x94@ah	; 	xld.b	[tia+148],%r0
	ext	tia+0x94@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x1	; 	xsra	%r10,1
	ext	tia+0x4b@ah	; 	xld.b	[tia+75],%r10
	ext	tia+0x4b@al
	ld.b	[%r8],%r10
__LX255:				; __L255:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_ENAM1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x95@ah	; 	xld.ub	%r10,[tia+149]
	ext	tia+0x95@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX263		; 	xjreq	__L263
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x95@ah	; 	xld.b	[tia+149],%r0
	ext	tia+0x95@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x1	; 	xsra	%r10,1
	ext	tia+0x4f@ah	; 	xld.b	[tia+79],%r10
	ext	tia+0x4f@al
	ld.b	[%r8],%r10
__LX263:				; __L263:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_ENABL:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x96@ah	; 	xld.ub	%r10,[tia+150]
	ext	tia+0x96@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX271		; 	xjreq	__L271
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x96@ah	; 	xld.b	[tia+150],%r0
	ext	tia+0x96@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x1	; 	xsra	%r10,1
	ext	tia+0x53@ah	; 	xld.b	[tia+83],%r10
	ext	tia+0x53@al
	ld.b	[%r8],%r10
__LX271:				; __L271:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_HMP0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	0x3		; 	xand	%r12,%r12,0x000000f0
	and	%r12,0x30
	ext	tia+0x97@ah	; 	xld.ub	%r10,[tia+151]
	ext	tia+0x97@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX280		; 	xjreq	__L280
	ext	tia+0x97@ah	; 	xld.b	[tia+151],%r12
	ext	tia+0x97@al
	ld.b	[%r8],%r12
__LX280:				; __L280:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_HMP1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	0x3		; 	xand	%r12,%r12,0x000000f0
	and	%r12,0x30
	ext	tia+0x98@ah	; 	xld.ub	%r10,[tia+152]
	ext	tia+0x98@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX288		; 	xjreq	__L288
	ext	tia+0x98@ah	; 	xld.b	[tia+152],%r12
	ext	tia+0x98@al
	ld.b	[%r8],%r12
__LX288:				; __L288:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_HMM0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	0x3		; 	xand	%r12,%r12,0x000000f0
	and	%r12,0x30
	ext	tia+0x99@ah	; 	xld.ub	%r10,[tia+153]
	ext	tia+0x99@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX296		; 	xjreq	__L296
	ext	tia+0x99@ah	; 	xld.b	[tia+153],%r12
	ext	tia+0x99@al
	ld.b	[%r8],%r12
__LX296:				; __L296:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_HMM1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	0x3		; 	xand	%r12,%r12,0x000000f0
	and	%r12,0x30
	ext	tia+0x9a@ah	; 	xld.ub	%r10,[tia+154]
	ext	tia+0x9a@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX304		; 	xjreq	__L304
	ext	tia+0x9a@ah	; 	xld.b	[tia+154],%r12
	ext	tia+0x9a@al
	ld.b	[%r8],%r12
__LX304:				; __L304:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_HMBL:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	0x3		; 	xand	%r12,%r12,0x000000f0
	and	%r12,0x30
	ext	tia+0x9b@ah	; 	xld.ub	%r10,[tia+155]
	ext	tia+0x9b@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r12
	jreq	__LX312		; 	xjreq	__L312
	ext	tia+0x9b@ah	; 	xld.b	[tia+155],%r12
	ext	tia+0x9b@al
	ld.b	[%r8],%r12
__LX312:				; __L312:
	ld.w	%r10,0x0
	ret
	.align	1
tia_write_VDELP0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x1		; 	xand	%r0,%r0,0x00000001
	ext	tia+0x3b@ah	; 	xld.ub	%r10,[tia+59]
	ext	tia+0x3b@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX319		; 	xjreq	__L319
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x3b@ah	; 	xld.b	[tia+59],%r0
	ext	tia+0x3b@al
	ld.b	[%r8],%r0
__LX319:				; __L319:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_VDELP1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x1		; 	xand	%r0,%r0,0x00000001
	ext	tia+0x43@ah	; 	xld.ub	%r10,[tia+67]
	ext	tia+0x43@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX327		; 	xjreq	__L327
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x43@ah	; 	xld.b	[tia+67],%r0
	ext	tia+0x43@al
	ld.b	[%r8],%r0
__LX327:				; __L327:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_VDELBL:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x1		; 	xand	%r0,%r0,0x00000001
	ext	tia+0x52@ah	; 	xld.ub	%r10,[tia+82]
	ext	tia+0x52@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX335		; 	xjreq	__L335
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x52@ah	; 	xld.b	[tia+82],%r0
	ext	tia+0x52@al
	ld.b	[%r8],%r0
__LX335:				; __L335:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_RESMP0:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x9c@ah	; 	xld.ub	%r10,[tia+156]
	ext	tia+0x9c@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX346		; 	xjreq	__L346
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x9c@ah	; 	xld.b	[tia+156],%r0
	ext	tia+0x9c@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x1	; 	xsra	%r10,1
	and	%r10,0x1	; 	xand	%r10,%r10,0x00000001
	ext	tia+0x4a@ah	; 	xld.b	[tia+74],%r10
	ext	tia+0x4a@al
	ld.b	[%r8],%r10
	jrne	__LX346		; 	xjrne	__L346
	ext	tia+0x38@ah	; 	xld.ub	%r10,[tia+56]
	ext	tia+0x38@al
	ld.ub	%r10,[%r8]
	ext	tia+0x48@ah	; 	xld.b	[tia+72],%r10
	ext	tia+0x48@al
	ld.b	[%r8],%r10
__LX346:				; __L346:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_RESMP1:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	and	%r0,0x2		; 	xand	%r0,%r0,0x00000002
	ext	tia+0x9d@ah	; 	xld.ub	%r10,[tia+157]
	ext	tia+0x9d@al
	ld.ub	%r10,[%r8]
	cmp	%r10,%r0
	jreq	__LX355		; 	xjreq	__L355
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x9d@ah	; 	xld.b	[tia+157],%r0
	ext	tia+0x9d@al
	ld.b	[%r8],%r0
	ld.w	%r10,%r0
	sra	%r10,0x1	; 	xsra	%r10,1
	and	%r10,0x1	; 	xand	%r10,%r10,0x00000001
	ext	tia+0x4e@ah	; 	xld.b	[tia+78],%r10
	ext	tia+0x4e@al
	ld.b	[%r8],%r10
	jrne	__LX355		; 	xjrne	__L355
	ext	tia+0x40@ah	; 	xld.ub	%r10,[tia+64]
	ext	tia+0x40@al
	ld.ub	%r10,[%r8]
	ext	tia+0x4c@ah	; 	xld.b	[tia+76],%r10
	ext	tia+0x4c@al
	ld.b	[%r8],%r10
__LX355:				; __L355:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_HMOVE:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ext	tia+0x0@h	; 	xld.w	%r0,tia
	ext	tia+0x0@m
	ld.w	%r0,tia+0x0@l
	ext	tia+0x97@ah	; 	xld.ub	%r10,[tia+151]
	ext	tia+0x97@al
	ld.ub	%r10,[%r8]
	cmp	%r10,0x0
	jrne	__LX359		; 	xjrne	__L359
	ext	tia+0x98@ah	; 	xld.w	%r10,[tia+152]
	ext	tia+0x98@al
	ld.w	%r10,[%r8]
	cmp	%r10,0x0
	jreq	__LX358		; 	xjreq	__L358
__LX359:				; __L359:
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x38@ah	; 	xld.ub	%r11,[tia+56]
	ext	tia+0x38@al
	ld.ub	%r11,[%r8]
	ext	tia+0x97@ah	; 	xld.b	%r10,[tia+151]
	ext	tia+0x97@al
	ld.b	%r10,[%r8]
	sra	%r10,0x4	; 	xsra	%r10,4
	sub	%r11,%r10
	jrge	__LX363		; 	xjrge	__L363
	ext	0x2		; 	xadd	%r11,%r11,160
	add	%r11,0x20
__LX363:				; __L363:
	ext	0x2		; 	xld.w	%r12,0x0000009f		; 159
	ld.w	%r12,0x1f
	cmp	%r11,%r12
	jrle	__LX364		; 	xjrle	__L364
	ext	0x2		; 	xsub	%r11,%r11,160
	sub	%r11,0x20
__LX364:				; __L364:
	ext	tia+0x38@ah	; 	xld.b	[tia+56],%r11
	ext	tia+0x38@al
	ld.b	[%r8],%r11
	ext	tia+0x40@ah	; 	xld.ub	%r11,[tia+64]
	ext	tia+0x40@al
	ld.ub	%r11,[%r8]
	ext	tia+0x98@ah	; 	xld.b	%r10,[tia+152]
	ext	tia+0x98@al
	ld.b	%r10,[%r8]
	sra	%r10,0x4	; 	xsra	%r10,4
	sub	%r11,%r10
	jrge	__LX369		; 	xjrge	__L369
	ext	0x2		; 	xadd	%r11,%r11,160
	add	%r11,0x20
__LX369:				; __L369:
	cmp	%r11,%r12
	jrle	__LX370		; 	xjrle	__L370
	ext	0x2		; 	xsub	%r11,%r11,160
	sub	%r11,0x20
__LX370:				; __L370:
	ext	tia+0x40@ah	; 	xld.b	[tia+64],%r11
	ext	tia+0x40@al
	ld.b	[%r8],%r11
	ext	tia+0x48@ah	; 	xld.ub	%r11,[tia+72]
	ext	tia+0x48@al
	ld.ub	%r11,[%r8]
	ext	tia+0x99@ah	; 	xld.b	%r10,[tia+153]
	ext	tia+0x99@al
	ld.b	%r10,[%r8]
	sra	%r10,0x4	; 	xsra	%r10,4
	sub	%r11,%r10
	jrge	__LX375		; 	xjrge	__L375
	ext	0x2		; 	xadd	%r11,%r11,160
	add	%r11,0x20
__LX375:				; __L375:
	cmp	%r11,%r12
	jrle	__LX376		; 	xjrle	__L376
	ext	0x2		; 	xsub	%r11,%r11,160
	sub	%r11,0x20
__LX376:				; __L376:
	ext	tia+0x48@ah	; 	xld.b	[tia+72],%r11
	ext	tia+0x48@al
	ld.b	[%r8],%r11
	ext	tia+0x4c@ah	; 	xld.ub	%r11,[tia+76]
	ext	tia+0x4c@al
	ld.ub	%r11,[%r8]
	ext	tia+0x9a@ah	; 	xld.b	%r10,[tia+154]
	ext	tia+0x9a@al
	ld.b	%r10,[%r8]
	sra	%r10,0x4	; 	xsra	%r10,4
	sub	%r11,%r10
	jrge	__LX381		; 	xjrge	__L381
	ext	0x2		; 	xadd	%r11,%r11,160
	add	%r11,0x20
__LX381:				; __L381:
	cmp	%r11,%r12
	jrle	__LX382		; 	xjrle	__L382
	ext	0x2		; 	xsub	%r11,%r11,160
	sub	%r11,0x20
__LX382:				; __L382:
	ext	tia+0x4c@ah	; 	xld.b	[tia+76],%r11
	ext	tia+0x4c@al
	ld.b	[%r8],%r11
	ext	tia+0x50@ah	; 	xld.ub	%r11,[tia+80]
	ext	tia+0x50@al
	ld.ub	%r11,[%r8]
	ext	tia+0x9b@ah	; 	xld.b	%r10,[tia+155]
	ext	tia+0x9b@al
	ld.b	%r10,[%r8]
	sra	%r10,0x4	; 	xsra	%r10,4
	sub	%r11,%r10
	jrge	__LX387		; 	xjrge	__L387
	ext	0x2		; 	xadd	%r11,%r11,160
	add	%r11,0x20
__LX387:				; __L387:
	cmp	%r11,%r12
	jrle	__LX388		; 	xjrle	__L388
	ext	0x2		; 	xsub	%r11,%r11,160
	sub	%r11,0x20
__LX388:				; __L388:
	ext	0x50		; 	xld.b	[%r0+80],%r11
	ld.b	[%r0],%r11
__LX358:				; __L358:
	ld.w	%r10,0x0
	popn	%r0
	ret
	.align	1
tia_write_HMCLR:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ld.w	%r11,0x0
	ext	tia+0x97@ah	; 	xld.b	[tia+151],%r11
	ext	tia+0x97@al
	ld.b	[%r8],%r11
	ext	tia+0x98@ah	; 	xld.b	[tia+152],%r11
	ext	tia+0x98@al
	ld.b	[%r8],%r11
	ext	tia+0x99@ah	; 	xld.b	[tia+153],%r11
	ext	tia+0x99@al
	ld.b	[%r8],%r11
	ext	tia+0x9a@ah	; 	xld.b	[tia+154],%r11
	ext	tia+0x9a@al
	ld.b	[%r8],%r11
	ext	tia+0x9b@ah	; 	xld.b	[tia+155],%r11
	ext	tia+0x9b@al
	ld.b	[%r8],%r11
	ld.w	%r10,0x0
	ret
	.align	1
	.global	tia_write_CXCLR
tia_write_CXCLR:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ld.w	%r11,0x0
	ext	tia+0x18@ah	; 	xld.h	[tia+24],%r11
	ext	tia+0x18@al
	ld.h	[%r8],%r11
	ld.w	%r10,0x0
	ret
	.global	tia_write_table
	.data
	.align	2
tia_write_table:
	.word	tia_write_VSYNC
	.word	tia_write_VBLANK
	.word	tia_write_WSYNC
	.word	tia_write_RSYNC
	.word	tia_write_NUSIZ0
	.word	tia_write_NUSIZ1
	.word	tia_write_COLUP0
	.word	tia_write_COLUP1
	.word	tia_write_COLUPF
	.word	tia_write_COLUBK
	.word	tia_write_CTRLPF
	.word	tia_write_REFP0
	.word	tia_write_REFP1
	.word	tia_write_PF0
	.word	tia_write_PF1
	.word	tia_write_PF2
	.word	tia_write_RESP0
	.word	tia_write_RESP1
	.word	tia_write_RESM0
	.word	tia_write_RESM1
	.word	tia_write_RESBL
	.word	tia_write_AUDC0
	.word	tia_write_AUDC1
	.word	tia_write_AUDF0
	.word	tia_write_AUDF1
	.word	tia_write_AUDV0
	.word	tia_write_AUDV1
	.word	tia_write_GRP0
	.word	tia_write_GRP1
	.word	tia_write_ENAM0
	.word	tia_write_ENAM1
	.word	tia_write_ENABL
	.word	tia_write_HMP0
	.word	tia_write_HMP1
	.word	tia_write_HMM0
	.word	tia_write_HMM1
	.word	tia_write_HMBL
	.word	tia_write_VDELP0
	.word	tia_write_VDELP1
	.word	tia_write_VDELBL
	.word	tia_write_RESMP0
	.word	tia_write_RESMP1
	.word	tia_write_HMOVE
	.word	tia_write_HMCLR
	.word	tia_write_CXCLR
	.code
	.align	1
tia_read_CXM0P:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	and	%r10,0x3	; 	xand	%r10,%r10,0x00000003
	sll	%r10,0x6	; 	xsll	%r10,6
	ret
	.align	1
tia_read_CXM1P:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	sll	%r10,0x4	; 	xsll	%r10,4
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXP0FB:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	sll	%r10,0x2	; 	xsll	%r10,2
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXP1FB:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXM0FB:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	srl	%r10,0x2	; 	xsrl	%r10,2
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXM1FB:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	srl	%r10,0x4	; 	xsrl	%r10,4
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXBLPF:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	srl	%r10,0x6	; 	xsrl	%r10,6
	ext	0x3		; 	xand	%r10,%r10,0x000000c0
	and	%r10,0x0
	ret
	.align	1
tia_read_CXPPMM:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia_partial_update@rm	; 	xcall	tia_partial_update
	call	tia_partial_update@rl
	ext	tia+0x18@ah	; 	xld.uh	%r10,[tia+24]
	ext	tia+0x18@al
	ld.uh	%r10,[%r8]
	srl	%r10,0x8	; 	xsrl	%r10,14
	srl	%r10,0x6
	sll	%r10,0x6	; 	xsll	%r10,6
	ret
	.align	1
tia_read_INPT0:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0x9e@ah	; 	xld.ub	%r10,[tia+158]
	ext	tia+0x9e@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_INPT1:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0x9f@ah	; 	xld.ub	%r10,[tia+159]
	ext	tia+0x9f@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_INPT2:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0xa0@ah	; 	xld.ub	%r10,[tia+160]
	ext	tia+0xa0@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_INPT3:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0xa1@ah	; 	xld.ub	%r10,[tia+161]
	ext	tia+0xa1@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_INPT4:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0xa2@ah	; 	xld.ub	%r10,[tia+162]
	ext	tia+0xa2@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_INPT5:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0xa3@ah	; 	xld.ub	%r10,[tia+163]
	ext	tia+0xa3@al
	ld.ub	%r10,[%r8]
	ret
	.align	1
tia_read_ERROR:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ld.w	%r10,0x0
	ret
	.global	tia_read_table
	.data
	.align	2
tia_read_table:
	.word	tia_read_CXM0P
	.word	tia_read_CXM1P
	.word	tia_read_CXP0FB
	.word	tia_read_CXP1FB
	.word	tia_read_CXM0FB
	.word	tia_read_CXM1FB
	.word	tia_read_CXBLPF
	.word	tia_read_CXPPMM
	.word	tia_read_INPT0
	.word	tia_read_INPT1
	.word	tia_read_INPT2
	.word	tia_read_INPT3
	.word	tia_read_INPT4
	.word	tia_read_INPT5
	.word	tia_read_ERROR
	.word	tia_read_ERROR
; APP
	
	.code
	.align	1
	.global	tia_read
tia_read:
	ext	tia_scan_progress@rm	; 	xcall.d	tia_scan_progress	; tia_scan_progress(now) (tia_scan_progress()のアセンブラ実装は、%r13-15を破壊しません)
	call.d	tia_scan_progress@rl
	and	%r13, 0xf		; *delay*
	;
	sll	%r13,0x2	; 	xsll	%r13, 2
	ext	tia_read_table@ah	; return tia_read_table[addr]()
	ext	tia_read_table@al
	ld.w	%r13, [%r13]
	jp	%r13			; !INTERLOCK!

; NO_APP
	.code
	.align	1
	.global	tia_set_i4_i5
tia_set_i4_i5:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	tia+0x1a@ah	; 	xld.b	[tia+26],%r12
	ext	tia+0x1a@al
	ld.b	[%r8],%r12
	ext	tia+0x1b@ah	; 	xld.b	[tia+27],%r13
	ext	tia+0x1b@al
	ld.b	[%r8],%r13
	ext	tia+0x81@ah	; 	xld.ub	%r10,[tia+129]
	ext	tia+0x81@al
	ld.ub	%r10,[%r8]
	ext	0x1		; 	xand	%r10,%r10,0x00000040
	and	%r10,0x0
	jreq	__LX408		; 	xjreq	__L408
	ld.w	%r10,%r12
	sll	%r10,0x7	; 	xsll	%r10,7
	ext	tia+0xa2@ah	; 	xld.ub	%r11,[tia+162]
	ext	tia+0xa2@al
	ld.ub	%r11,[%r8]
	and	%r11,%r10
	ld.w	%r10,%r11
	ext	tia+0xa2@ah	; 	xld.b	[tia+162],%r10
	ext	tia+0xa2@al
	ld.b	[%r8],%r10
	ld.w	%r10,%r13
	sll	%r10,0x7	; 	xsll	%r10,7
	ext	tia+0xa3@ah	; 	xld.ub	%r11,[tia+163]
	ext	tia+0xa3@al
	ld.ub	%r11,[%r8]
	and	%r11,%r10
	ld.w	%r10,%r11
	jp	__LX410		; 	xjp	__L410
__LX408:				; __L408:
	ld.w	%r10,%r12
	sll	%r10,0x7	; 	xsll	%r10,7
	ext	tia+0xa2@ah	; 	xld.b	[tia+162],%r10
	ext	tia+0xa2@al
	ld.b	[%r8],%r10
	ld.w	%r10,%r13
	sll	%r10,0x7	; 	xsll	%r10,7
__LX410:				; __L410:
	ext	tia+0xa3@ah	; 	xld.b	[tia+163],%r10
	ext	tia+0xa3@al
	ld.b	[%r8],%r10
	ret
	.global	tia_audio_mix_table
	.data
	.align	2
tia_audio_mix_table:
	.word	tia_audio_mix0
	.word	tia_audio_mix1
	.word	tia_audio_mix2
	.word	tia_audio_mix3
	.word	tia_audio_mix4
	.word	tia_audio_mix4
	.word	tia_audio_mix6
	.word	tia_audio_mix7
	.word	tia_audio_mix8
	.word	tia_audio_mix9
	.word	tia_audio_mixA
	.word	tia_audio_mix0
	.word	tia_audio_mixC
	.word	tia_audio_mixC
	.word	tia_audio_mixE
	.word	tia_audio_mixF
	.code
	.align	1
	.global	tia_mix
tia_mix:
;	.frame	%sp,16,$31		# vars= 4, regs= 3/0, args= 0, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	sub	%sp,0x1		; 	xsub	%sp,%sp,4
	ld.w	%r0,%r12
	ext	tia+0x0@h	; 	xld.w	%r1,tia
	ext	tia+0x0@m
	ld.w	%r1,tia+0x0@l
	ld.w	%r13,0x0
	ext	0xa		; 	xld.w	%r14,0x00000280		; 640
	ld.w	%r14,0x0
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
	ext	tia+0x8e@ah	; 	xld.ub	%r10,[tia+142]
	ext	tia+0x8e@al
	ld.ub	%r10,[%r8]
	sll	%r10,0x2	; 	xsll	%r10,2
	ext	tia_audio_mix_table+0x0@h	; 	xld.w	%r10,[%r10+tia_audio_mix_table]
	ext	tia_audio_mix_table+0x0@m
	ld.w	%r9,tia_audio_mix_table+0x0@l
	add	%r9,%r10
	ld.w	%r10,[%r9]
	ext	0x60		; 	xadd	%r12,%r1,96
	add	%r12,%r1
	ld.w	%r13,%r0
	call	%r10
	ext	tia+0x8f@ah	; 	xld.ub	%r10,[tia+143]
	ext	tia+0x8f@al
	ld.ub	%r10,[%r8]
	sll	%r10,0x2	; 	xsll	%r10,2
	ext	tia_audio_mix_table+0x0@h	; 	xld.w	%r10,[%r10+tia_audio_mix_table]
	ext	tia_audio_mix_table+0x0@m
	ld.w	%r9,tia_audio_mix_table+0x0@l
	add	%r9,%r10
	ld.w	%r10,[%r9]
	ext	0x70		; 	xadd	%r12,%r1,112
	add	%r12,%r1
	ld.w	%r13,%r0
	call	%r10
	ld.w	%r12,%r0
	ext	tia_volume_shift@rm	; 	xcall	tia_volume_shift
	call	tia_volume_shift@rl
	add	%sp,0x1		; 	xadd	%sp,%sp,4
	popn	%r1
	ret
	.align	1
	.global	pia_reset
pia_reset:
;	.frame	%sp,8,$31		# vars= 0, regs= 2/0, args= 0, extra= 0
;	.mask	0x80010000,-4
;	.fmask	0x00000000,0
	pushn	%r0
	ld.w	%r0,%r12
	ext	pia+0x0@h	; 	xld.w	%r12,pia
	ext	pia+0x0@m
	ld.w	%r12,pia+0x0@l
	ld.w	%r13,0x0
	ld.w	%r14,0x10	; 	xld.w	%r14,0x00000010		; 16
	ext	memset@rm	; 	xcall	memset
	call	memset@rl
	ext	pia+0x4@ah	; 	xld.w	[pia+4],%r0
	ext	pia+0x4@al
	ld.w	[%r8],%r0
	popn	%r0
	ret
	.align	1
pia_timer_progress:
;	.frame	%sp,4,$31		# vars= 0, regs= 1/0, args= 0, extra= 0
;	.mask	0x80000000,-4
;	.fmask	0x00000000,0
	ext	pia+0x4@ah	; 	xld.w	%r10,[pia+4]
	ext	pia+0x4@al
	ld.w	%r10,[%r8]
	ld.w	%r11,%r12
	sub	%r11,%r10
	ext	0x137		; 	xld.w	%r10,0x00004dc8		; 19912
	ld.w	%r10,0x8
	cmp	%r11,%r10
	jrule	__LX414		; 	xjrule	__L414
	ld.w	%r11,%r10
__LX414:				; __L414:
	ext	pia+0x4@ah	; 	xld.w	[pia+4],%r12
	ext	pia+0x4@al
	ld.w	[%r8],%r12
	ext	pia+0xc@ah	; 	xld.w	%r10,[pia+12]
	ext	pia+0xc@al
	ld.w	%r10,[%r8]
	cmp	%r10,%r11
	jruge	__LX415		; 	xjruge	__L415
	ld.w	%r13,0x0
	ext	pia+0x8@ah	; 	xld.w	[pia+8],%r13
	ext	pia+0x8@al
	ld.w	[%r8],%r13
__LX415:				; __L415:
	sub	%r10,%r11
	ext	pia+0xc@ah	; 	xld.w	[pia+12],%r10
	ext	pia+0xc@al
	ld.w	[%r8],%r10
	ret
	.align	1
	.global	pia_write
pia_write:
;	.frame	%sp,16,$31		# vars= 0, regs= 4/0, args= 0, extra= 0
;	.mask	0x80070000,-4
;	.fmask	0x00000000,0
	pushn	%r2
	ld.w	%r0,%r13
	ld.w	%r1,%r14
	ext	pia+0x0@h	; 	xld.w	%r2,pia
	ext	pia+0x0@m
	ld.w	%r2,pia+0x0@l
	call	pia_timer_progress	; 	xcall	pia_timer_progress
	ext	0x280		; 	xsub	%r10,%r0,640
	sub	%r10,%r0
	cmp	%r10,0x17	; 	xcmp	%r10,23
	jrugt	__L416		; 	xjrugt	__L416
	sll	%r10,0x2	; 	xsll	%r10,2
	ext	__L426+0x0@h	; 	xld.w	%r10,[%r10+__L426]
	ext	__L426+0x0@m
	ld.w	%r9,__L426+0x0@l
	add	%r9,%r10
	ld.w	%r10,[%r9]
	jp	%r10
	.code
	.align	2
__L426:
	.word	__L418
	.word	__L419
	.word	__L420
	.word	__L421
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L416
	.word	__L422
	.word	__L423
	.word	__L424
	.word	__L425
	.code
__L418:
	ld.b	[%r2],%r1	; 	xld.b	[%r2],%r1
	jp	__L416		; 	xjp	__L416
__L419:
	ext	0x1		; 	xld.b	[%r2+1],%r1
	ld.b	[%r2],%r1
	jp	__L416		; 	xjp	__L416
__L420:
	ext	0x2		; 	xld.b	[%r2+2],%r1
	ld.b	[%r2],%r1
	jp	__L416		; 	xjp	__L416
__L421:
	ext	0x3		; 	xld.b	[%r2+3],%r1
	ld.b	[%r2],%r1
	jp	__L416		; 	xjp	__L416
__L422:
	ld.w	%r11,0x0
	ext	0x8		; 	xld.w	[%r2+8],%r11
	ld.w	[%r2],%r11
	ext	0xc		; 	xld.w	[%r2+12],%r1
	ld.w	[%r2],%r1
	jp	__L416		; 	xjp	__L416
__L423:
	ld.w	%r10,0x3	; 	xld.w	%r10,0x00000003		; 3
	jp	__LX428		; 	xjp	__L428
__L424:
	ld.w	%r10,0x6	; 	xld.w	%r10,0x00000006		; 6
	jp	__LX428		; 	xjp	__L428
__L425:
	ld.w	%r10,0xa	; 	xld.w	%r10,0x0000000a		; 10
__LX428:				; __L428:
	ext	0x8		; 	xld.w	[%r2+8],%r10
	ld.w	[%r2],%r10
	ld.w	%r9,%r10	; 	xsll	%r1,%r10
	and	%r9,0x1f
	cmp	%r9,0x8
	jrle	4
	sll	%r1,0x8
	jp.d	-3
	sub	%r9,0x8
	sll	%r1,%r9
	ld.w	%r10,%r1
	ext	0xc		; 	xld.w	[%r2+12],%r10
	ld.w	[%r2],%r10
__L416:
	popn	%r2
	ret
	.align	1
	.global	pia_read
pia_read:
;	.frame	%sp,12,$31		# vars= 0, regs= 3/0, args= 0, extra= 0
;	.mask	0x80030000,-4
;	.fmask	0x00000000,0
	pushn	%r1
	ld.w	%r0,%r13
	ext	pia+0x0@h	; 	xld.w	%r1,pia
	ext	pia+0x0@m
	ld.w	%r1,pia+0x0@l
	ext	pia_timer_progress@rm	; 	xcall	pia_timer_progress
	call	pia_timer_progress@rl
	ext	0x280		; 	xsub	%r10,%r0,640
	sub	%r10,%r0
	cmp	%r10,0x4	; 	xcmp	%r10,4
	jrugt	__LX430		; 	xjrugt	__L430
	sll	%r10,0x2	; 	xsll	%r10,2
	ext	__L436+0x0@h	; 	xld.w	%r10,[%r10+__L436]
	ext	__L436+0x0@m
	ld.w	%r9,__L436+0x0@l
	add	%r9,%r10
	ld.w	%r10,[%r9]
	jp	%r10
	.code
	.align	2
__L436:
	.word	__L431
	.word	__L432
	.word	__L433
	.word	__L434
	.word	__L435
	.code
__L431:
	ld.ub	%r10,[%r1]	; 	xld.ub	%r10,[%r1]
	jp	__LX438		; 	xjp	__L438
__L432:
	ext	0x1		; 	xld.ub	%r10,[%r1+1]
	ld.ub	%r10,[%r1]
	jp	__LX438		; 	xjp	__L438
__L433:
	ext	0x2		; 	xld.ub	%r10,[%r1+2]
	ld.ub	%r10,[%r1]
	jp	__LX438		; 	xjp	__L438
__L434:
	ext	0x3		; 	xld.ub	%r10,[%r1+3]
	ld.ub	%r10,[%r1]
	jp	__LX438		; 	xjp	__L438
__L435:
	ext	0xc		; 	xld.w	%r10,[%r1+12]
	ld.w	%r10,[%r1]
	ext	0x8		; 	xld.w	%r11,[%r1+8]
	ld.w	%r11,[%r1]
	ld.w	%r9,%r11	; 	xsrl	%r10,%r11
	and	%r9,0x1f
	cmp	%r9,0x8
	jrle	4
	srl	%r10,0x8
	jp.d	-3
	sub	%r9,0x8
	srl	%r10,%r9
	ld.ub	%r10,%r10
	jp	__LX438		; 	xjp	__L438
__LX430:				; __L430:
	ld.w	%r10,0x0
__LX438:				; __L438:
	popn	%r1
	ret

	.comm	tia 164

	.comm	pia 16

