Changes

Jump to: navigation, search

Programming:Filling memory with a byte

No change in size, 23:15, 17 March 2018
/* Using the stack */
; Set up a fast 16-bit loop counter
dec de ld b,e ; This method takes advantage of the fact that DJNZ leaves B as 0, which subsequent DJNZs see as 256ld b,e dec de ; B = (length/2) MOD 256, so 0 = a 512-byte blockinc b d ; D = the number of 512-byte blocks to write, or just = 1 if the length is <512inc d ; Of course, if you know the length ahead of run-time, you can set B and D directly in your ASM
; Fill the memory
14
edits