eris2206

Documentation: http://frombelow.net/projects/eris2206/
Clone: git clone https://git.frombelow.net/eris2206.git
Log | Files | Refs | Submodules | README | LICENSE

rom_uart.asm (636B)


      1 #define UART_STATUS $FF
      2 #define UART_DATA $FE
      3 #define LEDS $FD
      4 .set_address $80
      5 start:
      6     STA   UART_STATUS // Clear recv_buffer_full; ready to receive next byte
      7 receive_loop:
      8     LDA   UART_STATUS
      9     STA   LEDS
     10     ADD   :mask_recv_buffer_full // A is 0 if recv_buffer_full
     11     JNZ   :receive_loop
     12     LDA   UART_DATA
     13     // Echo byte
     14     STA   UART_DATA
     15     // Wait until byte sent
     16 send_loop:
     17     LDA   UART_STATUS
     18     ADD   :mask_tx_busy_and_recv_buffer_full // A is 0 if tx_busy and recv_buffer_full
     19     JZE   :send_loop
     20     // Start over
     21     JMP   :start
     22 mask_recv_buffer_full:
     23     $FE
     24 mask_tx_busy_and_recv_buffer_full:
     25     $FD