[gforth] / gforth / abi-code-test.fs  

gforth: gforth/abi-code-test.fs


1 : dvdkhlng 1.1
2 :     abi-code my+ ( n1 n2 -- n3 )
3 :     di ax mov \ ABI: sp passed in di, returned in ax
4 :     si dx mov \ ABI: fp passed in si, returned in dx
5 :     ax ) r8 mov \ load sp[0]
6 :     8 ax d) r8 add \ add sp[1]
7 :     8 # ax add \ store result to *++sp
8 :     r8 ax ) mov
9 :     ret \ return to caller
10 :     end-code
11 :    
12 :     : my+-compiled ( n1 n2 -- n3 ) my+ ;
13 :    
14 :     assert0( 12 34 my+ 46 = )
15 :     assert0( 12 34 my+-compiled 46 = )

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help