;
; 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, "../../../io/src/uart.c", 3632, 1267200496
	.dbg		file, "../inc/manifest.h", 151, 1267200480
	.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, "../../../io/inc/uart.h", 1541, 1267200496
	.dbg		file, "../../../data/inc/types.h", 1544, 1267200498
	.dbg		file, "../../../system/inc/soft_signal.h", 1293, 1267200486
	.export		_uart_read_buffer
	.export		_uart_write_buffer
	.export		_uart_data_available
	.import		_Signals

; ---------------------------------------------------------------
; signed short __near__ uart_read_buffer (__near__ const void*, unsigned short)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_uart_read_buffer: near

.segment	"CODE"

;
; BYTE *pnt = (BYTE *)buf;
;
	.dbg	line, "../../../io/src/uart.c", 72
	jsr     decsp1
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
;
; SHORT i = 0;
;
	.dbg	line, "../../../io/src/uart.c", 73
	jsr     push0
;
; clear_signal(SGNL_UART_BREAK);
;
	.dbg	line, "../../../io/src/uart.c", 76
	jsr     decsp1
	sta     _Signals+1
;
; d = 0;   
;
	.dbg	line, "../../../io/src/uart.c", 78
	ldy     #$00
	sta     (sp),y
;
; st = UART_FLAGS;
;
	.dbg	line, "../../../io/src/uart.c", 80
L000F:	lda     $2102
	ldy     #$05
	sta     (sp),y
;
; if (st & UART_RxDataAv) {
;
	.dbg	line, "../../../io/src/uart.c", 81
	and     #$80
	beq     L0015
;
; if (count) {
;
	.dbg	line, "../../../io/src/uart.c", 82
	ldy     #$07
	lda     (sp),y
	dey
	ora     (sp),y
	beq     L0015
;
; d = UART_DATA;
;
	.dbg	line, "../../../io/src/uart.c", 83
	lda     $2100
	ldy     #$00
	sta     (sp),y
;
; *(pnt++) = d;
;
	.dbg	line, "../../../io/src/uart.c", 84
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	clc
	adc     #$01
	bcc     L001E
	inx
L001E:	jsr     staxysp
	ldy     #$00
	lda     (sp),y
	sta     (regsave),y
;
; UART_GET = 0;
;
	.dbg	line, "../../../io/src/uart.c", 85
	sty     $2101
;
; count --;
;
	.dbg	line, "../../../io/src/uart.c", 86
	ldy     #$07
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sec
	sbc     #$01
	bcs     L0024
	dex
L0024:	jsr     staxysp
;
; i++;
;
	.dbg	line, "../../../io/src/uart.c", 87
	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	bcc     L0026
	inx
L0026:	jsr     staxysp
;
; d &= 0x7F;
;
	.dbg	line, "../../../io/src/uart.c", 92
L0015:	ldy     #$00
	lda     (sp),y
	and     #$7F
	sta     (sp),y
;
; } while(count && (d != VT100_CR) && (d != VT100_NL) && !signal_set(SGNL_UART_BREAK));
;
	.dbg	line, "../../../io/src/uart.c", 93
	ldy     #$07
	lda     (sp),y
	dey
	ora     (sp),y
	beq     L0057
	ldy     #$00
	lda     (sp),y
	cmp     #$0D
	beq     L0057
	lda     (sp),y
	cmp     #$0A
	beq     L0057
	lda     _Signals+1
	beq     L000F
;
; return i;
;
	.dbg	line, "../../../io/src/uart.c", 96
L0057:	ldy     #$02
	lda     (sp),y
	tax
	dey
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../io/src/uart.c", 97
	ldy     #$0A
	jmp     addysp
	.dbg	line

.endproc

; ---------------------------------------------------------------
; signed short __near__ uart_write_buffer (__near__ const void*, unsigned short)
; ---------------------------------------------------------------

.segment	"CODE"

.proc	_uart_write_buffer: near

.segment	"CODE"

;
; BYTE *pnt = (BYTE *)buf;
;
	.dbg	line, "../../../io/src/uart.c", 120
	jsr     decsp3
	ldy     #$06
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	jsr     pushax
;
; for(i=0;i<count;i++) {
;
	.dbg	line, "../../../io/src/uart.c", 122
	ldx     #$00
	txa
	ldy     #$03
L0059:	jsr     staxysp
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	ldy     #$05
	cmp     (sp),y
	txa
	iny
	sbc     (sp),y
	jcs     L0034
;
; st = UART_FLAGS;
;
	.dbg	line, "../../../io/src/uart.c", 124
L0036:	lda     $2102
	ldy     #$02
	sta     (sp),y
;
; while(!(st & UART_TxReady));
;
	.dbg	line, "../../../io/src/uart.c", 127
	and     #$40
	beq     L0036
;
; if(*pnt == 0x0A) {
;
	.dbg	line, "../../../io/src/uart.c", 129
	dey
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	lda     (ptr1),y
	cmp     #$0A
	bne     L0044
;
; UART_DATA = 0x0D;
;
	.dbg	line, "../../../io/src/uart.c", 130
	lda     #$0D
	sta     $2100
;
; if(*pnt == 0x0D) {
;
	.dbg	line, "../../../io/src/uart.c", 133
L0044:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     ptr1
	stx     ptr1+1
	lda     (ptr1),y
	cmp     #$0D
	bne     L0049
;
; UART_DATA = *pnt++;
;
	.dbg	line, "../../../io/src/uart.c", 134
	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	clc
	adc     #$01
	bcc     L004E
	inx
L004E:	jsr     stax0sp
	ldy     #$00
	lda     (regsave),y
	sta     $2100
;
; UART_DATA = 0x0A;
;
	.dbg	line, "../../../io/src/uart.c", 135
	lda     #$0A
;
; continue;
;
	.dbg	line, "../../../io/src/uart.c", 136
	jmp     L0058
;
; UART_DATA = *pnt++;
;
	.dbg	line, "../../../io/src/uart.c", 138
L0049:	iny
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	sta     regsave
	stx     regsave+1
	clc
	adc     #$01
	bcc     L0055
	inx
L0055:	jsr     stax0sp
	ldy     #$00
	lda     (regsave),y
L0058:	sta     $2100
;
; for(i=0;i<count;i++) {
;
	.dbg	line, "../../../io/src/uart.c", 122
	ldy     #$04
	lda     (sp),y
	tax
	dey
	lda     (sp),y
	clc
	adc     #$01
	jcc     L0059
	inx
	jmp     L0059
;
; return count;
;
	.dbg	line, "../../../io/src/uart.c", 141
L0034:	lda     (sp),y
	tax
	dey
	lda     (sp),y
;
; }
;
	.dbg	line, "../../../io/src/uart.c", 142
	ldy     #$09
	jmp     addysp
	.dbg	line

.endproc

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

.segment	"CODE"

.proc	_uart_data_available: near

.segment	"CODE"

;
; return (UART_FLAGS & UART_RxDataAv);
;
	.dbg	line, "../../../io/src/uart.c", 49
	lda     $2102
	ldx     #$00
	and     #$80
;
; }
;
	.dbg	line, "../../../io/src/uart.c", 50
	rts
	.dbg	line

.endproc

