aboutsummaryrefslogtreecommitdiff
path: root/samples/clamp.orgaasm
blob: ecd2824649815e102a5501cc2f97af2cb8257921 (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
	#000f #00f0 #0042 DBG
	/clamp DBG POP
	#000f #00f0 #0f00 DBG
	/clamp DBG POP
	#000f #00f0 #0001 DBG
	/clamp DBG POP
	RET

@clamp ( min max a -- b )
	/min /max RET

@min ( a b -- a < b ? a : b )
	OVR OVR LTH
	JNZ ,min/morethan
	SWP
@min/morethan
	POP
	RET

@max ( a b -- a > b ? a : b )
	OVR OVR GTH
	JNZ ,max/lessthan
	SWP
@max/lessthan
	POP
	RET