;
; File generated by cc65 v 2.13.1
;
	.fopt		compiler,"cc65 v 2.13.1"
	.setcpu		"6502"
	.smart		on
	.autoimport	on
	.case		on
	.debuginfo	on
	.importzp	sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
	.macpack	longbranch
	.dbg		file, "../../../ui/src/c64_menu.c", 39639, 1267200498
	.dbg		file, "C:\Programme\cc65\include/stdio.h", 5964, 1262467470
	.dbg		file, "C:\Programme\cc65\include/stddef.h", 2972, 1262467470
	.dbg		file, "C:\Programme\cc65\include/stdarg.h", 2817, 1262467470
	.dbg		file, "C:\Programme\cc65\include/stdlib.h", 5578, 1262467470
	.dbg		file, "C:\Programme\cc65\include/string.h", 4883, 1262467470
	.dbg		file, "../inc/version.h", 1454, 1267200480
	.dbg		file, "../../../data/inc/types.h", 1544, 1267200498
	.dbg		file, "../../../data/inc/data_tools.h", 1380, 1267200498
	.dbg		file, "../../../filesystem/fat/inc/ff.h", 11459, 1267200484
	.dbg		file, "../../../storage/ram/inc/mapper.h", 2486, 1267200486
	.dbg		file, "../../../io/inc/gpio.h", 4272, 1267200496
	.dbg		file, "../../../io/inc/keyb.h", 1109, 1267200496
	.dbg		file, "../../../io/inc/screen.h", 1493, 1267200496
	.dbg		file, "../../../filesystem/fat/inc/dir.h", 2992, 1267200484
	.dbg		file, "../../../ui/inc/c64_menu.h", 1936, 1267200498
	.dbg		file, "../../../system/inc/c64_addr.h", 2168, 1267200486
	.dbg		file, "../../../system/inc/copper.h", 1146, 1267200486
	.dbg		file, "../../../data/inc/gcr.h", 1429, 1267200498
	.dbg		file, "../../../filetype/d64/inc/d64.h", 1475, 1267200478
	.dbg		file, "../../../filetype/t64/inc/t64.h", 1254, 1267200478
	.dbg		file, "../../../filetype/sid/inc/sid.h", 167, 1267200478
	.dbg		file, "../../../ui/inc/freezer.h", 1398, 1267200498
	.dbg		file, "../../../io/inc/sd.h", 1808, 1267200496
	.dbg		file, "../../../io/inc/diskio.h", 2164, 1267200496
	.dbg		file, "../../../storage/flash/inc/flash.h", 1349, 1267200486
	.dbg		file, "../../../ui/inc/config.h", 2554, 1267200498
	.dbg		file, "../../../system/inc/last.h", 1115, 1267200486
	.dbg		file, "../../../filetype/tap/inc/tap.h", 141, 1267200478
	.import		_printf
	.import		_sprintf
	.import		_strcat
	.import		_strlen
	.import		_strncpy
	.import		_memcpy
	.import		_memset
	.import		_hardware_type
	.import		_data_strnlen
	.import		_f_open_direct
	.import		_f_read
	.import		_f_close
	.import		_f_opendir_direct
	.import		_f_mountdrv
	.import		_f_write
	.import		_f_create_file_entry
	.import		_f_create_dir_entry
	.import		_f_unlink_direct
	.import		_f_rename_direct
	.import		_kb_buf_getch
	.import		_scroll_down
	.import		_scroll_up
	.import		_clear_screen
	.import		_set_color
	.import		_start_pos
	.import		_num_lines
	.import		_width
	.import		_do_color
	.import		_dir_change
	.import		_dir_getentry
	.import		_dir_getindex
	.import		_dir_find_entry
	.import		_dir_analyze_name
	.export		_menu_reset_global_scroll
	.export		_menu_init
	.export		_menu_run
	.export		_draw_menu
	.export		_draw_directory
	.export		_handle_create_disk
	.export		_handle_create_dir
	.export		_handle_dump_mem
	.export		_handle_flash
	.export		_prg_loadfile
	.export		_string_box
	.import		_copper_list
	.import		_copper_pntr
	.import		_copper_en
	.import		_new_message
	.import		_scroll_msg
	.import		_load_d64
	.import		_load_g64
	.import		_d64_dir
	.import		_d64_loadfile
	.import		_d64_create
	.import		_t64_dir
	.import		_t64_loadfile
	.import		_t64_loadfirst
	.import		_sid_dir
	.import		_sid_load
	.import		_exit_freeze
	.import		_dma_load_init
	.import		_dma_load_exit
	.import		_card_change
	.import		_card_det
	.import		_flash_file
	.import		_run_config
	.import		_cfg_get_value
	.import		_last_load
	.import		_last_update
	.import		_tap_open_file
	.import		_mountfile
	.import		_disk_change
	.export		_menu_file
	.export		_menu_dir
	.export		_menu_fres
	.export		_menu_offset
	.export		_menu_index
	.export		_swap_delay
	.export		_menu_dir_depth
	.export		_subdir_trace
	.export		_index_trace
	.export		_offset_trace
	.export		_menu_dir_cache
	.import		_ClearFloppyMem
	.export		_default_msg
	.export		_my_copper
	.import		_extsout
	.export		_scroll_enable
	.export		_dump_mem_to_file
	.export		_dump_trace_to_file
	.export		_check_change
	.export		_set_title
	.export		_string_input
	.export		_question_box

.segment	"DATA"

_default_msg:
	.byte	$04,$20,$2A,$2A,$20,$31,$35,$34,$31,$20,$55,$6C,$74,$69,$6D,$61
	.byte	$74,$65,$20,$2A,$2A,$20,$42,$79,$20,$47,$69,$64,$65,$6F,$6E,$20
	.byte	$5A,$20,$2A,$2A,$20,$20,$20,$08,$32,$03,$20,$20,$55,$73,$65,$20
	.byte	$63,$75,$72,$73,$6F,$72,$20,$6B,$65,$79,$73,$20,$74,$6F,$20,$6E
	.byte	$61,$76,$69,$67,$61,$74,$65,$2E,$20,$20,$46,$31,$20,$73,$63,$72
	.byte	$6F,$6C,$6C,$73,$20,$61,$20,$70,$61,$67,$65,$20,$75,$70,$3B,$20
	.byte	$46,$37,$20,$73,$63,$72,$6F,$6C,$6C,$73,$20,$61,$20,$70,$61,$67
	.byte	$65,$20,$64,$6F,$77,$6E,$3B,$20,$52,$65,$74,$75,$72,$6E,$20,$73
	.byte	$65,$6C,$65,$63,$74,$73,$20,$61,$6E,$20,$65,$6E,$74,$72,$79,$3B
	.byte	$20,$44,$45,$4C,$20,$6C,$65,$61,$76,$65,$73,$20,$61,$20,$64,$69
	.byte	$72,$65,$63,$74,$6F,$72,$79,$3B,$20,$53,$68,$69,$66,$74,$2B,$44
	.byte	$45,$4C,$20,$74,$6F,$20,$64,$65,$6C,$65,$74,$65,$20,$61,$6E,$20
	.byte	$65,$6E,$74,$72,$79,$3B,$20,$53,$68,$69,$66,$74,$2B,$27,$43,$27
	.byte	$20,$74,$6F,$20,$63,$72,$65,$61,$74,$65,$20,$61,$20,$6E,$65,$77
	.byte	$20,$64,$69,$73,$6B,$3B,$20,$53,$68,$69,$66,$74,$2B,$27,$44,$27
	.byte	$20,$74,$6F,$20,$63,$72,$65,$61,$74,$65,$20,$61,$20,$6E,$65,$77
	.byte	$20,$64,$69,$72,$65,$63,$74,$6F,$72,$79,$3B,$20,$53,$68,$69,$66
	.byte	$74,$2B,$27,$52,$27,$20,$74,$6F,$20,$72,$65,$6E,$61,$6D,$65,$3B
	.byte	$20,$46,$33,$20,$74,$6F,$20,$72,$75,$6E,$20,$61,$20,$70,$72,$6F
	.byte	$67,$72,$61,$6D,$3B,$20,$46,$32,$20,$74,$6F,$20,$65,$6E,$74,$65
	.byte	$72,$20,$74,$68,$65,$20,$73,$65,$74,$75,$70,$20,$6D,$65,$6E,$75
	.byte	$2E,$20,$59,$6F,$75,$20,$63,$61,$6E,$20,$74,$79,$70,$65,$20,$74
	.byte	$68,$65,$20,$65,$6E,$74,$72,$79,$20,$6E,$61,$6D,$65,$20,$66,$6F
	.byte	$72,$20,$71,$75,$69,$63,$6B,$20,$73,$65,$61,$72,$63,$68,$2E,$20
	.byte	$55,$73,$65,$20,$27,$3F,$27,$20,$66,$6F,$72,$20,$63,$68,$61,$72
	.byte	$61,$63,$74,$65,$72,$73,$20,$79,$6F,$75,$20,$61,$72,$65,$20,$75
	.byte	$6E,$73,$75,$72,$65,$20,$6F,$66,$2E,$20,$45,$6E,$6A,$6F,$79,$21
	.byte	$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$00

.segment	"RODATA"

_my_copper:
	.byte	$12
	.byte	$28
	.byte	$16
	.byte	$08
	.byte	$12
	.byte	$42
	.byte	$20
	.byte	$06
	.byte	$21
	.byte	$06
	.byte	$12
	.byte	$4A
	.byte	$20
	.byte	$00
	.byte	$21
	.byte	$00
	.byte	$12
	.byte	$F2
	.byte	$16
	.byte	$00
	.byte	$12
	.byte	$FE
	.byte	$FF
L0001:
	.byte	$25,$64,$20,$62,$79,$74,$65,$73,$20,$77,$72,$69,$74,$74,$65,$6E
	.byte	$3B,$20,$61,$64,$64,$72,$20,$3D,$20,$25,$30,$36,$78,$0A,$00,$63
	.byte	$6F,$6E,$73,$6F,$6C,$65,$5F,$66,$72,$65,$73,$20,$3D,$20,$25,$64
	.byte	$20,$7C,$20,$62,$79,$74,$65,$73,$20,$77,$72,$69,$74,$74,$65,$6E
	.byte	$20,$3D,$20,$25,$64,$0A,$00,$25,$64,$20,$70,$61,$67,$65,$73,$20
	.byte	$77,$72,$69,$74,$74,$65,$6E,$2E,$0A,$00,$43,$61,$6E,$27,$74,$20
	.byte	$6F,$70,$65,$6E,$20,$66,$69,$6C,$65,$20,$66,$6F,$72,$20,$77,$72
	.byte	$69,$74,$69,$6E,$67,$2E,$0A,$00,$4E,$65,$77,$20,$63,$61,$72,$64
	.byte	$20,$69,$6E,$73,$65,$72,$74,$65,$64,$21,$20,$00,$46,$69,$6C,$65
	.byte	$73,$79,$73,$74,$65,$6D,$20,$72,$65,$6D,$6F,$75,$6E,$74,$65,$64
	.byte	$2E,$0A,$00,$43,$61,$72,$64,$20,$72,$65,$6D,$6F,$76,$65,$64,$21
	.byte	$0A,$00,$20,$20,$20,$2A,$2A,$20,$31,$35,$34,$31,$20,$55,$6C,$74
	.byte	$69,$6D,$61,$74,$65,$20,$50,$6C,$75,$73,$20,$2D,$20,$56,$31,$2E
	.byte	$37,$11,$20,$2A,$2A,$20,$20,$00,$20,$2A,$2A,$20,$31,$35,$34,$31
	.byte	$20,$55,$6C,$74,$69,$6D,$61,$74,$65,$20,$45,$74,$68,$65,$72,$6E
	.byte	$65,$74,$20,$2D,$20,$56,$31,$2E,$37,$11,$20,$2A,$2A,$00,$20,$20
	.byte	$20,$20,$20,$2A,$2A,$20,$31,$35,$34,$31,$20,$55,$6C,$74,$69,$6D
	.byte	$61,$74,$65,$20,$2D,$20,$56,$31,$2E,$37,$11,$20,$2A,$2A,$20,$20
	.byte	$20,$20,$20,$00,$52,$75,$6E,$6E,$69,$6E,$67,$20,$6D,$65,$6E,$75
	.byte	$2E,$2E,$2E,$0A,$00,$73,$65,$65,$6B,$3A,$20,$25,$73,$00,$55,$6E
	.byte	$6B,$6E,$6F,$77,$6E,$20,$63,$68,$61,$72,$61,$63,$74,$65,$72,$2E
	.byte	$20,$25,$30,$32,$78,$2E,$0A,$00,$43,$61,$6E,$27,$74,$20,$65,$6E
	.byte	$74,$65,$72,$20,$74,$68,$69,$73,$20,$74,$79,$70,$65,$2E,$0A,$00
	.byte	$4E,$75,$6D,$62,$65,$72,$20,$6F,$66,$20,$74,$72,$61,$63,$6B,$73
	.byte	$20,$72,$65,$61,$64,$3A,$20,$25,$64,$0A,$00,$03,$4D,$6F,$75,$6E
	.byte	$74,$69,$6E,$67,$20,$64,$69,$73,$6B,$2E,$2E,$2E,$20,$00,$55,$6E
	.byte	$6B,$6E,$6F,$77,$6E,$20,$74,$79,$70,$65,$2E,$0A,$00,$04,$20,$53
	.byte	$65,$6C,$65,$63,$74,$65,$64,$20,$65,$6E,$74,$72,$79,$20,$69,$73
	.byte	$20,$6E,$6F,$74,$20,$61,$20,$76,$61,$6C,$69,$64,$20,$66,$6F,$72
	.byte	$20,$66,$6C,$61,$73,$68,$69,$6E,$67,$21,$20,$20,$20,$09,$00,$02
	.byte	$46,$6C,$61,$73,$68,$69,$6E,$67,$2E,$2E,$2E,$20,$44,$6F,$20,$6E
	.byte	$6F,$74,$20,$74,$75,$72,$6E,$20,$6F,$66,$66,$20,$70,$6F,$77,$65
	.byte	$72,$21,$20,$20,$20,$00,$04,$20,$20,$20,$20,$45,$52,$52,$4F,$52
	.byte	$3A,$20,$46,$6C,$61,$73,$68,$69,$6E,$67,$20,$4E,$4F,$54,$20,$73
	.byte	$75,$63,$63,$65,$73,$73,$66,$75,$6C,$21,$21,$20,$20,$20,$20,$08
	.byte	$32,$20,$20,$20,$09,$00,$03,$45,$6E,$74,$65,$72,$20,$6E,$61,$6D
	.byte	$65,$20,$6F,$66,$20,$6E,$65,$77,$20,$64,$69,$73,$6B,$2E,$2E,$2E
	.byte	$20,$20,$20,$20,$20,$01,$20,$00,$2E,$64,$36,$34,$00,$2E,$64,$36
	.byte	$34,$00,$2E,$64,$36,$34,$00,$20,$49,$6C,$6C,$65,$67,$61,$6C,$20
	.byte	$6E,$61,$6D,$65,$2E,$20,$54,$72,$79,$20,$61,$67,$61,$69,$6E,$2E
	.byte	$20,$20,$00,$20,$43,$72,$65,$61,$74,$69,$6E,$67,$20,$64,$69,$73
	.byte	$6B,$2E,$20,$50,$6C,$65,$61,$73,$65,$20,$77,$61,$69,$74,$2E,$2E
	.byte	$2E,$20,$00,$05,$20,$20,$4F,$62,$6A,$65,$63,$74,$20,$61,$6C,$72
	.byte	$65,$61,$64,$79,$20,$65,$78,$69,$73,$74,$73,$21,$20,$20,$20,$09
	.byte	$00,$05,$20,$20,$45,$72,$72,$6F,$72,$20,$63,$72,$65,$61,$74,$69
	.byte	$6E,$67,$20,$66,$69,$6C,$65,$21,$20,$20,$20,$09,$00,$03,$45,$6E
	.byte	$74,$65,$72,$20,$66,$69,$6C,$65,$6E,$61,$6D,$65,$20,$66,$6F,$72
	.byte	$20,$6D,$65,$6D,$20,$64,$75,$6D,$70,$2E,$2E,$2E,$20,$20,$20,$01
	.byte	$20,$00,$2E,$64,$6D,$70,$00,$2E,$64,$6D,$70,$00,$2E,$64,$6D,$70
	.byte	$00,$20,$49,$6C,$6C,$65,$67,$61,$6C,$20,$6E,$61,$6D,$65,$2E,$20
	.byte	$54,$72,$79,$20,$61,$67,$61,$69,$6E,$20,$00,$20,$44,$75,$6D,$70
	.byte	$69,$6E,$67,$20,$6D,$65,$6D,$6F,$72,$79,$20,$74,$6F,$20,$66,$69
	.byte	$6C,$65,$2E,$2E,$2E,$20,$00,$05,$20,$20,$4F,$62,$6A,$65,$63,$74
	.byte	$20,$61,$6C,$72,$65,$61,$64,$79,$20,$65,$78,$69,$73,$74,$73,$21
	.byte	$20,$20,$20,$08,$32,$03,$09,$00,$05,$20,$20,$45,$72,$72,$6F,$72
	.byte	$20,$63,$72,$65,$61,$74,$69,$6E,$67,$20,$66,$69,$6C,$65,$21,$20
	.byte	$20,$20,$08,$32,$03,$09,$00,$03,$45,$6E,$74,$65,$72,$20,$6E,$61
	.byte	$6D,$65,$20,$6F,$66,$20,$6E,$65,$77,$20,$64,$69,$72,$65,$63,$74
	.byte	$6F,$72,$79,$2E,$2E,$2E,$20,$01,$20,$00,$20,$49,$6C,$6C,$65,$67
	.byte	$61,$6C,$20,$6E,$61,$6D,$65,$2E,$20,$54,$72,$79,$20,$61,$67,$61
	.byte	$69,$6E,$20,$00,$20,$43,$72,$65,$61,$74,$69,$6E,$67,$20,$64,$69
	.byte	$72,$65,$63,$74,$6F,$72,$79,$2E,$20,$50,$6C,$65,$61,$73,$65,$20
	.byte	$77,$61,$69,$74,$2E,$2E,$2E,$20,$00,$72,$65,$73,$75,$6C,$74,$20
	.byte	$3D,$20,$25,$64,$0A,$00,$05,$20,$20,$4F,$62,$6A,$65,$63,$74,$20
	.byte	$61,$6C,$72,$65,$61,$64,$79,$20,$65,$78,$69,$73,$74,$73,$21,$20
	.byte	$20,$20,$08,$32,$03,$09,$00,$05,$20,$20,$45,$72,$72,$6F,$72,$20
	.byte	$63,$72,$65,$61,$74,$69,$6E,$67,$20,$66,$69,$6C,$65,$21,$20,$20
	.byte	$20,$08,$32,$03,$09,$00,$03,$41,$52,$45,$20,$59,$4F,$55,$20,$53
	.byte	$55,$52,$45,$3F,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20,$20
	.byte	$01,$20,$00,$20,$59,$65,$73,$2C,$20,$4E,$6F,$2C,$20,$41,$6C,$77
	.byte	$61,$79,$73,$20,$00,$05,$20,$20,$45,$72,$72,$6F,$72,$20,$64,$65
	.byte	$6C,$65,$74,$69,$6E,$67,$20,$65,$6E,$74,$72,$79,$21,$20,$20,$20
	.byte	$09,$00,$05,$20,$20,$45,$72,$72,$6F,$72,$20,$72,$65,$6E,$61,$6D
	.byte	$69,$6E,$67,$21,$20,$20,$20,$09,$00,$25,$34,$75,$20,$62,$6C,$6B
	.byte	$73,$00,$25,$36,$75,$6B,$42,$00,$53,$74,$61,$72,$74,$20,$61,$64
	.byte	$64,$72,$65,$73,$73,$20,$6F,$66,$20,$2E,$50,$52,$47,$20,$3D,$20
	.byte	$25,$30,$34,$78,$2E,$0A,$00,$25,$64,$20,$62,$79,$74,$65,$73,$20
	.byte	$72,$65,$61,$64,$20,$74,$6F,$20,$61,$64,$64,$72,$20,$25,$30,$34
	.byte	$78,$2E,$20,$52,$65,$71,$75,$65,$73,$74,$65,$64,$20,$25,$30,$34
	.byte	$78,$20,$62,$79,$74,$65,$73,$2E,$0A,$00

.segment	"BSS"

_menu_file:
	.res	540,$00
_menu_dir:
	.res	14,$00
_menu_fres:
	.res	1,$00
_menu_offset:
	.res	2,$00
_menu_index:
	.res	2,$00
_disk_changed:
	.res	1,$00
_delete_always:
	.res	1,$00
_num_entries:
	.res	2,$00
_tmp:
	.res	38,$00
_swap_delay:
	.res	1,$00
_menu_dir_depth:
	.res	1,$00
_subdir_trace:
	.res	48,$00
_index_trace:
	.res	24,$00
_offset_trace:
	.res	24,$00
_quick_seek:
	.res	13,$00
_quick_seek_name:
	.res	22,$00
_under_box:
	.res	240,$00
_menu_dir_cache:
	.res	6,$00
_menu_entry_name:
	.res	13,$00
_scroll_enable:
	.res	1,$00

; ---------------------------------------------------------------
; void __near__ menu_reset_global_scroll (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_menu_reset_global_scroll: near

.segment	"CODE"

;
; start_pos  = 81;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 127
	ldx     #$00
	lda     #$51
	sta     _start_pos
	stx     _start_pos+1
;
; width      = NUM_COLMS;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 128
	lda     #$26
	sta     _width
;
; num_lines  = NUM_LINES;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 129
	lda     #$15
	sta     _num_lines
;
; do_color   = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 130
	stx     _do_color
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 131
	rts
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ menu_init (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_menu_init: near

.segment	"CODE"

;
; menu_dir_cache.dir_address = MENU_DIR_ADDR;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 597
	ldx     #$00
	lda     #$31
	sta     _menu_dir_cache
	stx     _menu_dir_cache+1
;
; menu_dir_depth  = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 598
	txa
	sta     _menu_dir_depth
;
; menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 599
	sta     _menu_offset
	sta     _menu_offset+1
;
; menu_index  = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 600
	sta     _menu_index
	sta     _menu_index+1
;
; num_entries = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 601
	sta     _num_entries
	sta     _num_entries+1
;
; quick_seek.command_len = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 602
	sta     _quick_seek+5
;
; quick_seek.command_str = NULL;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 603
	sta     _quick_seek+7
	sta     _quick_seek+7+1
;
; quick_seek.illegal = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 604
	sta     _quick_seek+3
;
; quick_seek.len = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 605
	sta     _quick_seek+4
;
; quick_seek.name_str = quick_seek_name;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 606
	lda     #<(_quick_seek_name)
	sta     _quick_seek+9
	lda     #>(_quick_seek_name)
	sta     _quick_seek+9+1
;
; quick_seek.pattern = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 607
	txa
	sta     _quick_seek+1
;
; quick_seek.replace = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 608
	sta     _quick_seek
;
; quick_seek.unit = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 609
	sta     _quick_seek+6
;
; quick_seek.wildcard = TRUE; // ALWAYS OTHERWISE IT WOULD NOT BE A SEEK NOW WOULD IT?
;
	.dbg	line, "../../../ui/src/c64_menu.c", 610
	lda     #$01
	sta     _quick_seek+2
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 611
	rts
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ menu_run (unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_menu_run: near

.segment	"CODE"

;
; printf("Running menu...\n");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 619
	jsr     decsp4
	lda     #<(L0001+292)
	ldx     #>(L0001+292)
	jsr     pushax
	ldy     #$02
	jsr     _printf
;
; check_change();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 621
	jsr     _check_change
;
; disk_changed = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 622
	lda     #$00
	sta     _disk_changed
;
; delete_always = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 624
	sta     _delete_always
;
; draw_menu();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 626
	jsr     _draw_menu
;
; GPIO_IMASK = C64_IRQ; // turn on IRQ from VIC
;
	.dbg	line, "../../../ui/src/c64_menu.c", 627
	lda     #$10
	sta     $2002
;
; run = TRUE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 629
	lda     #$01
	tay
	sta     (sp),y
;
; flash_flag = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 630
	lda     #$00
	dey
	sta     (sp),y
;
; swap_delay = (BYTE)cfg_get_value(CFG_SWAP_DELAY);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 632
L0921:	lda     #$16
	jsr     pusha
	jsr     _cfg_get_value
	sta     _swap_delay
;
; while(run) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 634
L0468:	ldy     #$01
	lda     (sp),y
	jeq     L0469
;
; check_change();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 635
	jsr     _check_change
;
; if(disk_changed && boot && !card_det) {  // SD-remove => exit
;
	.dbg	line, "../../../ui/src/c64_menu.c", 637
	lda     _disk_changed
	beq     L046C
	ldy     #$04
	lda     (sp),y
	beq     L046C
	lda     _card_det
	bne     L046C
;
; run = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 638
	ldy     #$01
	sta     (sp),y
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 639
	jsr     _exit_freeze
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 640
	jmp     L0469
;
; key = kb_buf_getch();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 643
L046C:	jsr     _kb_buf_getch
	ldy     #$03
	sta     (sp),y
;
; if(!key)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 644
	lda     (sp),y
;
; continue;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 645
	beq     L0468
;
; if((key == '!')&&(flash_flag)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 647
	lda     (sp),y
	cmp     #$21
	bne     L0477
	ldy     #$00
	lda     (sp),y
	beq     L0477
;
; handle_flash();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 648
	jsr     _handle_flash
;
; continue;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 649
	jmp     L0468
;
; flash_flag = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 651
L0477:	lda     #$00
	tay
	sta     (sp),y
;
; len = quick_seek.len;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 654
	lda     _quick_seek+4
	ldy     #$02
	sta     (sp),y
;
; (!((key < 32)||(key > 127))) ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 656
	iny
	lda     (sp),y
	cmp     #$20
	bcc     L0486
	lda     (sp),y
	cmp     #$80
	bcs     L0486
	lda     #$00
	jmp     L0489
L0486:	lda     #$01
L0489:	jsr     bnega
	bne     L0484
;
; ((key == 0x14) && (len > 0))   // backspace (inst/del)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 657
	lda     (sp),y
	cmp     #$14
	jne     L0482
	dey
	lda     (sp),y
	jeq     L0482
;
; !((key >= 'A') && (key <= 'Z'))  // CAPS for special functions?
;
	.dbg	line, "../../../ui/src/c64_menu.c", 661
L0484:	ldy     #$03
	lda     (sp),y
	cmp     #$41
	bcc     L0494
	lda     (sp),y
	cmp     #$5B
	bcc     L0492
L0494:	lda     #$00
	jmp     L0496
L0492:	lda     #$01
;
; )
;
	.dbg	line, "../../../ui/src/c64_menu.c", 662
L0496:	jsr     bnega
;
; &&
;
	.dbg	line, "../../../ui/src/c64_menu.c", 663
	jeq     L0482
;
; (key != 0x2F)   // filter /, since we need it for root
;
	.dbg	line, "../../../ui/src/c64_menu.c", 664
	lda     (sp),y
	cmp     #$2F
;
; ) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 665
	beq     L0482
;
; if(key == 0x14) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 666
	lda     (sp),y
	cmp     #$14
	bne     L0499
;
; len--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 667
	dey
	lda     (sp),y
	pha
	sec
	sbc     #$01
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 669
	jmp     L091E
;
; if((key >= 'a') && (key <= 'z')) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 670
L0499:	lda     (sp),y
	cmp     #$61
	bcc     L049D
	lda     (sp),y
	cmp     #$7B
	bcs     L049D
;
; key &= ~0x20;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 671
	lda     (sp),y
	and     #$DF
	sta     (sp),y
;
; quick_seek_name[len] = key;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 673
L049D:	lda     #<(_quick_seek_name)
	ldx     #>(_quick_seek_name)
	dey
	clc
	adc     (sp),y
	bcc     L04A7
	inx
L04A7:	sta     ptr1
	stx     ptr1+1
	iny
	lda     (sp),y
	ldy     #$00
	sta     (ptr1),y
;
; len++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 674
	ldy     #$02
	lda     (sp),y
	pha
	clc
	adc     #$01
L091E:	sta     (sp),y
	pla
;
; quick_seek_name[len] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 677
	lda     #<(_quick_seek_name)
	ldx     #>(_quick_seek_name)
	clc
	adc     (sp),y
	bcc     L04AD
	inx
L04AD:	sta     ptr1
	stx     ptr1+1
	lda     #$00
	tay
	sta     (ptr1),y
;
; quick_seek.len = len;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 678
	ldy     #$02
	lda     (sp),y
	sta     _quick_seek+4
;
; printf("seek: %s", quick_seek.name_str);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 680
	lda     #<(L0001+309)
	ldx     #>(L0001+309)
	jsr     pushax
	lda     _quick_seek+9
	ldx     _quick_seek+9+1
	jsr     pushax
	ldy     #$04
	jsr     _printf
;
; perform_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 681
	jsr     _perform_quick_seek
;
; continue;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 682
	jmp     L0468
;
; switch(key) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 685
L0482:	ldy     #$03
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 774
	cmp     #$03
	beq     L04BD
	cmp     #$0D
	jeq     L0511
	cmp     #$11
	beq     L04C2
	cmp     #$14
	jeq     L04F6
	cmp     #$1D
	jeq     L04F2
	cmp     #$2F
	jeq     L04FC
	cmp     #$43
	jeq     L050D
	cmp     #$44
	jeq     L0505
	cmp     #$46
	beq     L04B9
	cmp     #$51
	jeq     L0502
	cmp     #$52
	jeq     L0509
	cmp     #$85
	beq     L04CC
	cmp     #$86
	jeq     L04E8
	cmp     #$88
	jeq     L04ED
	cmp     #$89
	beq     L04D1
	cmp     #$91
	beq     L04C7
	cmp     #$94
	jeq     L0517
	cmp     #$9D
	jeq     L04F6
	jmp     L051A
;
; flash_flag = TRUE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 687
L04B9:	lda     #$01
	ldy     #$00
	sta     (sp),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 688
	jmp     L0468
;
; run = FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 690
L04BD:	lda     #$00
	ldy     #$01
	sta     (sp),y
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 691
	jsr     _exit_freeze
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 692
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 694
L04C2:	jsr     _reset_quick_seek
;
; handle_down(1);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 695
	lda     #$01
	jsr     pusha
	jsr     _handle_down
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 696
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 698
L04C7:	jsr     _reset_quick_seek
;
; handle_up(1);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 699
	lda     #$01
	jsr     pusha
	jsr     _handle_up
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 700
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 702
L04CC:	jsr     _reset_quick_seek
;
; handle_up(NUM_LINES-1);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 703
	lda     #$14
	jsr     pusha
	jsr     _handle_up
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 704
	jmp     L0468
;
; if(!run_config()) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 706
L04D1:	jsr     _run_config
	tax
	bne     L04D2
;
; set_title();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 707
	jsr     _set_title
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 708
	jsr     _draw_directory
;
; if(quick_seek.len != 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 709
	lda     _quick_seek+4
	beq     L04D6
;
; perform_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 710
	jsr     _perform_quick_seek
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 712
L04D6:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 713
	lda     #$15
	sta     _new_message
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 714
	jmp     L0921
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 715
L04D2:	jsr     _reset_quick_seek
;
; clear_screen(0x0f);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 716
	lda     #$0F
	jsr     pusha
	jsr     _clear_screen
;
; disk_change = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 717
	lda     #$01
	sta     _disk_change
;
; draw_menu();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 718
	jsr     _draw_menu
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 721
	jmp     L0921
;
; run = handle_select(TRUE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 723
L04E8:	lda     #$01
	jsr     pusha
	jsr     _handle_select
	ldy     #$01
	sta     (sp),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 724
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 727
L04ED:	jsr     _reset_quick_seek
;
; handle_down(NUM_LINES-1);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 728
	lda     #$14
	jsr     pusha
	jsr     _handle_down
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 729
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 731
L04F2:	jsr     _reset_quick_seek
;
; dir_down();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 732
	jsr     _dir_down
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 733
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 737
L04F6:	jsr     _reset_quick_seek
;
; dir_up();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 738
	jsr     _dir_up
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 739
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 741
L04FC:	jsr     _reset_quick_seek
;
; menu_dir_depth = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 742
	lda     #$01
	sta     _menu_dir_depth
;
; dir_up();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 743
	jsr     _dir_up
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 744
	jmp     L0468
;
; handle_dump_mem();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 746
L0502:	jsr     _handle_dump_mem
;
; break; 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 747
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 749
L0505:	jsr     _reset_quick_seek
;
; handle_create_dir();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 750
	jsr     _handle_create_dir
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 751
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 753
L0509:	jsr     _reset_quick_seek
;
; handle_rename();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 754
	jsr     _handle_rename
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 755
	jmp     L0468
;
; reset_quick_seek();   
;
	.dbg	line, "../../../ui/src/c64_menu.c", 760
L050D:	jsr     _reset_quick_seek
;
; handle_create_disk();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 762
	jsr     _handle_create_disk
;
; break; 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 763
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 765
L0511:	jsr     _reset_quick_seek
;
; run = handle_select(FALSE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 766
	lda     #$00
	jsr     pusha
	jsr     _handle_select
	ldy     #$01
	sta     (sp),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 767
	jmp     L0468
;
; reset_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 769
L0517:	jsr     _reset_quick_seek
;
; handle_delete();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 770
	jsr     _handle_delete
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 771
	jmp     L0468
;
; printf("Unknown character. %02x.\n", key);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 773
L051A:	lda     #<(L0001+318)
	ldx     #>(L0001+318)
	jsr     pushax
	ldy     #$05
	lda     (sp),y
	jsr     pusha0
	ldy     #$04
	jsr     _printf
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 774
	jmp     L0468
;
; return disk_changed;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 776
L0469:	ldx     #$00
	lda     _disk_changed
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 777
	jmp     incsp5
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ draw_menu (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_draw_menu: near

.segment	"CODE"

;
; char *scr = (char *)SCREEN1_ADDR;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 227
	ldx     #$44
	lda     #$00
	jsr     pushax
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 230
	jsr     decsp1
	ldx     #$04
	sta     $2300
	stx     $2300+1
;
; set_title();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 232
	jsr     _set_title
;
; for(b=40;b<80;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 233
	lda     #$28
	ldy     #$00
L0922:	sta     (sp),y
	cmp     #$50
	bcs     L00C6
;
; scr[b] = 2; // horizontal line
;
	.dbg	line, "../../../ui/src/c64_menu.c", 234
	lda     (sp),y
	clc
	iny
	adc     (sp),y
	sta     ptr1
	lda     #$00
	iny
	adc     (sp),y
	sta     ptr1+1
	tya
	ldy     #$00
	sta     (ptr1),y
;
; for(b=40;b<80;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 233
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0922
;
; for(b=0;b<40;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 235
L00C6:	tya
L0923:	sta     (sp),y
	cmp     #$28
	bcs     L00D1
;
; scr[(NUM_LINES+2)*40+b] = 2; // horizontal line
;
	.dbg	line, "../../../ui/src/c64_menu.c", 236
	lda     (sp),y
	clc
	adc     #$98
	pha
	tya
	adc     #$03
	tax
	pla
	clc
	iny
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	tya
	ldy     #$00
	sta     (ptr1),y
;
; for(b=0;b<40;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 235
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0923
;
; for(b=0;b<40;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 239
L00D1:	tya
L0924:	sta     (sp),y
	cmp     #$28
	bcs     L00DD
;
; COLOR_MAP3(b) = 1; // white title    
;
	.dbg	line, "../../../ui/src/c64_menu.c", 240
	lda     (sp),y
	sta     ptr1
	lda     #$00
	clc
	adc     #$38
	sta     ptr1+1
	lda     #$01
	sta     (ptr1),y
;
; for(b=0;b<40;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 239
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0924
;
; menu_reset_global_scroll();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 243
L00DD:	jsr     _menu_reset_global_scroll
;
; check_change();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 245
	jsr     _check_change
;
; memcpy(copper_list, my_copper, 32);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 247
	ldy     #$1F
L00EE:	lda     _my_copper,y
	sta     _copper_list,y
	dey
	bpl     L00EE
;
; copper_pntr = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 248
	lda     #$00
	sta     _copper_pntr
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 250
	jsr     _draw_directory
;
; if(quick_seek.len != 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 251
	lda     _quick_seek+4
	beq     L00F2
;
; perform_quick_seek();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 252
	jsr     _perform_quick_seek
;
; scroll_enable = cfg_get_value(CFG_SCROLL_EN);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 255
L00F2:	lda     #$0C
	jsr     pusha
	jsr     _cfg_get_value
	sta     _scroll_enable
;
; if(scroll_enable) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 256
	lda     _scroll_enable
	beq     L00F8
;
; scroll_msg  = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 257
	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
	sta     _scroll_msg+1
;
; new_message = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 258
	lda     #$01
	sta     _new_message
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 259
	jmp     incsp3
;
; memset(&scr[960], 32, 40); // clear out bottom line
;
	.dbg	line, "../../../ui/src/c64_menu.c", 260
L00F8:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$C0
	sta     ptr1
	txa
	adc     #$03
	sta     ptr1+1
	ldy     #$27
	lda     #$20
L0104:	sta     (ptr1),y
	dey
	bpl     L0104
;
; }    
;
	.dbg	line, "../../../ui/src/c64_menu.c", 262
	jmp     incsp3
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ draw_directory (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_draw_directory: near

.segment	"BSS"

L0106:
	.res	2,$00

.segment	"CODE"

;
; scr = (char *)(SCREEN1_ADDR);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 269
	jsr     decsp5
	ldx     #$44
	lda     #$00
	sta     L0106
	stx     L0106+1
;
; line_start = 81;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 271
	tax
	lda     #$51
	ldy     #$01
	jsr     staxysp
;
; if((menu_offset == 0) && (menu_index >= NUM_LINES)) { // Is the offset zero and does the index never fit on the screen?
;
	.dbg	line, "../../../ui/src/c64_menu.c", 275
	lda     _menu_offset
	ora     _menu_offset+1
	bne     L0119
	lda     _menu_index
	cmp     #$15
	lda     _menu_index+1
	sbc     #$00
	bcc     L0119
;
; menu_offset = (menu_index - (NUM_LINES / 2)); // Put the offset so that the menu_index lands in the middle
;
	.dbg	line, "../../../ui/src/c64_menu.c", 276
	lda     _menu_index
	ldx     _menu_index+1
	sec
	sbc     #$0A
	bcs     L0118
	dex
L0118:	sta     _menu_offset
	stx     _menu_offset+1
;
; if((menu_offset + NUM_LINES) > menu_dir_cache.num_entries) { // Does the offset fill the entire screen?
;
	.dbg	line, "../../../ui/src/c64_menu.c", 277
	clc
	adc     #$15
	bcc     L011C
	inx
L011C:	sec
	sbc     _menu_dir_cache+2
	sta     tmp1
	txa
	sbc     _menu_dir_cache+2+1
	ora     tmp1
	bcc     L0119
	beq     L0119
;
; menu_offset = menu_index - (NUM_LINES - 1);  
;
	.dbg	line, "../../../ui/src/c64_menu.c", 278
	lda     _menu_index
	ldx     _menu_index+1
	sec
	sbc     #$14
	bcs     L0120
	dex
L0120:	sta     _menu_offset
	stx     _menu_offset+1
;
; idx = menu_offset;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 283
L0119:	lda     _menu_offset
	ldx     _menu_offset+1
	ldy     #$03
	jsr     staxysp
;
; if((idx + NUM_LINES) > menu_dir_cache.num_entries) { // Does the offset fill the entire screen?
;
	.dbg	line, "../../../ui/src/c64_menu.c", 284
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$15
	bcc     L0126
	inx
L0126:	sec
	sbc     _menu_dir_cache+2
	sta     tmp1
	txa
	sbc     _menu_dir_cache+2+1
	ora     tmp1
	bcc     L012C
	beq     L012C
;
; if(menu_dir_cache.num_entries < NUM_LINES) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 285
	lda     _menu_dir_cache+2+1
	bne     L0129
	lda     _menu_dir_cache+2
	cmp     #$15
L0129:	bcs     L0127
;
; idx = 0; // Index x is zero because the dircache cannot fill the entire screen
;
	.dbg	line, "../../../ui/src/c64_menu.c", 286
	ldx     #$00
	txa
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 287
	jmp     L0925
;
; idx = menu_dir_cache.num_entries - NUM_LINES;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 288
L0127:	lda     _menu_dir_cache+2
	ldx     _menu_dir_cache+2+1
	sec
	sbc     #$15
	bcs     L0925
	dex
L0925:	jsr     staxysp
;
; for(b = 0; b < NUM_LINES; b++, idx++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 292
L012C:	lda     #$00
	tay
	sta     (sp),y
L0130:	ldy     #$00
	lda     (sp),y
	cmp     #$15
	jcs     L0131
;
; format_direntry_menu(idx, menu_dir_cache.cbm_medium);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 293
	jsr     decsp3
	ldy     #$07
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     _menu_dir_cache+4
	ldy     #$00
	sta     (sp),y
	jsr     _format_direntry_menu
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 294
	ldx     #$04
	lda     #$00
	sta     $2300
	stx     $2300+1
;
; memcpy(scr + line_start, tmp, NUM_COLMS);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 295
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     L0106
	pha
	txa
	adc     L0106+1
	tax
	pla
	jsr     pushax
	lda     #<(_tmp)
	ldx     #>(_tmp)
	jsr     pushax
	ldx     #$00
	lda     #$26
	jsr     _memcpy
;
; start_pos = line_start;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 296
	ldy     #$02
	lda     (sp),y
	sta     _start_pos+1
	dey
	lda     (sp),y
	sta     _start_pos
;
; num_lines = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 297
	sty     _num_lines
;
; width = NUM_COLMS - 3; 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 298
	lda     #$23
	sta     _width
;
; set_color(0xF);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 299
	lda     #$0F
	jsr     pusha
	jsr     _set_color
;
; start_pos = line_start + NUM_COLMS - 3;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 300
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$26
	bcc     L014E
	inx
L014E:	sec
	sbc     #$03
	bcs     L014F
	dex
L014F:	sta     _start_pos
	stx     _start_pos+1
;
; num_lines = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 301
	sty     _num_lines
;
; width = 3;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 302
	lda     #$03
	sta     _width
;
; set_color(0x7);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 303
	lda     #$07
	jsr     pusha
	jsr     _set_color
;
; line_start += 40;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 304
	ldy     #$01
	ldx     #$00
	lda     #$28
	jsr     addeqysp
;
; for(b = 0; b < NUM_LINES; b++, idx++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 292
	ldy     #$00
	lda     (sp),y
	clc
	adc     #$01
	sta     (sp),y
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	bcc     L0139
	inx
L0139:	jsr     staxysp
	jmp     L0130
;
; menu_reset_global_scroll();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 307
L0131:	jsr     _menu_reset_global_scroll
;
; copper_en   = 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 309
	lda     #$80
	sta     _copper_en
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 310
	jmp     incsp5
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_create_disk (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_create_disk: near

.segment	"CODE"

;
; scroll_msg = "\003Enter name of new disk...     \001 ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1066
	ldy     #$24
	jsr     subysp
	lda     #<(L0001+566)
	sta     _scroll_msg
	lda     #>(L0001+566)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1070
	lda     #$15
	sta     _new_message
;
; filename[0] = '\0';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1072
	lda     #$00
	ldy     #$04
	sta     (sp),y
;
; if(!string_box(446, NR_OF_EL(filename) - sizeof(D64_EXT),
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1075
L06CD:	jsr     decsp6
	lda     #$BE
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$01
	sta     (sp),y
	lda     #$1B
	ldy     #$03
	sta     (sp),y
;
; filename, NR_OF_EL(filename) - sizeof(D64_EXT)))
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1076
	lda     sp
	ldx     sp+1
	clc
	adc     #$0A
	bcc     L06DB
	inx
L06DB:	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$1B
	ldy     #$00
	sta     (sp),y
	jsr     _string_box
	tax
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1077
	jeq     L06CE
;
; strcat(filename, D64_EXT);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1079
	lda     sp
	ldx     sp+1
	clc
	adc     #$04
	bcc     L06E5
	inx
L06E5:	jsr     pushax
	lda     #<(L0001+610)
	ldx     #>(L0001+610)
	jsr     _strcat
;
; dir_analyze_name(filename, NR_OF_EL(filename), &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1080
	jsr     decsp5
	lda     sp
	ldx     sp+1
	clc
	adc     #$09
	bcc     L06E9
	inx
L06E9:	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$20
	ldy     #$02
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_analyze_name
;
; if( menu_entry_name.pattern ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1081
	lda     _menu_entry_name+1
	bne     L06F2
;
; menu_entry_name.command_len != 0 || // THIS IS ALLOWED BUT NOT YET IMPLEMENTED (for replace will point to @)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1082
	lda     _menu_entry_name+5
	bne     L06F2
;
; menu_entry_name.unit != 0 ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1083
	lda     _menu_entry_name+6
	bne     L06F2
;
; menu_entry_name.wildcard || 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1084
	lda     _menu_entry_name+2
	bne     L06F2
;
; menu_entry_name.illegal) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1085
	lda     _menu_entry_name+3
	beq     L06F1
;
; scroll_msg = " Illegal name. Try again.  ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1087
L06F2:	lda     #<(L0001+615)
	sta     _scroll_msg
	lda     #>(L0001+615)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1088
	lda     #$15
	sta     _new_message
;
; else  {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1090
	jmp     L06CD
;
; scroll_msg = " Creating disk. Please wait... ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1092
L06F1:	lda     #<(L0001+643)
	sta     _scroll_msg
	lda     #>(L0001+643)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1095
	lda     #$15
	sta     _new_message
;
; if(menu_dir_depth) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1097
	lda     _menu_dir_depth
	beq     L06FD
;
; dir_cluster = subdir_trace[menu_dir_depth-1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1098
	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L0702
	dex
L0702:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
	jsr     steax0sp
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1099
	jmp     L0703
;
; dir_cluster = 0L;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1100
L06FD:	tay
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
;
; f_opendir_direct(&menu_dir, dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1102
L0703:	jsr     decsp6
	lda     #<(_menu_dir)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	ldy     #$09
	jsr     ldeaxysp
	jsr     steax0sp
	jsr     _f_opendir_direct
;
; menu_fres = f_create_file_entry(&menu_file, &menu_dir, menu_entry_name.name_str, D64_SIZE, menu_entry_name.replace, FALSE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1105
	ldy     #$0C
	jsr     subysp
	lda     #<(_menu_file)
	ldy     #$0A
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(_menu_dir)
	ldy     #$08
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	lda     _menu_entry_name+9
	ldy     #$06
	sta     (sp),y
	iny
	lda     _menu_entry_name+9+1
	sta     (sp),y
	lda     #$00
	ldy     #$02
	sta     (sp),y
	ldy     #$05
	sta     (sp),y
	lda     #$AB
	ldy     #$03
	sta     (sp),y
	lda     #$02
	iny
	sta     (sp),y
	lda     _menu_entry_name
	ldy     #$01
	sta     (sp),y
	lda     #$00
	dey
	sta     (sp),y
	jsr     _f_create_file_entry
	sta     _menu_fres
;
; if(menu_fres) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1106
	lda     _menu_fres
	beq     L0711
;
; if(menu_fres == FR_EXISTS) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1107
	lda     _menu_fres
	cmp     #$0C
	bne     L0713
;
; scroll_msg = "\005  Object already exists!   \011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1108
	lda     #<(L0001+675)
	sta     _scroll_msg
	lda     #>(L0001+675)
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1110
	jmp     L0929
;
; scroll_msg = "\005  Error creating file!   \011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1111
L0713:	lda     #<(L0001+705)
	sta     _scroll_msg
	lda     #>(L0001+705)
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1114
	jmp     L0929
;
; menu_fres = d64_create(&menu_file, menu_entry_name.name_str);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1117
L0711:	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     _menu_entry_name+9
	ldy     #$00
	sta     (sp),y
	iny
	lda     _menu_entry_name+9+1
	sta     (sp),y
	jsr     _d64_create
	sta     _menu_fres
;
; f_close(&menu_file);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1119
	lda     #<(_menu_file)
	ldx     #>(_menu_file)
	jsr     pushax
	jsr     _f_close
;
; menu_dir_change(dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1129
	jsr     ldeax0sp
	jsr     pusheax
	jsr     _menu_dir_change
;
; menu_index = dir_getindex(&menu_dir_cache, &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1130
	jsr     decsp4
	lda     #<(_menu_dir_cache)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_getindex
	sta     _menu_index
	stx     _menu_index+1
;
; menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1131
	lda     #$00
	sta     _menu_offset
	sta     _menu_offset+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1132
	jsr     _draw_directory
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1137
L06CE:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
L0929:	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1138
	lda     #$15
	sta     _new_message
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1139
	ldy     #$24
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_create_dir (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_create_dir: near

.segment	"CODE"

;
; scroll_msg = "\003Enter name of new directory... \001 ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1204
	ldy     #$1C
	jsr     subysp
	lda     #<(L0001+903)
	sta     _scroll_msg
	lda     #>(L0001+903)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1205
	lda     #$15
	sta     _new_message
;
; dirname[0] = '\0';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1207
	lda     #$00
	ldy     #$04
	sta     (sp),y
;
; if(!string_box(448, NR_OF_EL(dirname), 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1209
L079E:	jsr     decsp6
	lda     #$C0
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$01
	sta     (sp),y
	lda     #$18
	ldy     #$03
	sta     (sp),y
;
; dirname, NR_OF_EL(dirname)))
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1210
	lda     sp
	ldx     sp+1
	clc
	adc     #$0A
	bcc     L07AB
	inx
L07AB:	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$18
	ldy     #$00
	sta     (sp),y
	jsr     _string_box
	tax
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1211
	jeq     L079F
;
; dir_analyze_name(dirname, NR_OF_EL(dirname), &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1213
	jsr     decsp5
	lda     sp
	ldx     sp+1
	clc
	adc     #$09
	bcc     L07B4
	inx
L07B4:	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$18
	ldy     #$02
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_analyze_name
;
; if( menu_entry_name.pattern ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1214
	lda     _menu_entry_name+1
	bne     L07BD
;
; menu_entry_name.command_len != 0 || // THIS IS ALLOWED BUT NOT YET IMPLEMENTED 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1215
	lda     _menu_entry_name+5
	bne     L07BD
;
; menu_entry_name.unit != 0 ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1216
	lda     _menu_entry_name+6
	bne     L07BD
;
; menu_entry_name.wildcard || 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1217
	lda     _menu_entry_name+2
	bne     L07BD
;
; menu_entry_name.illegal) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1218
	lda     _menu_entry_name+3
	beq     L07BC
;
; scroll_msg = " Illegal name. Try again ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1220
L07BD:	lda     #<(L0001+938)
	sta     _scroll_msg
	lda     #>(L0001+938)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1221
	lda     #$15
	sta     _new_message
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1223
	jmp     L079E
;
; scroll_msg = " Creating directory. Please wait... ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1224
L07BC:	lda     #<(L0001+964)
	sta     _scroll_msg
	lda     #>(L0001+964)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1225
	lda     #$15
	sta     _new_message
;
; if(menu_dir_depth) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1227
	lda     _menu_dir_depth
	beq     L07C8
;
; dir_cluster = subdir_trace[menu_dir_depth-1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1228
	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L07CD
	dex
L07CD:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
	jsr     steax0sp
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1229
	jmp     L07CE
;
; dir_cluster = 0L;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1230
L07C8:	tay
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
;
; f_opendir_direct(&menu_dir, dir_cluster); 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1232
L07CE:	jsr     decsp6
	lda     #<(_menu_dir)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	ldy     #$09
	jsr     ldeaxysp
	jsr     steax0sp
	jsr     _f_opendir_direct
;
; menu_fres = f_create_dir_entry(&menu_dir, menu_entry_name.name_str, menu_entry_name.replace);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1235
	jsr     decsp5
	lda     #<(_menu_dir)
	ldy     #$03
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	lda     _menu_entry_name+9
	ldy     #$01
	sta     (sp),y
	iny
	lda     _menu_entry_name+9+1
	sta     (sp),y
	lda     _menu_entry_name
	ldy     #$00
	sta     (sp),y
	jsr     _f_create_dir_entry
	sta     _menu_fres
;
; if(menu_fres) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1236
	lda     _menu_fres
	beq     L07D9
;
; printf("result = %d\n", menu_fres);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1237
	lda     #<(L0001+1001)
	ldx     #>(L0001+1001)
	jsr     pushax
	lda     _menu_fres
	jsr     pusha0
	ldy     #$04
	jsr     _printf
;
; if(menu_fres == FR_EXISTS) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1238
	lda     _menu_fres
	cmp     #$0C
	bne     L07DE
;
; scroll_msg = "\005  Object already exists!   \010\x32\003\011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1239
	lda     #<(L0001+1014)
	sta     _scroll_msg
	lda     #>(L0001+1014)
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1241
	jmp     L092D
;
; scroll_msg = "\005  Error creating file!   \010\x32\003\011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1242
L07DE:	lda     #<(L0001+1047)
	sta     _scroll_msg
	lda     #>(L0001+1047)
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1245
	jmp     L092D
;
; menu_dir_change(dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1247
L07D9:	jsr     ldeax0sp
	jsr     pusheax
	jsr     _menu_dir_change
;
; menu_index = dir_getindex(&menu_dir_cache, &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1248
	jsr     decsp4
	lda     #<(_menu_dir_cache)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_getindex
	sta     _menu_index
	stx     _menu_index+1
;
; menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1249
	lda     #$00
	sta     _menu_offset
	sta     _menu_offset+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1250
	jsr     _draw_directory
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1256
L079F:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
L092D:	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1257
	lda     #$15
	sta     _new_message
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1258
	ldy     #$1C
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_dump_mem (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_dump_mem: near

.segment	"CODE"

;
; scroll_msg = "\003Enter filename for mem dump...   \001 ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1146
	ldy     #$24
	jsr     subysp
	lda     #<(L0001+733)
	sta     _scroll_msg
	lda     #>(L0001+733)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1147
	lda     #$15
	sta     _new_message
;
; filename[0] = '\0';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1149
	lda     #$00
	ldy     #$04
	sta     (sp),y
;
; if(!string_box(446,  NR_OF_EL(filename) - sizeof(DMP_EXT),
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1151
L073A:	jsr     decsp6
	lda     #$BE
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$01
	sta     (sp),y
	lda     #$1B
	ldy     #$03
	sta     (sp),y
;
; filename, NR_OF_EL(filename) - sizeof(DMP_EXT)))
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1152
	lda     sp
	ldx     sp+1
	clc
	adc     #$0A
	bcc     L0748
	inx
L0748:	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$1B
	ldy     #$00
	sta     (sp),y
	jsr     _string_box
	tax
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1153
	jeq     L073B
;
; strcat(filename, DMP_EXT);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1155
	lda     sp
	ldx     sp+1
	clc
	adc     #$04
	bcc     L0752
	inx
L0752:	jsr     pushax
	lda     #<(L0001+780)
	ldx     #>(L0001+780)
	jsr     _strcat
;
; dir_analyze_name(filename, NR_OF_EL(filename), &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1156
	jsr     decsp5
	lda     sp
	ldx     sp+1
	clc
	adc     #$09
	bcc     L0756
	inx
L0756:	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$20
	ldy     #$02
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_analyze_name
;
; if( menu_entry_name.pattern ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1157
	lda     _menu_entry_name+1
	bne     L075F
;
; menu_entry_name.command_len != 0 || // THIS IS ALLOWED BUT NOT YET IMPLEMENTED
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1158
	lda     _menu_entry_name+5
	bne     L075F
;
; menu_entry_name.unit != 0 ||
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1159
	lda     _menu_entry_name+6
	bne     L075F
;
; menu_entry_name.wildcard || 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1160
	lda     _menu_entry_name+2
	bne     L075F
;
; menu_entry_name.illegal) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1161
	lda     _menu_entry_name+3
	beq     L075E
;
; scroll_msg = " Illegal name. Try again ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1163
L075F:	lda     #<(L0001+785)
	sta     _scroll_msg
	lda     #>(L0001+785)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1164
	lda     #$15
	sta     _new_message
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1166
	jmp     L073A
;
; scroll_msg = " Dumping memory to file... ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1167
L075E:	lda     #<(L0001+811)
	sta     _scroll_msg
	lda     #>(L0001+811)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1168
	lda     #$15
	sta     _new_message
;
; if(menu_dir_depth) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1170
	lda     _menu_dir_depth
	beq     L076A
;
; dir_cluster = subdir_trace[menu_dir_depth-1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1171
	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L076F
	dex
L076F:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
	jsr     steax0sp
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1172
	jmp     L0770
;
; dir_cluster = 0L;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1173
L076A:	tay
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
;
; f_opendir_direct(&menu_dir, dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1175
L0770:	jsr     decsp6
	lda     #<(_menu_dir)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	ldy     #$09
	jsr     ldeaxysp
	jsr     steax0sp
	jsr     _f_opendir_direct
;
; menu_fres = f_create_file_entry(&menu_file, &menu_dir, menu_entry_name.name_str, 0L, menu_entry_name.replace, FALSE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1176
	ldy     #$0C
	jsr     subysp
	lda     #<(_menu_file)
	ldy     #$0A
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(_menu_dir)
	ldy     #$08
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	lda     _menu_entry_name+9
	ldy     #$06
	sta     (sp),y
	iny
	lda     _menu_entry_name+9+1
	sta     (sp),y
	ldy     #$02
	lda     #$00
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	lda     _menu_entry_name
	ldy     #$01
	sta     (sp),y
	lda     #$00
	dey
	sta     (sp),y
	jsr     _f_create_file_entry
	sta     _menu_fres
;
; if(menu_fres) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1177
	lda     _menu_fres
	beq     L077E
;
; if(menu_fres == FR_EXISTS) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1178
	lda     _menu_fres
	cmp     #$0C
	bne     L0780
;
; scroll_msg = "\005  Object already exists!   \010\x32\003\011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1179
	lda     #<(L0001+839)
	sta     _scroll_msg
	lda     #>(L0001+839)
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1181
	jmp     L0931
;
; scroll_msg = "\005  Error creating file!   \010\x32\003\011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1182
L0780:	lda     #<(L0001+872)
	sta     _scroll_msg
	lda     #>(L0001+872)
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1185
	jmp     L0931
;
; dump_mem_to_file();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1187
L077E:	jsr     _dump_mem_to_file
;
; f_close(&menu_file);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1188
	lda     #<(_menu_file)
	ldx     #>(_menu_file)
	jsr     pushax
	jsr     _f_close
;
; menu_dir_change(dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1189
	jsr     ldeax0sp
	jsr     pusheax
	jsr     _menu_dir_change
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1190
	jsr     _draw_directory
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1195
L073B:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
L0931:	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1196
	lda     #$15
	sta     _new_message
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1197
	ldy     #$24
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_flash (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_flash: near

.segment	"BSS"

L0699:
	.res	2,$00

.segment	"CODE"

;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1034
	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L0699
	stx     L0699+1
;
; if(entry->ftype != TYPE_HEX) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1035
	sta     ptr1
	stx     ptr1+1
	ldy     #$09
	lda     (ptr1),y
	cmp     #$07
	beq     L069E
;
; scroll_msg  = "\004 Selected entry is not a valid for flashing!   \011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1036
	lda     #<(L0001+429)
	sta     _scroll_msg
	lda     #>(L0001+429)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1037
	lda     #$15
	sta     _new_message
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1038
	rts
;
; menu_fres = f_open_direct(&menu_file, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1041
L069E:	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L0699
	ldy     #$00
	sta     (sp),y
	iny
	lda     L0699+1
	sta     (sp),y
	jsr     _f_open_direct
	sta     _menu_fres
;
; if(menu_fres == FR_OK) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1042
	lda     _menu_fres
	bne     L06A8
;
; scroll_msg = "\002Flashing... Do not turn off power!   ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1043
	lda     #<(L0001+479)
	sta     _scroll_msg
	lda     #>(L0001+479)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1044
	lda     #$15
	sta     _new_message
;
; GPIO_CLEAR2 = SOUND_ENABLE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1045
	lda     #$01
	sta     $2007
;
; if(!flash_file(&menu_file, 0)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1046
	jsr     decsp3
	lda     #<(_menu_file)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #$00
	tay
	sta     (sp),y
	jsr     _flash_file
	tax
	bne     L06B1
;
; scroll_msg  = "\004    ERROR: Flashing NOT successful!!    \010\x32   \011";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1047
	lda     #<(L0001+518)
	sta     _scroll_msg
	lda     #>(L0001+518)
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1049
	jmp     L0934
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1050
L06B1:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
L0934:	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1051
	lda     #$15
	sta     _new_message
;
; GPIO_SET2 = SOUND_ENABLE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1053
	lda     #$01
	sta     $2006
;
; f_close(&menu_file);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1054
	lda     #<(_menu_file)
	ldx     #>(_menu_file)
	jsr     pushax
	jmp     _f_close
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1056
L06A8:	rts
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ prg_loadfile (unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_prg_loadfile: near

.segment	"BSS"

L08DD:
	.res	2,$00
L08DE:
	.res	2,$00
L08DF:
	.res	2,$00
L08E0:
	.res	2,$00
L08E1:
	.res	2,$00

.segment	"CODE"

;
; dma_load_init();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1403
	jsr     _dma_load_init
;
; menu_fres = f_read(&menu_file, &i, 2, &bytes_read);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1406
	jsr     decsp8
	lda     #<(_menu_file)
	ldy     #$06
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(L08DD)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(L08DD)
	sta     (sp),y
	lda     #$02
	tay
	sta     (sp),y
	iny
	lda     #$00
	sta     (sp),y
	lda     #<(L08E1)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L08E1)
	sta     (sp),y
	jsr     _f_read
	sta     _menu_fres
;
; printf("Start address of .PRG = %04x.\n", i);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1408
	lda     #<(L0001+1192)
	ldx     #>(L0001+1192)
	jsr     pushax
	lda     L08DD
	ldx     L08DD+1
	jsr     pushax
	ldy     #$04
	jsr     _printf
;
; e = i;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1409
	lda     L08DD
	sta     L08E0
	lda     L08DD+1
	sta     L08E0+1
;
; m = (i >> 13) | MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1410
	lda     L08DD+1
	ldx     #$00
	lsr     a
	lsr     a
	lsr     a
	lsr     a
	jsr     shrax1
	sta     L08DE
	txa
	ora     #$04
	sta     L08DE+1
;
; i &= 0x1FFF;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1411
	ldy     L08DD
	lda     L08DD+1
	and     #$1F
	sta     L08DD+1
	sty     L08DD
;
; n = 0x2000- i;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1412
	lda     #$00
	sec
	sbc     L08DD
	sta     L08DF
	lda     #$20
	sbc     L08DD+1
	sta     L08DF+1
;
; i |= MAP1_ADDR;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1413
	lda     L08DD
	sta     L08DD
	lda     L08DD+1
	ora     #$40
	sta     L08DD+1
;
; while(bytes_read) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1415
L08F7:	lda     L08E1
	ora     L08E1+1
	jeq     L08F8
;
; MAPPER_MAP1 = m;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1416
	lda     L08DE
	sta     $2300
	lda     L08DE+1
	sta     $2300+1
;
; f_read(&menu_file, (void *)i, n, &bytes_read);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1417
	jsr     decsp8
	lda     #<(_menu_file)
	ldy     #$06
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L08DD
	ldy     #$04
	sta     (sp),y
	iny
	lda     L08DD+1
	sta     (sp),y
	lda     L08DF
	ldy     #$02
	sta     (sp),y
	iny
	lda     L08DF+1
	sta     (sp),y
	lda     #<(L08E1)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L08E1)
	sta     (sp),y
	jsr     _f_read
;
; printf("%d bytes read to addr %04x. Requested %04x bytes.\n", bytes_read, i, n);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1418
	lda     #<(L0001+1223)
	ldx     #>(L0001+1223)
	jsr     pushax
	lda     L08E1
	ldx     L08E1+1
	jsr     pushax
	lda     L08DD
	ldx     L08DD+1
	jsr     pushax
	lda     L08DF
	ldx     L08DF+1
	jsr     pushax
	ldy     #$08
	jsr     _printf
;
; e += bytes_read;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1419
	lda     L08E1
	clc
	adc     L08E0
	sta     L08E0
	lda     L08E1+1
	adc     L08E0+1
	sta     L08E0+1
;
; i = MAP1_ADDR;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1420
	ldx     #$40
	lda     #$00
	sta     L08DD
	stx     L08DD+1
;
; n = 0x2000;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1421
	ldx     #$20
	sta     L08DF
	stx     L08DF+1
;
; m ++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1422
	lda     L08DE
	ldx     L08DE+1
	clc
	adc     #$01
	bcc     L090E
	inx
L090E:	sta     L08DE
	stx     L08DE+1
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1423
	jmp     L08F7
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1426
L08F8:	ldx     #$04
	sta     $2300
	stx     $2300+1
;
; *(WORD *)(MAP1_ADDR + 0x002D) = e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1427
	lda     L08E0
	sta     $402D
	lda     L08E0+1
	sta     $402D+1
;
; dma_load_exit(run?DMA_RUN:DMA_BASIC);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1429
	ldy     #$00
	lda     (sp),y
	beq     L0917
	lda     #$80
	jmp     L0919
L0917:	lda     #$C0
L0919:	jsr     pusha
	jsr     _dma_load_exit
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1430
	jmp     incsp1
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ string_box (unsigned short, signed char, __near__ signed char*, unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_string_box: near

.segment	"BSS"

L026B:
	.res	2,$00
L026C:
	.res	2,$00

.segment	"CODE"

;
; w = maxlen + 2;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 427
	jsr     decsp3
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$02
	ldy     #$06
	sta     (sp),y
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 429
	ldx     #$04
	lda     #$00
	sta     $2300
	stx     $2300+1
;
; scr = (char *)(SCREEN1_ADDR + pos);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 430
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     L026B
	txa
	clc
	adc     #$44
	sta     L026B+1
;
; col = (char *)(COLOR3_ADDR + pos);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 431
	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     L026C
	txa
	clc
	adc     #$38
	sta     L026C+1
;
; bar = copper_list[COP_POS_BRDR]; // store color, in case we want to play with this
;
	.dbg	line, "../../../ui/src/c64_menu.c", 434
	lda     _copper_list+7
	ldy     #$00
	sta     (sp),y
;
; copper_list[COP_POS_BRDR] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 435
	tya
	sta     _copper_list+7
;
; copper_list[COP_POS_SCR]  = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 436
	sta     _copper_list+9
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 441
	iny
L093D:	sta     (sp),y
	sec
	sbc     #$78
	bvc     L028D
	eor     #$80
L028D:	bpl     L0286
;
; under_box[0][b] = scr[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 442
	lda     #<(_under_box)
	ldx     #>(_under_box)
	clc
	adc     (sp),y
	bcc     L0294
	inx
L0294:	jsr     pushax
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0297
	dex
L0297:	clc
	adc     L026B
	pha
	txa
	adc     L026B+1
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; under_box[1][b] = col[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 443
	lda     #<(_under_box+120)
	ldx     #>(_under_box+120)
	ldy     #$01
	clc
	adc     (sp),y
	bcc     L029C
	inx
L029C:	jsr     pushax
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L029F
	dex
L029F:	clc
	adc     L026C
	pha
	txa
	adc     L026C+1
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 441
	ldy     #$01
	lda     (sp),y
	clc
	adc     #$01
	jmp     L093D
;
; scr[0] = 1; // upper left corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 447
L0286:	lda     L026B
	sta     ptr1
	lda     L026B+1
	sta     ptr1+1
	tya
	dey
	sta     (ptr1),y
;
; scr[40] = 4; // vertical bar
;
	.dbg	line, "../../../ui/src/c64_menu.c", 448
	lda     L026B
	sta     ptr1
	lda     L026B+1
	sta     ptr1+1
	lda     #$04
	ldy     #$28
	sta     (ptr1),y
;
; scr[80] = 5; // lower left corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 449
	lda     L026B
	sta     ptr1
	lda     L026B+1
	sta     ptr1+1
	lda     #$05
	ldy     #$50
	sta     (ptr1),y
;
; for(b=1;b<w-1;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 450
	lda     #$01
	tay
L093E:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L02B0
	dex
L02B0:	jsr     pushax
	ldy     #$08
	ldx     #$00
	lda     (sp),y
	bpl     L02B1
	dex
L02B1:	sec
	sbc     #$01
	bcs     L02B2
	dex
L02B2:	jsr     tosicmp
	bpl     L02AA
;
; scr[b] = 2; // horizontal line
;
	.dbg	line, "../../../ui/src/c64_menu.c", 451
	ldx     #$00
	ldy     #$01
	lda     (sp),y
	bpl     L02B7
	dex
L02B7:	clc
	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	lda     #$02
	dey
	sta     (ptr1),y
;
; scr[b+80] = 2;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 452
	ldx     #$00
	iny
	lda     (sp),y
	bpl     L02BB
	dex
L02BB:	clc
	adc     #$50
	bcc     L0936
	inx
	clc
L0936:	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	lda     #$02
	dey
	sta     (ptr1),y
;
; scr[b+40] = 20; // space
;
	.dbg	line, "../../../ui/src/c64_menu.c", 453
	ldx     #$00
	iny
	lda     (sp),y
	bpl     L02C0
	dex
L02C0:	clc
	adc     #$28
	bcc     L0937
	inx
	clc
L0937:	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	lda     #$14
	dey
	sta     (ptr1),y
;
; for(b=1;b<w-1;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 450
	iny
	lda     (sp),y
	clc
	adc     #$01
	jmp     L093E
;
; scr[w-1] = 3; // upper right corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 455
L02AA:	ldx     #$00
	ldy     #$06
	lda     (sp),y
	bpl     L02C5
	dex
L02C5:	sec
	sbc     #$01
	bcs     L02C6
	dex
L02C6:	clc
	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	lda     #$03
	ldy     #$00
	sta     (ptr1),y
;
; scr[39+w] = 4; // vertical bar
;
	.dbg	line, "../../../ui/src/c64_menu.c", 456
	ldx     #$00
	ldy     #$06
	lda     (sp),y
	bpl     L02CA
	dex
L02CA:	clc
	adc     #$27
	bcc     L0938
	inx
	clc
L0938:	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	lda     #$04
	ldy     #$00
	sta     (ptr1),y
;
; scr[79+w] = 6; // lower right corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 457
	ldx     #$00
	ldy     #$06
	lda     (sp),y
	bpl     L02CF
	dex
L02CF:	clc
	adc     #$4F
	bcc     L0939
	inx
	clc
L0939:	adc     L026B
	sta     ptr1
	txa
	adc     L026B+1
	sta     ptr1+1
	tya
	ldy     #$00
	sta     (ptr1),y
;
; strncpy(scr+41, buffer, w-2);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 460
	jsr     decsp4
	lda     L026B
	ldx     L026B+1
	clc
	adc     #$29
	bcc     L02D4
	inx
L02D4:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$09
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$0A
	ldx     #$00
	lda     (sp),y
	bpl     L02D7
	dex
L02D7:	sec
	sbc     #$02
	bcs     L02D8
	dex
L02D8:	jsr     _strncpy
;
; for(b=0;b<w;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 462
	lda     #$00
	ldy     #$01
L0940:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L02E0
	dex
L02E0:	jsr     pushax
	ldy     #$08
	ldx     #$00
	lda     (sp),y
	bpl     L02E1
	dex
L02E1:	jsr     tosicmp
	jpl     L02DA
;
; col[b]    = 0x0e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 463
	ldx     #$00
	ldy     #$01
	lda     (sp),y
	bpl     L02E6
	dex
L02E6:	clc
	adc     L026C
	sta     ptr1
	txa
	adc     L026C+1
	sta     ptr1+1
	lda     #$0E
	dey
	sta     (ptr1),y
;
; col[b+80] = 0x0e;  
;
	.dbg	line, "../../../ui/src/c64_menu.c", 464
	ldx     #$00
	iny
	lda     (sp),y
	bpl     L02EA
	dex
L02EA:	clc
	adc     #$50
	bcc     L093A
	inx
	clc
L093A:	adc     L026C
	sta     ptr1
	txa
	adc     L026C+1
	sta     ptr1+1
	lda     #$0E
	dey
	sta     (ptr1),y
;
; if((b > 0) && (b < (w-1))) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 465
	iny
	lda     (sp),y
	sec
	sbc     #$01
	bvs     L02F1
	eor     #$80
L02F1:	bpl     L02ED
	ldx     #$00
	lda     (sp),y
	bpl     L02F4
	dex
L02F4:	jsr     pushax
	ldy     #$08
	ldx     #$00
	lda     (sp),y
	bpl     L02F6
	dex
L02F6:	sec
	sbc     #$01
	bcs     L02F7
	dex
L02F7:	jsr     tosicmp
	bpl     L02ED
;
; col[b+40] = 0x0F; // Grey
;
	.dbg	line, "../../../ui/src/c64_menu.c", 466
	ldx     #$00
	ldy     #$01
	lda     (sp),y
	bpl     L02FB
	dex
L02FB:	clc
	adc     #$28
	bcc     L093B
	inx
	clc
L093B:	adc     L026C
	sta     ptr1
	txa
	adc     L026C+1
	sta     ptr1+1
	lda     #$0F
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 468
	jmp     L093F
;
; col[b+40] = 0x0e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 469
L02ED:	ldx     #$00
	ldy     #$01
	lda     (sp),y
	bpl     L0301
	dex
L0301:	clc
	adc     #$28
	bcc     L093C
	inx
	clc
L093C:	adc     L026C
	sta     ptr1
	txa
	adc     L026C+1
	sta     ptr1+1
	lda     #$0E
L093F:	dey
	sta     (ptr1),y
;
; for(b=0;b<w;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 462
	iny
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0940
;
; ret = string_input(&scr[41], buffer, maxlen); // cursor on second line, second char
;
	.dbg	line, "../../../ui/src/c64_menu.c", 473
L02DA:	jsr     decsp5
	lda     L026B
	ldx     L026B+1
	clc
	adc     #$29
	bcc     L0308
	inx
L0308:	ldy     #$03
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$0A
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldy     #$08
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	jsr     _string_input
	ldy     #$02
	sta     (sp),y
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 476
	lda     #$00
	dey
L0941:	sta     (sp),y
	sec
	sbc     #$78
	bvc     L0313
	eor     #$80
L0313:	bpl     L030C
;
; scr[b] = under_box[0][b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 477
	ldx     #$00
	lda     (sp),y
	bpl     L0318
	dex
L0318:	clc
	adc     L026B
	pha
	txa
	adc     L026B+1
	tax
	pla
	jsr     pushax
	lda     #<(_under_box)
	ldx     #>(_under_box)
	ldy     #$03
	clc
	adc     (sp),y
	bcc     L031D
	inx
L031D:	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; col[b] = under_box[1][b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 478
	ldx     #$00
	ldy     #$01
	lda     (sp),y
	bpl     L0320
	dex
L0320:	clc
	adc     L026C
	pha
	txa
	adc     L026C+1
	tax
	pla
	jsr     pushax
	lda     #<(_under_box+120)
	ldx     #>(_under_box+120)
	ldy     #$03
	clc
	adc     (sp),y
	bcc     L0325
	inx
L0325:	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 476
	ldy     #$01
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0941
;
; copper_list[COP_POS_BRDR] = bar;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 481
L030C:	dey
	lda     (sp),y
	sta     _copper_list+7
;
; copper_list[COP_POS_SCR]  = bar;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 482
	lda     (sp),y
	sta     _copper_list+9
;
; return ret;    
;
	.dbg	line, "../../../ui/src/c64_menu.c", 484
	ldy     #$02
	ldx     #$00
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 485
	ldy     #$09
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_up (unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_up: near

.segment	"BSS"

L0548:
	.res	2,$00

.segment	"CODE"

;
; if(!menu_dir_cache.num_entries)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 814
	lda     _menu_dir_cache+2
	ora     _menu_dir_cache+2+1
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 815
	jeq     incsp1
;
; if(menu_index >= a)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 818
	lda     _menu_index
	ldy     #$00
	cmp     (sp),y
	lda     _menu_index+1
	sbc     #$00
	bcc     L054B
;
; menu_index -= a;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 819
	lda     (sp),y
	eor     #$FF
	sec
	adc     _menu_index
	sta     _menu_index
	lda     #$FF
	adc     _menu_index+1
;
; else
;
	.dbg	line, "../../../ui/src/c64_menu.c", 820
	jmp     L0942
;
; menu_index = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 821
L054B:	tya
	sta     _menu_index
L0942:	sta     _menu_index+1
;
; if(menu_index < menu_dir_cache.info_fields) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 823
	lda     _menu_index
	cmp     _menu_dir_cache+5
	lda     _menu_index+1
	sbc     #$00
	bcs     L0552
;
; menu_index = menu_dir_cache.info_fields;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 824
	lda     _menu_dir_cache+5
	sta     _menu_index
	sty     _menu_index+1
;
; if(menu_offset > menu_index) { // scroll
;
	.dbg	line, "../../../ui/src/c64_menu.c", 827
L0552:	lda     _menu_offset
	sec
	sbc     _menu_index
	sta     tmp1
	lda     _menu_offset+1
	sbc     _menu_index+1
	ora     tmp1
	jcc     incsp1
	jeq     incsp1
;
; menu_offset = menu_index;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 828
	lda     _menu_index
	sta     _menu_offset
	lda     _menu_index+1
	sta     _menu_offset+1
;
; if(a == 1) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 829
	lda     (sp),y
	cmp     #$01
	bne     L055A
;
; scroll_up();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 830
	jsr     _scroll_up
;
; scr = (char *)(SCREEN1_ADDR + 81);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 831
	ldx     #$44
	lda     #$51
	sta     L0548
	stx     L0548+1
;
; format_direntry_menu(menu_index, menu_dir_cache.cbm_medium);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 832
	jsr     decsp3
	lda     _menu_index
	ldy     #$01
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     _menu_dir_cache+4
	ldy     #$00
	sta     (sp),y
	jsr     _format_direntry_menu
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 833
	ldx     #$04
	lda     #$00
	sta     $2300
	stx     $2300+1
;
; memcpy(scr, tmp, NUM_COLMS);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 834
	lda     L0548
	ldx     L0548+1
	jsr     pushax
	lda     #<(_tmp)
	ldx     #>(_tmp)
	jsr     pushax
	ldx     #$00
	lda     #$26
	jsr     _memcpy
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 836
	jmp     incsp1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 837
L055A:	jsr     _draw_directory
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 840
	jmp     incsp1
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_down (unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_down: near

.segment	"BSS"

L0520:
	.res	2,$00

.segment	"CODE"

;
; if(!menu_dir_cache.num_entries)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 785
	lda     _menu_dir_cache+2
	ora     _menu_dir_cache+2+1
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 786
	jeq     incsp1
;
; if(menu_index+a < menu_dir_cache.num_entries)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 788
	ldy     #$00
	lda     (sp),y
	clc
	adc     _menu_index
	ldx     _menu_index+1
	bcc     L0943
	inx
L0943:	cmp     _menu_dir_cache+2
	txa
	sbc     _menu_dir_cache+2+1
	bcs     L0523
;
; menu_index+=a;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 789
	lda     (sp),y
	clc
	adc     _menu_index
	sta     _menu_index
	tya
	adc     _menu_index+1
	sta     _menu_index+1
;
; else
;
	.dbg	line, "../../../ui/src/c64_menu.c", 790
	jmp     L0527
;
; menu_index = menu_dir_cache.num_entries - 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 791
L0523:	lda     _menu_dir_cache+2
	ldx     _menu_dir_cache+2+1
	sec
	sbc     #$01
	bcs     L052A
	dex
L052A:	sta     _menu_index
	stx     _menu_index+1
;
; if(menu_index >= menu_offset + NUM_LINES) { // scroll
;
	.dbg	line, "../../../ui/src/c64_menu.c", 793
L0527:	lda     _menu_index
	ldx     _menu_index+1
	jsr     pushax
	lda     _menu_offset
	ldx     _menu_offset+1
	clc
	adc     #$15
	bcc     L052D
	inx
L052D:	jsr     tosicmp
	jcc     incsp1
;
; if(a == 1) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 794
	ldy     #$00
	lda     (sp),y
	cmp     #$01
	bne     L052E
;
; menu_offset ++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 795
	lda     _menu_offset
	ldx     _menu_offset+1
	clc
	adc     #$01
	bcc     L0531
	inx
L0531:	sta     _menu_offset
	stx     _menu_offset+1
;
; scroll_down();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 796
	jsr     _scroll_down
;
; scr = (char *)(SCREEN1_ADDR + 41 + NUM_LINES * 40);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 797
	ldx     #$47
	lda     #$71
	sta     L0520
	stx     L0520+1
;
; format_direntry_menu(menu_index, menu_dir_cache.cbm_medium);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 798
	jsr     decsp3
	lda     _menu_index
	ldy     #$01
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     _menu_dir_cache+4
	ldy     #$00
	sta     (sp),y
	jsr     _format_direntry_menu
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 799
	ldx     #$04
	lda     #$00
	sta     $2300
	stx     $2300+1
;
; memcpy(scr, tmp, NUM_COLMS);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 800
	lda     L0520
	ldx     L0520+1
	jsr     pushax
	lda     #<(_tmp)
	ldx     #>(_tmp)
	jsr     pushax
	ldx     #$00
	lda     #$26
	jsr     _memcpy
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 802
	jmp     incsp1
;
; menu_offset = 1 + menu_index - NUM_LINES;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 803
L052E:	lda     _menu_index
	ldx     _menu_index+1
	clc
	adc     #$01
	bcc     L0544
	inx
L0544:	sec
	sbc     #$15
	bcs     L0545
	dex
L0545:	sta     _menu_offset
	stx     _menu_offset+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 804
	jsr     _draw_directory
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 807
	jmp     incsp1
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ dir_down (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_dir_down: near

.segment	"BSS"

L05A7:
	.res	2,$00

.segment	"CODE"

;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 883
	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L05A7
	stx     L05A7+1
;
; switch(entry->ftype) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 884
	sta     ptr1
	stx     ptr1+1
	ldy     #$09
	lda     (ptr1),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 897
	cmp     #$01
	beq     L05B0
	cmp     #$02
	beq     L05B4
	cmp     #$03
	beq     L05B4
	cmp     #$08
	beq     L05B4
	cmp     #$09
	beq     L05B4
	cmp     #$0E
	beq     L05B4
	jmp     L05C0
;
; handle_select(FALSE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 886
L05B0:	lda     #$00
	jsr     pusha
	jmp     _handle_select
;
; enter_cbm(entry, entry->ftype);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 893
L05B4:	jsr     decsp3
	lda     L05A7
	ldy     #$01
	sta     (sp),y
	iny
	lda     L05A7+1
	sta     (sp),y
	lda     L05A7
	sta     ptr1
	lda     L05A7+1
	sta     ptr1+1
	ldy     #$09
	lda     (ptr1),y
	ldy     #$00
	sta     (sp),y
	jmp     _enter_cbm
;
; printf("Can't enter this type.\n");   
;
	.dbg	line, "../../../ui/src/c64_menu.c", 896
L05C0:	lda     #<(L0001+344)
	ldx     #>(L0001+344)
	jsr     pushax
	ldy     #$02
	jmp     _printf
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ dir_up (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_dir_up: near

.segment	"CODE"

;
; if(menu_dir_depth == 0)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 903
	lda     _menu_dir_depth
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 904
	bne     L094A
;
; }    
;
	.dbg	line, "../../../ui/src/c64_menu.c", 919
	rts
;
; menu_dir_depth--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 906
L094A:	lda     _menu_dir_depth
	sec
	sbc     #$01
	sta     _menu_dir_depth
;
; if(menu_dir_cache.cbm_medium) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 907
	lda     _menu_dir_cache+4
	beq     L05C7
;
; f_close(&menu_file); // ale a cbm medium implies the file pointer is used
;
	.dbg	line, "../../../ui/src/c64_menu.c", 908
	lda     #<(_menu_file)
	ldx     #>(_menu_file)
	jsr     pushax
	jsr     _f_close
;
; if(menu_dir_depth == 0)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 910
L05C7:	lda     _menu_dir_depth
	bne     L05CB
;
; menu_dir_change(0L);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 911
	tax
	sta     sreg
	sta     sreg+1
;
; else
;
	.dbg	line, "../../../ui/src/c64_menu.c", 912
	jmp     L0949
;
; menu_dir_change(subdir_trace[menu_dir_depth-1]);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 913
L05CB:	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L05D3
	dex
L05D3:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
L0949:	jsr     pusheax
	jsr     _menu_dir_change
;
; menu_index = index_trace[menu_dir_depth];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 915
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L0947
	inx
	clc
L0947:	adc     #<(_index_trace)
	sta     ptr1
	txa
	adc     #>(_index_trace)
	sta     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	sta     _menu_index+1
	dey
	lda     (ptr1),y
	sta     _menu_index
;
; menu_offset = offset_trace[menu_dir_depth];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 916
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L0948
	inx
	clc
L0948:	adc     #<(_offset_trace)
	sta     ptr1
	txa
	adc     #>(_offset_trace)
	sta     ptr1+1
	iny
	lda     (ptr1),y
	sta     _menu_offset+1
	dey
	lda     (ptr1),y
	sta     _menu_offset
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 918
	jmp     _draw_directory
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ enter_cbm (__near__ struct _DIRENTRY*, unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_enter_cbm: near

.segment	"CODE"

;
; if(menu_dir_depth+1 < MAX_DEPTH) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 846
	jsr     decsp1
	ldx     #$00
	lda     _menu_dir_depth
	clc
	adc     #$01
	bcc     L0570
	inx
L0570:	cpx     #$00
	bne     L0571
	cmp     #$0C
L0571:	jcs     incsp4
;
; index_trace[menu_dir_depth] = menu_index;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 847
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L094E
	inx
	clc
L094E:	adc     #<(_index_trace)
	sta     ptr1
	txa
	adc     #>(_index_trace)
	sta     ptr1+1
	lda     _menu_index
	ldy     #$00
	sta     (ptr1),y
	iny
	lda     _menu_index+1
	sta     (ptr1),y
;
; offset_trace[menu_dir_depth] = menu_offset;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 848
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L094F
	inx
	clc
L094F:	adc     #<(_offset_trace)
	sta     ptr1
	txa
	adc     #>(_offset_trace)
	sta     ptr1+1
	lda     _menu_offset
	dey
	sta     (ptr1),y
	iny
	lda     _menu_offset+1
	sta     (ptr1),y
;
; subdir_trace[menu_dir_depth++] = entry->fcluster;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 849
	ldx     #$00
	lda     _menu_dir_depth
	pha
	clc
	adc     #$01
	sta     _menu_dir_depth
	pla
	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     pushax
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$07
	jsr     ldeaxidx
	ldy     #$00
	jsr     steaxspidx
;
; f_open_direct(&menu_file, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 850
	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	ldy     #$07
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	jsr     _f_open_direct
;
; switch(mode) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 851
	ldy     #$01
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 865
	cmp     #$02
	beq     L0589
	cmp     #$03
	beq     L0582
	cmp     #$08
	beq     L0589
	cmp     #$09
	beq     L0589
	cmp     #$0E
	beq     L0595
	jmp     L059A
;
; res = t64_dir(&menu_file, &menu_dir_cache, TRUE);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 853
L0582:	jsr     decsp5
	lda     #<(_menu_file)
	ldy     #$03
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     #$01
	ldy     #$00
	sta     (sp),y
	jsr     _t64_dir
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 854
	jmp     L0950
;
; res = d64_dir(&menu_file, &menu_dir_cache, TRUE, mode);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 858
L0589:	jsr     decsp6
	lda     #<(_menu_file)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     #$01
	tay
	sta     (sp),y
	ldy     #$07
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	jsr     _d64_dir
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 859
	jmp     L0950
;
; res = sid_dir(&menu_file, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 861
L0595:	jsr     decsp4
	lda     #<(_menu_file)
	iny
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _sid_dir
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 862
	jmp     L0950
;
; res = FR_OK+1; // not ok
;
	.dbg	line, "../../../ui/src/c64_menu.c", 864
L059A:	tya
L0950:	ldy     #$00
	sta     (sp),y
;
; if(res == FR_OK)  {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 866
	lda     (sp),y
	bne     L059D
;
; menu_index = menu_dir_cache.info_fields;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 867
	lda     _menu_dir_cache+5
	sta     _menu_index
	tya
	sta     _menu_index+1
;
; menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 868
	sta     _menu_offset
	sta     _menu_offset+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 869
	jsr     _draw_directory
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 872
	jmp     incsp4
;
; menu_dir_depth--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 873
L059D:	lda     _menu_dir_depth
	sec
	sbc     #$01
	sta     _menu_dir_depth
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 876
	jmp     incsp4
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ handle_select (unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_select: near

.segment	"BSS"

L05DC:
	.res	2,$00
L05DD:
	.res	4,$00
L05DE:
	.res	2,$00
L05DF:
	.res	2,$00

.segment	"CODE"

;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 929
	jsr     decsp2
	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L05DC
	stx     L05DC+1
;
; switch(entry->ftype) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 930
	sta     ptr1
	stx     ptr1+1
	ldy     #$09
	ldx     #$00
	lda     (ptr1),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1026
	cmp     #$01
	beq     L05E8
	cmp     #$02
	jeq     L060F
	cmp     #$03
	jeq     L0625
	cmp     #$04
	jeq     L062F
	cmp     #$05
	jeq     L0652
	cmp     #$06
	jeq     L0682
	cmp     #$0A
	jeq     L0674
	cmp     #$0B
	jeq     L0674
	cmp     #$0C
	jeq     L05FD
	cmp     #$0D
	jeq     L0638
	cmp     #$0E
	jeq     L063F
	cmp     #$0F
	jeq     L0649
	jmp     L0694
;
; if(menu_dir_depth+1 < MAX_DEPTH) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 932
L05E8:	lda     _menu_dir_depth
	clc
	adc     #$01
	bcc     L05EB
	inx
L05EB:	cpx     #$00
	bne     L05EC
	cmp     #$0C
L05EC:	jcs     L05E6
;
; index_trace[menu_dir_depth] = menu_index;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 933
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L0953
	inx
	clc
L0953:	adc     #<(_index_trace)
	sta     ptr1
	txa
	adc     #>(_index_trace)
	sta     ptr1+1
	lda     _menu_index
	ldy     #$00
	sta     (ptr1),y
	iny
	lda     _menu_index+1
	sta     (ptr1),y
;
; offset_trace[menu_dir_depth] = menu_offset;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 934
	ldx     #$00
	lda     _menu_dir_depth
	asl     a
	bcc     L0954
	inx
	clc
L0954:	adc     #<(_offset_trace)
	sta     ptr1
	txa
	adc     #>(_offset_trace)
	sta     ptr1+1
	lda     _menu_offset
	dey
	sta     (ptr1),y
	iny
	lda     _menu_offset+1
	sta     (ptr1),y
;
; subdir_trace[menu_dir_depth++] = entry->fcluster;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 935
	ldx     #$00
	lda     _menu_dir_depth
	pha
	clc
	adc     #$01
	sta     _menu_dir_depth
	pla
	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     pushax
	lda     L05DC
	ldx     L05DC+1
	ldy     #$07
	jsr     ldeaxidx
	ldy     #$00
	jsr     steaxspidx
;
; menu_dir_change(entry->fcluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 936
	lda     L05DC
	ldx     L05DC+1
	ldy     #$07
	jsr     ldeaxidx
	jsr     pusheax
	jsr     _menu_dir_change
;
; menu_index = menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 937
	lda     #$00
	sta     _menu_offset
	sta     _menu_offset+1
	sta     _menu_index
	sta     _menu_index+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 938
	jsr     _draw_directory
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 940
	jmp     L05E6
;
; f_close(&mountfile);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 943
L05FD:	lda     #<(_mountfile)
	ldx     #>(_mountfile)
	jsr     pushax
	jsr     _f_close
;
; last_update(entry); // should be done before we do exit_freeze, due to mapper
;
	.dbg	line, "../../../ui/src/c64_menu.c", 944
	lda     L05DC
	ldx     L05DC+1
	jsr     pushax
	jsr     _last_update
;
; f_open_direct(&mountfile, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 945
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	lda     L05DC
	ldy     #$00
	sta     (sp),y
	iny
	lda     L05DC+1
	sta     (sp),y
	jsr     _f_open_direct
;
; wp = (BYTE)(entry->fattrib & AM_RDO);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 946
	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	ldy     #$08
	lda     (ptr1),y
	and     #$01
	ldy     #$01
	sta     (sp),y
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 947
	jsr     _exit_freeze
;
; load_g64(&mountfile, wp, swap_delay);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 948
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	ldy     #$05
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	lda     _swap_delay
	dey
	sta     (sp),y
	jsr     _load_g64
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 949
	ldx     #$00
	txa
	jmp     incsp3
;
; f_close(&mountfile);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 952
L060F:	lda     #<(_mountfile)
	ldx     #>(_mountfile)
	jsr     pushax
	jsr     _f_close
;
; last_update(entry); // should be done before we do exit_freeze, due to mapper
;
	.dbg	line, "../../../ui/src/c64_menu.c", 953
	lda     L05DC
	ldx     L05DC+1
	jsr     pushax
	jsr     _last_update
;
; f_open_direct(&mountfile, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 954
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	lda     L05DC
	ldy     #$00
	sta     (sp),y
	iny
	lda     L05DC+1
	sta     (sp),y
	jsr     _f_open_direct
;
; wp = (BYTE)(entry->fattrib & AM_RDO);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 955
	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	ldy     #$08
	lda     (ptr1),y
	and     #$01
	ldy     #$01
	sta     (sp),y
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 956
	jsr     _exit_freeze
;
; tr = load_d64(&mountfile, wp, swap_delay);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 957
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	ldy     #$05
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	lda     _swap_delay
	dey
	sta     (sp),y
	jsr     _load_d64
	ldy     #$00
	sta     (sp),y
;
; printf("Number of tracks read: %d\n", tr);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 958
	lda     #<(L0001+368)
	ldx     #>(L0001+368)
	jsr     pushax
	ldy     #$02
	lda     (sp),y
	jsr     pusha0
	ldy     #$04
	jsr     _printf
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 959
	ldx     #$00
	txa
	jmp     incsp3
;
; f_open_direct(&menu_file, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 962
L0625:	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L05DC
	ldy     #$00
	sta     (sp),y
	iny
	lda     L05DC+1
	sta     (sp),y
	jsr     _f_open_direct
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 963
	jsr     _exit_freeze
;
; t64_loadfirst(&menu_file, runflag);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 964
	jsr     decsp3
	lda     #<(_menu_file)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	ldy     #$05
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	jsr     _t64_loadfirst
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 965
	ldx     #$00
	txa
	jmp     incsp3
;
; f_open_direct(&menu_file, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 968
L062F:	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L05DC
	ldy     #$00
	sta     (sp),y
	iny
	lda     L05DC+1
	sta     (sp),y
	jsr     _f_open_direct
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 969
	jsr     _exit_freeze
;
; prg_loadfile(runflag);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 970
	ldy     #$02
	lda     (sp),y
	jsr     pusha
	jsr     _prg_loadfile
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 971
	ldx     #$00
	txa
	jmp     incsp3
;
; if(tap_open_file(entry)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 974
L0638:	lda     L05DC
	ldx     L05DC+1
	jsr     pushax
	jsr     _tap_open_file
	tax
	jeq     L05E6
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 975
	jsr     _exit_freeze
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 976
	ldx     #$00
	txa
	jmp     incsp3
;
; f_open_direct(&menu_file, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 981
L063F:	jsr     decsp4
	lda     #<(_menu_file)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L05DC
	ldy     #$00
	sta     (sp),y
	iny
	lda     L05DC+1
	sta     (sp),y
	jsr     _f_open_direct
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 982
	jsr     _exit_freeze
;
; sid_load(&menu_file, 0xFF);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 983
	jsr     decsp3
	lda     #<(_menu_file)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #$FF
	ldy     #$00
	sta     (sp),y
	jsr     _sid_load
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 984
	ldx     #$00
	txa
	jmp     incsp3
;
; wp = (BYTE)entry->fcluster;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 987
L0649:	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	ldy     #$04
	lda     (ptr1),y
	ldy     #$01
	sta     (sp),y
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 988
	jsr     _exit_freeze
;
; sid_load(&menu_file, wp);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 989
	jsr     decsp3
	lda     #<(_menu_file)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	ldy     #$04
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	jsr     _sid_load
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 990
	ldx     #$00
	txa
	jmp     incsp3
;
; tmpentry.fcluster = menu_file.org_clust;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 996
L0652:	ldy     #$20
	jsr     subysp
	lda     _menu_file+8+3
	sta     sreg+1
	lda     _menu_file+8+2
	sta     sreg
	ldx     _menu_file+8+1
	lda     _menu_file+8
	ldy     #$04
	jsr     steaxysp
;
; tmpentry.fsize = menu_file.fsize;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 997
	lda     _menu_file+4+3
	sta     sreg+1
	lda     _menu_file+4+2
	sta     sreg
	ldx     _menu_file+4+1
	lda     _menu_file+4
	jsr     steax0sp
;
; tmpentry.fattrib = (menu_file.flag & FA_WRITE) ? 0 : AM_RDO; // Write protect the D64
;
	.dbg	line, "../../../ui/src/c64_menu.c", 998
	lda     _menu_file+26
	and     #$02
	beq     L065A
	lda     #$00
	jmp     L065C
L065A:	lda     #$01
L065C:	ldy     #$08
	sta     (sp),y
;
; if(runflag) { // run, so mount the disk, too
;
	.dbg	line, "../../../ui/src/c64_menu.c", 999
	ldy     #$22
	lda     (sp),y
	beq     L065E
;
; scroll_msg = "\003Mounting disk... ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1000
	lda     #<(L0001+395)
	sta     _scroll_msg
	lda     #>(L0001+395)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1001
	lda     #$15
	sta     _new_message
;
; f_close(&mountfile);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1002
	lda     #<(_mountfile)
	ldx     #>(_mountfile)
	jsr     pushax
	jsr     _f_close
;
; f_open_direct(&mountfile, &tmpentry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1003
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$04
	bcc     L0669
	inx
L0669:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	jsr     _f_open_direct
;
; wp = (BYTE)(entry->fattrib & AM_RDO); // this should work, since all d64 entries inherit the readonly flag (TODO!)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1004
	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	ldy     #$08
	lda     (ptr1),y
	and     #$01
	ldy     #$21
	sta     (sp),y
;
; load_d64(&mountfile, wp, swap_delay);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1005
	jsr     decsp4
	lda     #<(_mountfile)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_mountfile)
	sta     (sp),y
	ldy     #$25
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	lda     _swap_delay
	dey
	sta     (sp),y
	jsr     _load_d64
;
; last_update(&tmpentry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1006
	lda     sp
	ldx     sp+1
	jsr     pushax
	jsr     _last_update
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1008
L065E:	ldy     #$20
	jsr     addysp
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1012
L0674:	jsr     _exit_freeze
;
; MAPPER_MAP1 = MENU_DIR_ADDR; // so we can read entry members again
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1013
	ldx     #$00
	lda     #$31
	sta     $2300
	stx     $2300+1
;
; d64_loadfile(&menu_file, entry->fcluster, runflag, entry->ftype);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1014
	jsr     decsp8
	lda     #<(_menu_file)
	ldy     #$06
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L05DC
	ldx     L05DC+1
	jsr     ldeaxidx
	ldy     #$02
	jsr     steaxysp
	ldy     #$0A
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	ldy     #$09
	lda     (ptr1),y
	ldy     #$00
	sta     (sp),y
	jsr     _d64_loadfile
;
; return FALSE;        
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1015
	ldx     #$00
	txa
	jmp     incsp3
;
; start = entry->fcluster;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1018
L0682:	lda     L05DC
	ldx     L05DC+1
	ldy     #$07
	jsr     ldeaxidx
	sta     L05DD
	stx     L05DD+1
	ldy     sreg
	sty     L05DD+2
	ldy     sreg+1
	sty     L05DD+3
;
; c64_strt = *(WORD *)&entry->fname[20];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1019
	lda     L05DC
	ldx     L05DC+1
	clc
	adc     #$1E
	bcc     L0689
	inx
L0689:	sta     ptr1
	stx     ptr1+1
	ldy     #$01
	lda     (ptr1),y
	sta     L05DE+1
	dey
	lda     (ptr1),y
	sta     L05DE
;
; c64_len  = (WORD)entry->fsize;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1020
	lda     L05DC
	sta     ptr1
	lda     L05DC+1
	sta     ptr1+1
	iny
	lda     (ptr1),y
	sta     L05DF+1
	dey
	lda     (ptr1),y
	sta     L05DF
;
; exit_freeze();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1021
	jsr     _exit_freeze
;
; t64_loadfile(&menu_file, start, c64_strt, c64_len, runflag);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1022
	ldy     #$0B
	jsr     subysp
	lda     #<(_menu_file)
	ldy     #$09
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     L05DD+3
	sta     sreg+1
	lda     L05DD+2
	sta     sreg
	ldx     L05DD+1
	lda     L05DD
	ldy     #$05
	jsr     steaxysp
	lda     L05DE
	ldy     #$03
	sta     (sp),y
	iny
	lda     L05DE+1
	sta     (sp),y
	lda     L05DF
	ldy     #$01
	sta     (sp),y
	iny
	lda     L05DF+1
	sta     (sp),y
	ldy     #$0D
	lda     (sp),y
	ldy     #$00
	sta     (sp),y
	jsr     _t64_loadfile
;
; return FALSE;        
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1023
	ldx     #$00
	txa
	jmp     incsp3
;
; printf("Unknown type.\n");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1025
L0694:	lda     #<(L0001+414)
	ldx     #>(L0001+414)
	jsr     pushax
	ldy     #$02
	jsr     _printf
;
; return TRUE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1027
L05E6:	ldx     #$00
	lda     #$01
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1028
	jmp     incsp3
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ format_direntry_menu (unsigned short, unsigned char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_format_direntry_menu: near

.segment	"BSS"

L0877:
	.res	2,$00
L0878:
	.res	1,$00
L0879:
	.res	2,$00
L087A:
	.res	1,$00
L087B:
	.res	1,$00

.segment	"CODE"

;
; entry = dir_getentry(index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1354
	jsr     decsp4
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L0877
	stx     L0877+1
;
; if(!entry) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1355
	lda     L0877
	ora     L0877+1
	bne     L0880
;
; memset(tmp, 32, NUM_COLMS);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1356
	ldy     #$25
	lda     #$20
L0886:	sta     _tmp,y
	dey
	bpl     L0886
;
; return TYPE_UNKNOWN;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1357
	ldx     #$00
	txa
	jmp     incsp3
;
; typ   = entry->ftype;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1360
L0880:	lda     L0877
	sta     ptr1
	lda     L0877+1
	sta     ptr1+1
	ldy     #$09
	lda     (ptr1),y
	sta     L0878
;
; for(c=1,b=0;b<MAX_ENTRY_NAME;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1362
	lda     #$01
	sta     L087B
	lda     #$00
L0957:	sta     L087A
	cmp     #$16
	bcs     L088B
;
; if(c)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1363
	lda     L087B
	beq     L0894
;
; c = entry->fname[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1364
	lda     L0877
	ldx     L0877+1
	clc
	adc     #$0A
	bcc     L0898
	inx
L0898:	ldy     L087A
	sta     ptr1
	stx     ptr1+1
	lda     (ptr1),y
	sta     L087B
;
; if(c)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1365
L0894:	lda     L087B
	beq     L089A
;
; tmp[b] = c;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1366
	lda     #<(_tmp)
	ldx     #>(_tmp)
	clc
	adc     L087A
	bcc     L089E
	inx
L089E:	sta     ptr1
	stx     ptr1+1
	lda     L087B
	ldy     #$00
	sta     (ptr1),y
;
; else
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1367
	jmp     L088C
;
; tmp[b] = ' ';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1368
L089A:	ldy     L087A
	lda     #$20
	sta     _tmp,y
;
; for(c=1,b=0;b<MAX_ENTRY_NAME;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1362
L088C:	lda     L087A
	clc
	adc     #$01
	jmp     L0957
;
; for(;b<35;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1370
L088B:	lda     L087A
	cmp     #$23
	bcs     L08A7
;
; tmp[b] = ' ';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1371
	ldy     L087A
	lda     #$20
	sta     _tmp,y
;
; for(;b<35;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1370
	lda     L087A
	clc
	adc     #$01
	sta     L087A
	jmp     L088B
;
; memcpy(&tmp[35], &extsout[typ*3], 3);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1373
L08A7:	lda     #<(_tmp+35)
	ldx     #>(_tmp+35)
	jsr     pushax
	ldx     #$00
	lda     L0878
	jsr     mulax3
	clc
	adc     #<(_extsout)
	tay
	txa
	adc     #>(_extsout)
	tax
	tya
	jsr     pushax
	ldx     #$00
	lda     #$03
	jsr     _memcpy
;
; if(entry->fattrib & AM_RDO)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1375
	lda     L0877
	sta     ptr1
	lda     L0877+1
	sta     ptr1+1
	ldy     #$08
	lda     (ptr1),y
	and     #$01
	beq     L08B6
;
; tmp[33] = 'R';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1376
	lda     #$52
	sta     _tmp+33
;
; switch(cbm) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1378
L08B6:	ldy     #$00
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1388
	cmp     #$01
	beq     L08BF
	cmp     #$02
	beq     L08C3
	jmp     L08C8
;
; size = (WORD)entry->fsize;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1380
L08BF:	lda     L0877
	sta     ptr1
	lda     L0877+1
	sta     ptr1+1
	iny
	lda     (ptr1),y
	tax
	dey
	lda     (ptr1),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1381
	jmp     L0958
;
; size = (WORD)((entry->fsize + 253)/254);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1383
L08C3:	lda     L0877
	ldx     L0877+1
	jsr     ldeaxi
	ldy     #$FD
	jsr     inceaxy
	jsr     pusheax
	ldx     #$00
	lda     #$FE
	jsr     tosudiv0ax
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1384
	jmp     L0958
;
; size  = (WORD)((entry->fsize + 1023) >> 10);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1386
L08C8:	lda     L0877
	ldx     L0877+1
	jsr     ldeaxi
	jsr     pusheax
	ldx     #$03
	lda     #$FF
	jsr     tosadd0ax
	txa
	ldx     sreg
	ldy     sreg+1
	sty     sreg
	ldy     #$00
	sty     sreg+1
	jsr     shreax2
L0958:	sta     L0879
	stx     L0879+1
;
; if(typ != TYPE_DIR)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1390
	lda     L0878
	cmp     #$01
	beq     L08CD
;
; sprintf(&tmp[24], cbm?"%4u blks":"%6ukB", size);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1391
	jsr     decsp4
	lda     #<(_tmp+24)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_tmp+24)
	sta     (sp),y
	iny
	lda     (sp),y
	beq     L08D3
	lda     #<(L0001+1177)
	ldx     #>(L0001+1177)
	jmp     L08D5
L08D3:	lda     #<(L0001+1186)
	ldx     #>(L0001+1186)
L08D5:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     L0879
	ldx     L0879+1
	jsr     pushax
	ldy     #$06
	jsr     _sprintf
;
; tmp[32] = ' ';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1393
L08CD:	lda     #$20
	sta     _tmp+32
;
; return typ;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1395
	ldx     #$00
	lda     L0878
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1396
	jmp     incsp3
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ perform_quick_seek (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_perform_quick_seek: near

.segment	"CODE"

;
; foundentry = dir_find_entry(&quick_seek, NULL, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 563
	jsr     decsp2
	jsr     decsp6
	lda     #<(_quick_seek)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_quick_seek)
	sta     (sp),y
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_find_entry
	jsr     stax0sp
;
; if(foundentry != NULL) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 564
	ldy     #$01
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	cpx     #$00
	bne     L0959
	cmp     #$00
	jeq     L040A
;
; menu_entry_name.name_str = foundentry->fname;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 565
L0959:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$0A
	bcc     L040F
	inx
L040F:	sta     _menu_entry_name+9
	stx     _menu_entry_name+9+1
;
; menu_entry_name.len = data_strnlen(menu_entry_name.name_str, MAX_ENTRY_NAME);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 566
	jsr     decsp3
	lda     _menu_entry_name+9
	iny
	sta     (sp),y
	iny
	lda     _menu_entry_name+9+1
	sta     (sp),y
	lda     #$16
	ldy     #$00
	sta     (sp),y
	jsr     _data_strnlen
	sta     _menu_entry_name+4
;
; menu_index = dir_getindex(&menu_dir_cache, &menu_entry_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 567
	jsr     decsp4
	lda     #<(_menu_dir_cache)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     #<(_menu_entry_name)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_entry_name)
	sta     (sp),y
	jsr     _dir_getindex
	sta     _menu_index
	stx     _menu_index+1
;
; menu_offset = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 568
	lda     #$00
	sta     _menu_offset
	sta     _menu_offset+1
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 569
	jsr     _draw_directory
;
; if(quick_seek.len != 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 570
	lda     _quick_seek+4
	jeq     incsp2
;
; start_pos = 81 + ((menu_index - menu_offset) * 40);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 572
	lda     _menu_index
	sec
	sbc     _menu_offset
	pha
	lda     _menu_index+1
	sbc     _menu_offset+1
	tax
	pla
	jsr     pushax
	lda     #$28
	jsr     tosumula0
	clc
	adc     #$51
	bcc     L0421
	inx
L0421:	sta     _start_pos
	stx     _start_pos+1
;
; width = quick_seek.len;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 573
	lda     _quick_seek+4
	sta     _width
;
; num_lines = 1;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 574
	lda     #$01
	sta     _num_lines
;
; set_color(0x1);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 575
	jsr     pusha
	jsr     _set_color
;
; menu_reset_global_scroll();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 576
	jsr     _menu_reset_global_scroll
;
; else { // no yield. Strip one character
;
	.dbg	line, "../../../ui/src/c64_menu.c", 579
	jmp     incsp2
;
; quick_seek.len--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 580
L040A:	lda     _quick_seek+4
	sec
	sbc     #$01
	sta     _quick_seek+4
;
; quick_seek_name[quick_seek.len] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 581
	ldy     _quick_seek+4
	txa
	sta     _quick_seek_name,y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 583
	jmp     incsp2
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ reset_quick_seek (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_reset_quick_seek: near

.segment	"CODE"

;
; if(quick_seek.len != 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 588
	lda     _quick_seek+4
	beq     L0430
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 589
	jsr     _draw_directory
;
; quick_seek.len = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 590
	lda     #$00
	sta     _quick_seek+4
;
; quick_seek.name_str[0] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 591
	lda     _quick_seek+9
	sta     ptr1
	lda     _quick_seek+9+1
	sta     ptr1+1
	lda     #$00
	tay
	sta     (ptr1),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 593
L0430:	rts
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_rename (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_rename: near

.segment	"BSS"

L0836:
	.res	2,$00

.segment	"CODE"

;
; if((menu_dir_cache.num_entries == 0) || 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1313
	ldy     #$2C
	jsr     subysp
	lda     _menu_dir_cache+2
	ora     _menu_dir_cache+2+1
	jeq     L0871
;
; (menu_dir_cache.cbm_medium && (menu_dir_cache.num_entries == 1))) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1314
	lda     _menu_dir_cache+4
	beq     L0838
	lda     _menu_dir_cache+2+1
	bne     L0838
	lda     _menu_dir_cache+2
	cmp     #$01
	jeq     L0871
;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1319
L0838:	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L0836
	stx     L0836+1
;
; strncpy(new_name, entry->fname, MAX_ENTRY_NAME);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1320
	jsr     decsp4
	lda     sp
	ldx     sp+1
	clc
	adc     #$04
	bcc     L0848
	inx
L0848:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     L0836
	ldx     L0836+1
	clc
	adc     #$0A
	bcc     L084A
	inx
L084A:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	ldx     #$00
	lda     #$16
	jsr     _strncpy
;
; new_name[MAX_ENTRY_NAME] = '\0';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1321
	lda     #$00
	ldy     #$16
	sta     (sp),y
;
; if(!string_box(440, 38, new_name, 38))
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1323
	jsr     decsp6
	lda     #$B8
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$01
	sta     (sp),y
	lda     #$26
	ldy     #$03
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$06
	bcc     L0854
	inx
L0854:	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$26
	ldy     #$00
	sta     (sp),y
	jsr     _string_box
	tax
;
; return;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1324
	jeq     L0871
;
; if(menu_dir_depth) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1326
	lda     _menu_dir_depth
	beq     L0856
;
; dir_cluster = subdir_trace[menu_dir_depth-1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1327
	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L085B
	dex
L085B:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
	ldy     #$28
	jsr     steaxysp
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1328
	jmp     L085C
;
; dir_cluster = 0L;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1329
L0856:	ldy     #$28
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1332
L085C:	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L0836
	stx     L0836+1
;
; f_opendir_direct(&menu_dir, dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1333
	jsr     decsp6
	lda     #<(_menu_dir)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	ldy     #$31
	jsr     ldeaxysp
	jsr     steax0sp
	jsr     _f_opendir_direct
;
; menu_fres = f_rename_direct(entry, &menu_dir, new_name);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1334
	jsr     decsp6
	lda     L0836
	ldy     #$04
	sta     (sp),y
	iny
	lda     L0836+1
	sta     (sp),y
	lda     #<(_menu_dir)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$06
	bcc     L086B
	inx
L086B:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	jsr     _f_rename_direct
	sta     _menu_fres
;
; if(menu_fres == FR_OK) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1336
	lda     _menu_fres
	bne     L086C
;
; menu_dir_change(dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1337
	ldy     #$2B
	jsr     ldeaxysp
	jsr     pusheax
	jsr     _menu_dir_change
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1338
	jsr     _draw_directory
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1340
	jmp     L0871
;
; scroll_msg = "\005  Error renaming!   \011"; 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1341
L086C:	lda     #<(L0001+1154)
	sta     _scroll_msg
	lda     #>(L0001+1154)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1342
	lda     #$15
	sta     _new_message
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1344
L0871:	ldy     #$2C
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ handle_delete (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_handle_delete: near

.segment	"BSS"

L07F7:
	.res	2,$00

.segment	"CODE"

;
; BYTE sure = 'y';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1267
	jsr     decsp4
	lda     #$79
	jsr     pusha
;
; if((menu_dir_cache.num_entries == 0) || 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1269
	lda     _menu_dir_cache+2
	ora     _menu_dir_cache+2+1
	jeq     incsp5
;
; (menu_dir_cache.cbm_medium && (menu_dir_cache.num_entries == 1))) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1270
	lda     _menu_dir_cache+4
	beq     L07F9
	lda     _menu_dir_cache+2+1
	bne     L07F9
	lda     _menu_dir_cache+2
	cmp     #$01
	jeq     incsp5
;
; if(!delete_always) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1274
L07F9:	lda     _delete_always
	bne     L0803
;
; scroll_msg = "\003ARE YOU SURE?            \001 ";
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1275
	lda     #<(L0001+1078)
	sta     _scroll_msg
	lda     #>(L0001+1078)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1276
	lda     #$15
	sta     _new_message
;
; sure = question_box(451," Yes, No, Always ");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1277
	jsr     decsp4
	lda     #$C3
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$01
	sta     (sp),y
	lda     #<(L0001+1107)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L0001+1107)
	sta     (sp),y
	jsr     _question_box
	ldy     #$00
	sta     (sp),y
;
; if(sure == 'a') {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1278
	cmp     #$61
	bne     L080D
;
; sure = 'y';
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1279
	lda     #$79
	sta     (sp),y
;
; delete_always = TRUE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1280
	lda     #$01
	sta     _delete_always
;
; scroll_msg = default_msg;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1282
L080D:	lda     #<(_default_msg)
	sta     _scroll_msg
	lda     #>(_default_msg)
	sta     _scroll_msg+1
;
; if(sure == 'y') { 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1285
L0803:	ldy     #$00
	lda     (sp),y
	cmp     #$79
	jne     L0830
;
; if(menu_dir_depth) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1286
	lda     _menu_dir_depth
	beq     L0817
;
; dir_cluster = subdir_trace[menu_dir_depth-1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1287
	ldx     #$00
	lda     _menu_dir_depth
	sec
	sbc     #$01
	bcs     L081C
	dex
L081C:	jsr     aslax2
	clc
	adc     #<(_subdir_trace)
	tay
	txa
	adc     #>(_subdir_trace)
	tax
	tya
	jsr     ldeaxi
	ldy     #$01
	jsr     steaxysp
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1288
	jmp     L081D
;
; dir_cluster = 0L;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1289
L0817:	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
	iny
	sta     (sp),y
;
; entry = dir_getentry(menu_index, &menu_dir_cache);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1291
L081D:	jsr     decsp4
	lda     _menu_index
	ldy     #$02
	sta     (sp),y
	iny
	lda     _menu_index+1
	sta     (sp),y
	lda     #<(_menu_dir_cache)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	jsr     _dir_getentry
	sta     L07F7
	stx     L07F7+1
;
; f_opendir_direct(&menu_dir, dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1292
	jsr     decsp6
	lda     #<(_menu_dir)
	ldy     #$04
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	ldy     #$0A
	jsr     ldeaxysp
	jsr     steax0sp
	jsr     _f_opendir_direct
;
; menu_fres = f_unlink_direct(&menu_dir, entry);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1293
	jsr     decsp4
	lda     #<(_menu_dir)
	ldy     #$02
	sta     (sp),y
	iny
	lda     #>(_menu_dir)
	sta     (sp),y
	lda     L07F7
	ldy     #$00
	sta     (sp),y
	iny
	lda     L07F7+1
	sta     (sp),y
	jsr     _f_unlink_direct
	sta     _menu_fres
;
; if(menu_fres == FR_OK) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1294
	lda     _menu_fres
	bne     L082B
;
; menu_dir_change(dir_cluster);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1295
	ldy     #$04
	jsr     ldeaxysp
	jsr     pusheax
	jsr     _menu_dir_change
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1296
	jsr     _draw_directory
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1298
	jmp     L0830
;
; scroll_msg = "\005  Error deleting entry!   \011"; 
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1299
L082B:	lda     #<(L0001+1125)
	sta     _scroll_msg
	lda     #>(L0001+1125)
	sta     _scroll_msg+1
;
; new_message = SCROLL_OUT;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1303
L0830:	lda     #$15
	sta     _new_message
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 1304
	jmp     incsp5
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ menu_dir_change (unsigned long)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_menu_dir_change: near

.segment	"BSS"

L0034:
	.res	1,$00

.segment	"CODE"

;
; dot = cfg_get_value(CFG_HIDE_DOT);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 137
	lda     #$0B
	jsr     pusha
	jsr     _cfg_get_value
	sta     L0034
;
; return dir_change(cluster, &menu_dir_cache, dot);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 138
	jsr     decsp7
	ldy     #$0A
	jsr     ldeaxysp
	ldy     #$03
	jsr     steaxysp
	lda     #<(_menu_dir_cache)
	ldy     #$01
	sta     (sp),y
	iny
	lda     #>(_menu_dir_cache)
	sta     (sp),y
	lda     L0034
	ldy     #$00
	sta     (sp),y
	jsr     _dir_change
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 139
	jmp     incsp4
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ dump_mem_to_file (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_dump_mem_to_file: near

.segment	"CODE"

;
; for(w=2048;w<2304;w++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 145
	jsr     decsp4
	ldx     #$08
	lda     #$00
	ldy     #$02
L095E:	jsr     staxysp
	ldy     #$03
	lda     (sp),y
	tax
	cpx     #$09
	jcs     incsp4
;
; MAPPER_MAP1 = w;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 146
	lda     (sp),y
	sta     $2300+1
	dey
	lda     (sp),y
	sta     $2300
;
; f_write(&menu_file, (void *)MAP1_ADDR, 8192, &bytes_written);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 147
	jsr     decsp8
	lda     #<(_menu_file)
	ldy     #$06
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #$00
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$40
	sta     (sp),y
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$20
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$08
	bcc     L004E
	inx
L004E:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	jsr     _f_write
;
; printf("%d bytes written; addr = %06x\n", bytes_written, w << 13);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 148
	lda     #<(L0001)
	ldx     #>(L0001)
	jsr     pushax
	ldy     #$03
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$06
	lda     (sp),y
	tax
	lda     #$00
	jsr     shlax4
	stx     tmp1
	asl     a
	rol     tmp1
	ldx     tmp1
	jsr     pushax
	ldy     #$06
	jsr     _printf
;
; for(w=2048;w<2304;w++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 145
	ldy     #$03
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	jcc     L095E
	inx
	jmp     L095E
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ dump_trace_to_file (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_dump_trace_to_file: near

.segment	"CODE"

;
; if(menu_fres == FR_OK) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 160
	jsr     decsp4
	lda     _menu_fres
	jne     L0054
;
; for(w=4096;w<4352;w++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 161
	ldx     #$10
	ldy     #$02
L095F:	jsr     staxysp
	ldy     #$03
	lda     (sp),y
	tax
	cpx     #$11
	jcs     L0057
;
; MAPPER_MAP1 = w;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 162
	lda     (sp),y
	sta     $2300+1
	dey
	lda     (sp),y
	sta     $2300
;
; if((MAP1_WORD0 != 0xAAAA) || (MAP1_WORD1 != 0xAAAA)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 163
	lda     $4000+1
	cmp     #$AA
	bne     L0063
	lda     $4000
	cmp     #$AA
	bne     L0063
	lda     $4004+1
	cmp     #$AA
	bne     L0063
	lda     $4004
	cmp     #$AA
	beq     L0062
;
; menu_fres = f_write(&menu_file, (void *)0x4000, 0x2000, &r);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 164
L0063:	jsr     decsp8
	lda     #<(_menu_file)
	ldy     #$06
	sta     (sp),y
	iny
	lda     #>(_menu_file)
	sta     (sp),y
	lda     #$00
	ldy     #$04
	sta     (sp),y
	iny
	lda     #$40
	sta     (sp),y
	lda     #$00
	ldy     #$02
	sta     (sp),y
	iny
	lda     #$20
	sta     (sp),y
	lda     sp
	ldx     sp+1
	clc
	adc     #$08
	bcc     L0071
	inx
L0071:	ldy     #$00
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	jsr     _f_write
	sta     _menu_fres
;
; printf("console_fres = %d | bytes written = %d\n", menu_fres, r);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 165
	lda     #<(L0001+31)
	ldx     #>(L0001+31)
	jsr     pushax
	lda     _menu_fres
	jsr     pusha0
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
	ldy     #$06
	jsr     _printf
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 166
	jmp     L0058
;
; printf("%d pages written.\n", w-4096);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 167
L0062:	lda     #<(L0001+71)
	ldx     #>(L0001+71)
	jsr     pushax
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	pha
	txa
	sec
	sbc     #$10
	tax
	pla
	jsr     pushax
	ldy     #$04
	jsr     _printf
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 168
	jmp     L0057
;
; for(w=4096;w<4352;w++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 161
L0058:	ldy     #$03
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	jcc     L095F
	inx
	jmp     L095F
;
; f_close(&menu_file);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 171
L0057:	lda     #<(_menu_file)
	ldx     #>(_menu_file)
	jsr     pushax
	jsr     _f_close
;
; } else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 172
	jmp     incsp4
;
; printf("Can't open file for writing.\n");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 173
L0054:	lda     #<(L0001+90)
	ldx     #>(L0001+90)
	jsr     pushax
	ldy     #$02
	jsr     _printf
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 175
	jmp     incsp4
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ check_change (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_check_change: near

.segment	"CODE"

;
; if(card_change || disk_change) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 179
	lda     _card_change
	bne     L0081
	lda     _disk_change
	bne     L0081
	rts
;
; card_change = 0; // I saw it! clear flag
;
	.dbg	line, "../../../ui/src/c64_menu.c", 180
L0081:	lda     #$00
	sta     _card_change
;
; disk_change = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 181
	sta     _disk_change
;
; menu_init();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 182
	jsr     _menu_init
;
; disk_changed = TRUE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 183
	lda     #$01
	sta     _disk_changed
;
; if(card_det) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 185
	lda     _card_det
	beq     L008A
;
; printf("New card inserted! ");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 186
	lda     #<(L0001+120)
	ldx     #>(L0001+120)
	jsr     pushax
	ldy     #$02
	jsr     _printf
;
; f_mountdrv();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 187
	jsr     _f_mountdrv
;
; printf("Filesystem remounted.\n");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 188
	lda     #<(L0001+140)
	ldx     #>(L0001+140)
	jsr     pushax
	ldy     #$02
	jsr     _printf
;
; menu_fres = menu_dir_change(0L);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 189
	ldx     #$00
	txa
	jsr     push0ax
	jsr     _menu_dir_change
	sta     _menu_fres
;
; draw_directory();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 190
	jsr     _draw_directory
;
; last_load();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 191
	jmp     _last_load
;
; f_close(&mountfile);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 194
L008A:	lda     #<(_mountfile)
	ldx     #>(_mountfile)
	jsr     pushax
	jsr     _f_close
;
; if(cfg_get_value(CFG_CLR_ON_RMV)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 195
	lda     #$08
	jsr     pusha
	jsr     _cfg_get_value
	stx     tmp1
	ora     tmp1
	beq     L0099
;
; ClearFloppyMem();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 196
	jsr     _ClearFloppyMem
;
; clear_screen(0x0f);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 198
L0099:	lda     #$0F
	jsr     pusha
	jsr     _clear_screen
;
; printf("Card removed!\n");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 199
	lda     #<(L0001+163)
	ldx     #>(L0001+163)
	jsr     pushax
	ldy     #$02
	jmp     _printf
	.dbg	line

.endproc

; ---------------------------------------------------------------
; void __near__ set_title (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_set_title: near

.segment	"CODE"

;
; char *scr = (char *)SCREEN1_ADDR;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 206
	ldx     #$44
	lda     #$00
	jsr     pushax
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 207
	ldx     #$04
	sta     $2300
	stx     $2300+1
;
; switch(hardware_type) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 212
	lda     _hardware_type
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 221
	cmp     #$01
	beq     L00AB
	cmp     #$02
	beq     L00B2
	jmp     L00B8
;
; sprintf(&scr[1], "   ** 1541 Ultimate Plus - " SW_VERSION " **  ");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 214
L00AB:	jsr     decsp4
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	bcc     L00AF
	inx
L00AF:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #<(L0001+178)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L0001+178)
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 215
	jmp     L0962
;
; sprintf(&scr[1], " ** 1541 Ultimate Ethernet - " SW_VERSION " **");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 217
L00B2:	jsr     decsp4
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	bcc     L00B6
	inx
L00B6:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #<(L0001+216)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L0001+216)
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 218
	jmp     L0962
;
; sprintf(&scr[1], "     ** 1541 Ultimate - " SW_VERSION " **     ");
;
	.dbg	line, "../../../ui/src/c64_menu.c", 220
L00B8:	jsr     decsp4
	ldy     #$05
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	bcc     L00BC
	inx
L00BC:	ldy     #$02
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #<(L0001+254)
	ldy     #$00
	sta     (sp),y
	iny
	lda     #>(L0001+254)
L0962:	sta     (sp),y
	ldy     #$04
	jsr     _sprintf
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 223
	jmp     incsp2
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ string_input (__near__ signed char*, __near__ signed char*, signed char)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_string_input: near

.segment	"CODE"

;
; char cur = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 314
	lda     #$00
	jsr     pusha
;
; char len = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 316
	jsr     decsp1
	jsr     pusha
;
; cur = strlen(buffer); // assume it is prefilled, set cursor at the end.
;
	.dbg	line, "../../../ui/src/c64_menu.c", 320
	jsr     decsp1
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     _strlen
	ldy     #$03
	sta     (sp),y
;
; if(cur > maxlen) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 321
	ldx     #$00
	lda     (sp),y
	bpl     L0163
	dex
L0163:	jsr     pushax
	ldy     #$06
	ldx     #$00
	lda     (sp),y
	bpl     L0164
	dex
L0164:	jsr     tosicmp
	bmi     L0161
	beq     L0161
;
; buffer[cur]=0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 322
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0167
	dex
L0167:	clc
	ldy     #$05
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	lda     #$00
	tay
	sta     (ptr1),y
;
; cur = maxlen;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 323
	ldy     #$04
	lda     (sp),y
	dey
	sta     (sp),y
;
; len = cur;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 325
L0161:	ldy     #$03
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 329
L097C:	ldx     #$00
	ldy     #$03
L097A:	lda     (sp),y
	bpl     L0171
	dex
L0171:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	ora     #$80
	jsr     staspidx
;
; key = kb_buf_getch();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 333
L0173:	jsr     _kb_buf_getch
	ldy     #$00
	sta     (sp),y
;
; if(!key)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 334
	lda     (sp),y
;
; continue;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 335
	beq     L0173
;
; switch(key) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 337
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 413
	cmp     #$03
	jeq     L0239
	cmp     #$0D
	beq     L017E
	cmp     #$11
	jeq     L022C
	cmp     #$13
	jeq     L0220
	cmp     #$14
	jeq     L01BB
	cmp     #$1D
	jeq     L01AB
	cmp     #$93
	jeq     L01E4
	cmp     #$94
	jeq     L01FD
	cmp     #$9D
	jeq     L019B
	jmp     L023B
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 339
L017E:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0181
	dex
L0181:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; for(b=0;b<len;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 340
	lda     #$00
	ldy     #$02
L0967:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L018A
	dex
L018A:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L018B
	dex
L018B:	jsr     tosicmp
	bpl     L0184
;
; buffer[b] = scr[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 341
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0190
	dex
L0190:	clc
	ldy     #$05
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldx     #$00
	ldy     #$04
	lda     (sp),y
	bpl     L0193
	dex
L0193:	clc
	ldy     #$09
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=0;b<len;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 340
	ldy     #$02
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0967
;
; buffer[b] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 342
L0184:	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0196
	dex
L0196:	clc
	ldy     #$05
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	lda     #$00
	tay
	sta     (ptr1),y
;
; return b!=0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 343
	ldy     #$02
	lda     (sp),y
	jsr     boolne
	jmp     L0174
;
; if (cur > 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 345
L019B:	ldy     #$03
	lda     (sp),y
	sec
	sbc     #$01
	bvs     L019F
	eor     #$80
L019F:	jpl     L0173
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 346
	ldx     #$00
	lda     (sp),y
	bpl     L01A2
	dex
L01A2:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; cur--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 347
	ldy     #$03
	lda     (sp),y
	sec
	sbc     #$01
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 348
	ldx     #$00
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 350
	jmp     L097A
;
; if (cur < len) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 352
L01AB:	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L01AE
	dex
L01AE:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L01AF
	dex
L01AF:	jsr     tosicmp
	jpl     L0173
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 353
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L01B2
	dex
L01B2:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; cur++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 354
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 355
	ldx     #$00
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 357
	jmp     L097A
;
; if (cur > 0) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 359
L01BB:	ldy     #$03
	lda     (sp),y
	sec
	sbc     #$01
	bvs     L01BF
	eor     #$80
L01BF:	jpl     L0173
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 360
	ldx     #$00
	lda     (sp),y
	bpl     L01C2
	dex
L01C2:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; cur--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 361
	ldy     #$03
	lda     (sp),y
	sec
	sbc     #$01
	sta     (sp),y
;
; len--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 362
	ldy     #$01
	lda     (sp),y
	sec
	sbc     #$01
	sta     (sp),y
;
; for(b=cur;b<len;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 363
	ldy     #$03
	lda     (sp),y
	dey
L0969:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L01D0
	dex
L01D0:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L01D1
	dex
L01D1:	jsr     tosicmp
	bpl     L01C9
;
; scr[b] = scr[b+1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 364
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L01D6
	dex
L01D6:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldx     #$00
	ldy     #$04
	lda     (sp),y
	bpl     L01D9
	dex
L01D9:	clc
	adc     #$01
	bcc     L0964
	inx
	clc
L0964:	ldy     #$09
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=cur;b<len;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 363
	ldy     #$02
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0969
;
; } scr[b] = 0x20;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 365
L01C9:	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L01DD
	dex
L01DD:	clc
	ldy     #$07
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	lda     #$20
	ldy     #$00
	sta     (ptr1),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 368
	jmp     L097C
;
; for(b=0;b<maxlen;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 370
L01E4:	tya
	ldy     #$02
L096A:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L01EC
	dex
L01EC:	jsr     pushax
	ldy     #$06
	ldx     #$00
	lda     (sp),y
	bpl     L01ED
	dex
L01ED:	jsr     tosicmp
	bpl     L01E6
;
; scr[b] = 0x20;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 371
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L01F2
	dex
L01F2:	clc
	ldy     #$07
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	lda     #$20
	ldy     #$00
	sta     (ptr1),y
;
; for(b=0;b<maxlen;b++)
;
	.dbg	line, "../../../ui/src/c64_menu.c", 370
	ldy     #$02
	lda     (sp),y
	clc
	adc     #$01
	jmp     L096A
;
; len = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 372
L01E6:	lda     #$00
	ldy     #$01
	sta     (sp),y
;
; cur = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 373
	ldy     #$03
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 374
	tax
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 375
	jmp     L097A
;
; if(cur < len) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 377
L01FD:	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L0200
	dex
L0200:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L0201
	dex
L0201:	jsr     tosicmp
	jpl     L0173
;
; len--;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 378
	ldy     #$01
	lda     (sp),y
	sec
	sbc     #$01
	sta     (sp),y
;
; for(b=cur;b<len;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 379
	ldy     #$03
	lda     (sp),y
	dey
L096B:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L020C
	dex
L020C:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L020D
	dex
L020D:	jsr     tosicmp
	bpl     L0205
;
; scr[b] = scr[b+1];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 380
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0212
	dex
L0212:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldx     #$00
	ldy     #$04
	lda     (sp),y
	bpl     L0215
	dex
L0215:	clc
	adc     #$01
	bcc     L0965
	inx
	clc
L0965:	ldy     #$09
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=cur;b<len;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 379
	ldy     #$02
	lda     (sp),y
	clc
	adc     #$01
	jmp     L096B
;
; } scr[b] = 0x20;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 381
L0205:	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0219
	dex
L0219:	clc
	ldy     #$07
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	lda     #$20
	ldy     #$00
	sta     (ptr1),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 384
	jmp     L097C
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 386
L0220:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0223
	dex
L0223:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; cur = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 387
	lda     #$00
	ldy     #$03
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 388
	tax
;
; break;        
;
	.dbg	line, "../../../ui/src/c64_menu.c", 389
	jmp     L097A
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 391
L022C:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L022F
	dex
L022F:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; cur = len;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 392
	ldy     #$01
	lda     (sp),y
	ldy     #$03
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 393
	ldx     #$00
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 394
	jmp     L097A
;
; return FALSE;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 396
L0239:	ldx     #$00
	txa
	jmp     L0174
;
; if ((key < 32)||(key > 127)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 398
L023B:	lda     (sp),y
	cmp     #$20
	jcc     L0173
	lda     (sp),y
	cmp     #$80
	jcs     L0173
;
; if (len < maxlen) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 402
	iny
	ldx     #$00
	lda     (sp),y
	bpl     L0243
	dex
L0243:	jsr     pushax
	ldy     #$06
	ldx     #$00
	lda     (sp),y
	bpl     L0244
	dex
L0244:	jsr     tosicmp
	jpl     L0173
;
; scr[cur] &= 0x7F;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 403
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0247
	dex
L0247:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	and     #$7F
	jsr     staspidx
;
; for(b=len-1; b>=cur; b--) { // insert if necessary
;
	.dbg	line, "../../../ui/src/c64_menu.c", 404
	ldy     #$01
	lda     (sp),y
	sec
	sbc     #$01
	iny
L096C:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L0252
	dex
L0252:	jsr     pushax
	ldy     #$05
	ldx     #$00
	lda     (sp),y
	bpl     L0253
	dex
L0253:	jsr     tosicmp
	bmi     L024A
;
; scr[b+1] = scr[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 405
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0258
	dex
L0258:	clc
	adc     #$01
	bcc     L0966
	inx
	clc
L0966:	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldx     #$00
	ldy     #$04
	lda     (sp),y
	bpl     L025C
	dex
L025C:	clc
	ldy     #$09
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=len-1; b>=cur; b--) { // insert if necessary
;
	.dbg	line, "../../../ui/src/c64_menu.c", 404
	ldy     #$02
	lda     (sp),y
	sec
	sbc     #$01
	jmp     L096C
;
; scr[cur] = key;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 407
L024A:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L025F
	dex
L025F:	clc
	ldy     #$07
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	ldy     #$00
	lda     (sp),y
	sta     (ptr1),y
;
; cur++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 408
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	sta     (sp),y
;
; scr[cur] |= 0x80;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 409
	ldx     #$00
	lda     (sp),y
	bpl     L0266
	dex
L0266:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$00
	jsr     ldaidx
	ora     #$80
	jsr     staspidx
;
; len++;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 410
	ldy     #$01
	lda     (sp),y
	clc
	adc     #$01
	sta     (sp),y
;
; break;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 412
	jmp     L0173
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 416
L0174:	ldy     #$09
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; unsigned char __near__ question_box (unsigned short, __near__ signed char*)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_question_box: near

.segment	"BSS"

L032E:
	.res	2,$00
L032F:
	.res	2,$00

.segment	"CODE"

;
; len = data_strnlen(options, NUM_COLMS);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 495
	jsr     decsp5
	jsr     decsp3
	ldy     #$09
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$01
	sta     (sp),y
	iny
	txa
	sta     (sp),y
	lda     #$26
	ldy     #$00
	sta     (sp),y
	jsr     _data_strnlen
	ldy     #$01
	sta     (sp),y
;
; w = len + 2;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 496
	clc
	adc     #$02
	iny
	sta     (sp),y
;
; MAPPER_MAP1 = MAP_RAMDMA;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 497
	ldx     #$04
	lda     #$00
	sta     $2300
	stx     $2300+1
;
; scr = (char *)(SCREEN1_ADDR + pos);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 498
	ldy     #$08
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     L032E
	txa
	clc
	adc     #$44
	sta     L032E+1
;
; col = (char *)(COLOR3_ADDR + pos);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 499
	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     L032F
	txa
	clc
	adc     #$38
	sta     L032F+1
;
; bar = copper_list[COP_POS_BRDR]; // store color, in case we want to play with this
;
	.dbg	line, "../../../ui/src/c64_menu.c", 502
	lda     _copper_list+7
	ldy     #$00
	sta     (sp),y
;
; copper_list[COP_POS_BRDR] = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 503
	tya
	sta     _copper_list+7
;
; copper_list[COP_POS_SCR]  = 0;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 504
	sta     _copper_list+9
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 509
	ldy     #$03
L0986:	sta     (sp),y
	sec
	sbc     #$78
	bvc     L0355
	eor     #$80
L0355:	bpl     L034E
;
; under_box[0][b] = scr[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 510
	lda     #<(_under_box)
	ldx     #>(_under_box)
	clc
	adc     (sp),y
	bcc     L035C
	inx
L035C:	jsr     pushax
	ldx     #$00
	ldy     #$05
	lda     (sp),y
	bpl     L035F
	dex
L035F:	clc
	adc     L032E
	pha
	txa
	adc     L032E+1
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; under_box[1][b] = col[b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 511
	lda     #<(_under_box+120)
	ldx     #>(_under_box+120)
	ldy     #$03
	clc
	adc     (sp),y
	bcc     L0364
	inx
L0364:	jsr     pushax
	ldx     #$00
	ldy     #$05
	lda     (sp),y
	bpl     L0367
	dex
L0367:	clc
	adc     L032F
	pha
	txa
	adc     L032F+1
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 509
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0986
;
; scr[0] = 1; // upper left corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 514
L034E:	lda     L032E
	sta     ptr1
	lda     L032E+1
	sta     ptr1+1
	lda     #$01
	ldy     #$00
	sta     (ptr1),y
;
; scr[40] = 4; // vertical bar
;
	.dbg	line, "../../../ui/src/c64_menu.c", 515
	lda     L032E
	sta     ptr1
	lda     L032E+1
	sta     ptr1+1
	lda     #$04
	ldy     #$28
	sta     (ptr1),y
;
; scr[80] = 5; // lower left corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 516
	lda     L032E
	sta     ptr1
	lda     L032E+1
	sta     ptr1+1
	lda     #$05
	ldy     #$50
	sta     (ptr1),y
;
; for(b=1;b<w-1;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 517
	lda     #$01
	ldy     #$03
L0987:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L0378
	dex
L0378:	jsr     pushax
	ldy     #$04
	ldx     #$00
	lda     (sp),y
	bpl     L0379
	dex
L0379:	sec
	sbc     #$01
	bcs     L037A
	dex
L037A:	jsr     tosicmp
	jpl     L0372
;
; scr[b] = 2; // horizontal line
;
	.dbg	line, "../../../ui/src/c64_menu.c", 518
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L037F
	dex
L037F:	clc
	adc     L032E
	sta     ptr1
	txa
	adc     L032E+1
	sta     ptr1+1
	lda     #$02
	ldy     #$00
	sta     (ptr1),y
;
; scr[b+80] = 2;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 519
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0383
	dex
L0383:	clc
	adc     #$50
	bcc     L097E
	inx
	clc
L097E:	adc     L032E
	sta     ptr1
	txa
	adc     L032E+1
	sta     ptr1+1
	lda     #$02
	ldy     #$00
	sta     (ptr1),y
;
; scr[b+40] = options[b-1]; // space
;
	.dbg	line, "../../../ui/src/c64_menu.c", 520
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L0388
	dex
L0388:	clc
	adc     #$28
	bcc     L097F
	inx
	clc
L097F:	adc     L032E
	pha
	txa
	adc     L032E+1
	tax
	pla
	jsr     pushax
	ldx     #$00
	ldy     #$05
	lda     (sp),y
	bpl     L038C
	dex
L038C:	sec
	sbc     #$01
	bcs     L038D
	dex
L038D:	clc
	ldy     #$07
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=1;b<w-1;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 517
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0987
;
; scr[w-1] = 3; // upper right corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 522
L0372:	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0390
	dex
L0390:	sec
	sbc     #$01
	bcs     L0391
	dex
L0391:	clc
	adc     L032E
	sta     ptr1
	txa
	adc     L032E+1
	sta     ptr1+1
	lda     #$03
	ldy     #$00
	sta     (ptr1),y
;
; scr[39+w] = 4; // vertical bar
;
	.dbg	line, "../../../ui/src/c64_menu.c", 523
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L0395
	dex
L0395:	clc
	adc     #$27
	bcc     L0980
	inx
	clc
L0980:	adc     L032E
	sta     ptr1
	txa
	adc     L032E+1
	sta     ptr1+1
	lda     #$04
	ldy     #$00
	sta     (ptr1),y
;
; scr[79+w] = 6; // lower right corner
;
	.dbg	line, "../../../ui/src/c64_menu.c", 524
	ldx     #$00
	ldy     #$02
	lda     (sp),y
	bpl     L039A
	dex
L039A:	clc
	adc     #$4F
	bcc     L0981
	inx
	clc
L0981:	adc     L032E
	sta     ptr1
	txa
	adc     L032E+1
	sta     ptr1+1
	lda     #$06
	ldy     #$00
	sta     (ptr1),y
;
; for(b=0;b<w;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 526
	tya
	ldy     #$03
L0989:	sta     (sp),y
	ldx     #$00
	lda     (sp),y
	bpl     L03A4
	dex
L03A4:	jsr     pushax
	ldy     #$04
	ldx     #$00
	lda     (sp),y
	bpl     L03A5
	dex
L03A5:	jsr     tosicmp
	jpl     L039E
;
; col[b]    = 0x0e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 527
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03AA
	dex
L03AA:	clc
	adc     L032F
	sta     ptr1
	txa
	adc     L032F+1
	sta     ptr1+1
	lda     #$0E
	ldy     #$00
	sta     (ptr1),y
;
; col[b+80] = 0x0e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 528
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03AE
	dex
L03AE:	clc
	adc     #$50
	bcc     L0982
	inx
	clc
L0982:	adc     L032F
	sta     ptr1
	txa
	adc     L032F+1
	sta     ptr1+1
	lda     #$0E
	ldy     #$00
	sta     (ptr1),y
;
; if((b > 0) && (b <= len)) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 529
	ldy     #$03
	lda     (sp),y
	sec
	sbc     #$01
	bvs     L03B5
	eor     #$80
L03B5:	jpl     L03B1
	ldx     #$00
	lda     (sp),y
	bpl     L03B8
	dex
L03B8:	jsr     pushax
	ldy     #$03
	ldx     #$00
	lda     (sp),y
	bpl     L03B9
	dex
L03B9:	jsr     tosicmp
	bmi     L03B2
	jne     L03B1
;
; if((options[b-1] >= 'a') && (options[b-1] <= 'z')) // Actually I mean caps
;
	.dbg	line, "../../../ui/src/c64_menu.c", 530
L03B2:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03BF
	dex
L03BF:	sec
	sbc     #$01
	bcs     L03C0
	dex
L03C0:	clc
	ldy     #$05
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	sec
	sbc     #$61
	bvs     L03C1
	eor     #$80
L03C1:	bpl     L03BB
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03C5
	dex
L03C5:	sec
	sbc     #$01
	bcs     L03C6
	dex
L03C6:	clc
	ldy     #$05
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	ldy     #$00
	jsr     ldaidx
	sec
	sbc     #$7B
	bvc     L03C7
	eor     #$80
L03C7:	bpl     L03BB
;
; col[b+40] = 0x0F; // Grey
;
	.dbg	line, "../../../ui/src/c64_menu.c", 531
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03CB
	dex
L03CB:	clc
	adc     #$28
	bcc     L0983
	inx
	clc
L0983:	adc     L032F
	sta     ptr1
	txa
	adc     L032F+1
	sta     ptr1+1
	lda     #$0F
;
; else
;
	.dbg	line, "../../../ui/src/c64_menu.c", 532
	jmp     L0988
;
; col[b+40] = 0x01; // White
;
	.dbg	line, "../../../ui/src/c64_menu.c", 533
L03BB:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03D1
	dex
L03D1:	clc
	adc     #$28
	bcc     L0984
	inx
	clc
L0984:	adc     L032F
	sta     ptr1
	txa
	adc     L032F+1
	sta     ptr1+1
	lda     #$01
;
; else {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 535
	jmp     L0988
;
; col[b+40] = 0x0e;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 536
L03B1:	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03D7
	dex
L03D7:	clc
	adc     #$28
	bcc     L0985
	inx
	clc
L0985:	adc     L032F
	sta     ptr1
	txa
	adc     L032F+1
	sta     ptr1+1
	lda     #$0E
L0988:	ldy     #$00
	sta     (ptr1),y
;
; for(b=0;b<w;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 526
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	jmp     L0989
;
; ret = kb_buf_getch();
;
	.dbg	line, "../../../ui/src/c64_menu.c", 541
L039E:	jsr     _kb_buf_getch
	ldy     #$04
	sta     (sp),y
;
; } while(!ret);
;
	.dbg	line, "../../../ui/src/c64_menu.c", 542
	lda     (sp),y
	beq     L039E
;
; ret |= 0x20;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 544
	lda     (sp),y
	ora     #$20
	sta     (sp),y
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 547
	lda     #$00
	dey
L098A:	sta     (sp),y
	sec
	sbc     #$78
	bvc     L03EA
	eor     #$80
L03EA:	bpl     L03E3
;
; scr[b] = under_box[0][b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 548
	ldx     #$00
	lda     (sp),y
	bpl     L03EF
	dex
L03EF:	clc
	adc     L032E
	pha
	txa
	adc     L032E+1
	tax
	pla
	jsr     pushax
	lda     #<(_under_box)
	ldx     #>(_under_box)
	ldy     #$05
	clc
	adc     (sp),y
	bcc     L03F4
	inx
L03F4:	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; col[b] = under_box[1][b];
;
	.dbg	line, "../../../ui/src/c64_menu.c", 549
	ldx     #$00
	ldy     #$03
	lda     (sp),y
	bpl     L03F7
	dex
L03F7:	clc
	adc     L032F
	pha
	txa
	adc     L032F+1
	tax
	pla
	jsr     pushax
	lda     #<(_under_box+120)
	ldx     #>(_under_box+120)
	ldy     #$05
	clc
	adc     (sp),y
	bcc     L03FC
	inx
L03FC:	ldy     #$00
	jsr     ldaidx
	jsr     staspidx
;
; for(b=0;b<120;b++) {
;
	.dbg	line, "../../../ui/src/c64_menu.c", 547
	ldy     #$03
	lda     (sp),y
	clc
	adc     #$01
	jmp     L098A
;
; copper_list[COP_POS_BRDR] = bar;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 552
L03E3:	ldy     #$00
	lda     (sp),y
	sta     _copper_list+7
;
; copper_list[COP_POS_SCR]  = bar;
;
	.dbg	line, "../../../ui/src/c64_menu.c", 553
	lda     (sp),y
	sta     _copper_list+9
;
; return ret;     
;
	.dbg	line, "../../../ui/src/c64_menu.c", 555
	ldy     #$04
	ldx     #$00
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../ui/src/c64_menu.c", 556
	ldy     #$09
	jmp     addysp
	.dbg	line

.endproc

