/* This is a simple demonstration file for the Zeus assembler. If you want more sustantial files they're available at www.desdes.com These are just some jottings to help, so they'll just touch on the subjects... Structures. These are a handy way to generate the offset values for (IX+NN) index operations. Imagine we do the following (which indeed you can do) org 0 dpNext ds 2 ; Value = 0 A two byte variable dX ds 2 ; Value = 2 A two byte variable dY ds 2 ; Value = 4 " " dFlags ds 1 ; Value = 6 A byte variable Then we could use those labels as follows: ld a,(ix+dFlags); ie (IX+6) (Note that I put a 'd' on the front to indicate they're displacements. You don't have to do this, it's just a nice reminder)... Which is all fine and dandy except that we can't just move the PC around in the middle of the source unless we do ugly things with variables to save it... So, a while back Zeus added the "STRUCT" / "SEND" convention which effectively saves the PC in a stack and restores it again. Let's see it in operation: */ org $6000 Start nop ; Addr 6000 nop ; Addr 6001 struct dpNext ds 2 ; Value = 0 dX ds 2 ; Value = 2 dY ds 2 ; Value = 4 dFlags ds 1 ; Value = 6 lStar equ . ; Value = 7 (The length of this structure) send struct dopNext ds 2 ; Value = 0 doFlags ds 1 ; Value = 2 lThing equ . ; Value = 3 (The length of this structure) send nop ; Addr 6002 nop ; Addr 6003 // Show the results zeusprint "Structure A ",dpNext,dX,dY,dFlags,lStar zeusprint "Structure B ",dopNext,doFlags,lThing /* You can nest structures, but gawd knows why you'd want to do this. Zeus will prevent you from trying to plant data in a structure definition, you're only allowed "ds" operations. You can also put a label on the send, which will return the length of the structure. struct ; Fred db 1 ; This is illegal and will generate an error. send ; */ ; The fp_euq.asm source in the FP sources shows these used to good effect. ; Much nicer than a list of "Blah equ 42" statements? No? Oh, well, suit yourself ;) ; ; Excerpt from FP: struct dpnObje ds 2 dppObje ds 2 dpnFreeObje ds 2 dObjeX ds 2 dObjeY ds 2 dObjeZ ds 2 dObjedX ds 2 dObjedY ds 2 dObjedZ ds 2 dObjeOX ds 2 dObjeOY ds 2 dObjeOZ ds 2 dObjeDispXL ds 2 dObjeDispXR ds 2 dObjeDispYT ds 2 dObjeDispYB ds 2 dObjepLines ds 2*8 ; There are 8 line pointers, each 16-bits dObjepDraw ds 1 dObjepUnDraw ds 1 dObjeDraw ds 2 dObjeShot ds 2 dObjeColl ds 2 dObjeMiss ds 2 dObjeAlter ds 2 dObjeMove ds 2 dObjeFlags ds 1 dObjeStateF ds 1 dObjeStarComp ds 1 dObjeAXS ds 2 dObjeAYS ds 2 dObjepSizeTab ds 2 dObjeCnt ds 1 dObjeBdXS ds 2 dObjeBdYS ds 2 dObjeBXS ds 2 dObjeBYS ds 2 dObjeWindF ds 1 dObjeCol ds 1 dObjeCntA ds 1 dObjeCntiA ds 1 dObjeCntB ds 1 dObjeCntiB ds 1 dObjeWidthX ds 1 dObjeWidthY ds 1 dObjeClipFlags ds 1 dObjeWeapon ds 1 ; These variables overlap the line pointers dObjeFFH1 equ dObjepLines+2 dObjeFFH2 equ dObjepLines+4 dObjeFFV1 equ dObjepLines+6 dObjeFFV2 equ dObjepLines+8 lObje equ . send /* This next command tells Zeus where to put the code it generates. As a szx file... It has three parameters, the filename, where the stack should go and where to start Alter the path to suit your system, of course. */ output_szx "zt2.szx",$0000,Start ; The szx file /* The output_szx can appear wherever you like in the file. If there's more than one of them the last one will be the one used. */ /* If for some reason you want raw binary, include this line It has three parameters, the filename, start of block and length */ ; output_bin "c:\zt2.bin",$0000,$10000 ; The binary file /* Note that I've commented it out. Normally it wouldn't be, of course. The output_bin can appear wherever you like in the file. If there's more than one of them the last one will be the one used. If both output types appear, both files will be written. */