04 January 2022, 17:54 | #1 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
Vasm - getting the size of structure
Quick question hereā¦. As per the title, is it possible to get the size of a defined structure as a constant? It seems logical that i should be able to do this but cant seem to find it.
Cheers, Graeme |
04 January 2022, 18:12 | #2 |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
I think it's normally done by adding a fake sizeof element at the end.
|
04 January 2022, 18:14 | #3 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
|
Something like this
Code:
rsreset var1 rs.w 1 var2 rs.w 1 varsLen rs.w 0 |
04 January 2022, 18:34 | #4 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
ahhhh...
so in my scenario... Code:
STRUCTURE EnemyBoss,hBobSpriteReserved ULONG BossMoveSpeed ; Speed parameter UWORD BossFaceDirection ; Facing Direction UWORD BossHasHold ; Used for holding UWORD BossTimer ; Univseral Timer UWORD BossSeqNum ; Current Animation Sequence Number UWORD BossSeqPos ; Current Animation Sequence Position UWORD BossSeqParam ; Parameter on Sequence UWORD BossCollisionAnim ; Bool - Collision Activate? UWORD BossCollisionRange ; Range - 0-320 Pixels from Thomas UWORD BossCollisionOffWhenCrouch ; Bool - Can be hit when Crouching UWORD BossCollisionWhenJumpSinePos ; Range - Sine Position on Jump for Thomas UWORD BossCollisionFrame ; Frame Number on Boss for Collision UWORD BossCollisionDepleteEnergy ; Int - When hit the amount o deplete from player UWORD BossHitFrameLeft UWORD BossHitFrameLeftXOffset UWORD BossHitFrameLeftYOffset UWORD BossHitFrameRight UWORD BossHitFrameRightXOffset UWORD BossHitFrameRightYOffset UWORD BossCollisionFired ; Bool UWORD sizeBossStruct I would have thought there's be some way to declare is at a constant like sizeBossStruct equ sizeof(EnemyBoss) ... or something like that. Either way, I have a working method... cheers gents. |
04 January 2022, 18:36 | #5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
There is so directive for that.
Code:
xx rs.l 1 yy rs.w 1 ssize so |
04 January 2022, 18:43 | #6 |
Registered User
Join Date: Feb 2017
Location: Denmark
Posts: 1,099
|
You're using the macros from exec/types.i? Then just look at what's done in e.g. exec/lists.i:
Code:
STRUCTURE MLH,0 APTR MLH_HEAD APTR MLH_TAIL APTR MLH_TAILPRED LABEL MLH_SIZE |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
horiz. size & vert. size greyed out in some configurations | honx | support.WinUAE | 3 | 15 August 2020 21:14 |
vasm/mot: structure | guy lateur | Coders. Asm / Hardware | 20 | 05 January 2020 00:01 |
Structure of CopList object? | earok | Coders. Blitz Basic | 10 | 22 June 2019 05:37 |
Resource and Structure.offs | copse | Coders. General | 4 | 23 December 2013 23:56 |
|
|