This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PowerPoint PresentationNew/Old Assembler DirectivesData Definition StatementExamplesDefining ListsDefining StringsUsing the DUP OperatorSymbolic ConstantsEqual-Sign DirectiveCalculating the Sizes of Strings and ArraysCalculating the Sizes of Strings and Arrays of Words and DoublewordsLists and StringsTYPE UsageBYTE 8-bit unsigned integerSBYTE 8-bit signed integerWORD 16-bit unsigned integer (can also be a Near pointer in Real-address mode)SWORD 16-bit signed integerDWORD 32-bit unsigned integer (can also be a Near pointer in Protected mode)SDWORD 32-bit signed integerFWORD 48-bit integer (Far pointer in Protected mode)QWORD 64-bit integerTBYTE 80-bit (10 byte) integerREAL4 32-bit (4 byte) IEEE short realREAL8 64-bit (8 Byte) IEEE long realREAL10 80-bit (10 byte) IEEE extended realIntrinisic Data TypesNew/Old Assembler DirectivesNew DirectivesOld DirectivesBYTE DBW ORD DWDW ORD DDQW ORD DQTBYTE DTData Definition Statement•syntax–[name] directive initializer [,initializer]…•At least one initializer is required in a data definition even if it is ? (does not assign a specific value) –The name is a label that marks the offset of a variable from the beginning of its enclosing segment.Examples•Var1 BYTE 35h ;use h for hex •Var2 byte 255 ;case not checked•Var3 db ‘A’ ;old syntax•Var4 sbyte -128 ;signed byte•Var5 byte ? ;uninitializedDefining Lists•.data•List byte 10, 20, 30, 40•List2 byte 10, 32, 41h, 00100010b•List3 byte 10, 20, 30, 40byte 50, 60, 70, 80byte 90, 100, 120Defining Strings•String1 byte “This is a string”, 0•String2 byte ‘T’,’h’,’i’,’s’,‘i’,….•String3 byte “This is a long string that”byte “that extends across many”byte “lines”, 0Dh, 0Ah,0•String4 \byte “Continuation character \ may be”byte “ used to concatenate two lines” byte“ into one.”,0Using the DUP Operator•Generates a repeated storage allocation, using a constant expression as a counter•BYTE 20 DUP(0)–Results in 20 bytes, all equal to 0•BYTE 20 DUP(?)–Results in 20 bytes, uninitialized•BYTE 4 DUP(“STACK”)–Results in 20 bytes “STACKSTACKSTACKSTACK”Symbolic Constants•Created by associating an identifier with either an integer value or some text. Does not reserve any storage. They are only used during assembly of a program, so they cannot change value during runtime.Equal-Sign Directive•Associates a symbol name with an integer value•.code–COUNT = 500–Mov al, COUNT•.code–ESC_KEY = 27–Mov al, ESC_KEY•.data–COUNT = 50–Array COUNT DUP(0)•Useful for constants. Easy to later change one line of code.Calculating the Sizes of Strings and Arrays•Use the current location counter ($).–List byte 10, 20,30, 40–ListSize = ($ - list)•The calculation must be done immediately following the list definiton–mystring byte “This is my string”,0–String_len = ($ - mystring –1)Calculating the Sizes of Strings and Arrays of Words and Doublewords•ListWORD 1000h, 2000h, 3000h•Listsize = ($ - list) / 2•List DWORD 10000000h,20000000h, DWORD 30000000h,40000000h•Listsize = ($ - list) / 4•This is important when using loops through arraysLists and StringsList1 db 10, ‘A’, 41h, 0Ah, 00100010b, 101qListptr db List1Cstring db “This is a string”,0Clength = ($ - Cstring) ; sets Clength to length of CstringArray1 db 20 dup(0) ; 20 bytes, all equal to zeroArray2 db 4 dup(“ABC”) ; 12 bytes,


View Full Document

MSU ECE 3724 - Defining Data

Documents in this Course
Timers

Timers

38 pages

TEST 4

TEST 4

9 pages

Flags

Flags

6 pages

Timers

Timers

6 pages

Timers

Timers

54 pages

TEST2

TEST2

8 pages

Load more
Download Defining Data
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Defining Data and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Defining Data 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?