IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Fourth Day Class (Assembler E-learning Cource)


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kalpana

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Wed Dec 21, 2005 3:06 pm
Reply with quote

I will explain simple Program
For adding two numbers
here is the code

NAME OPERATION OPERND FIELD
SAMPLE START 0
BALR 12,0
USING *,12

L 3,A1
A 3,A2
ST 3,RESULT

A1 DC F'10'
A2 DC F'20'
RESULT DS F
BR 14
END

This is a simple assembler code which adds two numbers and place the result in result variable.
Every assembler program should start with START command and ends with END command. In assembly language we will perform all operations uding registers tottaly 16 register we will use.
In assembler coding we have to establish addersabilty of the program. This can be achieved by using two instructions ie; BALR and Using
BALR is RR instruction in which the next sequential instruction vale will stired in the first operand. In this sample next sequential instruction value will be stored in 12 register and the secon opernad specifies the place where u want to branch. Here BALR 12,0 specifies 0 means no branching.
L--> stands for Load
L 3,A1
Load instructuion says that load the content of the memory location(A1) into the register 3
A--> Stands for Addition
A 3,A2
Add the content of memory loction (A2) to the register 3
ST--> Stands for Store
ST 3,Result
Store the content of the register (3) to the variabke Result
Then we need to define the space for the memory variables this can done by suing DC & DS statements
DC -Define Constant
By using this we can reserve memry space for a variable as well as we can assign value to the variale
DS --> Define Storage
By using this we can only reserve space for a variable

BR 14 --> Branch 14
It halts the execution of assembler program. Its like Stoprun in cobol.
Back to top
View user's profile Send private message
Gautam512

Active User


Joined: 05 Oct 2005
Posts: 308
Location: Vizag / US

PostPosted: Fri Jan 06, 2006 11:48 pm
Reply with quote

Thanks for the Class,

Learnt Assembler a bit.

-Gau
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts building java class with zip4j.jar on... Java & MQSeries 0
No new posts Anyone has PL/I learning material PL/I & Assembler 2
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
Search our Forums:

Back to Top