English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 04 January 2022, 17:54   #1
mcgeezer
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
mcgeezer is offline  
Old 04 January 2022, 18:12   #2
deimos
It's coming back!
 
deimos's Avatar
 
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.
deimos is offline  
Old 04 January 2022, 18:14   #3
DanScott
Lemon. / Core Design
 
DanScott's Avatar
 
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
DanScott is offline  
Old 04 January 2022, 18:34   #4
mcgeezer
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
So sizeBossStruct will be the size of the structure.

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.
mcgeezer is offline  
Old 04 January 2022, 18:36   #5
meynaf
son of 68k
 
meynaf's Avatar
 
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
meynaf is online now  
Old 04 January 2022, 18:43   #6
paraj
Registered User
 
paraj's Avatar
 
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
I.e. use LABEL.
paraj is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:47.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07032 seconds with 15 queries