]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - avr/hw-uart.asm
SVN --> GIT
[avrcpm.git] / avr / hw-uart.asm
index 6fdb6db667ecbe8010fa626e301acaf82676bea4..81552b9bdb356bbc11f1122375b52816f44970db 100644 (file)
@@ -1,4 +1,4 @@
-; Serial interface using the ATmega8/88 USART. 
+; Serial interface using the ATmega8/88 USART.
 ; This is part of the Z80-CP/M emulator written by Sprite_tm.
 ;
 ;    Copyright (C) 2010 Leo C.
@@ -27,7 +27,7 @@
 #define TXBUFMASK  TXBUFSIZE-1
 
        .dseg
-       
+
 rxcount:
        .byte   1
 rxidx_w:
@@ -45,9 +45,9 @@ rxfifo:
 txfifo:
        .byte   TXBUFSIZE
 
-       
+
        .cseg
-; Init 
+; Init
 uart_init:
 
        ldi temp, (1<<TXEN0) | (1<<RXEN0) | (1<<RXCIE0)
@@ -68,7 +68,7 @@ uart_init:
 
 ; USART receive interrupt
 
-       INTERRUPT URXCaddr   
+       INTERRUPT URXCaddr
 
        push    temp
        in      temp,sreg
@@ -78,11 +78,11 @@ uart_init:
        inm8    temp,RXTXDR0
        lds     zh,rxcount              ;if rxcount < RXBUFSIZE
        cpi     zh,RXBUFSIZE            ;   (room for at least 1 char?)
-       brsh    rxi_ov                  ; 
+       brsh    rxi_ov                  ;
        inc     zh                      ;
        sts     rxcount,zh              ;   rxcount++
 
-       ldi     zl,low(rxfifo)          ;  
+       ldi     zl,low(rxfifo)          ;
        lds     zh,rxidx_w              ;
        add     zl,zh                   ;
        inc     zh                      ;
@@ -107,7 +107,7 @@ uartgetc:
        lds     temp,rxcount            ; Number of characters in buffer
        tst     temp
        breq    uartgetc                ;Wait for char
-       
+
        push    zh
        push    zl
        ldi     zl,low(rxfifo)
@@ -138,13 +138,13 @@ uartgetc:
        push    temp
        lds     temp,txcount            ;if txcount != 0
        tst     temp                    ;
-       breq    txi_e                   ; 
+       breq    txi_e                   ;
 
        dec     temp                    ;
        sts     txcount,temp            ;   --txcount
        push    zh                      ;
        push    zl                      ;
-       ldi     zl,low(txfifo)          ;  
+       ldi     zl,low(txfifo)          ;
        ldi     zh,high(txfifo)         ;
        lds     temp,txidx_r            ;
        add     zl,temp                 ;
@@ -170,7 +170,7 @@ txi_x:
        reti
 
 
-;Sends a char from temp to the uart. 
+;Sends a char from temp to the uart.
 uartputc:
        push    zh
        push    zl
@@ -180,7 +180,7 @@ putc_l:
        cpi     temp,TXBUFSIZE          ;
        brsh    putc_l                  ;} while (txcount >= TXBUFSIZE)
 
-       ldi     zl,low(txfifo)          ;  
+       ldi     zl,low(txfifo)          ;
        ldi     zh,high(txfifo)         ;
        lds     temp,txidx_w            ;
        add     zl,temp                 ;
@@ -203,4 +203,3 @@ putc_l:
        ret
 
 ; vim:set ts=8 noet nowrap
-