rob.masm

mud++0.33/src/x/rob.masm · 1.2 KB

From the archive mud++0.33.tar.gz

Download the archive   « Back to the archive contents

# rob.masm
# MUD Assembler functions for VM

!constant string Some string~

!funstart sample_fun
!A PC pc
!A string str1
	pushc string You managed to call sample_fun.~
	pushl 0
	fcall echo_fun
	ret
!funend

!funstart echo_fun
!A PC pc
!A string str1
	pushl 1
	pushl 0
	icall out_string__pPC_s
	ret
!funend

!funstart makeobj
!A PC pc
!A string str1
!L Object obj
	pushl @str1
	icall getObjPrototype__s
	clone
	isnull e OBJ_NOT_FOUND
	icall copyObject__pObject
	popl @obj
	pushl 0
	icall inRoom__pThing
	pushl @obj
	icall toRoom__pObject_pRoom
	pushc string Done.~
	pushl @pc
	icall out_string__pPC_s
	ret
:OBJ_NOT_FOUND pop
	pushc string No such object~
	pushl @pc
	icall out_string__pPC_s
	ret
!funend

# This is fun -Fusion
!funstart say
!A PC pc
!A string str1
	pushl @str1
	pushl @pc
	icall say__pChar_s
	ret
!funend

# Try 'vmftest benchmark 100000' to see how
# fast the VM really is! -Fusion
!funstart benchmark
!A PC pc
!A string str1
	pushl @pc
	icall out_time__pPC
	pushl @str1
	stoint
	popl @str1
:DO_AGAIN decl @str1
	lieval g @str1 DO_AGAIN
	pushl @pc
	icall out_time__pPC
	ret
!funend

!end

Site Stats

Snippets: 1791
Codebases: 571