| Purpose: | Initialize a range of SRAM to a specific value. | |||
| Assumes: | bPtrDest is valid | |||
| Passed: | R25:R24 | BYTE * | bPtrStart | the starting SRAM address |
| R22 | BYTE | bValue | data value to write to all BYTEs in the range | |
| R21:R20 | WORD | wCount | number of BYTEs to initialize to bValue | |
| Returns: | R25:R24 | BYTE * | bPtrStart | the caller's bPtrStart value (unmodified) |
| Alters: | No Registers, only the memory block referenced and the FLAGs | |||
| Example: | If a temporary buffer is only needed for the duration of a subroutine call, it can be allocated on the stack. Zeroing it out is needed for string functions (strlen() and strcmp(), for example) and also helps to see what changed when dumping memory while debugging. |
| |
| Notes: | The bPtrStart value is not checked for validity. The wCount value is limited to 2,047 (= 0x7FF) BYTEs. If wCount is zero, it exits immediately with no SRAM change. |
| Dropin: (setup code) |
; Setup for the meminit() call: ; Passed: R25:R24 BYTE * bPtrStart to the SRAM buffer's starting point ; R22 BYTE bValue to write to all BYTEs in the range ; R21:R20 WORD wCount is the number of BYTEs to initialize ; Returns: R25:R24 BYTE * bPtrStart, the caller's bPtrStart value (unmodified) ; Alters: No Registers, only the memory block referenced and the FLAGs |
| Also see: | The memcpy and meminitEEPROM system routines. |