Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Memory Management
#8
britlion Wrote:Not sure where the heap is put, though? I think it's after the code....It's my belief that they are compiled in order, so you should get that effect from..........

The heap is after the code and runtime.
With O1 and ORG 28000 this produces a TAP file of 6078 bytes and that I
find quite odd.
Code:
GOTO start

REM Routines that can go below 32768
FUNCTION a ()

Print "Hello_A";

Asm
dec a
dec a
dec a
End asm

END FUNCTION

SUB b

Print "Hello_B";

Asm
dec b
dec b
dec b
End asm

END SUB

'align 32768
REM BUFFER
asm
align 32768
defs 0,6912
end asm

REM High memory routines
FUNCTION c()

Print "Hello_C";

Asm
inc c
inc c
inc c
End asm
end function

SUB d

Print "Hello_D";

Asm
inc d
inc d
inc d
End asm

end sub

start:
Print "Hello_Start";

Asm
inc e
inc e
inc e
End asm

They are compiled in order but not in the way you think. In the generated ASM
file there is a small section to init the machine code and that includes the
goto statement, then the align and def and then it is all (code and data)
lumped together in one section as the compiler finds it, code first and then
the data.

So it did not solve the problem.

Also if you do:
Asm
ld e, (NN)
End asm

Then the assembler acctepts it and it is there in the generated ASM file and
when you compile it with zbasm it goes through without a hitch but as
there is no such instruction in the Z80A instruction set then the result is
garbage. That one can see in a debugger after the TAP file is loaded.

So i guess this is a item for the whishlist, two sections of code and data
under user control.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)