06-25-2014, 09:41 PM
Inspired by a recent thread I started using the HP-80 emulator but had troubles with the calendar functions. Whatever I entered the result was always a blinking 9.999999999 99.
So I started to debug the DATE function and noticed a fishy line 6201 in the following block of code:
The loop was executed once too often and thus the month (here 6) was shifted over the right end of register c and thus got lost:
To be sure I had a look at the original US-patent 3863060 and noticed a special case at exactly that line:
The leading L is missing in line number 6201. And while the texts agree (if p # 14 | IF P # 14) the bit pattern don't: 111.1.11.. | 11111.11... And of course [if p # 15] makes more sense.
Thus I patched these two files in my installation:
/usr/local/lib/nonpareil diff 80.lst.orig 80.lst
/usr/local/lib/nonpareil diff 80.obj.orig 80.obj
And, lo and behold, the bug in the calendar functions was fixed.
Cheers
Thomas
So I started to debug the DATE function and noticed a fishy line 6201 in the following block of code:
Code:
1708 L06175: .1....11.. 4 -> p
1709 L06176: 1...11..1. b exchange c[wp]
1710 L06177: 1..1..111. dd2: shift right c[w]
1711 L06200: .....111.. p - 1 -> p
1712 L06201: 111.1.11.. if p # 14
1713 L06202: .111111111 -> L063177 then go to dd2
1714 L06203: .11.1.1.1. if c[x] = 0
The loop was executed once too often and thus the month (here 6) was shifted over the right end of register c and thus got lost:
Code:
1712 L06201: 111.1.11.. if p # 14
pc=06202 p=15 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000030006
m: 07000000000000
1713 L06202: .111111111 -> L063177 then go to dd2
pc=06177 p=15 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000030006
m: 07000000000000
1710 L06177: 1..1..111. dd2: shift right c[w]
pc=06200 p=15 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000003000
m: 07000000000000
1711 L06200: .....111.. p - 1 -> p
pc=06201 p=14 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000003000
m: 07000000000000
1712 L06201: 111.1.11.. if p # 14
pc=06202 p=14 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000003000
m: 07000000000000
1713 L06202: .111111111 -> L063177 then go to dd2
pc=06203 p=14 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000003000
m: 07000000000000
1714 L06203: .11.1.1.1. if c[x] = 0
pc=06204 p=14 stat: 0 2 3 7 9
a: 00000030680000
b: 00000000023099
c: 00000000003000
m: 07000000000000
To be sure I had a look at the original US-patent 3863060 and noticed a special case at exactly that line:
The leading L is missing in line number 6201. And while the texts agree (if p # 14 | IF P # 14) the bit pattern don't: 111.1.11.. | 11111.11... And of course [if p # 15] makes more sense.
Thus I patched these two files in my installation:
/usr/local/lib/nonpareil diff 80.lst.orig 80.lst
Code:
2074c2074
< 1712 L06201: 111.1.11.. if p # 14
---
> 1712 L06201: 11111.11.. if p # 15
Code:
1666c1666
< 3201:1654
---
> 3201:1754
And, lo and behold, the bug in the calendar functions was fixed.
Cheers
Thomas