won't redistribute TASM, TLINK, TD
[dos-tasm-exercises.git] / task1__6_6.1 / main.asm
blobae59084df496dff45f20ee8159ebe2e84e3d40b1
2 ; Copyright (C) 2008 Alexander Potashev
4 ; Exchange of 2 top words in the stack, all registers saved
7 .model small
8 .code
10 start:
11 push 10
12 push 20
13 push 30
14 push 40
15 push 50
16 push 60
17 push 70
18 push 80
19 push 90 ; [bp + 6]
20 push 100 ; [bp + 4]
22 ;-----------------------
23 push ax ; save all registers which will be used
24 push bp
26 mov bp, sp ; using "bp" to access stack variables
28 mov ax, [bp + 4] ; exchange
29 xchg ax, [bp + 6]
30 mov [bp + 4], ax
32 pop bp ; restore registers
33 pop ax
34 ;-----------------------
36 add sp, 20
38 mov ax, 4c00h
39 int 21h
41 .stack 256
43 end start