chiark / gitweb /
some comments about the buffer management
authorian <ian>
Tue, 20 Dec 2005 23:17:13 +0000 (23:17 +0000)
committerian <ian>
Tue, 20 Dec 2005 23:17:13 +0000 (23:17 +0000)
detpic/nmra-stream.asm

index fe3154ccc151c8de845b20c9e90eb236fcdf8559..9a8c6755716fec8883f546a819bdcfa0723fcb05 100644 (file)
@@ -24,10 +24,25 @@ clock equ mclock ; this part runs really only on master
 nmractrl       res     1       ; state relevant to NMRA control
 transmitbit    equ     7       ; bit 7: 0/1 bit currently being transmitted
 nextaction     equ     6       ; bit 6: change polarity on next interrupt y/n
+ ; nmractrl is a bitmask, and only the bits above are used
 
 fromserial     res     1       ; from-serial buffer location (in buffer bank)
 totrack                res     1       ; to-track buffer location (in buffer bank)
 totrackbit     res     1       ; bit location of pointer within byte
+ ;
+ ; buffers are each 16 bytes (this is hardwired)
+ ; and there are four of them starting at 0x500, 0x510, 0x520, 0x530.
+ ;
+ ; fromserial and totrack are pointers into the buffer page
+ ;
+ ; fromserial points to the first empty byte, where we will put new
+ ; data provided by the host; this means that (fromserial & 0xf0) is
+ ; the first buffer which fails to contain a complete nmra message
+ ;
+ ; totrack points to the first remaining full byte, which is currently
+ ; being transmitted; if nothing is currently being transmitted
+ ; because there is no nmra data at all then totrack points to the
+ ; start of the same buffer as fromserial
 
 bufferpage     equ     5