blob: 4783660883f42c5b082702dc9baf5dacf7eaf96c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
;; void txbuf_append_chr(char c) {
;; tx_buf[txbuflen++] = c;
;; }
; compiles to 45 bytes. routine below is 29 bytes (~33% smaller)
tx_buf = $a200 ; MUST agree with src/rxtxbuf.h!
.import _txbuflen
.export _txbuf_append_chr
.importzp sreg ; avoid ptr1 & friends, callers may use
_txbuf_append_chr:
tax
lda #<tx_buf
clc
adc _txbuflen
sta sreg
lda #>tx_buf
adc _txbuflen+1
sta sreg+1
ldy #0
txa
sta (sreg),y
inc _txbuflen
bne @ret
inc _txbuflen+1
@ret:
rts
|