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

Beebasm 1.07 GUARD problem
http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=732
Page 1 of 1

Author:  PitfallJ [ Sat Feb 11, 2012 11:41 am ]
Post subject:  Beebasm 1.07 GUARD problem

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

Author:  RichTW [ Sat Feb 11, 2012 10:24 pm ]
Post subject:  Re: Beebasm 1.07 GUARD problem

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.

Author:  PitfallJ [ Sun Feb 19, 2012 10:52 am ]
Post subject:  Re: Beebasm 1.07 GUARD problem

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

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