From: ian Date: Tue, 20 Dec 2005 23:17:13 +0000 (+0000) Subject: some comments about the buffer management X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=2b871adc25c16c51673daf08e162f7d1b6f26399;p=trains.git some comments about the buffer management --- diff --git a/detpic/nmra-stream.asm b/detpic/nmra-stream.asm index fe3154c..9a8c675 100644 --- a/detpic/nmra-stream.asm +++ b/detpic/nmra-stream.asm @@ -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