z80 Development Kit
You are not logged in.
Pages: 1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Which features necessary or useful for use of sdcc in z88dk do you
consider the most important?
A small update on the current sdcc status:
* new register allocator is quite stable and will hopefully be merged soon.
* --fomit-frame-pointer (necessary when ix cannot be used) is still
somewhat broken.
* --reserve-regs-iy (necessary when iy cannot be used) seems to work well.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3spcQACgkQbtUV+xsoLpr0hgCfYcnzjl5FA3BGAA9X/sMKATZC
oz4AniY7cUhJCE28eUA0VqIcfxewt7cD
=R2+0
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today.
http://p.sf.net/sfu/quest-dev2dev2
Hi Philipp,
Which features necessary or useful for use of sdcc in z88dk do you
consider the most important?
For ease of drop-in the following are essential:
- SDCC generates an invalid pseudo-op at the top of the assembler file (.opt)
- Reverse parameter parsing (i.e. left to right rather than right-to-left) with a containing the number of words on the stack for variadic functions - possibly as a function decorator to allow a gradual migration to right-to-left convention
For compact code:
- Change initialisation of static data so that it's contained within defb rather than initialised with ld (xx),hl
Without these fixes we can't connect the z88dk libraries with the sdcc compiler.
* --fomit-frame-pointer (necessary when ix cannot be used) is still
somewhat broken.
* --reserve-regs-iy (necessary when iy cannot be used) seems to work well.
We can initially cope with only one index register being used - for certain platforms we can swap them round in the assembler, I think there's only a couple of platforms that prohibit use of either of them.
With these 3 changes in place, we should then be able to offer sdcc as a drop in compiler whilst maintaining compatibility with the majority of our existing libraries and most projects apart from those that use floating point.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
Dom,
thank you for spotting them out, I'm adding a comment, hope it doesn't add complexity ![]()
>For compact code:
>- Change initialisation of static data so that it's contained within defb rather than initialised with ld (xx),hl
z88dk just links a 'main' program, then jumps to it.
If I remember well the sdcc main entry name not "main".
Perhaps a possible workaround could be to label the init portion with 'main' and make it end with a direct jump in "sdcc main".
>We can initially cope with only one index register being used - for certain platforms we can swap them round in the >assembler, I think there's only a couple of platforms that prohibit use of either of them.
Yes, even the ZX81 now survives with a single index register !
Normally the most critical reg is thought to be IY; with the zx81, which can never alter IX, the swap trick is used.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
Am 07.06.2011 19:38, schrieb Stefano Bodrato (stefano_bodrato@...):
Dom, thank you for spotting them out, I'm adding a comment, hope it
doesn't add complexityFor compact code: - Change initialisation of static data so that
it's contained within defb rather than initialised with ld (xx),hlz88dk just links a 'main' program, then jumps to it. If I remember
well the sdcc main entry name not "main". Perhaps a possible
workaround could be to label the init portion with 'main' and make it
end with a direct jump in "sdcc main".
wouldn't that be linking in another object file containing:
main:
jp _main
and thus something that's easy to do outside the compiler?
Philipp
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 07.06.2011 11:34, schrieb dom (dom@...):
Hi Philipp,
Which features necessary or useful for use of sdcc in z88dk do you
consider the most important?For ease of drop-in the following are essential:
- SDCC generates an invalid pseudo-op at the top of the assembler file (.opt)
Done. --no-optsdcc-in-asm.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3vTqwACgkQbtUV+xsoLppPJACfZvIzxoYnEEyiJL0nRPpTQg/+
0mMAnRamF76xBRPybNbok3jenCk9FXNO
=UZt2
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Reverse parameter parsing (i.e. left to right rather than
right-to-left) with a containing the number of words on the stack for
variadic functions - possibly as a function decorator to allow a
gradual migration to right-to-left convention
Most of it doesn't work yet, but it may be enough for what you want to do.
Things that don't work: Function definitions, function pointers.
Thus you can now call functions from sdcc passing parameters in reverse
order as long as you don't use function pointers, but you can't have an
sdcc function accept it's parameters in reverse order yet.
void f(int, int) __optlink;
void h(int, int);
void (*p)(int, int) __optlink;
void (*q)(int, int);
void g(void)
{
f(1, 2); // OK - parameters passed in reverse order
h(1, 2); // OK - parameters passed in normal order
(*p)(1, 2); // Broken
(*q)(1, 2); // OK
}
Philipp
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
__optlink is now works for function pointers, too.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3vZ0MACgkQbtUV+xsoLpoIdQCeM9EoiiGrHnf2ohtpJ+zljFIP
0V4AoKys4ASq7pqsvs1B/IT5+L+weYKn
=CBpm
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Change initialisation of static data so that it's contained within
defb rather than initialised with ld (xx),hl
How important is this? One one hand it's purely a code size issue, on
the other hand code size matters (and was one of the main motivations
for the new register allocator in sdcc).
For me, such data typically is only a few bytes per program. Does anyone
really use large amounts of static data?
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3vb7AACgkQbtUV+xsoLpp3/gCfbH+I9GkqpL1aI9KmOxSg+CPl
UrMAoN18+k0xqUPV+VhkCBquYgC9N1wd
=E6Hl
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Change initialisation of static data so that it's contained within
defb rather than initialised with ld (xx),hlHow important is this? One one hand it's purely a code size issue, on
the other hand code size matters (and was one of the main motivations
for the new register allocator in sdcc).
For me, such data typically is only a few bytes per program. Does anyone
really use large amounts of static data?
I think it depends on what you're writing. One of our examples adv_a.c contains a large amount of static data and I can envisage games in general using a large amount of static data, eg sprites, room layouts etc. One method that I've seen quite a lot is for the graphics (or whatever) tool to export the data as char array. As an example, one of my old games has 80 sprites of 36 bytes each. Which is, give or take, 3k, if not statically initialised (or merged in another way) that goes up to around 10k!
The other reason is the inability of z80asm to stitch together the gsinit sections and so multi-file projects fail to initialise properly.
Thanks for doing the other things so quickly today, I'll have a think as to the best way to apply the __optlink annotation - i.e. just the assembler libs and recompile the C versions for SDCC or use the same libraries for both sdcc and sccz80.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 08.06.2011 15:15, schrieb dom (dom@...):
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Change initialisation of static data so that it's contained
within defb rather than initialised with ld (xx),hlHow important is this? One one hand it's purely a code size issue,
on the other hand code size matters (and was one of the main
motivations for the new register allocator in sdcc). For me, such
data typically is only a few bytes per program. Does anyone really
use large amounts of static data?
While I think that sdcc should support using defb for static one day it
will probably take some time; until then, I suggest to fix applications
that suffer from the current situation.
I think it depends on what you're writing. One of our examples
adv_a.c contains a large amount of static data and I can envisage
games in general using a large amount of static data, eg sprites,
room layouts etc. One method that I've seen quite a lot is for the
graphics (or whatever) tool to export the data as char array. As an
example, one of my old games has 80 sprites of 36 bytes each. Which
is, give or take, 3k, if not statically initialised (or merged in
another way) that goes up to around 10k!
As long as these are never modified there should be no problem. Global
variables that are not modified (as all that stuff in adv_a.c, or
sprites, graphics, etc in my games) can be placed in the _CODE segment
by sdcc, where defb is used. If you tell sdcc that it will never be
modified:
unsigned char x = 7;
const unsigned char y = 7;
becomes
.area _GSINIT
;test.c:1: unsigned char x = 7;
ld iy,#_x
ld 0 (iy),#0x07
.area _CODE
_y:
.db #0x07 ; 7
The other reason is the inability of z80asm to stitch together the
gsinit sections and so multi-file projects fail to initialise
properly.
That looks like a bigger problem.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3vfBUACgkQbtUV+xsoLpqK0gCgmwfI1gVPkMvyh5RgRUltAj7X
G2AAoIi8JJAjVnea/pIB53pH7LYcpDve
=I0Es
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Reverse parameter parsing (i.e. left to right rather than
right-to-left) with a containing the number of words on the stack for
variadic functions - possibly as a function decorator to allow a
gradual migration to right-to-left convention
As far as I can see, z88dk expects the number of parameters in register
A when using varargs. Is this correct?
Currently __optlink will reverse the order of parameters for varargs,
but doesn't communicate the number of parameters to the callee.
Philipp
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Reverse parameter parsing (i.e. left to right rather than
right-to-left) with a containing the number of words on the stack for
variadic functions - possibly as a function decorator to allow a
gradual migration to right-to-left conventionAs far as I can see, z88dk expects the number of parameters in register
A when using varargs. Is this correct?
Currently __optlink will reverse the order of parameters for varargs,
but doesn't communicate the number of parameters to the callee.
I think that will be okay, the only varargs functions we've got are the *scanf and *printf and some syscall functions for the Rex6000. Since the stdio functions are written in C, I think that's pushed me towards having a different set of libraries for sdcc builds with the C functions being right-to-left and the assembler ones left-to-right.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
As long as these are never modified there should be no problem. Global
variables that are not modified (as all that stuff in adv_a.c, or
sprites, graphics, etc in my games) can be placed in the _CODE segment
by sdcc, where defb is used. If you tell sdcc that it will never be
modified:
unsigned char x = 7;
const unsigned char y = 7;
becomes
.area _GSINIT
;test.c:1: unsigned char x = 7;
ld iy,#_x
ld 0 (iy),#0x07
.area _CODE
_y:
.db #0x07 ; 7
Ah cool, I didn't realise that const was treated differently in terms of dumping the literals. That's great.
The other reason is the inability of z80asm to stitch together the
gsinit sections and so multi-file projects fail to initialise
properly.That looks like a bigger problem.
Yes, I need to have a good think about that, that's one of the reasons we were looking into changing the assembler as well, though asxxx isn't ideal due to the syntax differences. I'm guessing that adding a new assembler to sdcc is fairly easy so I might take a look at that - it seems that the gnu binutils is gaining some traction amongst the ZX community.
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 07.06.2011 11:34, schrieb dom (dom@...):
- Reverse parameter parsing (i.e. left to right rather than
right-to-left) with a containing the number of words on the stack for
variadic functions - possibly as a function decorator to allow a
gradual migration to right-to-left convention
Do you happen to have a name for this calling convention? It has been
brought to my attention, that "__optlink" is a bad name for this.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3v2lkACgkQbtUV+xsoLpo9WACfW5pTrxn5Ye9sEqcAJ1+Cgc+r
hS4AoLj/2fdhTE5MLDEEJQturFK24Fhy
=+joG
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Do you happen to have a name for this calling convention? It has been
brought to my attention, that "__optlink" is a bad name for this.
Looks like it's called "pascal" convention in the Visual Studio world: http://blogs.msdn.com/b/oldnewthing/arc … 47184.aspx
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 08.06.2011 22:30, schrieb dom (dom@...):
Do you happen to have a name for this calling convention? It has
been brought to my attention, that "__optlink" is a bad name for
this.Looks like it's called "pascal" convention in the Visual Studio
world:
http://blogs.msdn.com/b/oldnewthing/arc … 47184.aspx
The pascal calling convention is left-to-right, callee-cleans.
The convention I implemented is left-to-right, caller-cleans.
Philipp
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk3v3cQACgkQbtUV+xsoLpr6iACg4kxePUCHY4qo6OfURwvc8onW
920AoItYUIzgcWNcRZ25p69IAMZtfvG6
=6ic8
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
The pascal calling convention is left-to-right, callee-cleans.
The convention I implemented is left-to-right, caller-cleans.
Close! Why don't just call it __smallc since that's what all the SmallC compilers generate? Or is that too specific?
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Offline
Am 08.06.2011 22:46, schrieb dom (dom@...):
The pascal calling convention is left-to-right, callee-cleans. The
convention I implemented is left-to-right, caller-cleans.Close! Why don't just call it __smallc since that's what all the
SmallC compilers generate? Or is that too specific?
Well, __smallc is probably the best choice. I was just wondering if
maybe this convention is more widespread, so it has a generic, more
well-known name.
Philipp
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Pages: 1