GARTHWILSON wrote:
Ok, just to add another one, hopefully ahead of time so it won't mess you up further when you see it: with some assemblers, $ by itself (not followed by hex digits) is the way to get the value of the program counter. So you might see something like
Code:
ORG $ + N
which is equivalent to the *=*+N that we had above. Yeah, there's definitely a lack of consistency.
That is very non-standard. None of the assemblers I have ever used in the past 40 years has used the dollar sign to represent the program counter. I would find that usage to be counter-intuitive.
Quote:
Although the following is in the interrupts primer, including with an illustration, I should comment again that the RS-232 buffer as I'm using it there is a ring, a circle...It's kind of like a gas tank which does not need to be emptied before you put more gas in...
This is more directed to Dan, since Garth already knows this.
In assembly language, it's helpful to think of the structure to which Garth is referring as a FIFO (first-in, first-out), not a buffer. In academic terms, a buffer is a temporary storage structure in which the structure's
logical beginning and end are the same as its physical beginning and end. You would use a buffer for collecting typed input, storing a disk block, etc.
On the other hand, a FIFO's logical beginning and end is constantly moving—hence the FIFO is "circular." An index is maintained somewhere to tell the program using the FIFO where the logical beginning is located within the FIFO's boundaries. The same index implies the location of the logical end, which is one less than the beginning. Typically that index is zero-based and is added to the starting address of the FIFO to get the actual address of the logical beginning. As you develop your TIA-232 driver routines you will get very up close and personal with FIFOs.
A stack, whether hardware or software, is a LIFO (last-in, first-out) structure and as is the case with the FIFO, the logical beginning and end constantly moves—making a FIFO "circular." Considering a hardware stack as in the 6502 family, each push to the stack decrements the stack pointer (SP) after the byte has been written to the stack (SP is postdecremented). If a push occurs while SP is $00 the pushed byte will be stored at $0100 (in the eight bit MPUs) and SP will wrap to $FF. Pulling a byte will increment SP before the byte is read from the stack and if SP is $FF when a byte is pulled SP will wrap to $00. Software stacks work in essentially the same fashion, but the "stack pointer" is (sometimes laboriously) maintained in software.
Quote:
Also, there's no requirement that the incoming data all be in strings, whether counted or null-terminated. It might for example start with a string to tell it that the next 913 bytes are binary program material to put in memory starting at address xyz. After that many bytes have come in, the next bytes might again be a string giving the computer the next instruction.
That's true. However, the term "string" most often means "character string," since such data are usually treated as a single entity, e.g., someone's name in a database. What Garth is referring to is commonly referred to in systems software engineering as a "stream," which means it is a series of bytes that individually stand on their own. An example of a stream would be a Motorola S-record, which represents binary values in a (more or less) human-readable format.