flat assembler
Message board for the users of flat assembler.
Index
> Main > How to expand Extrn and AS instruction to support struct |
Author |
|
IceStudent 06 Sep 2006, 06:07
You must use a struct declaration as in the HLL and 'virtual' wrapper:
Code: ; struct.inc struct SPIOpStruct Preop0 db ?; preop 0 (Write enable) Preop1 db ?; preop 1 (Write status register) ends ; A.file include 'struct.inc' ; data definition SpiReg SPIOpStruct public SpiReg as '_SpiReg' B.file include 'struct.inc' ; struct declaration EXTRN '_SpiReg' AS SpiReg:word ; SpiReg declaration ; place new ..SpiReg at external SpiReg address virtual at SpiReg ..SpiReg SPIOpStruct end virtual ; and now use it mov [..SpiReg.Preop0],al |
|||
06 Sep 2006, 06:07 |
|
Kevin_Zheng 08 Sep 2006, 00:45
Hi, IceStudent:
Thank you very much! It's a very good soultion for it. And other, I have another method to do it. Code: ; struct.inc struct SPIOpStruct Preop0 db ?; preop 0 (Write enable) Preop1 db ?; preop 1 (Write status register) ends ; A.file include 'struct.inc' ; data definition SpiReg SPIOpStruct public SpiReg as '_SpiReg' B.file include 'struct.inc' ; struct declaration EXTRN '_SpiReg' AS SpiReg:word ; SpiReg declaration lea esi, [SpiReg] mov [esi+SpiRegStruct.PreOp0], al Thanks. Kevin Zheng |
|||
08 Sep 2006, 00:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.