Download presentation
Presentation is loading. Please wait.
Published byCory Short Modified over 9 years ago
1
Assembly Programming Timothy C. Rice Jr., MIT
2
OUTLINE Basic Structure Exit to Dos Print Character Clear Screen Change BG & FG Color Set Curser Location TCRJR
3
Basic Structure.Model small; Size of the program.Stack 100h; Size of the stack.Code; Beginning of code End; End of code TCRJR
4
Exit to DOS Function Function Number: 4ch Function Register: AH Interrupt: 21h Sample Code.Model Small.Stack 100h.Code MOV AH, 4Ch INT 21h End TCRJR
5
Print Character Function Function Number: 2 Function Register: AH Interrupt: 21h Registers Involved: DL - Source of character to print Sample Code.Model Small.Stack 100h.Code MOV AH, 2 MOV DL, ‘A’ INT 21h MOV AH, 4Ch INT 21h End TCRJR
6
Clear Screen Function Function Number: 3 Function Register: AX Interrupt: 10h Sample Code.Model Small.Stack 100h.Code MOV AX, 3 INT 10h MOV AH, 4Ch INT 21h End TCRJR
7
Set Background and Foreground Color Function Function Number: 0600h Function Register: AX Interrupt: 10h Registers Involved: BH - Back and Fore Color CH - Y1 Coordinate DH - Y2 Coordinate CL - X1 Coordinate DL - X2 Coordinate Sample Code.Model Small.Stack 100h.Code MOV AX, 0600h MOV BH, 10h MOV CH, 0 MOV DH, 13 MOV CL, 0 MOV DL, 40 INT 10h MOV AH, 4Ch INT 21h End TCRJR
8
Set Curser Coordinates Function Function Number: 2 Function Register: AH Interrupt: 10h Registers Involved: BH- Video Mode DH- Y Coordinate DL - X Coordinate Sample Code.Model Small.Stack 100h.Code MOV AH, 2h MOV BH, 0h MOV DH, 13 MOV DL, 40 INT 10h MOV AH, 4Ch INT 21h End TCRJR
9
Input Character from Keyboard Function Function Number: 1 Function Register: AH Interrupt: 21h Registers Involved: AL - Destination of entered character Sample Code.Model Small.Stack 100h.Code MOV AH, 1 INT 21h MOV AH, 4Ch INT 21h End TCRJR
10
String Variable Declaration Sample Code.Model Small.Stack 100h.Data Var1 DB ‘Hello World$’ Var2 DB ‘One’ Var3 DB ‘Two$’ Var4 DB ‘Hello “, ‘World$’ Var5 DB ?.Code MOV AX, @Data MOV DS, AX MOV ES, AX MOV AH, 4Ch INT 21h End TCRJR
11
Print String Function Function Number: 9 Function Register: AH Interrupt: 21h Registers Involved: DX - Starting Address of string to print Sample Code.Model Small.Stack 100h.Data Var1 DB ‘Hello World$’ Var2 DB ‘One’ Var3 DB ‘Two$’.Code MOV AX, @Data MOV DS, AX MOV ES, AX MOV AH,9 LEA DX, Var2 INT 21h MOV AH, 4Ch INT 21h End TCRJR
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.