Another request related to this one: Would you name in asm the offsets within the structs according to the names of the fields in C? It would help debug and integration with asm code Something like this: ld iy, #_SwSprite ld de, #0x0010 ld b, #0x26 03999$: ld a, MyObj.lx (iy) ld MyObj.x1 (iy) ,a ; SwSpPntr->x1 = SwSpPntr->lx; ld l, MyObj.ly (iy) ld h, MyObj.ly+1 (iy) ld MyObj.y1 (iy),l ld MyObj.y1+1 (iy),h ; SwSpPntr->y1 = SwSpPntr->ly; add iy, de ; SwSpPntr++; djnz 03999$
Another request related to this one: Would you name in asm the offsets within the structs according to the names of the fields in C? It would help debug and integration with asm code
Another request related to this one: Would you name in asm the offsets within the struct according to the names of the fields? It would help debug and integration with asm code
I am testing v 4.6.2 and nothing changes also allowing insane numbers of nodes at compile time...
Peephole optimizer introduced an invalid "ld hl, a" You should replace it by ld h, a ld l, a this is 2 bytes and faster than ld hl, 0 which is 3 bytes and 2 cycle slower
To compile the above C this could work struct MyObj { u8 lx; // Logical x u8 x0,x1,x2; // Physical x's in the 3 pages i16 ly; // Logical Y u16 y0,y1,y2; // Physical y's in the 3 pages u16 frame; i8 dx; // x direction i8 dy; // y direction }; #define TotDem (32) #define TotSprt (32+6) struct MyObj SwSprite[TotSprt]; void main() { SwSpPntr = &SwSprite[0]; for (u8 i=0; i<TotSprt;i++) { SwSpPntr->x1 = SwSpPntr->lx; SwSpPntr->y1 = SwSpPntr->ly; SwSpPntr++; } }
To compile the above C you need struct MyObj { u8 lx; // Logical x u8 x0,x1,x2; // Physical x's in the 3 pages i16 ly; // Logical Y u16 y0,y1,y2; // Physical y's in the 3 pages u16 frame; i8 dx; // x direction i8 dy; // y direction }; #define TotDem (32) #define TotSprt (32+6) struct MyObj SwSprite[TotSprt];
This is with current version 4.6, as you can see the issue is unchanged ;./AdrianLift.c:707: SwSpPntr = &SwSprite[0]; ld hl, #_SwSprite ld (_SwSpPntr), hl ;./AdrianLift.c:708: for (u8 i=0; i<TotSprt;i++) { ld c, #0x00 00143$: ld a, c sub a, #0x26 jr nc, 00112$ ;./AdrianLift.c:709: SwSpPntr->x1 = SwSpPntr->lx; ld de, (_SwSpPntr) inc de inc de ld hl, (_SwSpPntr) ld a, (hl) ld (de), a ;./AdrianLift.c:604: SwSpPntr->ly = (Field.ly + MyY ); ld hl, (_SwSpPntr) ;./AdrianLift.c:710: SwSpPntr->y1 = SwSpPntr->ly;...