forked from Anobium/Great-Cow-BASIC-Demonstration-Sources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Power_2PlacesPrecision_16F88.gcb
61 lines (47 loc) · 1.81 KB
/
Power_2PlacesPrecision_16F88.gcb
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'''A program for GCGB and GCB.
'''--------------------------------------------------------------------------------------------------------------------------------
'''This program shows a function to raise a base to a power.
'''Remember, powers can easily become huge, so it is up to the
'''calling program to make certain your numbers remain within
'''range. The base and exponent are Byte sized numbers in any
'''event. The returned result is a Long. Non-negative numbers are
'''assumed throughout.
'''Keep in mind that 0 raised to 0 is meaningless and should be
'''avoided. But any other non-zero base raised to 0 is handled.
'''@author EvanV based on works of ThomasH
'''@licence GPL
'''@version 1.0a
'''@date 01.04.2015
'''********************************************************************************
; ----- Configuration
#chip 16F88, 8
#config mclr=off ;reset handled internally
#config osc=int ;use internal clock
#include <maths.h>
; ----- Constants
#define LCD_IO 4 ;4-bit mode
#define LCD_RS PortB.2
#define LCD_Enable PortB.3
#define LCD_DB4 PortB.4
#define LCD_DB5 PortB.5
#define LCD_DB6 PortB.6
#define LCD_DB7 PortB.7
#define LCD_NO_RW
; ----- Define Hardware settings
dir PortB out ;all outputs to the LCD
; ----- Variables
dim ii, jj as byte
; ----- Main body of program commences here.
for ii = 1 to 10 ;do all the way from
for jj = 0 to 9 ;1^0 on up to 10^9
cls
print ii
print"^"
print jj
print "="
locate 1,0
print power(ii,jj) ;here's the invocation
wait 1 S
next jj
next ii
; ----- Support methods. Subroutines and Functions