;
; File generated by cc65 v 2.19 - Git 39df6f8
;
	.fopt		compiler,"cc65 v 2.19 - Git 39df6f8"
	.setcpu		"6502"
	.smart		on
	.autoimport	on
	.case		on
	.debuginfo	on
	.importzp	sp, sreg, regsave, regbank
	.importzp	tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
	.macpack	longbranch
	.dbg		file, "vdc_control_listbox.c", 2382, 1646425082
	.dbg		file, "vdc_gui.h", 778, 1543280824
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/c128.h", 6518, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_vic2.h", 10835, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_sid.h", 3626, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_vdc.h", 2827, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_6526.h", 3962, 1645504249
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/peekpoke.h", 3108, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/string.h", 5187, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stddef.h", 3057, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdio.h", 5920, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdarg.h", 2913, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/limits.h", 3580, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdlib.h", 5999, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/conio.h", 9026, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/target.h", 2992, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/cbm.h", 11892, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/cbm_filetype.h", 4949, 1645504250
	.dbg		file, "vdc_win.h", 1736, 1543282193
	.dbg		file, "vdc_core.h", 1814, 1543295196
	.dbg		file, "vdc_controls.h", 561, 1543268877
	.dbg		file, "vdc_menus.h", 527, 1543268877
	.dbg		file, "vdc_control_listbox.h", 1037, 1646425066
	.dbg		file, "vdc_control_textbox.h", 916, 1543268877
	.dbg		file, "vdc_control_label.h", 695, 1543268877
	.dbg		file, "vdc_control_button.h", 818, 1543268877
	.dbg		file, "vdc_control_checkbox.h", 815, 1543268877
	.dbg		sym, "malloc", "00", extern, "_malloc"
	.dbg		sym, "VDC_DrawBox", "00", extern, "_VDC_DrawBox"
	.dbg		sym, "VDC_PrintAt", "00", extern, "_VDC_PrintAt"
	.dbg		sym, "CreateControl", "00", extern, "_CreateControl"
	.import		_malloc
	.import		_VDC_DrawBox
	.import		_VDC_PrintAt
	.import		_CreateControl
	.export		_CreateListbox
	.export		__renderListBoxHandler
	.export		__listBoxInputHandler

.segment	"RODATA"

S0002:
	.byte	$20,$00
S0003	:=	S0002+0
S0001:
	.byte	$2A,$00

; ---------------------------------------------------------------
; struct _LISTBOX *__near__ CreateListbox (struct Window *window, unsigned char *name, unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char itemCount, struct _LISTITEM *listitems)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_CreateListbox: near

	.dbg	func, "CreateListbox", "00", extern, "_CreateListbox"
	.dbg	sym, "window", "00", auto, 9
	.dbg	sym, "name", "00", auto, 7
	.dbg	sym, "x", "00", auto, 6
	.dbg	sym, "y", "00", auto, 5
	.dbg	sym, "width", "00", auto, 4
	.dbg	sym, "height", "00", auto, 3
	.dbg	sym, "itemCount", "00", auto, 2
	.dbg	sym, "listitems", "00", auto, 0
	.dbg	sym, "ctrl", "00", auto, -2
	.dbg	sym, "listBox", "00", auto, -4

.segment	"CODE"

	.dbg	line, "vdc_control_listbox.c", 14
	jsr     pushax
	.dbg	line, "vdc_control_listbox.c", 20
	jsr     decsp4
	ldy     #$10
	jsr     pushwysp
	ldy     #$10
	jsr     pushwysp
	ldy     #$0E
	lda     (sp),y
	jsr     pusha
	ldy     #$0E
	lda     (sp),y
	jsr     pusha
	ldx     #$00
	lda     #$04
	jsr     _CreateControl
	ldy     #$02
	jsr     staxysp
	.dbg	line, "vdc_control_listbox.c", 22
	cpx     #$00
	bne     L0005
	cmp     #$00
	jeq     L0004
	.dbg	line, "vdc_control_listbox.c", 24
L0005:	ldx     #$00
	lda     #$0A
	jsr     _malloc
	jsr     stax0sp
	.dbg	line, "vdc_control_listbox.c", 27
	ldy     #$03
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	jsr     ldax0sp
	ldy     #$06
	sta     (ptr1),y
	iny
	txa
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 28
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$03
	jsr     ldaxysp
	ldy     #$00
	sta     (ptr1),y
	iny
	txa
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 31
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$08
	lda     (sp),y
	ldy     #$02
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 32
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$07
	lda     (sp),y
	ldy     #$03
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 33
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	jsr     ldaxysp
	ldy     #$06
	sta     (ptr1),y
	iny
	txa
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 34
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$06
	lda     (sp),y
	ldy     #$04
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 35
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	lda     #$00
	ldy     #$05
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 36
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	lda     #$00
	ldy     #$08
	sta     (ptr1),y
	iny
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 39
	ldy     #$03
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	lda     #<(__renderListBoxHandler)
	ldy     #$0F
	sta     (ptr1),y
	iny
	lda     #>(__renderListBoxHandler)
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 40
	ldy     #$03
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	lda     #<(__listBoxInputHandler)
	ldy     #$11
	sta     (ptr1),y
	iny
	lda     #>(__listBoxInputHandler)
	sta     (ptr1),y
	.dbg	line, "vdc_control_listbox.c", 42
	jsr     ldax0sp
	.dbg	line, "vdc_control_listbox.c", 46
L0004:	ldy     #$0F
	jmp     addysp

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ _renderListBoxHandler (struct Control *ctrl)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	__renderListBoxHandler: near

	.dbg	func, "_renderListBoxHandler", "00", extern, "__renderListBoxHandler"
	.dbg	sym, "ctrl", "00", auto, 0
	.dbg	sym, "listBox", "00", auto, -2
	.dbg	sym, "win", "00", auto, -4
	.dbg	sym, "x", "00", auto, -5
	.dbg	sym, "col", "00", auto, -7
	.dbg	sym, "row", "00", auto, -9

.segment	"CODE"

	.dbg	line, "vdc_control_listbox.c", 49
	jsr     pushax
	.dbg	line, "vdc_control_listbox.c", 50
	jsr     ldax0sp
	ldy     #$07
	jsr     pushwidx
	.dbg	line, "vdc_control_listbox.c", 51
	jsr     ldax0sp
	jsr     ldaxi
	ldy     #$09
	jsr     pushwidx
	.dbg	line, "vdc_control_listbox.c", 54
	jsr     decsp1
	ldy     #$02
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$00
	lda     (ptr1),y
	sta     sreg
	ldy     #$06
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$02
	ldx     #$00
	lda     (ptr1),y
	clc
	adc     sreg
	bcc     L000C
	inx
L000C:	jsr     pushax
	.dbg	line, "vdc_control_listbox.c", 55
	ldy     #$04
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	sta     sreg
	ldy     #$08
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$03
	ldx     #$00
	lda     (ptr1),y
	clc
	adc     sreg
	bcc     L000D
	inx
L000D:	jsr     pushax
	.dbg	line, "vdc_control_listbox.c", 57
	ldy     #$02
	lda     (sp),y
	jsr     pusha
	ldy     #$01
	lda     (sp),y
	jsr     pusha
	ldy     #$0A
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$02
	lda     (ptr1),y
	jsr     pusha
	ldy     #$0B
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$03
	lda     (ptr1),y
	jsr     pusha
	lda     #$01
	jsr     _VDC_DrawBox
	.dbg	line, "vdc_control_listbox.c", 59
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	.dbg	line, "vdc_control_listbox.c", 61
	lda     #$00
	ldy     #$04
L0011:	sta     (sp),y
	sta     sreg
	ldy     #$08
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$04
	lda     (ptr1),y
	cmp     sreg
	jeq     L0003
	jcc     L0003
	.dbg	line, "vdc_control_listbox.c", 63
	ldy     #$08
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	lda     (ptr1),y
	dey
	cmp     (sp),y
	jne     L0006
	.dbg	line, "vdc_control_listbox.c", 65
	ldy     #$08
	jsr     ldaxysp
	jsr     ldaxi
	sta     ptr1
	stx     ptr1+1
	ldy     #$0E
	lda     (ptr1),y
	cmp     #$01
	bne     L0007
	.dbg	line, "vdc_control_listbox.c", 66
	jsr     pushw0sp
	ldy     #$05
	jsr     ldaxysp
	jsr     incax1
	jsr     pushax
	lda     #<(S0001)
	ldx     #>(S0001)
	.dbg	line, "vdc_control_listbox.c", 67
	jmp     L0016
	.dbg	line, "vdc_control_listbox.c", 68
L0007:	jsr     pushw0sp
	ldy     #$05
	jsr     ldaxysp
	jsr     incax1
	jsr     pushax
	lda     #<(S0002)
	ldx     #>(S0002)
L0016:	jsr     pushax
	ldx     #$00
	lda     #$01
	jsr     _VDC_PrintAt
	.dbg	line, "vdc_control_listbox.c", 70
	jsr     pushw0sp
	ldy     #$02
	ldx     #$00
	lda     #$01
	jsr     addeqysp
	ldy     #$05
	jsr     ldaxysp
	jsr     incax2
	jsr     pushax
	ldy     #$0C
	jsr     ldaxysp
	ldy     #$07
	jsr     ldaxidx
	sta     ptr1
	stx     ptr1+1
	ldx     #$00
	ldy     #$08
	lda     (sp),y
	asl     a
	bcc     L0012
	inx
	clc
L0012:	adc     ptr1
	pha
	txa
	adc     ptr1+1
	tax
	pla
	jsr     pushw
	ldx     #$00
	lda     #$01
	.dbg	line, "vdc_control_listbox.c", 72
	jmp     L0010
	.dbg	line, "vdc_control_listbox.c", 74
L0006:	jsr     pushw0sp
	ldy     #$05
	jsr     ldaxysp
	jsr     incax1
	jsr     pushax
	lda     #<(S0003)
	ldx     #>(S0003)
	jsr     pushax
	ldx     #$00
	txa
	jsr     _VDC_PrintAt
	.dbg	line, "vdc_control_listbox.c", 75
	jsr     pushw0sp
	ldy     #$02
	ldx     #$00
	lda     #$01
	jsr     addeqysp
	ldy     #$05
	jsr     ldaxysp
	jsr     incax2
	jsr     pushax
	ldy     #$0C
	jsr     ldaxysp
	ldy     #$07
	jsr     ldaxidx
	sta     ptr1
	stx     ptr1+1
	ldx     #$00
	ldy     #$08
	lda     (sp),y
	asl     a
	bcc     L0013
	inx
	clc
L0013:	adc     ptr1
	pha
	txa
	adc     ptr1+1
	tax
	pla
	jsr     pushw
	ldx     #$00
	txa
L0010:	jsr     _VDC_PrintAt
	.dbg	line, "vdc_control_listbox.c", 61
	ldy     #$04
	clc
	lda     #$01
	adc     (sp),y
	jmp     L0011
	.dbg	line, "vdc_control_listbox.c", 78
L0003:	ldy     #$0B
	jmp     addysp

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ _listBoxInputHandler (struct Control *ctrl, unsigned char c)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	__listBoxInputHandler: near

	.dbg	func, "_listBoxInputHandler", "00", extern, "__listBoxInputHandler"
	.dbg	sym, "ctrl", "00", auto, 1
	.dbg	sym, "c", "00", auto, 0
	.dbg	sym, "listBox", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_control_listbox.c", 82
	jsr     pusha
	.dbg	line, "vdc_control_listbox.c", 83
	ldy     #$02
	jsr     ldaxysp
	ldy     #$07
	jsr     pushwidx
	.dbg	line, "vdc_control_listbox.c", 85
	ldy     #$02
	lda     (sp),y
	cmp     #$11
	bne     L0013
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	lda     (ptr1),y
	jsr     pusha0
	ldy     #$03
	jsr     ldaxysp
	sta     ptr1
	stx     ptr1+1
	ldy     #$04
	ldx     #$00
	lda     (ptr1),y
	jsr     decax1
	jsr     tosicmp
	bpl     L0006
	.dbg	line, "vdc_control_listbox.c", 87
	jsr     ldax0sp
	sta     sreg
	stx     sreg+1
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	lda     (ptr1),y
	clc
	adc     #$01
	sta     (sreg),y
	.dbg	line, "vdc_control_listbox.c", 88
	dey
	jsr     ldaxysp
	jsr     __renderListBoxHandler
	.dbg	line, "vdc_control_listbox.c", 90
	jsr     ldax0sp
	ldy     #$09
	jsr     ldaxidx
	cpx     #$00
	bne     L0011
	cmp     #$00
	beq     L0006
	.dbg	line, "vdc_control_listbox.c", 91
L0011:	jsr     ldax0sp
	ldy     #$09
	jsr     pushwidx
	ldy     #$03
	jsr     ldaxysp
	pha
	ldy     #$00
	lda     (sp),y
	sta     jmpvec+1
	iny
	lda     (sp),y
	sta     jmpvec+2
	pla
	jsr     jmpvec
	jsr     incsp2
	.dbg	line, "vdc_control_listbox.c", 94
L0006:	ldy     #$02
L0013:	lda     (sp),y
	cmp     #$91
	bne     L000C
	jsr     ldax0sp
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	lda     (ptr1),y
	beq     L000C
	.dbg	line, "vdc_control_listbox.c", 96
	jsr     ldax0sp
	sta     sreg
	stx     sreg+1
	sta     ptr1
	stx     ptr1+1
	ldy     #$05
	lda     (ptr1),y
	sec
	sbc     #$01
	sta     (sreg),y
	.dbg	line, "vdc_control_listbox.c", 97
	dey
	jsr     ldaxysp
	jsr     __renderListBoxHandler
	.dbg	line, "vdc_control_listbox.c", 99
	jsr     ldax0sp
	ldy     #$09
	jsr     ldaxidx
	cpx     #$00
	bne     L0012
	cmp     #$00
	beq     L000C
	.dbg	line, "vdc_control_listbox.c", 100
L0012:	jsr     ldax0sp
	ldy     #$09
	jsr     pushwidx
	ldy     #$03
	jsr     ldaxysp
	pha
	ldy     #$00
	lda     (sp),y
	sta     jmpvec+1
	iny
	lda     (sp),y
	sta     jmpvec+2
	pla
	jsr     jmpvec
	jsr     incsp2
	.dbg	line, "vdc_control_listbox.c", 104
L000C:	jmp     incsp5

	.dbg	line
.endproc

