add call and ret function
add drop (idk if it is working right) add prog5 and prog6
This commit is contained in:
35
programs/prog5.asm
Normal file
35
programs/prog5.asm
Normal file
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// prog01.asm -- call/ret without args, and without ret value
|
||||
//
|
||||
|
||||
asf 3
|
||||
pushc 11
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
call proc
|
||||
pushc 44
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
rsf
|
||||
halt
|
||||
|
||||
proc:
|
||||
asf 2
|
||||
pushc 22
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
call proctwo
|
||||
rsf
|
||||
ret
|
||||
|
||||
proctwo:
|
||||
asf 2
|
||||
pushc 33
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
rsf
|
||||
ret
|
||||
BIN
programs/prog5.bin
Normal file
BIN
programs/prog5.bin
Normal file
Binary file not shown.
28
programs/prog6.asm
Normal file
28
programs/prog6.asm
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// prog02.asm -- call/ret with args, but without ret value
|
||||
//
|
||||
|
||||
asf 3
|
||||
pushc 11
|
||||
pushc 33
|
||||
call proc
|
||||
drop 2
|
||||
rsf
|
||||
halt
|
||||
|
||||
proc:
|
||||
asf 2
|
||||
pushl -4
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
pushc 22
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
pushl -3
|
||||
wrint
|
||||
pushc '\n'
|
||||
wrchr
|
||||
rsf
|
||||
ret
|
||||
BIN
programs/prog6.bin
Normal file
BIN
programs/prog6.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user