;
; 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
	.forceimport	__STARTUP__
	.export		_first_time
	.export		_next_application
	.import		_start_irqs
	.import		_intro
	.import		_maingame
	.import		_FileLoadFile
	.export		_last_application
	.export		_old_stack
	.export		_main

.segment	"DATA"

_first_time:
	.byte	$01
_next_application:
	.byte	$01
_last_application:
	.byte	$00

.segment	"BSS"

_old_stack:
	.res	2,$00

; ---------------------------------------------------------------
; int __near__ main (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_main: near

.segment	"CODE"

	lda     _first_time
	beq     not_first_time
	lda     #2
	ldx     #0
	stz     _first_time
	jmp     _FileExecFile
not_first_time:
	lda     _next_application
	cmp     #$01
	beq     L002E
	cmp     #$02
	beq     L0037
	cmp     #$08
	beq     L003F
	cmp     #$64
	beq     L0014
	cmp     #$65
	beq     L0022
L0014:	lda     _last_application
	cmp     #$02
	beq     L001E
	lda     #$02
	bra     L004D
L001E:	lda     #$08
	bra     L004D
L0022:	lda     _last_application
	cmp     #$02
	beq     L002A
	lda     #$02
	bra     L004D
L002A:	lda     #$08
	bra     L004D
L002E:	jsr     _start_irqs
	lda     _next_application
	sta     _last_application
	jsr     _intro
	sta     _next_application
	lda     $0000
	sta     _old_stack
	lda     $0000+1
	sta     _old_stack+1
	bra     L0013
L0037:	ldx     #$00
	jsr     _FileLoadFile
	lda     _next_application
	sta     _last_application
	jsr     _intro
	bra     L004D
L003F:	ldx     #$00
	lda     #$03
	jsr     _FileLoadFile
	lda     _next_application
	sta     _last_application
	jsr     _maingame
L004D:	sta     _next_application
L0013:	lda     _old_stack
	ldx     _old_stack+1
	cpx     $0000+1
	bne     L004E
	cmp     $0000
	jeq     not_first_time
L004E:	lda     #$02
	sta     _next_application
	jmp     not_first_time

.endproc

