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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Feb 11, 2012 11:41 am 
Offline
 Profile

Joined: Fri Nov 07, 2008 2:28 pm
Posts: 65
I recently discovered using GUARD and having multiple SAVEs in my .asm files.
I find it really useful and now use ORG and GUARD to define my zero page usage instead of equates as well - much easier!

Anyway I get an error with the following test code:

Is guard off by 1 byte?


Code:
ORG       $1900
GUARD   $1A00

.data:
   EQUB    1,2,3,4

ORG       $1A00
GUARD   $7C00


.code:
      JMP   code


Top
 
PostPosted: Sat Feb 11, 2012 10:24 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
No, the problem is that you've guarded &1A00, which means that as soon as you try to assemble to it, an error will be thrown. Obviously, that's the first thing that happens when you try to assemble the JMP instruction.

As it stands, the solution would be to CLEAR the memory which contains the guard before proceeding with assembling the code at &1A00, like this:

Code:
CLEAR   $1900, $1A00     ; not really necessary, but done for 'symmetry' with the other assembled block
ORG     $1900
GUARD   $1A00

.data:
   EQUB    1,2,3,4

CLEAR   $1A00, $7C00
ORG     $1A00
GUARD   $7C00


.code:
      JMP   code

I probably need to rethink or at least clarify how GUARD and CLEAR work - I implemented them without a hell of a lot of thought when I first wrote BeebAsm, and the truth is, even I'm a bit confused about how they should be used.


Top
 
PostPosted: Sun Feb 19, 2012 10:52 am 
Offline
 Profile

Joined: Fri Nov 07, 2008 2:28 pm
Posts: 65
Thanks for that - CLEAR doesn't actually fill memory full of zeros does it?
(because in that previous example I'd like to SAVE the program from $1900 at the end of the file so clear wouldn't work for me)

I guess I imagined the new GUARD $7C00 would clear the last GUARD $1A00 so by the time .code is assembled the latest GUARD is in effect.

In his particular example I was loading a data file from disc below the program - as I continued writing the program the data might be bigger so I put the GUARD in to warn myself - if it did get bigger I'd move the code start higher -> $1B00 etc..

I must say in general I find GUARD is extremely useful - with the limited memory available I find it a great check for main program and zero page usage.

- PJ


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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