Skip to navigation

BBC Micro Elite

Utility routines: ZES2

Name: ZES2 [View in context] Type: Subroutine Category: Utility routines Summary: Zero-fill a specific page
Zero-fill from address (X SC) + Y to (X SC) + &FF. Arguments: X The high byte (i.e. the page) of the starting point of the zero-fill Y The offset from (X SC) where we start zeroing, counting up to to &FF SC The low byte (i.e. the offset into the page) of the starting point of the zero-fill Returns: Z flag Z flag is set
.ZES2 LDA #0 \ Load A with the byte we want to fill the memory block \ with - i.e. zero STX SC+1 \ We want to zero-fill page X, so store this in the \ high byte of SC, so the 16-bit address in SC and \ SC+1 is now pointing to the SC-th byte of page X .ZEL1 STA (SC),Y \ Zero the Y-th byte of the block pointed to by SC, \ so that's effectively the Y-th byte before SC INY \ Increment the loop counter BNE ZEL1 \ Loop back to zero the next byte RTS \ Return from the subroutine