;{ Function pwroften returns value of ten }
;{ raised to the power e. e ranges 0 - 37 }
;function pwroften( e: integer ): real;
;{$m-,c-}
	NAME PWROFTEN
	ENTRY PWROFTEN
M	SET		  0
C	SET		  0
;{ 10**e, 0<e<38 }
;label 9;
;var	i: integer;
;	t: real;
;begin
PWROFTEN:
	ENTR	D,2,6
;  if ( e<0 ) or ( e>37 ) then begin
	MOV	L,8(IX)
	MOV	H,9(IX)
	MOV	D,A
	MOV	E,A
	LESS	D,0
	jrc	L154
	MOV	L,8(IX)
	MOV	H,9(IX)
	LXI	D,37
	GRET	D,0
	jrnc	L153
L152
L154	EQU	L152
;    pwroften := 0; { EXIT } goto 9
	CVTF	A,0
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	LXI	B,13
	DADD	B
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
	JMP    L151
;  end;
L153
;  i := 0;
	MOV	0(IX),A
	MOV	-1(IX),A
;  t := 1.0;
	LXI	H,320
	MOV	D,A
	MOV	E,A
	PUSH	H
	PUSH	D
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;  repeat
;    if odd(e) then
L194
	MOV	L,8(IX)
	MOV	H,9(IX)
	RRCR	L
;	case i of
	JNC    L196
;	 0: t := t * 1.0e1;
	MOV	L,-1(IX)
	MOV	H,0(IX)
	XCHG
	LXI	H,0
	DSB1
	jrnz	 L215
L217
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,1104
	MOV	D,A
	MOV	E,A
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;	 1: t := t * 1.0e2;
	JMP    L216
L215
	LXI	H,1
	DSB1
	jrnz	 L230
L231
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,1892
	MOV	D,A
	MOV	E,A
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;	 2: t := t * 1.0e4;
	JMP    L216
L230
	LXI	H,2
	DSB1
	jrnz	 L244
L245
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,3662
	LXI	D,8192
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;	 3: t := t * 1.0e8;
	JMP    L216
L244
	LXI	H,3
	DSB1
	jrnz	 L258
L259
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,7007
	LXI	D,24080
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;	 4: t := t * 1.0e16;
	JMP    L216
L258
	LXI	H,4
	DSB1
	jrnz	 L272
L273
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,13895
	LXI	D,3556
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;	 5: t := t * 1.0e32;
	JMP    L216
L272
	LXI	H,5
	DSB1
	jrnz	 L286
L287
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,27470
	LXI	D,-7466
	PUSH	H
	PUSH	D
	MULT	D,-4
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	DCX	H
	DCX	H
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
	JMP    L216
;
L286
;	 6,7,8: e := 2
	LXI	H,6
	DSB1
	jrz	L301
	LXI	H,7
	DSB1
	jrz	L301
	LXI	H,8
	DSB1
	jrnz	 L300
L301
;	end{case};
	MOV	9(IX),A
	MVI	8(IX),2
L300
L216
L196
;    e := e div 2;
	MOV	L,8(IX)
	MOV	H,9(IX)
	LXI	D,2
	DIVD	D,0
	MOV	9(IX),H
	MOV	8(IX),L
;    i := i + 1;
	MOV	L,-1(IX)
	MOV	H,0(IX)
	INX	H
	MOV	0(IX),H
	MOV	-1(IX),L
;  until ( e=0 );
	CTRL	M,19
	MOV	L,8(IX)
	MOV	H,9(IX)
	MOV	D,A
	MOV	E,A
	DSB1	D,0
	JNZ	L194
;  pwroften := t;
	LXI	H,-4
	DADD	S
	SPHL
	XCHG
	PUSH	IX
	POP	H
	LXI	B,-5
	DADD	B
	LXI	B,4
	LDIR
	LXI	H,3
	DADD	S
	XCHG
	PUSH	IX
	POP	H
	LXI	B,13
	DADD	B
	XCHG
	LXI	B,4
	LDDR
	POP	H
	POP	H
;9: { quick exit }
L151
;end{ of pwroften };
	EXIT	D,2
;
;

	LXI	B