blob: 493a12f28e93f0b93494fc39394e3cf044a1119e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
; test8 - subroutines, saving registers to the stack
begin:
mov ax, 1
mov bx, 2
mov cx, 3
mov dx, 4
jsr func
; the subroutine saves all registers to the stack, modifies them and
; then restores them to their original value
; while in the subroutine we should se 04 03 02 01 0a on the stack
; (the registers and the return address 0a)
end:
hlt
func:
push ax
push bx
push cx
push dx
mov ax, 10
mov bx, 11
mov cx, 12
mov dx, 13
pop dx
pop cx
pop bx
pop ax
ret
|