The DB (define byte) directive is used to allocate byte-sized blocks of memory. The section that comes after the DB specifies the value that should be placed into the allocated memory. For example, if you wanted to define a single byte of memory with the value 65, you could use the following directive.
SingleByte DB 65 ; allocate a single byte and write 65 into the byte
The DUP (duplicate) directive is used to duplicate a series of characters. The series of characters to be duplicated are specified within the parentheses that follow DUP. The number before DUP specifies the number of times that the series of characters should be duplicated. For example, if you wanted to define a 10-byte block of memory where each byte had the value 65, you could use the following directive.
TenBytes DB 10 DUP(65); allocate 10 bytes and write 65 into each byte
In your case, you do not care what values are stored in each byte in the buffer originally, so you can use ?
as the byte that is being duplicated. If you wanted to instead initialize each byte to zero, you could replace ?
with 0
.
Buffer DB 80 DUP(?) ; set aside 80 bytes without assigning them any values
The maximum length and the actual length of the buffer should be managed using separate variables. In all, you probably want something of the following nature.
Buffer DB 80 DUP(0) ; 80-byte buffer initialized to all zeros
BufferMaxLen DB 80 ; maximum length of Buffer
BufferLen DB 0 ; actual length of Buffer