[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] libgem16: vs_color
Helmut Karlowski wrote:
When I change the C-code to vdi_intin[1] = rgb[0], instead of *ptr++ =
..., the pointer vdi_params.control is even, but something else gets
corrupted, which again leads to an odd pointer arriving at fvdi for the
rgb-array.
I have done some annotation (see attachment) and I failed to see
anything wrong.
But it looks as if you have sent the good one, not the *ptr++ version.
Side note:
The stack frame size is long aligned, although at the
least effective end. Oops.
If you make VDI_CNTRLMAX even, all stack references will be
long aligned. :-)
--
Groeten; Regards.
Henk Robbers. http://members.chello.nl/h.robbers
Interactive disassembler: TT-Digger; http://digger.atari.org
A Home Cooked C compiler: AHCC; http://ahcc.atari.org
/* tab size 8 */
void
vs_color (short handle, short index, short rgb[])
{
short vdi_intin[4] = {0,0,0,0};
short vdi_control[VDI_CNTRLMAX] = {0};
short *ptr;
VDI_PARAMS(vdi_control, vdi_intin, 0L, vdi_dummy, vdi_dummy );
ptr = vdi_intin;
*(ptr ++) = index; /* vdi_intin[0] = index */
if( (long)vdi_params.control & (long)1 ) <- this is true if arrays not static!
0: 4fef ffc0 lea %sp@(-64),%sp -64
4: 2f02 movel %d2,%sp@- -4 = -68
6: 342f 0048 movew %sp@(72),%d2 -68+72=4 handle
a: 302f 004a movew %sp@(74),%d0 -68+74=6 index
e: 206f 004c moveal %sp@(76),%a0 -68+76=8 &rgb (rgb_p)
12: 42af 0022 clrl %sp@(34) vdictrl + 0
16: 42af 0026 clrl %sp@(38) + 4
1a: 42af 002a clrl %sp@(42) + 8
1e: 42af 002e clrl %sp@(46) +12
22: 42af 0032 clrl %sp@(50) +16
26: 42af 0036 clrl %sp@(54) +20
2a: 42af 003a clrl %sp@(58) +24
2e: 426f 003e clrw %sp@(62) +28.w
32: 42af 0006 clrl %sp@(6) intin + 0
36: 42af 000a clrl %sp@(10) + 4
3a: 43ef 0022 lea %sp@(34),%a1 &vdicntrl
3e: 2f49 000e movel %a1,%sp@(14) --> pb + 0
42: 43ef 0006 lea %sp@(6),%a1 &intin
46: 2f49 0012 movel %a1,%sp@(18) --> pb + 4
4a: 42af 0016 clrl %sp@(22) pb + 8
4e: 2f7c 0000 0000 movel #0,%sp@(26) pb + 12
54: 001a
56: 2f7c 0000 0000 movel #0,%sp@(30) pb + 16
5c: 001e
5e: 3f40 0006 movew %d0,%sp@(6) index --> intin[0]
62: 3f58 0008 movew %a0@+,%sp@(8) rgb_p++ --> intin[1]
66: 3f58 000a movew %a0@+,%sp@(10) rgb_p++ --> intin[2]
6a: 3f50 000c movew %a0@,%sp@(12) rgb_p++ --> intin[3]
6e: 43ef 000e lea %sp@(14),%a1 &pb
72: 2049 moveal %a1,%a0
74: 2208 movel %a0,%d1 &pb --> d1
76: 2050 moveal %a0@,%a0 &vdicntl --> a0
78: 20fc 000e 0000 movel #917504,%a0@+ 14,0,0,4,0,0 --> vdicntl
7e: 20fc 0000 0004 movel #4,%a0@+
84: 20fc 0000 0000 movel #0,%a0@+
8a: 3082 movew %d2,%a0@ hdl --> vdicntl + 6
8c: 303c 0073 movew #115,%d0
90: 4e42 trap #2
92: 241f movel %sp@+,%d2
94: 4fef 0040 lea %sp@(64),%sp
98: 4e75 rts