Assembly programming
assembly programs are generally written as pure text files using any text editor (Notepad etc.) as saved as. ASM files the steps are as follows.
1.CODES the program and save as .asm files, using any suitable text editor. dont use MS-Word or any word processing software.
2.ASSEMBLE program with the command Tasm <filenamw.ASM>. An object file <filename.obj> is generated.
3.If no errors are found, LINK the object file: TLINK <filename> to generate executable program/file <filename.e
REQUIREMENTS
1. Turbo Assemble (TASM.EXE)
2. LINKER (TLINK.EXE)
3.Editor
a. Notepad
b. C++ editor saved as a pure text file with asm extension.
Generally source file (.asm) is made up of segments containing INSTURCTION/MNEMOMICS and or DIRECTIVES. Comments must be proceded by a semi-colon (;) for each line.
Generally instructions are in the form of mnemomics such as:
*MOV
*ADD
*SUB
*RET
*INT
*XOR
*OR
*NOT
*MUL
*DIV
etc.
Arithmetic Instructions
* ADD
*MUL
*DIV
*SUB
Move Instructions
*MOV - Interrups
Logical Instructions
*OR
*AND
*NOT
*XOR
Other Instructions
*PUSH
*POP
*RET
*ROL
*ROR
Jump Instructions
*JMP-jump
*JE-jump if equal
*JNE-jump if not equal
*JZ-jump if zero
*JNZ-jump if not zero
*JAE-jump above/Equal
Sample program
PAGE SR, 132
TITLE DISPLAY
SSEG SEGMENT STRACK
DB 32 DUP ("STRACK....")
SSEG ENDS
DSEG SEGMENT
MESSAGE DB "HELLO, HOW ARE YOU?", OOH.OAH
L_MESS EQU $-MESSAGE
CSEG SEGMENT 'CODE'
ASSUME OS:CSEG:SS:SSEG,DS:DSEG
MAIN
PROC FAR
PUSH DS
PUSH O
MOV DX,DSEG
MOV DX,AX
MOV BX, 0001H
LEA DX,MESSAGE
MOV CX,L-MESS
MOV AH,40H
INT 21H
MAIN ENDP
CSEG ENDS
END MAIN
No comments:
Post a Comment