I've started inputting the IEEE 754 conversion program found on here but can't figure out how to add the JMP command.
First occurence required is - JMP ZeroF, shortly after there's a JMP SpecF.
I'm doing this on the WP34s itself not opn the emulator.
Can anyone help?
Cheers
Roger
(12-11-2014 12:51 PM)Roger Ward Wrote: [ -> ]I've started inputting the IEEE 754 conversion program found on here
What program do you refer to? Is it this one in the old forum?
[wp34s] Converting to/from IEEE 754 Binary64 (Double Precision)
(12-11-2014 12:51 PM)Roger Ward Wrote: [ -> ]but can't figure out how to add the JMP command.
Sure - there is no JMP command. ;-)
JMP is a shorcut generated by the 34s assembler. The actual program uses SKIP (forward jump) or BACK (backward jump) instead, stating the number of skipped lines. Since these numbers may change during editing, the assembler has this handy JMP command that allows jumping to symbolic labels.
Take a look at the listing. In the left column you will notice some labels: ZeroF, SpecF, InfF, ZeroI, SpecI and InfI. Whenever a JMP to one of these labels occurs, you could count the number of program lines between that point and the target label and insert a SKIP command. So if I got it right, JMP ZeroF would be a SKIP 044, because there are 44 lines between the JMP and the respective label. Of course that's cumbersome and error prone.
Much easier: use regular labels like LBL 01, LBL 02, LBL 03 at the position of ZeroF, SpecF, InfF etc. and replace the JMP commands with simple GTOs.
Example:
Code:
LBL A
LocR 001
CL[alpha]
x=0?
GTO 01 // was JMP ZeroF
SPEC?
GTO 02 // was JMP SpecF
...
LBL 01 // was label ZeroF
CF .01
x=-0?
SF .01
BASE 16
FS? .01
SB 63
RTN
LBL 02 // was label SpecF
[infinity]?
GTO 03 // was JMP InfF
...
LBL 03 // was label InfF
CF .01
x<0?
SF .01
...
And finally you could also use the listing "as is", feed it to the assembler and transfer the result to your hardware 34s.
Dieter
Dieter
Yes, that's the program and thanks for your clear explanation!
I'm not a programmer so this is all new to me.
Will keep going now.
Cheers
Rogr
(12-11-2014 01:40 PM)Roger Ward Wrote: [ -> ]I'm not a programmer so this is all new to me.
OK, in this case a complete "translation" may be helpful. There are some other lines that have to be entered differently from what the assembler-generated listing says.
Code:
LBL'IED'
WSIZE 64
SIGNMT
DBLON
INTM?
GTO B
LBL A
LocR 001
CLα
x=0?
GTO 01
SPEC?
GTO 02
ENTER
ABS
LOG_2
FLOOR
# 010
2^x
DEC X
x<? Y
ERR 08
+/-
MAX
STO .00
# 052
x<> Y
-
# 179
# 006
x
MIN
2^x
x
ROUNDI
RCL .00
BASE 16
# 010
2^x
DEC X
+
CF .00
x=0?
SF .00
SL 52
x<> Y
MASKR 52
+/-
AND
OR
FC? .00
RTN
α"Den"
α"orm"
VWα+ X
RTN
LBL 01
CF .01
x=-0?
SF .01
BASE 16
FS? .01
SB 63
RTN
LBL 02
∞ ?
GTO 03
BASE 16
MASKR 12
SL 51
α'NaN'
VWα+ X
RTN
LBL 03
CF .01
x<0?
SF .01
BASE 16
MASKR 11
SL 52
FS? .01
SB 63
RTN
LBL B
LocR 001
CLα
x=0?
GTO 04
ENTER
CB 63
SR 52
# 011
2^x
DEC X
x=? Y
GTO 05
DROP
CF .00
x=0?
SF .00
# 001
MAX
# 010
2^x
DEC X
-
x<> Y
MASKR 11
SL 52
NOT
AND
FC? .00
SB 52
DECM
x<> Y
# 052
x<> Y
-
2^x
/
FC? .00
RTN
α"Den"
α"orm"
VWα+ X
RTN
LBL 04
CF .01
x=-0?
SF .01
DECM
FC? .01
RTN
α"Neg"
α" 0"
0
+/-
VWα+ X
RTN
LBL 05
DROP
DROP
ENTER
MASKR 52
AND
x=0?
GTO 06
DECM
# NaN
RTN
LBL 06
DROP
CF .01
x<0?
SF .01
DECM
# ∞
FS? .01
+/-
RTN
END
This should look close to what you see in the display.
Dieter
Thanks again Dieter for your time.
This make even more sense
Cheers
Roger
(12-11-2014 01:21 PM)Dieter Wrote: [ -> ]JMP is a shorcut generated by the 34s assembler. The actual program uses SKIP (forward jump) or BACK (backward jump) instead, stating the number of skipped lines.
It is a bit more sophisticated than this. JMP will also insert a label and use a GTO instruction if the branch range is too far for BACK and SKIP.
- Pauli
(12-11-2014 09:37 PM)Paul Dale Wrote: [ -> ] (12-11-2014 01:21 PM)Dieter Wrote: [ -> ]JMP is a shorcut generated by the 34s assembler. The actual program uses SKIP (forward jump) or BACK (backward jump) instead, stating the number of skipped lines.
It is a bit more sophisticated than this. JMP will also insert a label and use a GTO instruction if the branch range is too far for BACK and SKIP.
JMP is not generated by the assembler but is a pseudo-command the assembler translates. Please see pp. 189f of the downloadable manual v3.1, pp. 212f of the printed manual v3.2, or pp. 323ff of the printed manual v3.3 in this matter.
d:-)