www.retrosoftware.co.uk
http://www.retrosoftware.co.uk/forum/

SKIP enhancement?
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=17&t=703
Page 1 of 1

Author:  mga1103 [ Thu Nov 03, 2011 6:01 pm ]
Post subject:  SKIP enhancement?

A useful addition to the SKIP directive would be to have the option of initialising a block of memory to a specific value. The EQU*'s are perfect for bytes/words/etc., but if you need to set aside a larger buffer and initialise it to a specific value, then apart from coding a loop to do it, is there another way?

Code:
 .buffer SKIP &100,0    ; initialise 256-byte buffer to zero

...might be nice (or perhaps a completely new directive?).

Watcha think? ;)

Author:  RichTW [ Thu Nov 03, 2011 11:52 pm ]
Post subject:  Re: SKIP enhancement?

If I have a spare moment, I'll add the clear value as an optional second parameter, as you suggest. I guess it's fair enough that 0 is not always the best value (e.g. &FF might be better for unused bits of EPROM code).

Otherwise, for the moment, just use a loop - or the following macros!

Code:
MACRO FILL num, value
    IF num>0
        FOR n, 1, num
            EQUB value
        NEXT
    ENDIF
ENDMACRO

MACRO FILLTO address, value
    num = address-P%
    IF num<0
        ERROR "FILLTO address is a backwards reference"
    ELSE
        FILL num, value
    ENDIF
ENDMACRO

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/