On 08/10/13 17:21, George Gwilt wrote:
Pennel says that (A6,A4) points to the start of data and (A6,A5) points to 
immediately past the data area end. This implies that the size of the data 
space is A5 - A4.

Yes, A4 is actually the program size, which in my case is 30 bytes only. It's not a complicated program:

begin   bra.s   start
        dc.l    0
        dc.w    $4afb
        dc.w    8
        dc.b    'Test Job'

start   moveq   #8,d0
        moveq   #-1,d1
        moveq   #10,d3
        suba.l  a1,a1
        trap    #1
        bra.s   start

Assembled with GWASL I get a file of 30 bytes and a data space of 4000.

What Marcel (and you) say makes perfect sense. If the job starts at the address A6 points to, and is 30 bytes long, then the start of the data space must be A6+30 and as A4 holds the value $1e, that's correct.

I would imagine that A5, on the other hand should hold the address of A6+30+4000 which would be correct in my case, but I get the extra 12 bytes.

4000 is exactly divisible by 2, 4, 8, 16 or 32 in the powers of two range. I think QDOSMSQ rounds some memory allocations to the next 8 but I can't remember if it rounds anything to the next 16.

4030 is divisible by 2.

4042 is divisible by 2, and not much else!

Maybe it's to do with the size of the code file on disc? I changed the source to add a buffer of 64 words, taking me up to a file size of 158 bytes.

This time, when executed, A4 is $9E (aka 158) which is exactly the size of the code file, as expected. A5 is 4000+158+12, which is exactly 12 bytes more than the data + code size - and matches up to what I was already seeing.

In my code size 30 example, I get 42 which is an extra 12 as well. What's so special about 12 I wonder?

<insert delay while I rummage in the source code>

Right, it must be something in the allocation of memory. I found the code that creates a job and it simply allocates memory for #jcb_end+d2+d3 and jcb_end is $68. This is what it requests of the memory allocation code - so whatever is being allocated must be coming from that.

I can live with this. It was something unusual that I came across, and I think it's explained adequately now.

Thanks to all who replied.


Cheers,
Norm.

--
Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
27a Lidget Hill
Pudsey
West Yorkshire
United Kingdom
LS28 7LG

Company Number: 05132767
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to