@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Writes 'pattern' in memory locations 'startaddr' to 'startaddr+count'.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTSSSN | Mark: 11000 (memset)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Store 'pattern' into one memory location on each pass through this loop.
NSSVSSSTTSSSSSSSSSSSN | Mark: 00011000 00000000
@ Decrement and check for loop end condition 'count == 0'.
NTSSSSTTSSSSSSSSSSTN | BRZ > 00011000 00000001
NSNSSSTTSSSSSSSSSSSN | JMP > 00011000 00000000
NSSVSSSTTSSSSSSSSSSTN | Mark: 00011000 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Copies 'count+1' words from 'source' to 'destination'.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTSSTN | Mark: 11001 (memcpy)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Copy one word on each pass through this loop.
NSSVSSSTTSSTSSSSSSSSN | Mark: 00011001 00000000
@ Decrement and check for loop end conditions.
NTSSSSTTSSTSSSSSSSTN | BRZ > 00011001 00000001
NSNSSSTTSSTSSSSSSSSN | JMP > 00011001 00000000
NSSVSSSTTSSTSSSSSSSTN | Mark: 00011001 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Writes random words into memory locations 'startaddr' to 'startaddr+count'.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTSTSN | Mark: 11010 (memrand)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Store random word into one memory location on each pass through this loop.
NSSVSSSTTSTSSSSSSSSSN | Mark: 00011010 00000000
NSTTSSSSN | JSR > 10000 (random)
@ Decrement and check loop end conditions
NTSSSSTTSTSSSSSSSSTN | BRZ > 00011010 00000001
NSNSSSTTSTSSSSSSSSSN | JMP > 00011010 00000000
NSSVSSSTTSTSSSSSSSSTN | Mark: 00011010 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Compares two blocks of memory:
@ blk1ptr -> blk1ptr+count
@ blk2ptr -> blk2ptr+count
@ The return value is zero if the blocks are identical, otherwise non-zero.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTSTTN | Mark: 11011 (memcmp)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Compare one word on each pass through this loop.
NSSVSSSTTSTTSSSSSSSSN | Mark: 00011011 00000000
NTSSSSTTSTTSSSSSSTSN | BRZ > 00011011 00000010 (jump if words match)
@ Return 'match? = false'
@ Decrement and loop again if loop is not complete.
NSSVSSSTTSTTSSSSSSTSN | Mark: 00011011 00000010
NTSSSSTTSTTSSSSSSSTN | BRZ > 00011011 00000001 (jump if loop is complete)
NSNSSSTTSTTSSSSSSSSN | JMP > 00011011 00000000
NSSVSSSTTSTTSSSSSSSTN | Mark: 00011011 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Searches the heap from 'address' to 'address+count'.
@ If 'pattern' is found, the return value is a pointer to the matching word.
@ If not found, the return value is a null pointer.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTTSSN | Mark: 11100 (memsrch)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Compare one word on each pass through this loop.
NSSVSSSTTTSSSSSSSSSSN | Mark: 00011100 00000000
NTSSSSTTTSSSSSSSSSTN | BRZ > 00011100 00000001
NTSSSSTTTSSSSSSSSTSN | BRZ > 00011100 00000010
NSNSSSTTTSSSSSSSSSSN | JMP > 00011100 00000000
@ Found a match. Clean up and return.
NSSVSSSTTTSSSSSSSSSTN | Mark: 00011100 00000001
@ No match found. Clean up and return.
NSSVSSSTTTSSSSSSSSTSN | Mark: 00011100 00000010
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Reads 'count' values from heap to stack in complementary order to 'spewreg'.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTSSSSSSN | Mark: 1000000 (slurpreg)
@ Load one word from heap on each pass.
NSSVSTSSSSSSSSSSSSSSN | Mark: 01000000 00000000
@ Check for loop completion.
@ As a side effect, prepare the next address.
NTSSTSSSSSSSSSSSSSTN | BRZ > 01000000 00000001
NSNSTSSSSSSSSSSSSSSN | JMP > 01000000 00000000
NSSVSTSSSSSSSSSSSSSTN | Mark: 01000000 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Writes 'count' values from stack to heap in this order:
@ This function uses heap[15] for temporary storage, thus limiting the total
@ registers to 14 since heap[0] is reserved. Since this function populates
@ the registers, encoding the value here seems a natural location to document
@ the limit. TODO: Should this be turned into a CPP define?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTSSSSSTN | Mark: 1000001 (spewreg)
@ To simplify other functions, sprewreg shall accept 0 as a valid count value.
NTSSTSSSSSTSSSSSSSTN | BRZ > 01000001 00000001
@ Create a counter in heap[15] that doubles as a destination pointer generator.
@ Store one word to heap on each pass.
NSSVSTSSSSSTSSSSSSSSN | Mark: 01000001 00000000
@ Check for loop completion.
NTSSTSSSSSTSSSSSSSTN | BRZ > 01000001 00000001
@ Increment heap[15] if continuing.
NSNSTSSSSSTSSSSSSSSN | JMP > 01000001 00000000
NSSVSTSSSSSTSSSSSSSTN | Mark: 01000001 00000001
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Reads values from heap to stack in complementary order to 'spew'.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTTTSN | Mark: 11110 (slurp)
@ Load one word from heap on each pass.
NSTTSTSN | JSR > 1010 (stackrotate)
NSTTSTSN | JSR > 1010 (stackrotate)
NSTTSTSN | JSR > 1010 (stackrotate)
@ Check for loop completion.
NTSSSSTTTTSSSSSSSSSN | BRZ > 00011110 00000000
NSNTTTTSN | JMP > 11110 (slurp)
NSSVSSSTTTTSSSSSSSSSN | Mark: 00011110 00000000
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ Writes values from stack to heap in this order:
@ TOS+1 -> heap[address+1]
@ TOS+n -> heap[address+count]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
NSSVTTTTTN | Mark: 11111 (spew)
NSTTSSSSSTN | JSR > 1000001 (spewreg)
@ Create a counter in heap[3] that doubles as a dest. pointer offset generator.
@ Store one word to heap on each pass.
NSSVSSSTTTTTSSSSSSSSN | Mark: 00011111 00000000
@ Check for loop completion.
NTSSSSTTTTTSSSSSSSTN | BRZ > 00011111 00000001
@ Increment heap[3] if continuing.
NSNSSSTTTTTSSSSSSSSN | JMP > 00011111 00000000
NSSVSSSTTTTTSSSSSSSTN | Mark: 00011111 00000001