It is currently Mon Oct 20, 2014 4:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: SKIP enhancement?
PostPosted: Thu Nov 03, 2011 6:01 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 24, 2011 6:10 pm
Posts: 29
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? ;)


Top
 
 Post subject: Re: SKIP enhancement?
PostPosted: Thu Nov 03, 2011 11:52 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
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


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron