Register | Login
Forum Index > Requests and Feedback > using structure member inside if
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1242] using structure member inside if - posted: 2012-06-05 21:19:57

Hi Mr Colin.

i want ziron support this
Code:
#define  I386MAGIC      0x14c
#define I386AIXMAGIC   0x175

block filehdr
{
  word  f_magic;     /* magic number             */
  word  f_nscns;     /* number of sections       */
  dword f_timdat;    /* time & date stamp         */
  dword f_symptr;    /* file pointer to symtab   */
  dword f_nsyms;     /* number of symtab entries */
  word  f_opthdr;    /* sizeof(optional hdr)     */
  word  f_flags;     /* flags                    */
}

edi = @obj as filehdr;

if( (edi.f_magic!=I386MAGIC) and (edi.f_magic!=I386AIXMAGIC) )
{
  print('this is not obj file');
} 


also this wanted
Code:
  cmp word[edi.f_magic],I386MAGIC


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1245] - posted: 2012-09-20 19:58:59
not sure i understand this request, could you explain? what is var obj also?

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1794] - posted: 2015-02-26 16:28:33
Maybe it was intended that it includes binary file into output file 'as is'? It would be useful i think smile

For example:
Code:
block FILEHDR {
 word  f_magic; 
 word  f_nscns; 
 dword f_timdat;
 dword f_symptr;
 dword f_nsyms; 
 word  f_opthdr;
 word  f_flags; 
}

FILEHDR MyFile = $incbin('myfile.obj'); 


Also it is possible to include not all file but only some part of it, like this:
Code:
FILEHDR MyFile = $incbin('myfile.obj', 0x100);        // includes data from file only from 0x100 offset 
FILEHDR MyFile = $incbin('myfile.obj', 0x100, 0x200); // includes 0x200 bytes from file from 0x100 offset 


For example we can directly include graphics by this way:
Code:
byte MyPicture[] = $incbin('mypicture.dat');
sysword PicSize = sizeof MyPicture; // get size of picture
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1795] - posted: 2015-02-26 16:56:20
Ziron 1 supported something similar, but I intended this features to be a plugin for Ziron 2, I will get around to writing a plugin to support this.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 1 user(s) online. 0 member(s) and 1 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd