0% found this document useful (0 votes)
46 views

Coal Lab 10 Notes

This document discusses different programming concepts in assembly language such as procedures, macros, structures, and file inclusion. Procedures are defined using the proc and endp keywords and are called using the call keyword. Macros are defined using the macro and endm keywords and can pass arguments without brackets. Structures are defined using the struct keyword and contain fields that are accessed using the structure variable name and field name. External files can be included using the include keyword.

Uploaded by

aleena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Coal Lab 10 Notes

This document discusses different programming concepts in assembly language such as procedures, macros, structures, and file inclusion. Procedures are defined using the proc and endp keywords and are called using the call keyword. Macros are defined using the macro and endm keywords and can pass arguments without brackets. Structures are defined using the struct keyword and contain fields that are accessed using the structure variable name and field name. External files can be included using the include keyword.

Uploaded by

aleena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Coal lab 10 notes

USES

Procedure

Nameprocedure proc  keyword

- (prog)

Ret

Nameprocedure endp

Procedure is called with keyword ‘call’ and the procedure name

Uses keyword is used with proc to push pop registers directly

Macro

Syntax:

namemacro macro  keyword (a1, a2) arguments can be passed to simply without brackets write the
var

-(prog)

Endm

Calling is done by just writing name and passing arguments if any (can pass reg,var,direct vals)

No arithmetic operations are not allowed within macro

Only push/pop, saving, moving simple tasks.

Similar to ‘proc’ just the prog within body is diff with some restrictions

Structure

Namestruct struct  keyword

//Name db 50 dup(?) (a string variable of byte type)

Sem db ? (var type of byte)

Cgpa db ?

Namestruct ends

Variables withing struct are known as fields

Same concept we learnt in c++

Only fields are added usually


If your macros are in another file, that files are called .inc and .lib files

.lib/ .inc do not need. code or .data keywords before coding

The code you write in are known as .asm files

Struct /macro files should be in the same file where your .Asm file is present

To include the files in asm file:

keyword include NAMEFILE.inc/lib


. model
.data

How to use structure?


It is used within .data segment
In code, another variable of that structure is defined
(Ignore name variable in above structure)

.data
(struct name you defined) S1 Namestruct <>
leaving ‘<>’ blanks mean you’re not assigning values to struct vars

Or
S1 Namestruct <4,3>

If you initialize the values, then 4 goes for sem and 3 for cgpa

Or
S1 Namestruct <,3> (ya phir) S1 Namestruct <4,>

One var initialized other left empty


If you didn’t initialize the vars and are taking user input:

. code
Mov ah,01h
Int 21h
mov S1. Sem, al
(For printing)
mov dl, S1. Sem
mov ah,02h
int 21h

(To save string values in struct)


initializing within .data segment simple use double quotes
.data
S1 Namestruct <” Fatima, $”>

Or else take from user and send the offset into variable

You might also like