;
; File generated by cc65 v 2.19 - Git 39df6f8
;
	.fopt		compiler,"cc65 v 2.19 - Git 39df6f8"
	.setcpu		"6502"
	.smart		on
	.autoimport	on
	.case		on
	.debuginfo	on
	.importzp	sp, sreg, regsave, regbank
	.importzp	tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
	.macpack	longbranch
	.dbg		file, "vdc_core.c", 7903, 1543295180
	.dbg		file, "vdc_gui.h", 778, 1543280824
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/c128.h", 6518, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_vic2.h", 10835, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_sid.h", 3626, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_vdc.h", 2827, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/_6526.h", 3962, 1645504249
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/peekpoke.h", 3108, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/string.h", 5187, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stddef.h", 3057, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdio.h", 5920, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdarg.h", 2913, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/limits.h", 3580, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/stdlib.h", 5999, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/conio.h", 9026, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/target.h", 2992, 1645504251
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/cbm.h", 11892, 1645504250
	.dbg		file, "F:\Software\Emulation\Commodore\Development\cc65\include/cbm_filetype.h", 4949, 1645504250
	.dbg		file, "vdc_win.h", 1736, 1543282193
	.dbg		file, "vdc_core.h", 1814, 1543295196
	.dbg		file, "vdc_controls.h", 561, 1543268877
	.dbg		file, "vdc_menus.h", 527, 1543268877
	.dbg		file, "vdc_control_listbox.h", 1037, 1646425066
	.dbg		file, "vdc_control_textbox.h", 916, 1543268877
	.dbg		file, "vdc_control_label.h", 695, 1543268877
	.dbg		file, "vdc_control_button.h", 818, 1543268877
	.dbg		file, "vdc_control_checkbox.h", 815, 1543268877
	.dbg		sym, "fast", "00", extern, "_fast"
	.dbg		sym, "printf", "00", extern, "_printf"
	.import		_fast
	.import		_printf
	.export		_VDC_Init
	.export		_VDC_DrawBox
	.export		_VDC_PetsciiToScreenCode
	.export		_VDC_PetsciiToScreenCodeRvs
	.export		_VDC_RowColToAddress
	.export		_VDC_Poke
	.export		_VDC_Peek
	.export		_VDC_BackColor
	.export		_VDC_CursorAt
	.export		_VDC_PrintAt
	.export		_VDC_Clear
	.export		_VDC_BlockCopy
	.export		_VDC_Fill
	.export		_VDC_StashScreen
	.export		_VDC_FetchScreen
	.export		_VDC_SetCursorMode
	.export		_VDC_CopyVDCToMem
	.export		_VDC_CopyMemToVDC

.segment	"RODATA"

S0001:
	.byte	$25,$43,$25,$43,$00

; ---------------------------------------------------------------
; void __near__ VDC_Init (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_Init: near

	.dbg	func, "VDC_Init", "00", extern, "_VDC_Init"

.segment	"CODE"

	.dbg	line, "vdc_core.c", 15
	lda     #<(S0001)
	ldx     #>(S0001)
	jsr     pushax
	lda     #$0E
	jsr     pusha0
	lda     #$93
	jsr     pusha0
	ldy     #$06
	jsr     _printf
	.dbg	line, "vdc_core.c", 16
	jmp     _fast

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ VDC_DrawBox (unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char borderStyle)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_DrawBox: near

	.dbg	func, "VDC_DrawBox", "00", extern, "_VDC_DrawBox"
	.dbg	sym, "x", "00", auto, 4
	.dbg	sym, "y", "00", auto, 3
	.dbg	sym, "width", "00", auto, 2
	.dbg	sym, "height", "00", auto, 1
	.dbg	sym, "borderStyle", "00", auto, 0
	.dbg	sym, "borderChars", "00", auto, -8
	.dbg	sym, "i", "00", auto, -10

.segment	"CODE"

	.dbg	line, "vdc_core.c", 20
	jsr     pusha
	.dbg	line, "vdc_core.c", 24
	ldy     #$0A
	jsr     subysp
	ldx     #$00
	lda     #$F0
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$02
	sta     (sp),y
	.dbg	line, "vdc_core.c", 25
	ldx     #$00
	lda     #$EE
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$03
	sta     (sp),y
	.dbg	line, "vdc_core.c", 26
	ldx     #$00
	lda     #$C0
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$04
	sta     (sp),y
	.dbg	line, "vdc_core.c", 27
	ldx     #$00
	lda     #$C0
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$05
	sta     (sp),y
	.dbg	line, "vdc_core.c", 28
	ldx     #$00
	lda     #$7D
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$06
	sta     (sp),y
	.dbg	line, "vdc_core.c", 29
	ldx     #$00
	lda     #$7D
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$07
	sta     (sp),y
	.dbg	line, "vdc_core.c", 30
	ldx     #$00
	lda     #$ED
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$08
	sta     (sp),y
	.dbg	line, "vdc_core.c", 31
	ldx     #$00
	lda     #$FD
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$09
	sta     (sp),y
	.dbg	line, "vdc_core.c", 34
	iny
	lda     (sp),y
	cmp     #$01
	beq     L0004
	.dbg	line, "vdc_core.c", 35
	ldx     #$00
	txa
	jsr     stax0sp
L0003:	jsr     ldax0sp
	cmp     #$08
	txa
	sbc     #$00
	bvc     L0007
	eor     #$80
L0007:	bpl     L0004
	.dbg	line, "vdc_core.c", 36
	jsr     ldax0sp
	jsr     incax2
	jsr     leaaxsp
	jsr     pushax
	ldy     #$0C
	ldx     #$00
	lda     (sp),y
	jsr     _VDC_PetsciiToScreenCode
	ldy     #$00
	jsr     staspidx
	.dbg	line, "vdc_core.c", 35
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	jmp     L0003
	.dbg	line, "vdc_core.c", 39
L0004:	ldy     #$0D
	lda     (sp),y
	jsr     pusha0
	ldy     #$10
	lda     (sp),y
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$04
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 42
	ldy     #$0D
	lda     (sp),y
	jsr     pusha0
	ldy     #$0E
	lda     (sp),y
	clc
	ldy     #$10
	adc     (sp),y
	bcc     L0010
	inx
L0010:	jsr     decax1
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$05
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 45
	ldx     #$00
	lda     #$01
	jsr     stax0sp
L0008:	jsr     pushw0sp
	ldy     #$0E
	ldx     #$00
	lda     (sp),y
	jsr     decax1
	jsr     tosicmp
	bpl     L0009
	.dbg	line, "vdc_core.c", 47
	ldy     #$0D
	lda     (sp),y
	jsr     pusha0
	ldy     #$10
	lda     (sp),y
	sta     ptr1
	ldy     #$03
	jsr     ldaxysp
	clc
	adc     ptr1
	bcc     L0011
	inx
L0011:	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$06
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 48
	ldx     #$00
	ldy     #$0B
	lda     (sp),y
	clc
	ldy     #$0D
	adc     (sp),y
	bcc     L0012
	inx
L0012:	jsr     decax1
	jsr     pushax
	ldy     #$10
	lda     (sp),y
	sta     ptr1
	ldy     #$03
	jsr     ldaxysp
	clc
	adc     ptr1
	bcc     L0013
	inx
L0013:	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$07
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 45
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	jmp     L0008
	.dbg	line, "vdc_core.c", 51
L0009:	ldx     #$00
	lda     #$01
	jsr     stax0sp
L000C:	jsr     pushw0sp
	ldy     #$0D
	ldx     #$00
	lda     (sp),y
	jsr     decax1
	jsr     tosicmp
	bpl     L000D
	.dbg	line, "vdc_core.c", 54
	ldy     #$0D
	lda     (sp),y
	sta     ptr1
	jsr     ldax0sp
	clc
	adc     ptr1
	bcc     L0014
	inx
L0014:	jsr     pushax
	ldy     #$10
	ldx     #$00
	lda     (sp),y
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$08
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 57
	ldy     #$0D
	lda     (sp),y
	sta     ptr1
	jsr     ldax0sp
	clc
	adc     ptr1
	bcc     L0015
	inx
L0015:	jsr     pushax
	ldx     #$00
	ldy     #$0E
	lda     (sp),y
	clc
	ldy     #$10
	adc     (sp),y
	bcc     L0016
	inx
L0016:	jsr     decax1
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$09
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 51
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	jmp     L000C
	.dbg	line, "vdc_core.c", 61
L000D:	ldx     #$00
	ldy     #$0B
	lda     (sp),y
	clc
	ldy     #$0D
	adc     (sp),y
	bcc     L0017
	inx
L0017:	jsr     decax1
	jsr     pushax
	ldy     #$10
	ldx     #$00
	lda     (sp),y
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$0A
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 62
	ldx     #$00
	ldy     #$0B
	lda     (sp),y
	clc
	ldy     #$0D
	adc     (sp),y
	bcc     L0018
	inx
L0018:	jsr     decax1
	jsr     pushax
	ldx     #$00
	ldy     #$0E
	lda     (sp),y
	clc
	ldy     #$10
	adc     (sp),y
	bcc     L0019
	inx
L0019:	jsr     decax1
	jsr     _VDC_RowColToAddress
	jsr     pushax
	ldy     #$0B
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 64
	ldy     #$0F
	jmp     addysp

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_PetsciiToScreenCode (int p)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_PetsciiToScreenCode: near

	.dbg	func, "VDC_PetsciiToScreenCode", "00", extern, "_VDC_PetsciiToScreenCode"
	.dbg	sym, "p", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 67
	jsr     pushax
	.dbg	line, "vdc_core.c", 69
	jsr     ldax0sp
	txa
	bmi     L0002
	jsr     ldax0sp
	cmp     #$20
	txa
	sbc     #$00
	bvc     L0004
	eor     #$80
L0004:	bpl     L0002
	jsr     ldax0sp
	ldy     #$80
	jsr     incaxy
	.dbg	line, "vdc_core.c", 70
	jmp     L003E
L0002:	jsr     ldax0sp
	cmp     #$40
	txa
	sbc     #$00
	bvs     L0009
	eor     #$80
L0009:	bpl     L0008
	jsr     ldax0sp
	cmp     #$60
	txa
	sbc     #$00
	bvc     L000B
	eor     #$80
L000B:	bpl     L0008
	jsr     ldax0sp
	ldy     #$40
	jsr     decaxy
	.dbg	line, "vdc_core.c", 71
	jmp     L003E
L0008:	jsr     ldax0sp
	cmp     #$60
	txa
	sbc     #$00
	bvs     L0010
	eor     #$80
L0010:	bpl     L000F
	jsr     ldax0sp
	cmp     #$80
	txa
	sbc     #$00
	bvc     L0012
	eor     #$80
L0012:	bpl     L000F
	jsr     ldax0sp
	ldy     #$20
	jsr     decaxy
	.dbg	line, "vdc_core.c", 72
	jmp     L003E
L000F:	jsr     ldax0sp
	cmp     #$80
	txa
	sbc     #$00
	bvs     L0017
	eor     #$80
L0017:	bpl     L0016
	jsr     ldax0sp
	cmp     #$A0
	txa
	sbc     #$00
	bvc     L0019
	eor     #$80
L0019:	bpl     L0016
	jsr     ldax0sp
	ldy     #$40
	jsr     incaxy
	.dbg	line, "vdc_core.c", 73
	jmp     L003E
L0016:	jsr     ldax0sp
	cmp     #$A2
	txa
	sbc     #$00
	bvs     L001E
	eor     #$80
L001E:	bpl     L001D
	jsr     ldax0sp
	cmp     #$C0
	txa
	sbc     #$00
	bvc     L0020
	eor     #$80
L0020:	bpl     L001D
	jsr     ldax0sp
	ldy     #$40
	jsr     decaxy
	.dbg	line, "vdc_core.c", 74
	jmp     L003E
L001D:	jsr     ldax0sp
	cmp     #$C0
	txa
	sbc     #$00
	bvs     L0025
	eor     #$80
L0025:	bpl     L0024
	jsr     ldax0sp
	cmp     #$FE
	txa
	sbc     #$00
	bvc     L0027
	eor     #$80
L0027:	bpl     L0024
	jsr     ldax0sp
	ldy     #$80
	jsr     decaxy
	.dbg	line, "vdc_core.c", 75
	jmp     L003E
L0024:	ldy     #$01
	lda     (sp),y
	bne     L003F
	dey
	lda     (sp),y
	cmp     #$FF
	bne     L003F
	ldx     #$00
	lda     #$5E
L003E:	jsr     stax0sp
	.dbg	line, "vdc_core.c", 77
L003F:	jsr     ldax0sp
	.dbg	line, "vdc_core.c", 78
	jmp     incsp2

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_PetsciiToScreenCodeRvs (int p)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_PetsciiToScreenCodeRvs: near

	.dbg	func, "VDC_PetsciiToScreenCodeRvs", "00", extern, "_VDC_PetsciiToScreenCodeRvs"
	.dbg	sym, "p", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 81
	jsr     pushax
	.dbg	line, "vdc_core.c", 83
	jsr     ldax0sp
	txa
	bmi     L0002
	jsr     ldax0sp
	cmp     #$20
	txa
	sbc     #$00
	bvc     L0004
	eor     #$80
L0004:	bpl     L0002
	jsr     ldax0sp
	ldy     #$80
	jsr     incaxy
	.dbg	line, "vdc_core.c", 84
	jmp     L0052
L0002:	jsr     ldax0sp
	cmp     #$20
	txa
	sbc     #$00
	bvs     L0009
	eor     #$80
L0009:	bpl     L0008
	jsr     ldax0sp
	cmp     #$40
	txa
	sbc     #$00
	bvc     L000B
	eor     #$80
L000B:	bpl     L0008
	jsr     ldax0sp
	ldy     #$80
	jsr     incaxy
	.dbg	line, "vdc_core.c", 85
	jmp     L0052
L0008:	jsr     ldax0sp
	cmp     #$40
	txa
	sbc     #$00
	bvs     L0010
	eor     #$80
L0010:	bpl     L000F
	jsr     ldax0sp
	cmp     #$60
	txa
	sbc     #$00
	bvc     L0012
	eor     #$80
L0012:	bpl     L000F
	jsr     ldax0sp
	ldy     #$40
	jsr     incaxy
	.dbg	line, "vdc_core.c", 86
	jmp     L0052
L000F:	jsr     ldax0sp
	cmp     #$60
	txa
	sbc     #$00
	bvs     L0017
	eor     #$80
L0017:	bpl     L0016
	jsr     ldax0sp
	cmp     #$80
	txa
	sbc     #$00
	bvc     L0019
	eor     #$80
L0019:	bpl     L0016
	jsr     ldax0sp
	ldy     #$20
	jsr     decaxy
	.dbg	line, "vdc_core.c", 87
	jmp     L0052
L0016:	jsr     ldax0sp
	cmp     #$80
	txa
	sbc     #$00
	bvs     L001E
	eor     #$80
L001E:	bpl     L001D
	jsr     ldax0sp
	cmp     #$A0
	txa
	sbc     #$00
	bvc     L0020
	eor     #$80
L0020:	bpl     L001D
	jsr     ldax0sp
	ldy     #$40
	jsr     incaxy
	.dbg	line, "vdc_core.c", 88
	jmp     L0052
L001D:	jsr     ldax0sp
	cmp     #$A2
	txa
	sbc     #$00
	bvs     L0025
	eor     #$80
L0025:	bpl     L0024
	jsr     ldax0sp
	cmp     #$C0
	txa
	sbc     #$00
	bvc     L0027
	eor     #$80
L0027:	bpl     L0024
	jsr     ldax0sp
	ldy     #$40
	jsr     decaxy
	.dbg	line, "vdc_core.c", 89
	jmp     L0052
L0024:	jsr     ldax0sp
	cmp     #$C0
	txa
	sbc     #$00
	bvs     L002C
	eor     #$80
L002C:	bpl     L002B
	jsr     ldax0sp
	cmp     #$E0
	txa
	sbc     #$00
	bvc     L002E
	eor     #$80
L002E:	bpl     L002B
	jsr     ldax0sp
	ldy     #$80
	jsr     decaxy
	.dbg	line, "vdc_core.c", 90
	jmp     L0052
L002B:	jsr     ldax0sp
	cmp     #$E0
	txa
	sbc     #$00
	bvs     L0033
	eor     #$80
L0033:	bpl     L0032
	jsr     ldax0sp
	cmp     #$FF
	txa
	sbc     #$00
	bvc     L0035
	eor     #$80
L0035:	bpl     L0032
	jsr     ldax0sp
	ldy     #$80
	jsr     decaxy
	.dbg	line, "vdc_core.c", 91
	jmp     L0052
L0032:	ldy     #$01
	lda     (sp),y
	bne     L0053
	dey
	lda     (sp),y
	cmp     #$FF
	bne     L0053
	ldx     #$00
	lda     #$5E
L0052:	jsr     stax0sp
	.dbg	line, "vdc_core.c", 93
L0053:	jsr     ldax0sp
	.dbg	line, "vdc_core.c", 94
	jmp     incsp2

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_RowColToAddress (int row, int col)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_RowColToAddress: near

	.dbg	func, "VDC_RowColToAddress", "00", extern, "_VDC_RowColToAddress"
	.dbg	sym, "row", "00", auto, 2
	.dbg	sym, "col", "00", auto, 0
	.dbg	sym, "addr", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 97
	jsr     pushax
	.dbg	line, "vdc_core.c", 101
	jsr     decsp2
	ldy     #$07
	jsr     pushwysp
	lda     #$50
	jsr     tosmula0
	sta     ptr1
	stx     ptr1+1
	ldy     #$03
	jsr     ldaxysp
	clc
	adc     ptr1
	pha
	txa
	adc     ptr1+1
	tax
	pla
	jsr     stax0sp
	.dbg	line, "vdc_core.c", 103
	txa
	bmi     L0002
	jsr     ldax0sp
	cmp     #$D0
	txa
	sbc     #$07
	bvc     L0004
	eor     #$80
L0004:	bpl     L0002
	.dbg	line, "vdc_core.c", 104
	jsr     ldax0sp
	jmp     L0007
	.dbg	line, "vdc_core.c", 106
L0002:	ldx     #$FF
	txa
	.dbg	line, "vdc_core.c", 107
L0007:	jmp     incsp6

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ VDC_Poke (int address, unsigned char value)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_Poke: near

	.dbg	func, "VDC_Poke", "00", extern, "_VDC_Poke"
	.dbg	sym, "address", "00", auto, 1
	.dbg	sym, "value", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 111
	jsr     pusha
	.dbg	line, "vdc_core.c", 113
	lda     #$12
	sta     $D600
	.dbg	line, "vdc_core.c", 114
	ldy     #$04
	jsr     pushwysp
	ldx     #$01
	lda     #$00
	jsr     tosdivax
	sta     $D601
	.dbg	line, "vdc_core.c", 117
	lda     #$13
	sta     $D600
	.dbg	line, "vdc_core.c", 118
	ldy     #$01
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 121
	lda     #$1F
	sta     $D600
	.dbg	line, "vdc_core.c", 122
	dey
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 123
	jmp     incsp3

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_Peek (int address)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_Peek: near

	.dbg	func, "VDC_Peek", "00", extern, "_VDC_Peek"
	.dbg	sym, "address", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 127
	jsr     pushax
	.dbg	line, "vdc_core.c", 129
	lda     #$12
	sta     $D600
	.dbg	line, "vdc_core.c", 130
	jsr     pushw0sp
	ldx     #$01
	lda     #$00
	jsr     tosdivax
	sta     $D601
	.dbg	line, "vdc_core.c", 133
	lda     #$13
	sta     $D600
	.dbg	line, "vdc_core.c", 134
	ldy     #$00
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 136
	lda     #$1F
	sta     $D600
	.dbg	line, "vdc_core.c", 138
	ldx     #$00
	lda     $D601
	.dbg	line, "vdc_core.c", 139
	jmp     incsp2

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ VDC_BackColor (int color)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_BackColor: near

	.dbg	func, "VDC_BackColor", "00", extern, "_VDC_BackColor"
	.dbg	sym, "color", "00", auto, 0
	.dbg	sym, "regval", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 143
	jsr     pushax
	.dbg	line, "vdc_core.c", 147
	jsr     decsp2
	lda     #$1A
	sta     $D600
	.dbg	line, "vdc_core.c", 148
	ldx     #$00
	lda     $D601
	jsr     stax0sp
	.dbg	line, "vdc_core.c", 150
	lda     #$1A
	sta     $D600
	.dbg	line, "vdc_core.c", 151
	lda     (sp,x)
	and     #$F0
	sta     ptr1
	ldy     #$02
	lda     (sp),y
	clc
	adc     ptr1
	sta     $D601
	.dbg	line, "vdc_core.c", 152
	jmp     incsp4

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_CursorAt (int row, int col)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_CursorAt: near

	.dbg	func, "VDC_CursorAt", "00", extern, "_VDC_CursorAt"
	.dbg	sym, "row", "00", auto, 2
	.dbg	sym, "col", "00", auto, 0
	.dbg	sym, "address", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 155
	jsr     pushax
	.dbg	line, "vdc_core.c", 158
	jsr     decsp2
	ldy     #$05
	jsr     ldaxysp
	cpx     #$80
	bcs     L0007
	ldy     #$05
	jsr     ldaxysp
	cmp     #$19
	txa
	sbc     #$00
	bvs     L0004
	eor     #$80
L0004:	bmi     L0007
	ldy     #$03
	jsr     ldaxysp
	cpx     #$80
	bcs     L0007
	ldy     #$03
	jsr     ldaxysp
	cmp     #$50
	txa
	sbc     #$00
	bvs     L0005
	eor     #$80
L0005:	bpl     L0002
	.dbg	line, "vdc_core.c", 159
L0007:	ldx     #$FF
	jmp     L0008
	.dbg	line, "vdc_core.c", 161
L0002:	ldy     #$07
	jsr     pushwysp
	ldy     #$05
	jsr     ldaxysp
	jsr     _VDC_RowColToAddress
	jsr     stax0sp
	.dbg	line, "vdc_core.c", 163
	lda     #$0E
	sta     $D600
	.dbg	line, "vdc_core.c", 164
	jsr     pushw0sp
	ldx     #$01
	lda     #$00
	jsr     tosdivax
	sta     $D601
	.dbg	line, "vdc_core.c", 166
	lda     #$0F
	sta     $D600
	.dbg	line, "vdc_core.c", 167
	ldy     #$00
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 169
	ldx     #$00
L0008:	txa
	.dbg	line, "vdc_core.c", 170
	jmp     incsp6

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_PrintAt (int row, int col, char *text, int rvsOn)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_PrintAt: near

	.dbg	func, "VDC_PrintAt", "00", extern, "_VDC_PrintAt"
	.dbg	sym, "row", "00", auto, 6
	.dbg	sym, "col", "00", auto, 4
	.dbg	sym, "text", "00", auto, 2
	.dbg	sym, "rvsOn", "00", auto, 0
	.dbg	sym, "x", "00", auto, -2
	.dbg	sym, "address", "00", auto, -4

.segment	"CODE"

	.dbg	line, "vdc_core.c", 172
	jsr     pushax
	.dbg	line, "vdc_core.c", 176
	jsr     decsp4
	ldy     #$0D
	jsr     pushwysp
	ldy     #$0B
	jsr     ldaxysp
	jsr     _VDC_RowColToAddress
	jsr     stax0sp
	.dbg	line, "vdc_core.c", 178
	cpx     #$FF
	bne     L000C
	cmp     #$FF
	jeq     L000A
	.dbg	line, "vdc_core.c", 180
L000C:	ldx     #$00
	txa
	ldy     #$02
	jsr     staxysp
	.dbg	line, "vdc_core.c", 181
	jmp     L0006
	.dbg	line, "vdc_core.c", 183
L0004:	ldy     #$03
	jsr     ldaxysp
	clc
	ldy     #$06
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	ldy     #$00
	lda     (ptr1),y
	jsr     pusha
	.dbg	line, "vdc_core.c", 185
	ldy     #$06
	lda     (sp),y
	bne     L0007
	dey
	lda     (sp),y
	cmp     #$01
	bne     L0007
	.dbg	line, "vdc_core.c", 186
	dey
	jsr     pushwysp
	ldy     #$02
	ldx     #$00
	lda     (sp),y
	jsr     _VDC_PetsciiToScreenCodeRvs
	.dbg	line, "vdc_core.c", 187
	jmp     L000B
	.dbg	line, "vdc_core.c", 188
L0007:	ldy     #$04
	jsr     pushwysp
	ldy     #$02
	ldx     #$00
	lda     (sp),y
	jsr     _VDC_PetsciiToScreenCode
L000B:	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 190
	ldy     #$01
	ldx     #$00
	tya
	jsr     addeqysp
	.dbg	line, "vdc_core.c", 191
	ldy     #$03
	ldx     #$00
	lda     #$01
	jsr     addeqysp
	.dbg	line, "vdc_core.c", 192
	jsr     incsp1
	.dbg	line, "vdc_core.c", 181
L0006:	ldy     #$03
	jsr     ldaxysp
	clc
	ldy     #$06
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	ldy     #$00
	lda     (ptr1),y
	bne     L0004
	.dbg	line, "vdc_core.c", 193
	ldy     #$03
	jsr     ldaxysp
	.dbg	line, "vdc_core.c", 197
L000A:	ldy     #$0C
	jmp     addysp

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_Clear (unsigned char val)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_Clear: near

	.dbg	func, "VDC_Clear", "00", extern, "_VDC_Clear"
	.dbg	sym, "val", "00", auto, 0
	.dbg	sym, "i", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 200
	jsr     pusha
	.dbg	line, "vdc_core.c", 204
	jsr     decsp2
	lda     #$12
	sta     $D600
	.dbg	line, "vdc_core.c", 205
	lda     #$00
	sta     $D601
	.dbg	line, "vdc_core.c", 208
	lda     #$13
	sta     $D600
	.dbg	line, "vdc_core.c", 209
	lda     #$00
	sta     $D601
	.dbg	line, "vdc_core.c", 212
	lda     #$18
	sta     $D600
	.dbg	line, "vdc_core.c", 213
	lda     $D601
	and     #$7F
	sta     $D601
	.dbg	line, "vdc_core.c", 216
	lda     #$1F
	sta     $D600
	.dbg	line, "vdc_core.c", 217
	ldy     #$02
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 220
	lda     #$1E
	sta     $D600
	.dbg	line, "vdc_core.c", 223
	ldx     #$00
	txa
	jsr     stax0sp
L0002:	jsr     ldax0sp
	cmp     #$08
	txa
	sbc     #$00
	bvc     L0006
	eor     #$80
L0006:	asl     a
	lda     #$00
	tax
	bcc     L0008
	.dbg	line, "vdc_core.c", 224
	lda     #$FF
	sta     $D601
	.dbg	line, "vdc_core.c", 223
	lda     #$01
	jsr     addeq0sp
	jmp     L0002
	.dbg	line, "vdc_core.c", 227
L0008:	jmp     incsp3

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_BlockCopy (int sourceaddr, int destaddr, int length)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_BlockCopy: near

	.dbg	func, "VDC_BlockCopy", "00", extern, "_VDC_BlockCopy"
	.dbg	sym, "sourceaddr", "00", auto, 4
	.dbg	sym, "destaddr", "00", auto, 2
	.dbg	sym, "length", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 231
	jsr     pushax
	.dbg	line, "vdc_core.c", 232
	jsr     ldax0sp
	cmp     #$00
	txa
	sbc     #$01
	bvs     L0003
	eor     #$80
L0003:	bpl     L0004
	.dbg	line, "vdc_core.c", 233
	ldx     #$FF
	txa
	jmp     L0001
	.dbg	line, "vdc_core.c", 236
L0004:	lda     #$12
	sta     $D600
	.dbg	line, "vdc_core.c", 237
	ldy     #$05
	jsr     pushwysp
	ldx     #$01
	lda     #$00
	jsr     tosdivax
	sta     $D601
	.dbg	line, "vdc_core.c", 240
	lda     #$13
	sta     $D600
	.dbg	line, "vdc_core.c", 241
	ldy     #$02
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 244
	lda     #$20
	sta     $D600
	.dbg	line, "vdc_core.c", 245
	ldy     #$07
	jsr     pushwysp
	ldx     #$01
	lda     #$00
	jsr     tosdivax
	sta     $D601
	.dbg	line, "vdc_core.c", 248
	lda     #$21
	sta     $D600
	.dbg	line, "vdc_core.c", 249
	ldy     #$04
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 252
	lda     #$18
	sta     $D600
	.dbg	line, "vdc_core.c", 253
	lda     $D601
	ora     #$80
	sta     $D601
	.dbg	line, "vdc_core.c", 256
	lda     #$1E
	sta     $D600
	.dbg	line, "vdc_core.c", 257
	ldy     #$00
	lda     (sp),y
	clc
	adc     #$01
	sta     $D601
	.dbg	line, "vdc_core.c", 259
	jsr     ldax0sp
	.dbg	line, "vdc_core.c", 260
L0001:	jmp     incsp6

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_Fill (int startAddr, int endAddr, unsigned char value)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_Fill: near

	.dbg	func, "VDC_Fill", "00", extern, "_VDC_Fill"
	.dbg	sym, "startAddr", "00", auto, 3
	.dbg	sym, "endAddr", "00", auto, 1
	.dbg	sym, "value", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 264
	jsr     pusha
	.dbg	line, "vdc_core.c", 265
	jmp     L0004
	.dbg	line, "vdc_core.c", 266
L0002:	ldy     #$06
	jsr     pushwysp
	ldy     #$05
	ldx     #$00
	lda     #$01
	jsr     addeqysp
	ldy     #$02
	lda     (sp),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 265
L0004:	ldy     #$06
	jsr     pushwysp
	ldy     #$04
	jsr     ldaxysp
	jsr     tosicmp
	bmi     L0002
	beq     L0002
	.dbg	line, "vdc_core.c", 268
	ldx     #$00
	txa
	.dbg	line, "vdc_core.c", 269
	jmp     incsp5

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ VDC_StashScreen (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_StashScreen: near

	.dbg	func, "VDC_StashScreen", "00", extern, "_VDC_StashScreen"
	.dbg	sym, "sourceAddr", "00", auto, -2
	.dbg	sym, "destAddr", "00", auto, -4

.segment	"CODE"

	.dbg	line, "vdc_core.c", 273
	jsr     push0
	.dbg	line, "vdc_core.c", 274
	ldx     #$10
	jsr     pushax
	.dbg	line, "vdc_core.c", 276
	jmp     L0004
	.dbg	line, "vdc_core.c", 278
L0002:	ldy     #$05
	jsr     pushwysp
	ldy     #$05
	jsr     pushwysp
	ldx     #$00
	lda     #$FF
	jsr     _VDC_BlockCopy
	.dbg	line, "vdc_core.c", 279
	ldy     #$02
	ldx     #$01
	lda     #$00
	jsr     addeqysp
	.dbg	line, "vdc_core.c", 280
	ldx     #$01
	lda     #$00
	jsr     addeq0sp
	.dbg	line, "vdc_core.c", 276
L0004:	ldy     #$03
	jsr     ldaxysp
	cmp     #$00
	txa
	sbc     #$08
	bvc     L0005
	eor     #$80
L0005:	bmi     L0002
	.dbg	line, "vdc_core.c", 291
	jmp     incsp4

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_FetchScreen (void)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_FetchScreen: near

	.dbg	func, "VDC_FetchScreen", "00", extern, "_VDC_FetchScreen"
	.dbg	sym, "sourceAddr", "00", auto, -2
	.dbg	sym, "destAddr", "00", auto, -4

.segment	"CODE"

	.dbg	line, "vdc_core.c", 297
	ldx     #$10
	lda     #$00
	jsr     pushax
	.dbg	line, "vdc_core.c", 298
	jsr     push0
	.dbg	line, "vdc_core.c", 300
	jmp     L0004
	.dbg	line, "vdc_core.c", 302
L0002:	ldy     #$05
	jsr     pushwysp
	ldy     #$05
	jsr     pushwysp
	ldx     #$00
	lda     #$FF
	jsr     _VDC_BlockCopy
	.dbg	line, "vdc_core.c", 303
	ldy     #$02
	ldx     #$01
	lda     #$00
	jsr     addeqysp
	.dbg	line, "vdc_core.c", 304
	ldx     #$01
	lda     #$00
	jsr     addeq0sp
	.dbg	line, "vdc_core.c", 300
L0004:	ldy     #$03
	jsr     ldaxysp
	cmp     #$00
	txa
	sbc     #$18
	bvc     L0005
	eor     #$80
L0005:	bmi     L0002
	.dbg	line, "vdc_core.c", 316
	ldx     #$00
	txa
	.dbg	line, "vdc_core.c", 317
	jmp     incsp4

	.dbg	line
.endproc

; ---------------------------------------------------------------
; void __near__ VDC_SetCursorMode (int cursorMode)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_SetCursorMode: near

	.dbg	func, "VDC_SetCursorMode", "00", extern, "_VDC_SetCursorMode"
	.dbg	sym, "cursorMode", "00", auto, 0

.segment	"CODE"

	.dbg	line, "vdc_core.c", 320
	jsr     pushax
	.dbg	line, "vdc_core.c", 321
	jsr     ldax0sp
	cmp     #$04
	txa
	sbc     #$00
	bvs     L0003
	eor     #$80
L0003:	bmi     L0001
	jsr     ldax0sp
	cpx     #$80
	bcs     L0001
	.dbg	line, "vdc_core.c", 325
	lda     #$12
	sta     $D600
	.dbg	line, "vdc_core.c", 326
	lda     #$00
	sta     $D601
	.dbg	line, "vdc_core.c", 329
	lda     #$13
	sta     $D600
	.dbg	line, "vdc_core.c", 330
	lda     #$00
	sta     $D601
	.dbg	line, "vdc_core.c", 333
	lda     #$0A
	sta     $D600
	.dbg	line, "vdc_core.c", 334
	ldy     #$00
	lda     (sp),y
	sta     $D601
	.dbg	line, "vdc_core.c", 336
L0001:	jmp     incsp2

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_CopyVDCToMem (int vdcAddress, int memAddress, int length)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_CopyVDCToMem: near

	.dbg	func, "VDC_CopyVDCToMem", "00", extern, "_VDC_CopyVDCToMem"
	.dbg	sym, "vdcAddress", "00", auto, 4
	.dbg	sym, "memAddress", "00", auto, 2
	.dbg	sym, "length", "00", auto, 0
	.dbg	sym, "x", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 339
	jsr     pushax
	.dbg	line, "vdc_core.c", 342
	jsr     decsp2
	ldx     #$00
	txa
	jsr     stax0sp
L0002:	jsr     ldax0sp
	ldy     #$02
	cmp     (sp),y
	txa
	iny
	sbc     (sp),y
	bvc     L0006
	eor     #$80
L0006:	asl     a
	lda     #$00
	tax
	bcc     L0008
	.dbg	line, "vdc_core.c", 343
	jsr     ldax0sp
	clc
	ldy     #$04
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$03
	jsr     ldaxysp
	clc
	ldy     #$08
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     _VDC_Peek
	ldy     #$00
	jsr     staspidx
	.dbg	line, "vdc_core.c", 342
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	jmp     L0002
	.dbg	line, "vdc_core.c", 346
L0008:	jmp     incsp8

	.dbg	line
.endproc

; ---------------------------------------------------------------
; int __near__ VDC_CopyMemToVDC (int memAddress, int vdcAddress, int length)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_VDC_CopyMemToVDC: near

	.dbg	func, "VDC_CopyMemToVDC", "00", extern, "_VDC_CopyMemToVDC"
	.dbg	sym, "memAddress", "00", auto, 4
	.dbg	sym, "vdcAddress", "00", auto, 2
	.dbg	sym, "length", "00", auto, 0
	.dbg	sym, "x", "00", auto, -2

.segment	"CODE"

	.dbg	line, "vdc_core.c", 349
	jsr     pushax
	.dbg	line, "vdc_core.c", 352
	jsr     decsp2
	ldx     #$00
	txa
	jsr     stax0sp
L0002:	jsr     ldax0sp
	ldy     #$02
	cmp     (sp),y
	txa
	iny
	sbc     (sp),y
	bvc     L0006
	eor     #$80
L0006:	asl     a
	lda     #$00
	tax
	bcc     L0008
	.dbg	line, "vdc_core.c", 353
	jsr     ldax0sp
	clc
	ldy     #$04
	adc     (sp),y
	pha
	txa
	iny
	adc     (sp),y
	tax
	pla
	jsr     pushax
	ldy     #$03
	jsr     ldaxysp
	clc
	ldy     #$08
	adc     (sp),y
	sta     ptr1
	txa
	iny
	adc     (sp),y
	sta     ptr1+1
	ldy     #$00
	lda     (ptr1),y
	jsr     _VDC_Poke
	.dbg	line, "vdc_core.c", 352
	ldx     #$00
	lda     #$01
	jsr     addeq0sp
	jmp     L0002
	.dbg	line, "vdc_core.c", 356
L0008:	jmp     incsp8

	.dbg	line
.endproc

