Microsoft (R) Macro Assembler Version 8.00.50727.762 10/19/08 13:23:25 MASM Operator Page 1 - 1 TITLE MASM Operators ; CIS-77 ; masm_operators.asm ; Demonstration of TYPE, LENGTHOF, SIZEOF operators .386 ; Tells MASM to use Intel 80386 instruction set. .MODEL FLAT ; Flat memory model option casemap:none ; Treat labels as case-sensitive 00000000 .CONST ; Constant data segment 00000000 0A 14 1E byte1 BYTE 10,20,30 00000003 0000001E [ array1 WORD 30 DUP(?),0,0 0000 ] 0000 0000 00000043 00000005 [ array2 WORD 5 DUP(3 DUP(?)) 00000003 [ 0000 ] ] 00000061 00000001 array3 DWORD 1,2,3,4 00000002 00000003 00000004 00000071 31 32 33 34 35 digitStr BYTE '12345678',0 36 37 38 00 0000007A 0A 14 1E 28 32 myArray BYTE 10,20,30,40,50, 3C 46 50 5A 64 60,70,80,90,100 ;--------------------------------------------- ; You can examine the following constant values ; by looking in the listing file masm_operators.lst ;--------------------------------------------- = 00000003 X = LENGTHOF byte1 ; 3 = 00000020 X = LENGTHOF array1 ; 30 + 2 = 0000000F X = LENGTHOF array2 ; 5 * 3 = 00000004 X = LENGTHOF array3 ; 4 = 00000009 X = LENGTHOF digitStr ; 9 = 0000000A X = LENGTHOF myArray ; 10 = 00000003 X = SIZEOF byte1 ; 1 * 3 = 00000040 X = SIZEOF array1 ; 2 * (30 + 2) = 0000001E X = SIZEOF array2 ; 2 * (5 * 3) = 00000010 X = SIZEOF array3 ; 4 * 4 = 00000009 X = SIZEOF digitStr ; 1 * 9 = 00000001 X = TYPE byte1 ; 1 = 00000002 X = TYPE array1 ; 2 = 00000002 X = TYPE array2 ; 2 = 00000004 X = TYPE array3 ; 4 = 00000001 X = TYPE digitStr ; 1 00000000 .DATA ; Begin initialized data segment 00000000 .CODE ; Begin code segment 00000000 _main PROC ; Beginning of code 00000000 C3 ret 00000001 _main ENDP END _main ; Marks the end of the module and sets the program entry point label Microsoft (R) Macro Assembler Version 8.00.50727.762 10/19/08 13:23:25 MASM Operator Symbols 2 - 1 Segments and Groups: N a m e Size Length Align Combine Class CONST . . . . . . . . . . . . . 32 Bit 00000084 DWord Public 'CONST' ReadOnly FLAT . . . . . . . . . . . . . . GROUP _DATA . . . . . . . . . . . . . 32 Bit 00000000 DWord Public 'DATA' _TEXT . . . . . . . . . . . . . 32 Bit 00000001 DWord Public 'CODE' Procedures, parameters, and locals: N a m e Type Value Attr _main . . . . . . . . . . . . . P Near 00000000 _TEXT Length= 00000001 Public Symbols: N a m e Type Value Attr @CodeSize . . . . . . . . . . . Number 00000000h @DataSize . . . . . . . . . . . Number 00000000h @Interface . . . . . . . . . . . Number 00000000h @Model . . . . . . . . . . . . . Number 00000007h @code . . . . . . . . . . . . . Text _TEXT @data . . . . . . . . . . . . . Text FLAT @fardata? . . . . . . . . . . . Text FLAT @fardata . . . . . . . . . . . . Text FLAT @stack . . . . . . . . . . . . . Text FLAT X . . . . . . . . . . . . . . . Number 00000001h array1 . . . . . . . . . . . . . Word 00000003 CONST array2 . . . . . . . . . . . . . Word 00000043 CONST array3 . . . . . . . . . . . . . DWord 00000061 CONST byte1 . . . . . . . . . . . . . Byte 00000000 CONST digitStr . . . . . . . . . . . . Byte 00000071 CONST myArray . . . . . . . . . . . . Byte 0000007A CONST 0 Warnings 0 Errors