;
; File generated by cc65 v 2.13.2
;
	.fopt		compiler,"cc65 v 2.13.2"
	.setcpu		"65C02"
	.smart		on
	.autoimport	on
	.case		on
	.debuginfo	off
	.importzp	sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
	.macpack	longbranch
	.import		_joy_masks
	.import		_joy_read
	.import		_tgi_setviewpage
	.import		_tgi_setdrawpage
	.import		_tgi_getcolorcount
	.import		_tgi_setcolor
	.import		_tgi_setpalette
	.import		_tgi_getdefpalette
	.import		_tgi_getxres
	.import		_tgi_getyres
	.import		_tgi_getpixel
	.import		_tgi_setpixel
	.import		_tgi_bar
	.import		_tgi_outtextxy
	.import		_tgi_ioctl
	.import		_abc_update
	.export		_b
	.import		_drawpage
	.export		_topBound
	.export		_bottomBound
	.export		_leftBound
	.export		_rightBound
	.export		_draw_ball
	.export		_bounce_ball
	.export		_move_ball
	.export		_drawLevel
	.export		_maingame

.segment	"MAINGAME_DATA"

_b:
	.byte	$01

.segment	"MAINGAME_RODATA"

L0001:
	.byte	$43,$41,$54,$4B,$41,$4E,$4F,$49,$44,$00,$62,$79,$20,$53,$65,$62
	.byte	$61,$73,$74,$69,$61,$6E,$20,$4D,$69,$68,$61,$69,$00,$50,$00,$4F
	.byte	$00,$57,$00,$45,$00,$52,$00

.segment	"MAINGAME_BSS"

_drawPending:
	.res	1,$00
_topBound:
	.res	2,$00
_bottomBound:
	.res	2,$00
_leftBound:
	.res	2,$00
_rightBound:
	.res	2,$00

; ---------------------------------------------------------------
; void __near__ usleep (int)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_usleep: near

.segment	"MAINGAME_CODE"

	jsr     decsp2
	ldx     #$00
	txa
L0452:	jsr     stax0sp
	ldy     #$01
	lda     (sp),y
	tax
	lda     (sp)
	jsr     pushax
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tosicmp
	jpl     incsp4
	jsr     _abc_update
	ldy     #$01
	lda     (sp),y
	tax
	lda     (sp)
	ina
	bne     L0452
	inx
	bra     L0452

.endproc

; ---------------------------------------------------------------
; void __near__ draw_ball (int, int, unsigned char)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_draw_ball: near

.segment	"MAINGAME_CODE"

	lda     (sp)
	jsr     _tgi_setcolor
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0018
	inx
L0018:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L001C
	inx
L001C:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L001E
	inx
L001E:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0022
	inx
L0022:	jsr     _tgi_setpixel
	jmp     incsp5

.endproc

; ---------------------------------------------------------------
; void __near__ bounce_ball (__near__ int*, __near__ int*, __near__ unsigned char*)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_bounce_ball: near

.segment	"MAINGAME_CODE"

	jsr     decsp5
	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$03
	jsr     staxysp
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$01
	jsr     staxysp
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	lda     (ptr1)
	sta     (sp)
	lda     (sp)
	bne     L0061
	dey
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$01
	bcs     L0055
	dex
L0055:	jsr     tosicmp
	bmi     L0053
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _topBound
	ldx     _topBound+1
	jsr     tosicmp
	bmi     L0054
	bne     L0053
L0054:	lda     #$02
	bra     L0462
L0053:	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$01
	bcs     L005D
	dex
L005D:	jsr     tosicmp
	bmi     L005B
	lda     #$01
	bra     L0462
L005B:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _topBound
	ldx     _topBound+1
	jsr     tosicmp
	beq     L045C
	bpl     L0061
L045C:	lda     #$03
L0462:	sta     (sp)
L0061:	lda     (sp)
	cmp     #$01
	bne     L0073
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _leftBound
	ldx     _leftBound+1
	jsr     tosicmp
	beq     L045D
	bpl     L0067
L045D:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _topBound
	ldx     _topBound+1
	jsr     tosicmp
	bmi     L0068
	bne     L0067
L0068:	lda     #$03
	bra     L0463
L0067:	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _leftBound
	ldx     _leftBound+1
	jsr     tosicmp
	beq     L045E
	bpl     L006E
L045E:	lda     #$00
	bra     L0463
L006E:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _topBound
	ldx     _topBound+1
	jsr     tosicmp
	beq     L045F
	bpl     L0073
L045F:	lda     #$02
L0463:	sta     (sp)
L0073:	lda     (sp)
	cmp     #$02
	bne     L0086
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _leftBound
	ldx     _leftBound+1
	jsr     tosicmp
	beq     L0460
	bpl     L0079
L0460:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _bottomBound
	ldx     _bottomBound+1
	sec
	sbc     #$01
	bcs     L007C
	dex
L007C:	jsr     tosicmp
	bmi     L0079
	lda     #$00
	bra     L0464
L0079:	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _leftBound
	ldx     _leftBound+1
	jsr     tosicmp
	beq     L0461
	bpl     L0081
L0461:	lda     #$03
	bra     L0464
L0081:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _bottomBound
	ldx     _bottomBound+1
	sec
	sbc     #$01
	bcs     L0088
	dex
L0088:	jsr     tosicmp
	bmi     L0086
	lda     #$01
L0464:	sta     (sp)
L0086:	lda     (sp)
	cmp     #$03
	bne     L009C
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$01
	bcs     L008F
	dex
L008F:	jsr     tosicmp
	bmi     L008D
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _bottomBound
	ldx     _bottomBound+1
	sec
	sbc     #$01
	bcs     L0091
	dex
L0091:	jsr     tosicmp
	bmi     L008D
	lda     #$01
	bra     L0465
L008D:	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$01
	bcs     L0098
	dex
L0098:	jsr     tosicmp
	bmi     L0096
	lda     #$02
	bra     L0465
L0096:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _bottomBound
	ldx     _bottomBound+1
	sec
	sbc     #$01
	bcs     L009E
	dex
L009E:	jsr     tosicmp
	bmi     L009C
	lda     #$00
L0465:	sta     (sp)
L009C:	lda     (sp)
	cmp     #$01
	jne     L00A1
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	jeq     L00A1
	lda     #$00
	jsr     _tgi_setcolor
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00AF
	inx
L00AF:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	beq     L00AC
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00B4
	inx
L00B4:	jsr     _tgi_getpixel
	cmp     #$00
	beq     L00AC
	lda     #$03
	bra     L0466
L00AC:	lda     #$02
L0466:	sta     (sp)
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00BD
	dex
L00BD:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00BF
	dex
L00BF:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00C3
	dex
L00C3:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00C6
	inx
L00C6:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00C8
	dex
L00C8:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00CB
	dex
L00CB:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L00CF
	dex
L00CF:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	jne     L0184
	jmp     L0488
L00A1:	lda     (sp)
	jne     L00DA
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00DE
	inx
L00DE:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	jeq     L00DA
	lda     #$00
	jsr     _tgi_setcolor
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00E5
	inx
L00E5:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	beq     L00E7
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00ED
	inx
L00ED:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00EF
	inx
L00EF:	jsr     _tgi_getpixel
	cmp     #$00
	beq     L00E7
	lda     #$02
	bra     L0468
L00E7:	lda     #$03
L0468:	sta     (sp)
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L00F8
	inx
L00F8:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L00FC
	inx
L00FC:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L00FE
	inx
L00FE:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0101
	inx
L0101:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0103
	dex
L0103:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0107
	dex
L0107:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L010A
	inx
L010A:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	jcs     L0184
	dex
	jmp     L0184
L00DA:	lda     (sp)
	cmp     #$03
	jne     L0115
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0119
	inx
L0119:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L011B
	inx
L011B:	jsr     _tgi_getpixel
	cmp     #$00
	jeq     L0115
	lda     #$00
	jsr     _tgi_setcolor
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0121
	inx
L0121:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0123
	inx
L0123:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0127
	inx
L0127:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	beq     L0124
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L012C
	inx
L012C:	jsr     _tgi_getpixel
	cmp     #$00
	beq     L0124
	lda     #$01
L0124:	sta     (sp)
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L0135
	inx
L0135:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0137
	inx
L0137:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L013A
	inx
L013A:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L013E
	inx
L013E:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L0140
	inx
L0140:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L0144
	inx
L0144:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	jcc     L0182
	inx
	jmp     L0182
L0115:	lda     (sp)
	cmp     #$02
	jne     L0152
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0157
	inx
L0157:	jsr     _tgi_getpixel
	cmp     #$00
	jeq     L0152
	lda     #$00
	jsr     _tgi_setcolor
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L015E
	inx
L015E:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_getpixel
	cmp     #$00
	beq     L015F
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0165
	inx
L0165:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0167
	inx
L0167:	jsr     _tgi_getpixel
	cmp     #$00
	beq     L015F
	lda     #$00
	bra     L0469
L015F:	ina
L0469:	sta     (sp)
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0170
	dex
L0170:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0172
	inx
L0172:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0175
	dex
L0175:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L017A
	inx
L017A:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L017D
	inx
L017D:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L017F
	inx
L017F:	jsr     _tgi_setpixel
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0182
	dex
L0182:	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$02
	bcc     L0184
L0488:	inx
L0184:	jsr     _tgi_setpixel
	jsr     decsp6
	lda     sp
	ldx     sp+1
	clc
	adc     #$09
	bcc     L0187
	inx
L0187:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$07
	bcc     L0189
	inx
L0189:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$06
	bcc     L018B
	inx
L018B:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	jsr     _bounce_ball
L0152:	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	lda     (sp)
	sta     (ptr1)
	ldy     #$0B
	jmp     addysp

.endproc

; ---------------------------------------------------------------
; void __near__ move_ball (__near__ int*, __near__ int*, __near__ unsigned char*)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_move_ball: near

.segment	"MAINGAME_CODE"

	jsr     decsp5
	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$03
	jsr     staxysp
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$01
	jsr     staxysp
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	lda     (ptr1)
	sta     (sp)
	lda     (sp)
	bne     L002A
	dey
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L002D
	inx
L002D:	jsr     staxysp
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L002F
	dex
L002F:	jsr     staxysp
L002A:	lda     (sp)
	cmp     #$01
	bne     L0030
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0033
	dex
L0033:	jsr     staxysp
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0035
	dex
L0035:	jsr     staxysp
L0030:	lda     (sp)
	cmp     #$02
	bne     L0036
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0039
	dex
L0039:	jsr     staxysp
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L003B
	inx
L003B:	jsr     staxysp
L0036:	lda     (sp)
	cmp     #$03
	bne     L003C
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L003F
	inx
L003F:	jsr     staxysp
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L0041
	inx
L0041:	jsr     staxysp
L003C:	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	jsr     decsp6
	ldy     #$10
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$0E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$0C
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	jsr     _bounce_ball
	ldy     #$0B
	jmp     addysp

.endproc

; ---------------------------------------------------------------
; void __near__ drawLevel (void)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_drawLevel: near

.segment	"MAINGAME_CODE"

	lda     #$04
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$05
	bcc     L0197
	inx
L0197:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$05
	bcc     L0199
	inx
L0199:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$0F
	bcc     L019B
	inx
L019B:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$0F
	bcc     L019D
	inx
L019D:	jsr     _tgi_bar
	lda     #$0D
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$19
	bcc     L01A2
	inx
L01A2:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$05
	bcc     L01A4
	inx
L01A4:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$23
	bcc     L01A6
	inx
L01A6:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$0F
	bcc     L01A8
	inx
L01A8:	jsr     _tgi_bar
	lda     #$0E
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$2D
	bcc     L01AD
	inx
L01AD:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$05
	bcc     L01AF
	inx
L01AF:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$37
	bcc     L01B1
	inx
L01B1:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$0F
	bcc     L01B3
	inx
L01B3:	jsr     _tgi_bar
	lda     #$01
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$41
	bcc     L01B8
	inx
L01B8:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$05
	bcc     L01BA
	inx
L01BA:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$4B
	bcc     L01BC
	inx
L01BC:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$0F
	bcc     L01BE
	inx
L01BE:	jsr     _tgi_bar
	lda     #$03
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$55
	bcc     L01C3
	inx
L01C3:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$05
	bcc     L01C5
	inx
L01C5:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$5F
	bcc     L01C7
	inx
L01C7:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$0F
	bcc     L01C9
	inx
L01C9:	jsr     _tgi_bar
	lda     #$02
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$0A
	bcc     L01CE
	inx
L01CE:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$14
	bcc     L01D0
	inx
L01D0:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$14
	bcc     L01D2
	inx
L01D2:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L01D4
	inx
L01D4:	jsr     _tgi_bar
	lda     #$0F
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$1E
	bcc     L01D9
	inx
L01D9:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$14
	bcc     L01DB
	inx
L01DB:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$28
	bcc     L01DD
	inx
L01DD:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L01DF
	inx
L01DF:	jsr     _tgi_bar
	lda     #$04
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$32
	bcc     L01E4
	inx
L01E4:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$14
	bcc     L01E6
	inx
L01E6:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$3C
	bcc     L01E8
	inx
L01E8:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L01EA
	inx
L01EA:	jsr     _tgi_bar
	lda     #$07
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$46
	bcc     L01EF
	inx
L01EF:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$14
	bcc     L01F1
	inx
L01F1:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$50
	bcc     L01F3
	inx
L01F3:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L01F5
	inx
L01F5:	jsr     _tgi_bar
	lda     #$05
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$5A
	bcc     L01FA
	inx
L01FA:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$14
	bcc     L01FC
	inx
L01FC:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$64
	bcc     L01FE
	inx
L01FE:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L0200
	inx
L0200:	jsr     _tgi_bar
	lda     #$03
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$05
	bcc     L0205
	inx
L0205:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$23
	bcc     L0207
	inx
L0207:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$0F
	bcc     L0209
	inx
L0209:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$2D
	bcc     L020B
	inx
L020B:	jsr     _tgi_bar
	lda     #$01
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$19
	bcc     L0210
	inx
L0210:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$23
	bcc     L0212
	inx
L0212:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$23
	bcc     L0214
	inx
L0214:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$2D
	bcc     L0216
	inx
L0216:	jsr     _tgi_bar
	lda     #$0E
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$2D
	bcc     L021B
	inx
L021B:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$23
	bcc     L021D
	inx
L021D:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$37
	bcc     L021F
	inx
L021F:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$2D
	bcc     L0221
	inx
L0221:	jsr     _tgi_bar
	lda     #$0D
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$41
	bcc     L0226
	inx
L0226:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$23
	bcc     L0228
	inx
L0228:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$4B
	bcc     L022A
	inx
L022A:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$2D
	bcc     L022C
	inx
L022C:	jsr     _tgi_bar
	lda     #$04
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$55
	bcc     L0231
	inx
L0231:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$23
	bcc     L0233
	inx
L0233:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$5F
	bcc     L0235
	inx
L0235:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$2D
	jcc     _tgi_bar
	inx
	jmp     _tgi_bar

.endproc

; ---------------------------------------------------------------
; int __near__ maingame (void)
; ---------------------------------------------------------------

.segment	"MAINGAME_CODE"

.proc	_maingame: near

.segment	"MAINGAME_CODE"

	ldy     #$0C
	jsr     subysp
	ldx     #$00
	txa
	jsr     push0ax
	lda     #$1E
	jsr     pusha0
	lda     #$0A
	jsr     pusha0
	jsr     decsp3
	lda     #<(L0001)
	ldx     #>(L0001)
	jsr     pushax
	lda     #<(L0001+10)
	ldx     #>(L0001+10)
	jsr     pushax
	ldy     #$78
	jsr     subysp
	lda     #$01
	jsr     pusha
	ina
	ldy     #$7D
	sta     (sp),y
	lda     #$00
	iny
	sta     (sp),y
	jsr     _tgi_getcolorcount
	ldy     #$7F
	sta     (sp),y
	jsr     _tgi_getxres
	ldy     #$92
	jsr     staxysp
	jsr     _tgi_getyres
	ldy     #$90
	jsr     staxysp
	ldy     #$81
	lda     (sp),y
	sta     _topBound+1
	dey
	lda     (sp),y
	sta     _topBound
	ldy     #$91
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$83
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tossubax
	sec
	sbc     #$01
	bcs     L0253
	dex
L0253:	sta     _bottomBound
	stx     _bottomBound+1
	ldy     #$83
	lda     (sp),y
	sta     _leftBound+1
	dey
	lda     (sp),y
	sta     _leftBound
	ldy     #$93
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$85
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tossubax
	sec
	sbc     #$01
	bcs     L0258
	dex
L0258:	sta     _rightBound
	stx     _rightBound+1
	lda     _drawpage
	jsr     _tgi_setviewpage
	lda     _drawpage
	jsr     _tgi_setdrawpage
	jsr     _tgi_getdefpalette
	jsr     _tgi_setpalette
	ldy     #$7D
	lda     (sp),y
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     #$00
	ldy     #$04
	sta     (sp),y
	iny
	sta     (sp),y
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	ldy     #$99
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0265
	dex
L0265:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	ldy     #$97
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0267
	dex
L0267:	jsr     _tgi_bar
	ldy     #$7E
	lda     (sp),y
	jsr     _tgi_setcolor
	jsr     decsp6
	ldy     #$89
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$87
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$99
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$8B
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tossubax
	sec
	sbc     #$01
	bcs     L026E
	dex
L026E:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	ldy     #$97
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$89
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tossubax
	sec
	sbc     #$01
	bcs     L0270
	dex
L0270:	jsr     _tgi_bar
	jsr     _drawLevel
	lda     #$03
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L0276
	dex
L0276:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L0278
	dex
L0278:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L027A
	inx
L027A:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L027C
	dex
L027C:	jsr     _tgi_bar
	jsr     decsp6
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L027F
	inx
L027F:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L0281
	dex
L0281:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L0283
	inx
L0283:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L0285
	inx
L0285:	jsr     _tgi_bar
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L0288
	dex
L0288:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L028A
	inx
L028A:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L028C
	inx
L028C:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L028E
	inx
L028E:	jsr     _tgi_bar
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L0291
	dex
L0291:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L0293
	dex
L0293:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L0295
	dex
L0295:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L0297
	inx
L0297:	jsr     _tgi_bar
	lda     #$03
	jsr     _tgi_setcolor
	lda     #$02
	jsr     pusha
	ldx     #$00
	jsr     _tgi_ioctl
	jsr     decsp4
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #$14
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	lda     #<(L0001+29)
	ldx     #>(L0001+29)
	jsr     _tgi_outtextxy
	jsr     decsp4
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #$1C
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	lda     #<(L0001+31)
	ldx     #>(L0001+31)
	jsr     _tgi_outtextxy
	jsr     decsp4
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #$24
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	lda     #<(L0001+33)
	ldx     #>(L0001+33)
	jsr     _tgi_outtextxy
	jsr     decsp4
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #$2C
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	lda     #<(L0001+35)
	ldx     #>(L0001+35)
	jsr     _tgi_outtextxy
	jsr     decsp4
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #$34
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	lda     #<(L0001+37)
	ldx     #>(L0001+37)
	jsr     _tgi_outtextxy
	ldx     #$00
	txa
	ldy     #$77
	jsr     staxysp
	ldy     #$93
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     asrax1
	sec
	sbc     #$0C
	bcs     L02B6
	dex
L02B6:	ldy     #$8E
	jsr     staxysp
	lda     _leftBound
	ldx     _leftBound+1
	clc
	adc     #$1A
	bcc     L02B9
	inx
L02B9:	ldy     #$75
	jsr     staxysp
	lda     _topBound
	ldx     _topBound+1
	clc
	adc     #$1E
	bcc     L02BC
	inx
L02BC:	ldy     #$73
	jsr     staxysp
	ldx     #$00
	txa
	ldy     #$8C
L0496:	jsr     staxysp
	ldy     #$8D
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0A
	txa
	sbc     #$00
	bvc     L02C4
	eor     #$80
L02C4:	jpl     L02BE
	iny
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$5F
	bcc     L02C9
	inx
	clc
L02C9:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	lda     #$FF
	sta     (ptr1)
	ldy     #$01
	sta     (ptr1),y
	ldy     #$8D
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$4B
	bcc     L02CD
	inx
	clc
L02CD:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	lda     #$FF
	sta     (ptr1)
	ldy     #$01
	sta     (ptr1),y
	ldy     #$8D
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$0F
	bcc     L02D1
	inx
	clc
L02D1:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	lda     #$00
	sta     (ptr1)
	ldy     #$01
	sta     (ptr1),y
	ldy     #$8D
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	jne     L0496
	inx
	jmp     L0496
L02BE:	lda     #$0E
	jsr     _tgi_setcolor
	lda     #$02
	jsr     pusha
	ldx     #$00
	jsr     _tgi_ioctl
	jsr     decsp4
	lda     #$2C
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	sta     (sp)
	ldy     #$01
	sta     (sp),y
	ldy     #$80
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_outtextxy
	lda     #$05
	jsr     _tgi_setcolor
	jsr     decsp4
	lda     #$08
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$5E
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	ldy     #$7E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _tgi_outtextxy
	stz     _drawPending
	jsr     decsp5
	ldy     #$7B
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$0F
	sta     (sp)
	jsr     _draw_ball
	ldx     #$23
	lda     #$28
	jsr     pushax
	jsr     _usleep
L02EB:	jsr     decsp1
	lda     #$00
	jsr     _joy_read
	sta     (sp)
	ldy     #$88
	jsr     ldeaxysp
	jsr     saveeax
	ldy     #$01
	jsr     inceaxy
	ldy     #$85
	jsr     steaxysp
	jsr     resteax
	ldy     #$88
	jsr     ldeaxysp
	jsr     pusheax
	ldx     #$00
	lda     #$05
	jsr     tosumod0ax
	jsr     pusheax
	ldx     #$00
	stz     sreg
	stz     sreg+1
	txa
	jsr     toseqeax
	beq     L02F4
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$28
	txa
	sbc     #$00
	bvc     L02F6
	eor     #$80
L02F6:	bpl     L02F4
	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	bne     L02F8
	inx
L02F8:	jsr     staxysp
L02F4:	lda     #$03
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L02FD
	dex
L02FD:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L02FF
	dex
L02FF:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L0301
	inx
L0301:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L0303
	dex
L0303:	jsr     _tgi_bar
	jsr     decsp6
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L0306
	inx
L0306:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L0308
	dex
L0308:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L030A
	inx
L030A:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L030C
	inx
L030C:	jsr     _tgi_bar
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L030F
	dex
L030F:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L0311
	inx
L0311:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _rightBound
	ldx     _rightBound+1
	ina
	bne     L0313
	inx
L0313:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L0315
	inx
L0315:	jsr     _tgi_bar
	jsr     decsp6
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L0318
	dex
L0318:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _topBound
	ldx     _topBound+1
	sec
	sbc     #$01
	bcs     L031A
	dex
L031A:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _leftBound
	ldx     _leftBound+1
	sec
	sbc     #$01
	bcs     L031C
	dex
L031C:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	lda     _bottomBound
	ldx     _bottomBound+1
	ina
	bne     L031E
	inx
L031E:	jsr     _tgi_bar
	jsr     decsp6
	lda     #$0C
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$13
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$11
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$13
	jsr     _tgi_bar
	jsr     decsp6
	lda     #$0C
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$3C
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$11
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$3C
	jsr     _tgi_bar
	jsr     decsp6
	lda     #$0C
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$13
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$0C
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$3C
	jsr     _tgi_bar
	jsr     decsp6
	lda     #$11
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$13
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$11
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$3C
	jsr     _tgi_bar
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     #$0A
	jsr     tosdiva0
	clc
	adc     #$0C
	jsr     _tgi_setcolor
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cpx     #$00
	bne     L0337
	cmp     #$28
	bne     L0337
	ldy     #$88
	jsr     ldeaxysp
	jsr     pusheax
	ldx     #$00
	lda     #$03
	jsr     tosumod0ax
	ldy     #$0D
	jsr     inceaxy
	jsr     _tgi_setcolor
L0337:	jsr     decsp6
	lda     #$0D
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$3C
	jsr     pusha0
	ldy     #$81
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tossubax
	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$10
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$3B
	jsr     _tgi_bar
	ldy     #$77
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$04
	jsr     staxysp
	ldy     #$75
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$02
	jsr     staxysp
	ldx     #$00
	txa
	ldy     #$8D
L0497:	jsr     staxysp
	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0A
	txa
	sbc     #$00
	bvc     L034C
	eor     #$80
L034C:	jpl     L0346
	iny
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$38
	bcc     L0351
	inx
	clc
L0351:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	jsr     pushax
	ldy     #$90
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$62
	bcc     L0354
	inx
	clc
L0354:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	dey
	lda     (ptr1)
	jsr     staxspidx
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$24
	bcc     L0357
	inx
	clc
L0357:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	jsr     pushax
	ldy     #$90
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$4E
	bcc     L035A
	inx
	clc
L035A:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	dey
	lda     (ptr1)
	jsr     staxspidx
	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	ina
	jne     L0497
	inx
	jmp     L0497
L0346:	lda     _joy_masks+2
	and     (sp)
	pha
	pla
	beq     L036D
	lda     #$00
	jsr     _tgi_setcolor
	jsr     decsp6
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$18
	bcc     L0364
	inx
L0364:	sec
	sbc     #$03
	bcs     L0365
	dex
L0365:	ina
	bne     L0366
	inx
L0366:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$58
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$18
	bcc     L0369
	inx
L0369:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	ldx     #$00
	lda     #$5A
	jsr     _tgi_bar
	ldx     #$00
	lda     #$03
	ldy     #$8F
	jsr     subeqysp
	ldy     #$90
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     _leftBound
	txa
	sbc     _leftBound+1
	bvc     L0491
	eor     #$80
L0491:	bpl     L036D
	lda     _leftBound
	ldx     _leftBound+1
	jsr     staxysp
L036D:	lda     _joy_masks+3
	and     (sp)
	pha
	pla
	beq     L0381
	lda     #$00
	jsr     _tgi_setcolor
	jsr     decsp6
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$58
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$03
	bcc     L037C
	inx
L037C:	sec
	sbc     #$01
	bcs     L037D
	dex
L037D:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	ldx     #$00
	lda     #$5A
	jsr     _tgi_bar
	ldy     #$8F
	ldx     #$00
	lda     #$03
	jsr     addeqysp
	ldy     #$90
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$18
	bcs     L0383
	dex
L0383:	jsr     tosicmp
	bmi     L0381
	beq     L0381
	lda     _rightBound
	ldx     _rightBound+1
	sec
	sbc     #$18
	bcs     L0386
	dex
L0386:	ldy     #$8F
	jsr     staxysp
L0381:	lda     _joy_masks+4
	and     (sp)
	pha
	pla
	jeq     L0387
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0B
	txa
	sbc     #$00
	bvs     L038D
	eor     #$80
L038D:	jpl     L0387
	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cpx     #$00
	bne     L038F
	cmp     #$28
	bne     L038F
	lda     #$05
	bra     L0498
L038F:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$1F
	txa
	sbc     #$00
	bvs     L0397
	eor     #$80
L0397:	bpl     L0395
	ldx     #$00
	lda     #$03
	bra     L0498
L0395:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$15
	txa
	sbc     #$00
	bvs     L039D
	eor     #$80
L039D:	bpl     L039B
	ldx     #$00
	lda     #$02
	bra     L0498
L039B:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0B
	txa
	sbc     #$00
	bvs     L03A3
	eor     #$80
L03A3:	bpl     L03A1
	ldx     #$00
	lda     #$01
	bra     L0498
L03A1:	ldx     #$00
	txa
L0498:	ldy     #$89
	jsr     staxysp
	txa
	ldy     #$8B
L049A:	jsr     staxysp
	ldy     #$8C
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$8C
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     tosicmp
	jpl     L03AA
	ldx     #$00
	txa
	ldy     #$8D
L0499:	jsr     staxysp
	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0A
	txa
	sbc     #$00
	bvc     L03B9
	eor     #$80
L03B9:	jpl     L03AB
	iny
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$10
	bcc     L03BF
	inx
	clc
L03BF:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cmp     #$01
	txa
	sbc     #$00
	bvc     L03C0
	eor     #$80
L03C0:	jpl     L03B4
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$10
	bcc     L03C3
	inx
	clc
L03C3:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	lda     #$64
	sta     (ptr1)
	ldy     #$01
	lda     #$00
	sta     (ptr1),y
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$60
	bcc     L03C7
	inx
	clc
L03C7:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	jsr     pushax
	ldy     #$79
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$4C
	bcc     L03CB
	inx
	clc
L03CB:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	jsr     pushax
	ldy     #$77
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	jsr     staxspidx
	lda     sp
	ldx     sp+1
	clc
	adc     #$06
	bcc     L03CF
	inx
L03CF:	ldy     #$8D
	clc
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldx     #$00
	lda     #$04
	jsr     tosmoda0
	ldy     #$00
	jsr     staspidx
	bra     L03AB
L03B4:	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	ina
	jne     L0499
	inx
	jmp     L0499
L03AB:	ldy     #$8C
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	ina
	jne     L049A
	inx
	jmp     L049A
L03AA:	ldx     #$00
	txa
	ldy     #$78
	jsr     staxysp
	lda     #$02
	jsr     _tgi_setcolor
	jsr     decsp6
	lda     #$0D
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$14
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #$10
	sta     (sp)
	ldy     #$01
	lda     #$00
	sta     (sp),y
	tax
	lda     #$3C
	jsr     _tgi_bar
L0387:	ldx     #$00
	txa
	ldy     #$8D
L049B:	jsr     staxysp
	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$0A
	txa
	sbc     #$00
	bvc     L03E1
	eor     #$80
L03E1:	jpl     L03DB
	iny
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$10
	bcc     L03E7
	inx
	clc
L03E7:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cmp     #$01
	txa
	sbc     #$00
	bvs     L03E8
	eor     #$80
L03E8:	jpl     L03E4
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$10
	bcc     L03EB
	inx
	clc
L03EB:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	sta     sreg
	stx     sreg+1
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	sec
	sbc     #$01
	bcs     L03EC
	dex
L03EC:	sta     (sreg)
	ldy     #$01
	txa
	sta     (sreg),y
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$38
	bcc     L03F0
	inx
	clc
L03F0:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L0493
	cmp     #$FF
	jeq     L03ED
L0493:	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$24
	bcc     L03F4
	inx
	clc
L03F4:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L03EE
	cmp     #$FF
	beq     L03ED
L03EE:	jsr     decsp5
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$3D
	bcc     L03FA
	inx
	clc
L03FA:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$29
	bcc     L03FD
	inx
	clc
L03FD:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$84
	lda     (sp),y
	sta     (sp)
	jsr     _draw_ball
L03ED:	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$60
	bcc     L0402
	inx
	clc
L0402:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L0494
	cmp     #$FF
	jeq     L03DC
L0494:	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$4C
	bcc     L0406
	inx
	clc
L0406:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L0400
	cmp     #$FF
	jeq     L03DC
L0400:	jsr     decsp6
	ldy     #$94
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$66
	bcc     L040C
	inx
	clc
L040C:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$94
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$52
	bcc     L040F
	inx
	clc
L040F:	adc     sp
	tay
	txa
	adc     sp+1
	tax
	tya
	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$0C
	bcc     L0412
	inx
L0412:	ldy     #$93
	clc
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	jsr     _move_ball
	jsr     decsp5
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$65
	bcc     L0416
	inx
	clc
L0416:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$51
	bcc     L0419
	inx
	clc
L0419:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$09
	sta     (sp)
	jsr     _draw_ball
	jmp     L03DC
L03E4:	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$38
	bcc     L041F
	inx
	clc
L041F:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L0495
	cmp     #$FF
	jeq     L03DC
L0495:	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$24
	bcc     L0423
	inx
	clc
L0423:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	cpx     #$FF
	bne     L041D
	cmp     #$FF
	jeq     L03DC
L041D:	jsr     decsp5
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$3D
	bcc     L0429
	inx
	clc
L0429:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$93
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$29
	bcc     L042C
	inx
	clc
L042C:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	tax
	lda     (ptr1)
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$84
	lda     (sp),y
	sta     (sp)
	jsr     _draw_ball
	ldy     #$8E
	lda     (sp),y
	sta     tmp1
	dey
	lda     (sp),y
	asl     a
	rol     tmp1
	ldx     tmp1
	clc
	adc     #$38
	bcc     L0430
	inx
	clc
L0430:	adc     sp
	sta     ptr1
	txa
	adc     sp+1
	sta     ptr1+1
	lda     #$FF
	sta     (ptr1)
	ldy     #$01
	sta     (ptr1),y
L03DC:	ldy     #$8E
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ina
	jne     L049B
	inx
	jmp     L049B
L03DB:	jsr     decsp5
	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$84
	lda     (sp),y
	sta     (sp)
	jsr     _draw_ball
	jsr     decsp6
	lda     sp
	ldx     sp+1
	clc
	adc     #$7C
	bcc     L0438
	inx
L0438:	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$7A
	bcc     L043A
	inx
L043A:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$07
	bcc     L043C
	inx
L043C:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	jsr     _move_ball
	jsr     decsp5
	ldy     #$7C
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$7A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$0F
	sta     (sp)
	jsr     _draw_ball
	lda     #$0E
	jsr     _tgi_setcolor
	jsr     decsp6
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$04
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$58
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	ldy     #$96
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$18
	bcc     L0447
	inx
L0447:	sta     (sp)
	ldy     #$01
	txa
	sta     (sp),y
	ldx     #$00
	lda     #$5A
	jsr     _tgi_bar
	ldx     #$01
	lda     #$F4
	jsr     pushax
	jsr     _usleep
	ldy     #$75
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cmp     #$59
	txa
	sbc     #$00
	bvs     L044D
	eor     #$80
L044D:	bpl     L044B
	ldx     #$23
	lda     #$28
	jsr     pushax
	jsr     _usleep
	ldx     #$00
	lda     #$65
	jsr     incsp1
	bra     L0238
L044B:	jsr     incsp1
	jmp     L02EB
L0238:	ldy     #$94
	jmp     addysp

.endproc

