Ein Anstoss:
Code:
Dim Base As Word
Dim Top As Word
Dim Wrpnt As Word
Dim Rdpnt As Word
Dim One_w As Byte
Dim One_r As Byte
Dim Buffer(260) As Byte


Buf_init:
   Base = Varptr(buffer(1))                                 'mem-adr von Buffer-base
   Top = Base + 260                                         'mem adr von bufer top
   Wrpnt = Base                                             'write pointer
   Rdpnt = Base                                             'read pointer
   Return

Buf_write:
   One_w = Udr                                              ' byte from UART
   Out Wrpnt , One_w                                        ' into buffer
   Incr Wrpnt                                               ' pointer + 1
   If Wrpnt >= Top Then Wrpnt = Base                        ' wrap around
   Return

Buf_read:
   interrupts disable
   If Rdpnt = Wrpnt Then
      interrupts enable
      One_r = 0                                             ' no data
   Else
      interrupts enable
      One_r = Inp(rdpnt)                                    ' read from pointer
      Incr Rdpnt                                            ' pointer + 1
      If Rdpnt >= Top Then Rdpnt = Base                     ' wrap around
   End If
   Return
"Buf-write" passiert eigentlich in der Interrupt-routine

"Udr" wird bei dir anders heissen