Added if statements and bitwise operations
This commit is contained in:
parent
1140b5b140
commit
848a01ff7d
6 changed files with 116 additions and 0 deletions
13
flagpole/tests/isprime.fp
Normal file
13
flagpole/tests/isprime.fp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
$inc fvmstd.fp
|
||||
|
||||
proc main
|
||||
:getuint @x
|
||||
2 @checkFact
|
||||
while &checkFact &checkFact u* 1 u- &x u< do
|
||||
if &x &checkFact u% 0 == then
|
||||
"Not Prime" :puts :newline return
|
||||
endif
|
||||
&checkFact 1 u+ @checkFact
|
||||
endwhile
|
||||
"Prime" :puts :newline
|
||||
endproc
|
||||
39
flagpole/tests/tempconv.fp
Normal file
39
flagpole/tests/tempconv.fp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
$inc fvmstd.fp
|
||||
|
||||
proc mainvar
|
||||
"Source Fahrenheit or Celsius (F/C): " :puts
|
||||
:getchar @srcUnit
|
||||
:getchar drop # newline pmo
|
||||
if &srcUnit 0x43 == &srcUnit 0x63 == bor then
|
||||
"Source Temp: " :puts :getuint @srcTemp
|
||||
&srcTemp 9 u* 5 u/ 32 u+ @dstTemp
|
||||
&srcTemp :putuint "*C == " :puts &dstTemp :putuint "*F" :puts :newline
|
||||
return
|
||||
endif
|
||||
if &srcUnit 0x46 == &srcUnit 0x66 == bor then
|
||||
"Source Temp: " :puts :getuint @srcTemp
|
||||
&srcTemp 32 u- 5 u* 9 u/ @dstTemp
|
||||
&srcTemp :putuint "*F == " :puts &dstTemp :putuint "*C" :puts :newline
|
||||
return
|
||||
endif
|
||||
"Invalid Unit" :puts :newline
|
||||
endproc
|
||||
|
||||
proc main
|
||||
"Source Fahrenheit or Celsius (F/C): " :puts
|
||||
:getchar
|
||||
:getchar drop # newline pmo
|
||||
if dup 0x43 == dup 0x63 == bor then
|
||||
"Source Temp: " :puts :getuint
|
||||
dup 9 u* 5 u/ 32 u+
|
||||
swap :putuint "*C == " :puts :putuint "*F" :puts :newline
|
||||
return
|
||||
endif
|
||||
if dup 0x46 == dup 0x66 == bor then
|
||||
"Source Temp: " :puts :getuint
|
||||
dup 32 u- 5 u* 9 u/
|
||||
swap :putuint "*F == " :puts :putuint "*C" :puts :newline
|
||||
return
|
||||
endif
|
||||
"Invalid Unit" :puts :newline
|
||||
endproc
|
||||
5
flagpole/tests/underflow.fp
Normal file
5
flagpole/tests/underflow.fp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
$inc fvmstd.fp
|
||||
|
||||
proc main
|
||||
1 u+ :putuint
|
||||
endproc
|
||||
Loading…
Add table
Add a link
Reference in a new issue