CAC 2015-09-23

tracking down from-source errors

bound_library_wired_
>user_dir_dir>SysEng>Anthony>fromSource>work>tmp>power_:
000073  aa   001000 4250 03   fcmg      512,du
Changed to:
>user_dir_dir>SysEng>Anthony>fromSource>work>power_:
000073  aa   777000 4250 03   fcmg      261632,du

From the MIT listing:

    000073  aa   001000 4250 03    117            fcmg      =-1.0,du            is abs(b) >= 1?

It seems that the value of -1.0 has changed…

Simple test case

pr test.list

                    test.list 09/23/93  0624.2 pdt Thu

ASSEMBLY LISTING OF SEGMENT >user_dir_dir>SysAdmin>Anthony>test.alm
ASSEMBLED ON:       09/23/93  0624.1 pdt Thu
OPTIONS USED:       list symbols
ASSEMBLED BY:       ALM Version 8.14 March 1989
ASSEMBLER CREATED:  06/09/89  1002.3 pdt Fri

    000000  aa   777000 4250 03      1            fcmg      =-1.0,du
                                     2            end

18 bit float:

  1 bit exp. sign
  7 bits exp.
  1 bit mantissa sign
  9 bits mantissa

001000 
   000 000 001 000 000 000 000
   0 0000000 1 000000000000

777000
   111 111 111 000 000 000
   1 1111111 1 000 000 000

I can get the same effect in pl1

        1 world: procedure options(main);
        2   dcl asl float;
        3   asl = -1.0;
        4    call ioa_ ("^f", asl);
        5 end world;

000011  aa   777000 4310 03   fld       261632,du

hello$world
-0.5

Doing the trace all thang:

look for the incorrect instruction...

DBG(126196616)> CPU TRACE: 00377:362530 4 100000751101 (STCA PR1|0,AU) 100000 751(0) 1 0 0 01
DBG(126196616)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66260011  readData=777000431004
DBG(126196616)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66260011 writeData=777000431003

back tracing address 66260011...

DBG(126196610)> CPU TRACE: 00377:362525 4 300000551160 (STBA PR3|0,*N) 300000 551(0) 1 0 3 00
DBG(126196610)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66260011  readData=000000431004
DBG(126196610)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66260011 writeData=777000431004
DBG(126196610)> CPU REGDUMPAQI: A=777000000000 Q=000000000000 IR:~BAR Neg
DBG(126196610)> CPU REGDUMPFLT: E=000 A=777000000000 Q=000000000000 -0.00390625

back tracing the A reg...

BG(126196606)> CPU TRACE: 00377:362523 4 600502235100 (LDA PR6|502) 600502 235(0) 1 0 0 00
DBG(126196606)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660362  readData=777000000000
DBG(126196606)> CPU REGDUMPAQI: A=777000000000 Q=000000000000 IR:~BAR Neg
DBG(126196606)> CPU REGDUMPFLT: E=000 A=777000000000 Q=000000000000 -0.00390625

back tracing address 66660362

DBG(126196596)> CPU TRACE: 00377:362506 4 600502755100 (STA PR6|502) 600502 755(0) 1 0 0 00
DBG(126196596)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660362 writeData=777000000000
DBG(126196596)> CPU REGDUMPAQI: A=777000000000 Q=000000000000 IR:~BAR Neg
DBG(126196596)> CPU REGDUMPFLT: E=000 A=777000000000 Q=000000000000 -0.00390625

back tracing the A reg...

DBG(126196592)> CPU TRACE: 00377:362504 4 600346235120 (LDA PR6|346,N*) 600346 235(0) 1 0 1 00
DBG(126196592)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660226  readData=000404400043
DBG(126196592)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660227  readData=016760000000
DBG(126196592)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462760  readData=777000000000
DBG(126196592)> CPU REGDUMPAQI: A=777000000000 Q=000000000000 IR:~BAR Neg
DBG(126196592)> CPU REGDUMPFLT: E=000 A=777000000000 Q=000000000000 -0.00390625

back tracing address  66462760

DBG(124364954)> CPU TRACE: 00377:004645 4 003140060540 (CSL PR0|3140,F1) 003140 060(1) 0 0 0 00
DBG(124364954)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660244  readData=777000000000
DBG(124364954)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66462760 writeData=777000000000

back tracing address 66660244

DBG(124363464)> CPU TRACE: 00377:004373 4 003140060540 (CSL PR0|3140,F1) 003140 060(1) 0 0 0 00
DBG(124363464)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66663140  readData=777000000000
DBG(124363464)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660244 writeData=777000000000

back tracing address 66663140

DBG(124363136)> CPU TRACE: 00314:052640 bound_library_wired_:any_to_any_+05266
DBG(124363136)> CPU TRACE:     005266  aa  1 00000 4551 00   4681     fst       target|0                      " store away
DBG(124363136)> CPU TRACE: 00314:052640 4 100000455100 (FST PR1|0) 100000 455(0) 1 0 0 00
DBG(124363136)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66663140 writeData=777000000000
DBG(124363136)> CPU REGDUMPAQI: A=400000000000 Q=000000000000 IR:~BAR OMASK Neg
DBG(124363136)> CPU REGDUMPFLT: E=377 A=400000000000 Q=000000000000 -0.5

ahh, our old friend any_to_any_

back tracing EAQ....

DBG(124363130)> CPU REGDUMPFLT: E=000 A=200000000000 Q=000000000000 0.5

DBG(124363132)> CPU TRACE: 00314:052741 bound_library_wired_:any_to_any_+05367
DBG(124363132)> CPU TRACE:     005367  aa   000000 5130 00   4777     fneg
DBG(124363132)> CPU TRACE: 00314:052741 4 000000513000 (FNEG 000000) 000000 513(0) 0 0 0 00
DBG(124363132)> CPU REGDUMPAQI: A=400000000000 Q=000000000000 IR:~BAR OMASK Neg
DBG(124363132)> CPU REGDUMPFLT: E=377 A=400000000000 Q=000000000000 -0.5

Huh. We're starting from -1.0; where did 0.5 come from?

back tracing EAQ....

DBG(124363128)> CPU REGDUMPFLT: E=000 A=777777777400 Q=000000000000 -7.450580597e-09

DBG(124363130)> CPU TRACE: 00314:052740 bound_library_wired_:any_to_any_+05366
DBG(124363130)> CPU TRACE:     005366  aa  5 00004 3771 00   4776     anaq      work|fix_bin_generic
DBG(124363130)> CPU TRACE: 00314:052740 4 500004377100 (ANAQ PR5|4) 500004 377(0) 1 0 0 00
DBG(124363130)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660174  readData=200000000177
DBG(124363130)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660175  readData=777777777777
DBG(124363130)> CPU REGDUMPAQI: A=200000000000 Q=000000000000 IR:~BAR OMASK
DBG(124363130)> CPU REGDUMPFLT: E=000 A=200000000000 Q=000000000000 0.5

There's that near-0 again?....

What is any_to_any_ up to here?

    005356                        4767  load_rounded_flt_bin.negative:
    005356  aa   000000 5130 00   4768            fneg
    005357  0a   010410 0770 13   4769            adaq      mask_table+2,x3               " round
    005360  aa   000000 5730 00   4770            fno                                     " fix overflow
    005361  aa  5 00004 7571 00   4771            staq      work|fix_bin_generic          " temp save
    005362  aa   004000 6340 07   4772            ldi       mask_faults,dl                " clear possible overflow
    005363  aa   400000 2350 03   4773            lda       =o400000,du                   " generate mask
    005364  aa   000000 2360 07   4774            ldq       =0,dl
    005365  aa   000000 7330 12   4775            lrs       0,x2                          " mask for precision+sign
    005366  aa  5 00004 3771 00   4776            anaq      work|fix_bin_generic
    005367  aa   000000 5130 00   4777            fneg
    005370  aa   000000 7100 11   4778            tra       0,x1

Walk through the code:

DBG(124363112)> CPU REGDUMPFLT: E=000 A=400000000000 Q=000000000000 -1

We enter with -1; a good sign...

DBG(124363114)> CPU TRACE:     005356                        4767  load_rounded_flt_bin.negative:
DBG(124363114)> CPU TRACE:     005356  aa   000000 5130 00   4768     fneg
DBG(124363114)> CPU TRACE: 00314:052730 4 000000513000 (FNEG 000000) 000000 513(0) 0 0 0 00
DBG(124363114)> CPU REGDUMPAQI: A=200000000000 Q=000000000000 IR:~BAR OMASK Carry
DBG(124363114)> CPU REGDUMPFLT: E=000 A=200000000000 Q=000000000000 0.5

FNEG of -1 is 0.5????

No; the -1 in is incorrect... it's not -1, it's  -<huge_num>E0. Also a bug in fneg() is preventing E from being incremented.

Rewrote fneg:

world: procedure options(main);
  dcl asl float;
  asl = -1.0;
   call ioa_ ("^f", asl);
end world;

hello$world
-4.

Closer (kinda).

Back to the code walk; the number going into load_rounded_flt_bin 'tis wrong, back trace from there...

    005333                        4742  load_rounded_flt_bin:
    005333  aa  5 00012 2351 00   4743            lda       work|flt_bin_generic_exp
    005334  aa   000034 7350 00   4744            als       36-8                          " make short exponent
    005335  0a   006233 6030 00   4745            trc       flt_range_error               " won't fit
    005336  aa  5 00012 7551 00   4746            sta       work|flt_bin_generic_exp
    005337  aa  5 00006 2371 00   4747            ldaq      work|flt_bin_generic          " get mantissa
    005340  aa  5 00012 4111 00   4748            lde       work|flt_bin_generic_exp      " get exponent
    005341  aa   000000 5730 00   4749            fno                                     " find 0.0
    005342  aa   000000 6000 11   4750            tze       0,x1                          " cannot round
    005343  aa   000000 1050 03   4751            cmpx5     0,du
    005344  aa   000000 6000 11   4752            tze       0,x1                          " no round
                                  4753
    005345  aa  5 00012 7421 00   4754            stx2      work|flt_bin_generic_exp      " two word mask entries
    005346  aa   000000 6230 12   4755            eax3      0,x2
    005347  aa  5 00012 0631 00   4756            adx3      work|flt_bin_generic_exp
    005350  aa   000000 1150 03   4757            cmpa      0,du
    005351  0a   005356 6040 00   4758            tmi       load_rounded_flt_bin.negative
    005352  0a   010410 0770 13   4759            adaq      mask_table+2,x3               " round

Walk the code:

DBG(124363092)> CPU TRACE:     005337  aa  5 00006 2371 00   4747     ldaq      work|flt_bin_generic          " get mantissa
DBG(124363092)> CPU TRACE: 00314:052711 4 500006237100 (LDAQ PR5|6) 500006 237(0) 1 0 0 00
DBG(124363092)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660176  readData=400000000000
DBG(124363092)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660177  readData=000000000000
DBG(124363092)> CPU REGDUMPAQI: A=400000000000 Q=000000000000 IR:~BAR OMASK Neg

That's bogus. Back trace address 66660176

                                  2219  "     Get the precision correction for the high order decimal input digit and
                                  2220  "     formulate the initial binary exponent.
                                  2221
    002242  aa   000000 6350 11   2222            eaa       0,x1
    002243  aa   000012 7350 00   2223            als       18-8                          " to exponent position
    002244  aa  5 00004 7551 00   2224            sta       work|fix_bin_generic
    002245  aa  5 00006 2371 00   2225            ldaq      work|flt_bin_generic
    002246  aa  5 00004 4111 00   2226            lde       work|fix_bin_generic
    002247  aa   000000 5730 00   2227            fno
    002250  aa  5 00004 4561 00   2228            ste       work|fix_bin_generic
    002251  aa  5 00006 7571 00   2229            staq      work|flt_bin_generic
    002252  aa  5 00004 2351 00   2230            lda       work|fix_bin_generic
    002253  aa   000034 7310 00   2231            ars       36-8
    002254  aa  5 00012 0551 00   2232            asa       work|flt_bin_generic_exp
    002255  0a   005175 7100 00   2233            tra       generic_to_target

Walk the code ...

DBG(124363052)> CPU TRACE:     002242  aa   000000 6350 11   2222     eaa       0,x1
DBG(124363052)> CPU TRACE: 00314:047614 4 000000635011 (EAA 000000,1) 000000 635(0) 0 0 0 11
DBG(124363054)> CPU TRACE: 00314:047615 bound_library_wired_:any_to_any_+02243
DBG(124363054)> CPU TRACE:     002243  aa   000012 7350 00   2223     als       18-8                          " to exponent position
DBG(124363054)> CPU TRACE: 00314:047615 4 000012735000 (ALS 000012) 000012 735(0) 0 0 0 00
DBG(124363054)> CPU REGDUMPAQI: A=004000000000 Q=000000000000 IR:~BAR OMASK
DBG(124363054)> CPU REGDUMPFLT: E=000 A=004000000000 Q=000000000000 0.015625

DBG(124363056)> CPU TRACE:     002244  aa  5 00004 7551 00   2224     sta       work|fix_bin_generic
DBG(124363056)> CPU TRACE: 00314:047616 4 500004755100 (STA PR5|4) 500004 755(0) 1 0 0 00
DBG(124363056)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660174 writeData=004000000000
DBG(124363056)> CPU REGDUMPAQI: A=004000000000 Q=000000000000 IR:~BAR OMASK

DBG(124363058)> CPU TRACE:     002245  aa  5 00006 2371 00   2225     ldaq      work|flt_bin_generic
DBG(124363058)> CPU TRACE: 00314:047617 4 500006237100 (LDAQ PR5|6) 500006 237(0) 1 0 0 00
DBG(124363058)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660176  readData=700000000000
DBG(124363058)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660177  readData=000000000000
DBG(124363058)> CPU REGDUMPAQI: A=700000000000 Q=000000000000 IR:~BAR OMASK Neg

DBG(124363060)> CPU TRACE:     002246  aa  5 00004 4111 00   2226     lde       work|fix_bin_generic
DBG(124363060)> CPU TRACE: 00314:047620 4 500004411100 (LDE PR5|4) 500004 411(0) 1 0 0 00
DBG(124363060)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660174  readData=004000000000
DBG(124363060)> CPU REGDUMPAQI: A=700000000000 Q=000000000000 IR:~BAR OMASK
DBG(124363060)> CPU REGDUMPFLT: E=002 A=700000000000 Q=000000000000 -1

Is that really -1?

Let us back trace the 70..0 (address 66660176)

DBG(124363050)> CPU TRACE:     002237                        2214  flt_dec.flt_bin.up.enter:
DBG(124363050)> CPU TRACE:     002237  aa  0 00100 3055 00   2215     dtb       (pr),(pr)
DBG(124363050)> CPU TRACE: 00314:047611 4 000100305500 (DTB PR0|100) 000100 305(1) 0 0 0 00
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055060060065   -005
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660205  readData=071060062071   9029
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660206  readData=065070061060   5810
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660207  readData=063065070067   3587
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660210  readData=060065066065   0565
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660211  readData=061067061062   1712

DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660177 writeData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=700000000000

?

Well, lets see where -0059..... came from...

DBG(124363046)> CPU TRACE:     002223  0a   000116 7160 15   2193     xec       mp3d.id.pr_rl.pr,x5 " up-scale mantissa ?round?
DBG(124363046)> CPU TRACE: 00314:047575 4 100340226420 (MP3D 100340,N*) 100340 226(1) 0 0 0 00

DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77417556  readData=054143070025

DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416143  readData=131002225201 
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416144  readData=003130160126
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416145  readData=121161040000

I had to ask.

DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055060060065

    002220                        2188  flt_dec.flt_bin.up.final:
    002220  aa  0 00113 1005 00   2189            mlr       (pr),(pr,x3)                  " move exponent
    002221  aa   500013 600001    2190            desc9a    work|flt_dec_generic_exp(3),1
    002222  aa   500013 600001    2191            desc9a    work|flt_dec_generic-1(3),1
                                  2192
    002223  0a   000116 7160 15   2193            xec       mp3d.id.pr_rl.pr,x5 " up-scale mantissa ?round?
    002224  0a   010077 0000 05   2194            arg       two_table,al
    002225  aa   500014 000013    2195            desc9fl   work|flt_dec_generic,x3
    002226  aa   500014 010030    2196            desc9ls   work|flt_dec_generic,24       " overlength for precision
    002227  0a   002237 7100 00   2197            tra       flt_dec.flt_bin.up.enter

So what's the exponent look like?

DBG(124363042)> CPU TRACE:     002220  aa  0 00113 1005 00   2189     mlr       (pr),(pr,x3)                  " move exponent
DBG(124363042)> CPU TRACE: 00314:047572 4 000113100500 (MLR PR0|113) 000113 100(1) 0 0 0 00
DBG(124363042)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660203  readData=777777777777
DBG(124363042)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000
DBG(124363042)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060777

-10

Hmm.

Back up to the entry: 

    002106                        2072  flt_dec_to_flt_bin:
    002106  aa  5 00001 7231 00   2073            lxl3      work|source_precision
    002107  aa  0 00000 1645 40   2074            tct       (pr,rl)                       " count leading zeros
    002110  aa   500014 200013    2075            desc9a    work|flt_dec_generic(1),x3    " miss sign and exponent
    002111  0a   005142 000000    2076            desc9a    zero_skip
    002112  aa  5 00004 0001 00   2077            arg       work|fix_bin_generic
    002113  0a   006246 6064 00   2078            ttn       store_float_bin_zero          " all digits are "0"

DBG(124362972)> CPU TRACE:     002106                        2072  flt_dec_to_flt_bin:
DBG(124362972)> CPU TRACE:     002106  aa  5 00001 7231 00   2073     lxl3      work|source_precision
DBG(124362972)> CPU TRACE: 00314:047460 4 500001723100 (LXL3 PR5|1) 500001 723(0) 1 0 0 00
DBG(124362972)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660171  readData=000000000002

DBG(124362974)> CPU TRACE:     002107  aa  0 00000 1645 40   2074     tct       (pr,rl)                       " count leading zeros
DBG(124362974)> CPU TRACE: 00314:047461 4 000000164540 (TCT PR0|0,F1) 000000 164(1) 0 0 0 00
DBG(124362974)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000    -10
DBG(124362974)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660174 writeData=777000000000

Hmmm.

Back trace that address

DBG(124362964)> CPU TRACE:     002004                        1945  flt_dec_generic_conversion:
DBG(124362964)> CPU TRACE:     002004  aa   000113 1004 00   1946     mlr       (),(pr,x3),fill(000)
DBG(124362964)> CPU TRACE: 00314:047356 4 000113100400 (MLR 000113) 000113 100(1) 0 0 0 00
DBG(124362964)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000
DBG(124362964)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060000

I think X3 had 4 in it.

and again:

DBG(124362946)> CPU TRACE:     004173  aa  0 60152 1005 54   3959     mlr       (pr,rl,x4),(pr,rl,x2),fill(digit_0)
DBG(124362946)> CPU TRACE: 00314:051545 4 060152100554 (MLR PR0|60152,DI) 060152 100(1) 0 0 0 00
DBG(124362946)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462644  readData=055061056060
DBG(124362946)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000
DBG(124362946)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060000

                                  3955  "     Move fractional part.
                                  3956
    004171  aa  5 00154 7241 00   3957            lxl4      work|real.fraction.index      " index in source DL
    004172  aa  5 00154 2231 00   3958            ldx3      work|real.fraction.length     " length of source DU
    004173  aa  0 60152 1005 54   3959            mlr       (pr,rl,x4),(pr,rl,x2),fill(digit_0)
    004174  aa   200000 000013    3960            desc9a    generic|0,x3
    004175  aa   500014 200013    3961            desc9a    work|flt_dec_generic(1),x3

DBG(124362942)> CPU TRACE:     004171  aa  5 00154 7241 00   3957     lxl4      work|real.fraction.index      " index in source DL
DBG(124362942)> CPU TRACE: 00314:051543 4 500154724100 (LXL4 PR5|154) 500154 724(0) 1 0 0 00
DBG(124362942)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660344  readData=000001000003

index was 1

DBG(124362944)> CPU TRACE:     004172  aa  5 00154 2231 00   3958     ldx3      work|real.fraction.length     " length of source DU
DBG(124362944)> CPU TRACE: 00314:051544 4 500154223100 (LDX3 PR5|154) 500154 223(0) 1 0 0 00
DBG(124362944)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660344  readData=000001000003

length was 1

So the fractional part is "1". Hmm.

Back trace 66462644

DBG(124171966)> CPU TRACE: 00377:000346 4 040140100540 (MLR PR0|40140,F1) 040140 100(1) 0 0 0 00
DBG(124171966)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66604347  readData=500000000016
DBG(124171966)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66604350  readData=200004000017
DBG(124171966)> CPU TRACE: MLR special case #1
DBG(124171966)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66662502  readData=055061056060
DBG(124171966)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66462644 writeData=055061056060
DBG(124171966)> CPU REGDUMPAQI: A=000000000000 Q=007777000001 IR:~BAR Carry
DBG(124171966)> CPU REGDUMPFLT: E=000 A=000000000000 Q=007777000001 4.54636329e-13

Somewhere back up in pl1

create_token:+234

Confused.

Let's try from the other end. From the beginning, look for "-1.0" (055061056060)

DBG(124171586)> CPU TRACE: 00377:120512 4 040140100540 (MLR PR0|40140,F1) 040140 100(1) 0 0 0 00
DBG(124171586)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462636  readData=061056060000
DBG(124171586)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66662502  readData=055234400043
DBG(124171586)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66662502 writeData=055061400043
DBG(124171586)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66662502 writeData=055061056043
DBG(124171586)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66662502 writeData=055061056060

DBG(124353248)> CPU TRACE: 00314:051102 bound_library_wired_:any_to_any_+03530
DBG(124353248)> CPU TRACE:     003530  aa  0 00000 1645 40   3445     tct       (pr,rl)                       " find illegal or end
DBG(124353248)> CPU TRACE: 00314:051102 4 000000164540 (TCT PR0|0,F1) 000000 164(1) 0 0 0 00
DBG(124353248)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462644  readData=055061056060
DBG(124353248)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=000000000004

    003526                        3439  char.arith.save_len:
    003526  aa  5 00150 7551 00   3440            sta       work|original_source_length   " save for conversion error
                                  3441
                                  3442  " NOTE - Here it should be spri generic,work|generic_ptr, but ALM won't do it.
    003527  aa  5 00040 2521 00   3443            spri2     work|generic_ptr              " save string pointer
                                  3444
    003530  aa  0 00000 1645 40   3445            tct       (pr,rl)                       " find illegal or end
    003531  aa   200000 000005    3446            desc9a    generic|0,al
    003532  0a   004656 0000 00   3447            arg       error_table
    003533  aa  5 00006 0001 00   3448            arg       work|flt_bin_generic
    003534  0a   003540 6064 00   3449            ttn       char.arith.good_string

DBG(124353244)> CPU TRACE:     003526  aa  5 00150 7551 00   3440     sta       work|original_source_length   " save for conversion error
DBG(124353244)> CPU TRACE: 00314:051100 4 500150755100 (STA PR5|150) 500150 755(0) 1 0 0 00
DBG(124353244)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660340 writeData=000000000004

Source length 4; good.

    003540                        3457  char.arith.good_string:
    003540  aa  0 00000 1655 40   3458            tctr      (pr,rl)                       " rtrim (string)
    003541  aa   200000 000005    3459            desc9a    generic|0,al
    003542  0a   005114 0000 00   3460            arg       blank_skip
    003543  aa  5 00004 0001 00   3461            arg       work|fix_bin_generic
    003544  aa  5 00004 3351 00   3462            lca       work|fix_bin_generic          " - blanks
    003545  aa   000011 7750 00   3463            alr       9                             " sign extend
    003546  aa   000011 7310 00   3464            ars       9
    003547  aa  5 00150 0751 00   3465            ada       work|original_source_length   " length - blanks
    003550  0a   003771 6000 00   3466            tze       char.arith.zero               " all blank
                                  3467

DBG(124353260)> CPU TRACE: 00314:051121 4 500150075100 (ADA PR5|150) 500150 075(0) 1 0 0 00
DBG(124353260)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660340  readData=000000000004
DBG(124353260)> CPU REGDUMPAQI: A=000000000004 Q=000000000004 IR:~BAR OMASK

length - blanks = 4; good.

                                  3468  "     Start index at first non-whitespace.
                                  3469  "     Build token information into imaginary token.  Will move it later.
                                  3470
    003551  aa   000100 1004 00   3471            mlr       (),(pr),fill(000)             " init real token
    003552  aa   000000 000000    3472            zero
    003553  aa   500152 000030    3473            desc9a    work|real_token,token_length
    003554  aa   000100 1004 00   3474            mlr       (),(pr),fill(000)             " init imag token
    003555  aa   000000 000000    3475            zero
    003556  aa   500160 000030    3476            desc9a    work|imag_token,token_length
    003557  aa  0 00000 1645 40   3477            tct       (pr,rl)                       " skip over leading blanks
    003560  aa   200000 000005    3478            desc9a    generic|0,al
    003561  0a   005114 0000 00   3479            arg       blank_skip
    003562  aa  5 00004 0001 00   3480            arg       work|fix_bin_generic
    003563  aa  5 00004 5511 40   3481            stba      work|fix_bin_generic,40       " clear high byte blank count
    003564  aa  5 00004 1751 00   3482            sba       work|fix_bin_generic          " account for blanks
    003565  0a   003771 6044 00   3483            tmoz      char.arith.zero               " all blank - is 0.0

DBG(124353272)> CPU TRACE:     003564  aa  5 00004 1751 00   3482     sba       work|fix_bin_generic          " account for blanks
DBG(124353272)> CPU TRACE: 00314:051136 4 500004175100 (SBA PR5|4) 500004 175(0) 1 0 0 00
DBG(124353272)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660174  readData=000000000000
DBG(124353272)> CPU REGDUMPAQI: A=000000000004 Q=000000000004 IR:~BAR OMASK Carry

No leading blanks; good.

                                  3485  "     Not all character input was blank.  Start on real part.
                                  3486
    003566  aa  5 00004 2361 00   3487            ldq       work|fix_bin_generic          " initialize offset
    003567  0a   004334 7020 00   3488            tsx2      recognize                     " look for a number

    004334                        4112  recognize:
    004334  aa   000003 2270 03   4113            ldx7      fixdec,du                     " preset to fixed decimal
                                  4114
                                  4115  "     Check for sign.  Translate and test next character.
                                  4116
    004335  aa  0 00100 1605 06   4117            mvt       (pr,ql),(pr)                  " translate first character
    004336  aa   200000 000001    4118            desc9a    generic|0,1
    004337  aa   500012 000001    4119            desc9a    work|flt_bin_generic_exp,1
    004340  0a   005046 0000 00   4120            arg       translate_table
                                  4121
    004341  aa  0 01000 1065 00   4122            cmpc      (pr),(),fill(sign_class)      " test if in classification
    004342  aa   500012 000001    4123            desc9a    work|flt_bin_generic_exp,1
    004343  aa   000000 000000    4124            zero
    004344  0a   004353 6010 00   4125            tnz       recognize.no_sign
                                  4126
                                  4126
                                  4127  "     Note sign index and length of 1.
                                  4128
    004345  aa  5 00160 7561 00   4129            stq       work|imag.sign.index          " index in DL

DBG(124353288)> CPU TRACE: 00314:051717 bound_library_wired_:any_to_any_+04345
DBG(124353288)> CPU TRACE:     004345  aa  5 00160 7561 00   4129     stq       work|imag.sign.index          " index in DL
DBG(124353288)> CPU TRACE: 00314:051717 4 500160756100 (STQ PR5|160) 500160 756(0) 1 0 0 00
DBG(124353288)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660350 writeData=000000000000

sign index is 0; good;

    004346  aa   000001 2230 03   4130            ldx3      1,du
    004347  aa  5 00160 7431 00   4131            stx3      work|imag.sign.length         " length of 1
    004350  aa   000001 1750 07   4132            sba       1,dl                          " done one character
    004351  0a   006072 6044 00   4133            tmoz      error_202                     " error - no digits found
    004352  aa   000001 0760 07   4134            adq       1,dl                          " skip sign

DBG(124353298)> CPU TRACE:     004352  aa   000001 0760 07   4134     adq       1,dl                          " skip sign
DBG(124353298)> CPU TRACE: 00314:051724 4 000001076007 (ADQ 000001,DL) 000001 076(0) 0 0 0 07
DBG(124353298)> CPU REGDUMPAQI: A=000000000003 Q=000000000001 IR:~BAR OMASK

                                  4136  "     Check for integer part.
                                  4137
    004353                        4138  recognize.no_sign:
    004353  aa  0 00000 1645 46   4139            tct       (pr,rl,ql)                    " skip over string of digits
    004354  aa   200000 000005    4140            desc9a    generic|0,al
    004355  0a   005071 0000 00   4141            arg       digit_skip
    004356  aa  5 00004 0001 00   4142            arg       work|fix_bin_generic
    004357  aa  5 00004 7231 00   4143            lxl3      work|fix_bin_generic          " get number of digits found
    004360  0a   004401 6000 00   4144            tze       recognize.no_integer          " skip if none

DBG(124353302)> CPU TRACE:     004357  aa  5 00004 7231 00   4143     lxl3      work|fix_bin_generic          " get number of digits found
DBG(124353302)> CPU TRACE: 00314:051731 4 500004723100 (LXL3 PR5|4) 500004 723(0) 1 0 0 00
DBG(124353302)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660174  readData=777000000001

One digit found; good.

                                  4146  "     Note that a mantissa exists by leaving a non-zero X3, and clip the
                                  4147  "     leading 0's from it to remove them from significance checks.
                                  4148
    004361  aa   000000 6240 13   4149            eax4      0,x3                          " remember mantissa size
    004362  aa  0 00000 1645 46   4150            tct       (pr,rl,ql)                    " skip over leading 0's
    004363  aa   200000 000013    4151            desc9a    generic|0,x3
    004364  0a   005142 0000 00   4152            arg       zero_skip
    004365  aa  5 00006 0001 00   4153            arg       work|flt_bin_generic
    004366  aa  5 00006 7251 00   4154            lxl5      work|flt_bin_generic
    004367  aa  5 00006 7451 00   4155            stx5      work|flt_bin_generic          " move to upper
    004370  aa   000000 6250 06   4156            eax5      0,ql                          " setup index
    004371  aa  5 00006 1641 00   4157            sbx4      work|flt_bin_generic          " length of non-zero int
    004372  aa  5 00006 0651 00   4158            adx5      work|flt_bin_generic          " index of 1st non-zero

                                  4160  "     Store length of integer part, and its index.
                                  4161
    004373  aa  5 00161 4451 00   4162            sxl5      work|imag.integer.index       " significance index in DL
    004374  aa  5 00161 7441 00   4163            stx4      work|imag.integer.length      " length of sig string in DU
    004375  aa  5 00004 5511 40   4164            stba      work|fix_bin_generic,40       " clear upper byte
    004376  aa  5 00004 0761 00   4165            adq       work|fix_bin_generic          " move string index
    004377  aa  5 00004 1751 00   4166            sba       work|fix_bin_generic          " count all digits done
    004400  0a   004614 6044 00   4167            tmoz      recognize.no_more_input       " no chars left

                                  4169  "     Check for decimal point, or other situations.
                                  4170
    004401                        4171  recognize.no_integer:
    004401  aa  0 00100 1605 06   4172            mvt       (pr,ql),(pr)                  " translate terminator
    004402  aa   200000 000001    4173            desc9a    generic|0,1
    004403  aa   500004 200001    4174            desc9a    work|fix_bin_generic(1),1
    004404  0a   005046 0000 00   4175            arg       translate_table
    004405  aa  5 00004 2241 00   4176            ldx4      work|fix_bin_generic          " get character class
    004406  aa   000777 3640 03   4177            anx4      =o777,du                      " mask for it
    004407  0a   004410 7100 14   4178            tra       *+1,4
    004410  0a   006074 7100 00   4179            tra       error_203                     " illegal
    004411  0a   004615 7100 00   4180            tra       recognize.finish_up           " sign (start imag?)
    004412  0a   004421 7100 00   4181            tra       recognize.start_fractional    " period
    004413  0a   004562 7100 00   4182            tra       recognize.have_bin            " b
    004414  0a   004465 7100 00   4183            tra       recognize.start_exponent_flt  " d e
    004415  0a   004615 7100 00   4184            tra       recognize.finish_up           " i
    004416  0a   004615 7100 00   4185            tra       recognize.finish_up           " blank
    004417  aa   000000 000000    4186            zero      0                             " digit (can't happen)
    004420  0a   004466 7100 00   4187            tra       recognize.start_scaled_fix    " f

DBG(124353332)> CPU TRACE:     004401  aa  0 00100 1605 06   4172     mvt       (pr,ql),(pr)                  " translate terminator
DBG(124353332)> CPU TRACE: 00314:051753 4 000100160506 (MVT PR0|100,QL) 000100 160(1) 0 0 0 00
DBG(124353332)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462644  readData=055061056060
DBG(124353332)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660174  readData=000000000001
DBG(124353332)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660174 writeData=000002000001

DBG(124353340)> CPU TRACE: 00314:051764 bound_library_wired_:any_to_any_+04412
DBG(124353340)> CPU TRACE:     004412  0a   004421 7100 00   4181     tra       recognize.start_fractional    " period

Found the "."; good.

    004421                        4191  recognize.start_fractional:
    004421  aa   000001 0760 07   4192            adq       1,dl                          " account for .
    004422  aa   000001 1750 07   4193            sba       1,dl
    004423  0a   004430 6054 00   4194            tpnz      recognize.scan_fraction       " fractional digits

                                  4200  "     Find limits of fractional digits.
                                  4201
    004430                        4202  recognize.scan_fraction:
    004430  aa  0 00000 1645 46   4203            tct       (pr,rl,ql)                    " skip over string of digits
    004431  aa   200000 000005    4204            desc9a    generic|0,al
    004432  0a   005071 0000 00   4205            arg       digit_skip
    004433  aa  5 00004 0001 00   4206            arg       work|fix_bin_generic
    004434  aa  5 00004 7251 00   4207            lxl5      work|fix_bin_generic          " get number of digits
    004435  0a   004445 6000 00   4208            tze       recognize.no_fraction

DBG(124353348)> CPU TRACE:     004430  aa  0 00000 1645 46   4203     tct       (pr,rl,ql)                    " skip over string of digits
DBG(124353348)> CPU TRACE: 00314:052002 4 000000164546 (TCT PR0|0,F2) 000000 164(1) 0 0 0 00
DBG(124353348)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660174 writeData=000000000001

Fraction is one digit long; good.

    004436  aa  5 00162 7561 00   4212            stq       work|imag.fraction.index      " save index in DL
    004437  aa  5 00162 7451 00   4213            stx5      work|imag.fraction.length     " save length in DU
    004440  aa  5 00162 0631 00   4214            adx3      work|imag.fraction.length     " form total precision
    004441  aa  5 00004 5521 40   4215            stbq      work|fix_bin_generic,40       " clear high byte digit count
    004442  aa  5 00004 0761 00   4216            adq       work|fix_bin_generic          " account for digits
    004443  aa  5 00004 1751 00   4217            sba       work|fix_bin_generic
    004444  0a   004614 6044 00   4218            tmoz      recognize.no_more_input       " exit if end reached

    004614                        4361  recognize.no_more_input:
    004614  aa   000006 2240 03   4362            ldx4      blank_class,du                " presume ended on blank
    004615                        4363  recognize.finish_up:                              " accept terminator found
    004615  aa  5 00161 2231 00   4364            ldx3      work|imag.integer.length      " for digit count
    004616  aa  5 00162 0631 00   4365            adx3      work|imag.fraction.length
    004617  aa  5 00164 7471 00   4366            stx7      work|imag.type                " save internal type code
    004620  aa  5 00164 4441 00   4367            sxl4      work|imag.term                " save termination character
    004621  aa  5 00161 2231 00   4368            ldx3      work|imag.integer.length      " form precision
    004622  aa  5 00162 0631 00   4369            adx3      work|imag.fraction.length
    004623  aa  5 00165 4431 00   4370            sxl3      work|imag.prec                " save in DL
    004624  aa  5 00162 2241 00   4371            ldx4      work|imag.fraction.length
    004625  aa  5 00165 7441 00   4372            stx4      work|imag.scale               " save scale in DU

DBG(124353374)> CPU TRACE: 00314:052171 bound_library_wired_:any_to_any_+04617
DBG(124353374)> CPU TRACE:     004617  aa  5 00164 7471 00   4366     stx7      work|imag.type                " save internal type code
DBG(124353374)> CPU TRACE: 00314:052171 4 500164747100 (STX7 PR5|164) 500164 747(0) 1 0 0 00
DBG(124353374)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660354  readData=000000000000
DBG(124353374)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660354 writeData=000003000000

imag.type = 3

DBG(124353376)> CPU TRACE:     004620  aa  5 00164 4441 00   4367     sxl4      work|imag.term                " save termination character
DBG(124353376)> CPU TRACE: 00314:052172 4 500164444100 (SXL4 PR5|164) 500164 444(0) 1 0 0 00
DBG(124353376)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660354  readData=000003000000
DBG(124353376)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660354 writeData=000003000006

imag.term = 4

DBG(124353382)> CPU TRACE:     004623  aa  5 00165 4431 00   4370     sxl3      work|imag.prec                " save in DL
DBG(124353382)> CPU TRACE: 00314:052175 4 500165443100 (SXL3 PR5|165) 500165 443(0) 1 0 0 00
DBG(124353382)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660355  readData=000000000000
DBG(124353382)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660355 writeData=000000000002

imag.prec = 2

DBG(124353386)> CPU TRACE:     004625  aa  5 00165 7441 00   4372     stx4      work|imag.scale               " save scale in DU
DBG(124353386)> CPU TRACE: 00314:052177 4 500165744100 (STX4 PR5|165) 500165 744(0) 1 0 0 00
DBG(124353386)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660355  readData=000000000002
DBG(124353386)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660355 writeData=000001000002

imag.scale = 1

                                  4374  "     Scaled fixed numbers should have the scale corrected for any exponent
                                  4375  "     which may have been specified.
                                  4376
    004626  aa   000001 1070 03   4377            cmpx7     fixbin,du
    004627  0a   004632 6000 00   4378            tze       recognize.fix_scale           " fixup scale from exp
    004630  aa   000003 1070 03   4379            cmpx7     fixdec,du
    004631  aa   000000 6010 12   4380            tnz       0,2                           " not a fixed type
                                  4381
    004632                        4382  recognize.fix_scale:
    004632  aa  5 00163 2241 00   4383            ldx4      work|imag.exponent.value      " load upper part
    004633  0a   004637 6000 00   4384            tze       recognize.finish_scale        " okay if clear

    004637                        4389  recognize.finish_scale:
    004637  aa  5 00163 7241 00   4390            lxl4      work|imag.exponent.value      " get exponent
    004640  aa  5 00165 1641 00   4391            sbx4      work|imag.scale               " -scale
    004641  0a   004650 6040 00   4392            tmi       recognize.scale_pos           " negative scale

    004650                        4400  recognize.scale_pos:
    004650  aa   777777 6640 03   4401            erx4      =o777777,du                   " complement
    004651  aa   000001 0640 03   4402            adx4      1,du                          " add one
    004652  aa   000177 1040 03   4403            cmpx4     max_scale,du
    004653  0a   006106 6054 00   4404            tpnz      error_208                     " scale too big
    004654  aa  5 00165 7441 00   4405            stx4      work|imag.scale               " save scale

DBG(124353414)> CPU TRACE:     004654  aa  5 00165 7441 00   4405     stx4      work|imag.scale               " save scale
DBG(124353414)> CPU TRACE: 00314:052226 4 500165744100 (STX4 PR5|165) 500165 744(0) 1 0 0 00
DBG(124353414)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660355  readData=000001000002
DBG(124353414)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660355 writeData=000001000002

imag.scale = 1

    004655  aa   000000 7100 12   4406            tra       0,2                           " return

    003570  aa  0 00100 1005 00   3489            mlr       (pr),(pr)                     " move imag to real
    003571  aa   500160 000030    3490            desc9a    work|imag_token,token_length
    003572  aa   500152 000030    3491            desc9a    work|real_token,token_length
    003573  aa   000000 1150 07   3492            cmpa      0,dl                          " did we reach end of input
    003574  0a   003577 6054 00   3493            tpnz      char.arith.more_input         " continue
    003575  aa  5 00164 4501 00   3494            stz       work|imag.type                " indicate no imaginary
    003576  0a   003643 7100 00   3495            tra       char.arith.end_of_input

                                  3561  "     From token list, form the generic input, using char.flt_dec_generic.
                                  3562
    003643                        3563  char.arith.end_of_input:                          " Set dominant conversion type.
    003643  aa   000000 6260 16   3564            eax6      0,x6                          " target of opportunity
    003644  0a   003730 6010 00   3565            tnz       char.arith.supplied
                                  3566
    003645  aa  5 00156 2271 00   3567            ldx7      work|real.type

DBG(124353432)> CPU TRACE:     003645  aa  5 00156 2271 00   3567     ldx7      work|real.type
DBG(124353432)> CPU TRACE: 00314:051217 4 500156227100 (LDX7 PR5|156) 500156 227(0) 1 0 0 00
DBG(124353432)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660346  readData=000003000006

real.type = 3

    003646  aa  5 00164 2211 00   3568            ldx1      work|imag.type

DBG(124353434)> CPU TRACE:     003646  aa  5 00164 2211 00   3568     ldx1      work|imag.type
DBG(124353434)> CPU TRACE: 00314:051220 4 500164221100 (LDX1 PR5|164) 500164 221(0) 1 0 0 00
DBG(124353434)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660354  readData=000000000000

imag.type = 0

    003647  0a   003776 3520 37   3569            epp       generic,dominant_type,x7*     " select imaginary table
    003650  aa  2 00000 2271 11   3570            ldx7      generic|0,x1                  " get dominant type
    003651  aa  2 00000 7221 11   3571            lxl2      generic|0,x1                  " get precision routine

                                  3573  "     If we alter the precision and scale, for a decimal to binary conversion.
                                  3574  "     The precision will appear in AL, and the scale in X5.  We indicate the
                                  3575  "     modified scale/precision tokenlist word by X3 as an offset in the
                                  3576  "     work area.
                                  3577
    003652  aa   000000 2350 07   3578            lda       0,dl                          " preset precision
    003653  aa   000000 2250 03   3579            ldx5      0,du                          " preset scale
    003654  aa   000000 2230 03   3580            ldx3      0,du                          " preset token prec/scale mod
    003655  aa   000000 7100 12   3581            tra       0,x2                          " manage precision

                                  3631  "     Take precisions as is:  From dominant, process precision and scale.
                                  3632
    003710                        3633  as_is:
    003710  aa   000000 6240 17   3634            eax4      0,x7                          " save type
    003711  0a   004111 7160 17   3635            xec       calculate_precision,x7        " target_precision

DBG(124353454)> CPU TRACE:     003711  0a   004111 7160 17   3635     xec       calculate_precision,x7        " target_precision
DBG(124353454)> CPU TRACE: 00314:051263 4 051412701000 (TSX1 051412) 051412 701(0) 0 0 0 00

                                  3803  "^LCompute precision and scale of final result
                                  3804
                                  3805  "     scale = max(real_scale,imag_scale)
                                  3806  "     precision = scale + max(real_prec-real_scale, imag_prec-imag_scale)
                                  3807  "
                                  3808  "     Result left in source_scale and source_precision fields in work area.
                                  3809
                                  3810
    004040                        3811  fixed_prec_and_scale:
    004040  aa  5 00164 2221 00   3812            ldx2      work|imag.type                " take real if no imag
    004041  0a   004065 6000 00   3813            tze       fixed_prec_and_scale.real

    004065                        3837  fixed_prec_and_scale.real:
    004065  aa  5 00157 2351 00   3838            lda       work|real.prec
    004066  aa  5 00000 7551 00   3839            sta       work|target_precision
    004067  aa   777777 3750 07   3840            ana       =o777777,dl                   " mask for precision
    004070  aa   000000 6054 11   3841            tpnz      0,x1

    003712  aa  5 00164 2251 00   3636            ldx5      work|imag.type                " determine if complex
    003713  0a   003715 6000 00   3637            tze       char.arith.real_type

    003715                        3639  char.arith.real_type:                             " set type of source
    003715  0a   004027 2260 14   3640            ldx6      final_type,x4                 " presume short
    003716  aa  5 00000 2251 00   3641            ldx5      work|target_precision
    003717  0a   004116 7160 17   3642            xec       calculate_type,x7             " compare to limit

DBG(124353478)> CPU TRACE:     003717  0a   004116 7160 17   3642     xec       calculate_type,x7             " compare to limit
DBG(124353478)> CPU TRACE: 00314:051271 4 000073105003 (CMPX5 000073,DU) 000073 105(0) 0 0 0 03

    003720  0a   003722 6044 00   3643            tmoz      char.arith.set_round          " within short

    003722                        3646  char.arith.set_round:
    003722  aa  5 00047 4501 00   3647            stz       work|save_rounding            " presume no round
    003723  0a   000376 2210 17   3648            ldx1      target_type_map,x7            " get default
    003724  aa   400000 3010 03   3649            canx1     round,du
    003725  0a   003730 6000 00   3650            tze       char.arith.supplied           " no round

                                  3654  "     Caller supplied target type and precision.  Convert input.
                                  3655
    003730                        3656  char.arith.supplied:
    003730  aa  5 00040 3521 20   3657            epp       generic,work|generic_ptr,*    " get ptr to source
    003731  0a   004123 7010 00   3658            tsx1      move_char_to_generic          " move and set scale/prec, type

    004123                        3904  move_char_to_generic:
    004123  aa  5 00156 2221 00   3905            ldx2      work|real.type
    004124  0a   004125 7100 12   3906            tra       *+1,x2

    004130  0a   004141 7100 00   3910            tra       char_to_generic.fixdec

    004141                        3922  char_to_generic.fixdec:
    004141                        3923  char_to_generic.fltdec:
    004141  aa  5 00001 4501 00   3924            stz       work|source_scale             " kill the scale
    004142  aa   000246 2270 03   3925            ldx7      real_flt_dec_generic*2,du     " set type of data moved to
    004143  aa  5 00153 2221 00   3926            ldx2      work|real.integer.length      " get precision (DU)
    004144  aa  5 00154 0621 00   3927            adx2      work|real.fraction.length
    004145  0a   004132 6044 00   3928            tmoz      char_to_generic.zero_dec      " default to 0.0
    004146  aa   000073 1020 03   3929            cmpx2     max_p_dec,du                  " see if too many digits
    004147  0a   006120 6054 00   3930            tpnz      error_218
    004150  aa  5 00001 4421 00   3931            sxl2      work|source_precision         " save precision
    004151  aa  5 00154 2351 00   3932            lda       work|real.fraction.length     " get fractional length
    004152  aa   000022 7310 00   3933            ars       18
    004153  aa  5 00155 1551 00   3934            ssa       work|real.exponent.value      " form fraction - exponent
    004154  aa  5 00155 3351 00   3935            lca       work|real.exponent.value      " save generic's exponent
    004155  aa  5 00013 7551 00   3936            sta       work|flt_dec_generic_exp

                                  3938  "     Move in sign.
                                  3939
    004156  aa  5 00152 2221 00   3940            ldx2      work|real.sign.length         " length in DU
    004157  aa  5 00152 7231 00   3941            lxl3      work|real.sign.index          " index in DL
    004160  aa   000001 2240 03   3942            ldx4      1,du                          " move 1 char
    004161  aa  0 53140 1005 53   3943            mlr       (pr,rl,x3),(pr,rl),fill(plus_sign)
    004162  aa   200000 000012    3944            desc9a    generic|0,x2                  " fills "+" if no sign
    004163  aa   500014 000014    3945            desc9a    work|flt_dec_generic,x4

DBG(124353532)> CPU TRACE:     004161  aa  0 53140 1005 53   3943     mlr       (pr,rl,x3),(pr,rl),fill(plus_sign)
DBG(124353532)> CPU TRACE: 00314:051533 4 053140100553 (MLR PR0|53140,AD) 053140 100(1) 0 0 0 00
DBG(124353532)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055337400043

"-"; good.

                                  3947  "     Move integer part.
                                  3948
    004164  aa  5 00153 2221 00   3949            ldx2      work|real.integer.length      " length of source DU
    004165  aa  5 00153 7241 00   3950            lxl4      work|real.integer.index       " index in source DL
    004166  aa  0 60140 1005 54   3951            mlr       (pr,rl,x4),(pr,rl),fill(digit_0)
    004167  aa   200000 000012    3952            desc9a    generic|0,x2
    004170  aa   500014 200012    3953            desc9a    work|flt_dec_generic(1),x2

DBG(124353538)> CPU TRACE: 00314:051540 bound_library_wired_:any_to_any_+04166
DBG(124353538)> CPU TRACE:     004166  aa  0 60140 1005 54   3951     mlr       (pr,rl,x4),(pr,rl),fill(digit_0)
DBG(124353538)> CPU TRACE: 00314:051540 4 060140100554 (MLR PR0|60140,DI) 060140 100(1) 0 0 0 00
DBG(124353538)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061400043

"-1" good so far

                                  3955  "     Move fractional part.
                                  3956
    004171  aa  5 00154 7241 00   3957            lxl4      work|real.fraction.index      " index in source DL
    004172  aa  5 00154 2231 00   3958            ldx3      work|real.fraction.length     " length of source DU
    004173  aa  0 60152 1005 54   3959            mlr       (pr,rl,x4),(pr,rl,x2),fill(digit_0)
    004174  aa   200000 000013    3960            desc9a    generic|0,x3
    004175  aa   500014 200013    3961            desc9a    work|flt_dec_generic(1),x3

DBG(124353544)> CPU TRACE:     004173  aa  0 60152 1005 54   3959     mlr       (pr,rl,x4),(pr,rl,x2),fill(digit_0)
DBG(124353544)> CPU TRACE: 00314:051545 4 060152100554 (MLR PR0|60152,DI) 060152 100(1) 0 0 0 00
DBG(124353544)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060043

"-10"; okay; this makes sense now; the scale factor is the implied decimal point.

    004176  aa   000000 7100 11   3962            tra       0,x1                          " return for next section

    003732  aa  5 00047 2251 00   3659            ldx5      work|save_rounding
    003733  0a   003745 3734 00   3660            epp7      char.arith.real_return        " setup return
    003734  aa  5 00157 7231 00   3661            lxl3      work|real.prec                " setup float dec precision
    003735  aa   000002 6230 13   3662            eax3      2,x3                          " extend for sign and hard exp
    003736  aa  5 00156 2221 00   3663            ldx2      work|real.type                " get internal type
    003737  0a   003740 7100 12   3664            tra       *+1,x2                        " process generic

    003743  0a   002004 7100 00   3668            tra       flt_dec_generic_conversion

    002004                        1945  flt_dec_generic_conversion:
    002004  aa   000113 1004 00   1946            mlr       (),(pr,x3),fill(000)
    002005  aa   000000 000000    1947            zero                                    " put in a 0 value
    002006  aa   500013 600001    1948            desc9a    work|flt_dec_generic-1(3),1   " to the exponent

DBG(124353562)> CPU TRACE:     002004  aa   000113 1004 00   1946     mlr       (),(pr,x3),fill(000)
DBG(124353562)> CPU TRACE: 00314:047356 4 000113100400 (MLR 000113) 000113 100(1) 0 0 0 00
DBG(124353562)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060000

IIRC, the exponent is stored as a 9 bit binary byte at the end

    002007  0a   000376 2210 16   1950            ldx1      target_type_map,x6            " find target GENERIC
    002010  aa   000077 3610 03   1951            anx1      generic_mask,du               " mask for type
    002011  0a   002012 7100 31   1952            tra       flt_dec_generic_case,x1*

    005175                        4593  generic_to_target:
    005175  0a   000376 7210 16   4594            lxl1      target_type_map,x6
    005176  aa   000000 7100 11   4595            tra       0,x1                          " call for target conversion

    005607                        5003  put_fix_dec_9ls:
    005607                        5004  put_fix_dec_9ls_packed:
    005607  0a   005767 7020 00   5005            tsx2      load_flt_dec.target           " load for conversion

    005767                        5205  load_flt_dec.target:
    005767  aa  5 00000 2351 00   5206            lda       work|target_scale             " setup scale offset
    005770  aa   000022 7310 00   5207            ars       18
    005771  aa  5 00013 0751 00   5208            ada       work|flt_dec_generic_exp      " get exponent range
    005772  aa  5 00013 7551 00   5209            sta       work|flt_dec_generic_exp      " save for testing
    005773  aa   000034 7350 00   5210            als       36-8                          " fit to normal 8-bit
    005774  0a   006004 6030 00   5211            trc       load_flt_dec.range            " exponent won't fit
    005775  aa   000001 7710 00   5212            arl       1
    005776                        5213  load_flt_dec.range_continue:                      " re-enter with max neg exp
    005776  aa  5 00013 7551 00   5214            sta       work|flt_dec_generic_exp
    005777  aa  0 00113 1005 00   5215            mlr       (pr),(pr,x3)                  " plant true scaled exp
    006000  aa   500013 000001    5216            desc9a    work|flt_dec_generic_exp,1
    006001  aa   500013 600001    5217            desc9a    work|flt_dec_generic-1(3),1   " as hardware exponent

DBG(124353592)> CPU TRACE:     005777  aa  0 00113 1005 00   5215     mlr       (pr),(pr,x3)                  " plant true scaled exp
DBG(124353592)> CPU TRACE: 00314:053351 4 000113100500 (MLR PR0|113) 000113 100(1) 0 0 0 00
DBG(124353592)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060000

Hmm. exponent still 0.

    006002  aa  5 00000 7211 00   5218            lxl1      work|target_precision
    006003  aa   000000 7100 12   5219            tra       0,x2

    005610  aa   000001 6210 11   5006            eax1      1,x1                          " count in sign
    005611  0a   000104 7160 15   5007            xec       mvn.pr_rl.pr_rl,x5
    005612  aa   500014 000013    5008            desc9fl   work|flt_dec_generic,x3
    005613  aa   100000 010011    5009            desc9ls   target|0,x1

DBG(124353602)> CPU TRACE:     005611  0a   000104 7160 15   5007     xec       mvn.pr_rl.pr_rl,x5
DBG(124353602)> CPU TRACE: 00314:053163 4 000140300540 (MVN PR0|140,F1) 000140 300(1) 0 0 0 00
DBG(124353602)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77421164  readData=500014000013
DBG(124353602)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77421165  readData=100000010011
DBG(124353602)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000
DBG(124353602)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66663140  readData=000234400043
DBG(124353602)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66663140 writeData=055234400043
DBG(124353602)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66663140 writeData=055061400043
DBG(124353602)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66663140 writeData=055061060043

floating -> scaled fixed-point leading sign.

"-10" okay, as long as we remember to fix the scaling...

     005614  0a   006226 6170 00   5010            tov       size_error                    " did not fit
    005615  aa  1 00000 5005 11   5011            a9bd      target|0,x1                   " update target pointer
    005616  aa  7 00000 7101 00   5012            tra       pr7|0

    003745                        3671  char.arith.real_return:
    003745  aa   004000 6340 07   3672            ldi       mask_faults,dl                " clear for faults again
    003746  0a   000376 2210 16   3673            ldx1      target_type_map,x6            " get flag word for target
    003747  aa   200000 3010 03   3674            canx1     complex,du                    " complex?
    003750  0a   000056 6000 00   3675            tze       unmask_exit                   " real target, return

                                   460  "     Unmask faults for exit.
                                   461
    000056                         462  unmask_exit:
    000056  aa   000000 6340 07    463            ldi       unmask_faults,dl
    000057  aa  5 00002 2341 00    464            szn       work|original_source          " was stack extended?
    000060  0a   000066 6000 00    465            tze       exit.1
    000066                         476  exit.1:
    000066  aa  5 00000 2351 00    477            lda       work|target_precision         " scale (DU), precision (DL)

DBG(124353624)> CPU TRACE:     000066  aa  5 00000 2351 00    477     lda       work|target_precision         " scale (DU), precision (DL)
DBG(124353624)> CPU TRACE: 00314:045440 4 500000235100 (LDA PR5|0) 500000 235(0) 1 0 0 00
DBG(124353624)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660170  readData=000001000002
DBG(124353624)> CPU REGDUMPAQI: A=000001000002 Q=000000000004 IR:~BAR

scale = 1
precision = 2

Could be good.

    000067  aa   000000 6270 16    478            eax7      0,x6                          " source type used
    000070  aa  6 00046 7101 70    479            tra       sp|tbp,*x0                    " return to caller

and back to pl1.

Start searching for the leading sign version...

DBG(124362934)> CPU TRACE: 00314:051533 bound_library_wired_:any_to_any_+04161
DBG(124362934)> CPU TRACE:     004161  aa  0 53140 1005 53   3943     mlr       (pr,rl,x3),(pr,rl),fill(plus_sign)
DBG(124362934)> CPU TRACE: 00314:051533 4 053140100553 (MLR PR0|53140,AD) 053140 100(1) 0 0 0 00
DBG(124362934)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462644  readData=055061056060
DBG(124362934)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000
DBG(124362934)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060000

Entry to any_to_any_ here:

DBG(124362642)> CPU TRACE: 00314:045354 bound_library_wired_:any_to_any_+02
DBG(124362642)> CPU TRACE:     000002                         378  any_to_any_:
DBG(124362642)> CPU TRACE:     000002                         379  real_to_real_:
DBG(124362642)> CPU TRACE:     000002  aa   000000 6250 00    380     eax5      0                             " assume no rounding

DBG(124362650)> CPU TRACE:     000006                         385  any_to_any_round_:
DBG(124362650)> CPU TRACE:     000006                         386  real_to_real_round_:
DBG(124362650)> CPU TRACE:     000006  aa   000001 6250 00    387     eax5      1                             " round
DBG(124362650)> CPU TRACE: 00314:045360 4 000001625000 (EAX5 000001) 000001 625(0) 0 0 0 00

Rounding is set this time.

    001320                        1382  get_char:
    001320                        1383  get_char_packed:

Doing the string conversion again....

DBG(124362708)> CPU TRACE: 00314:051102 bound_library_wired_:any_to_any_+03530
DBG(124362708)> CPU TRACE:     003530  aa  0 00000 1645 40   3445     tct       (pr,rl)                       " find illegal or end
DBG(124362708)> CPU TRACE: 00314:051102 4 000000164540 (TCT PR0|0,F1) 000000 164(1) 0 0 0 00
DBG(124362708)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66462644  readData=055061056060

"-1.0". that's me.

DBG(124362962)> CPU TRACE:     003743  0a   002004 7100 00   3668     tra       flt_dec_generic_conversion
DBG(124362962)> CPU TRACE: 00314:051315 4 047356710000 (TRA 047356) 047356 710(0) 0 0 0 00

DBG(124362972)> CPU TRACE:     002106                        2072  flt_dec_to_flt_bin:
DBG(124362972)> CPU TRACE:     002106  aa  5 00001 7231 00   2073     lxl3      work|source_precision

DBG(124362974)> CPU TRACE:     002107  aa  0 00000 1645 40   2074     tct       (pr,rl)                       " count leading zeros
DBG(124362974)> CPU TRACE: 00314:047461 4 000000164540 (TCT PR0|0,F1) 000000 164(1) 0 0 0 00
DBG(124362974)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055061060000

"-10"

DBG(124362984)> CPU TRACE:     002117  aa  5 00013 2361 00   2084     ldq       work|flt_dec_generic_exp      " exponent in Q
DBG(124362984)> CPU TRACE: 00314:047471 4 500013236100 (LDQ PR5|13) 500013 236(0) 1 0 0 00
DBG(124362984)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660203  readData=777777777777
DBG(124362984)> CPU REGDUMPAQI: A=000000000177 Q=777777777777 IR:~BAR OMASK Carry Neg

-10*10^-1; good.

DBG(124362986)> CPU TRACE:     002120  aa   777777 6350 13   2085     eaa       -1,x3                         " precision
DBG(124362986)> CPU TRACE: 00314:047472 4 777777635013 (EAA 777777,3) 777777 635(0) 0 0 0 13
DBG(124362986)> CPU REGDUMPAQI: A=000001000000 Q=777777777777 IR:~BAR OMASK Carry

presicion of 1. hmm. shouldn't it be 2?

DBG(124363042)> CPU TRACE:     002220  aa  0 00113 1005 00   2189     mlr       (pr),(pr,x3)                  " move exponent
DBG(124363042)> CPU TRACE: 00314:047572 4 000113100500 (MLR PR0|113) 000113 100(1) 0 0 0 00
DBG(124363042)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055061060777

-10e-1  good.

DBG(124363044)> CPU TRACE:     002223  0a   000116 7160 15   2193     xec       mp3d.id.pr_rl.pr,x5 " up-scale mantissa ?round?
DBG(124363044)> CPU TRACE: 00314:047575 4 045470716015 (XEC 045470,5) 045470 716(0) 0 0 0 15
DBG(124363046)> CPU TRACE:     002223  0a   000116 7160 15   2193     xec       mp3d.id.pr_rl.pr,x5 " up-scale mantissa ?round?
DBG(124363046)> CPU TRACE: 00314:047575 4 100340226420 (MP3D 100340,N*) 100340 226(1) 0 0 0 00
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77417556  readData=054143070025 op2; 9bit ",c8<NAK>"
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416143  readData=131002225201 op1; 4bit "590295810358705651712" 
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416144  readData=003130160126
DBG(124363046)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77416145  readData=121161040000
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660204 writeData=055060060065     '-005'
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660205 writeData=071060062071     '9029'
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660206 writeData=065070061060     '5810'
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660207 writeData=063065070067     '3587'
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660210 writeData=060065066065     '0565'
DBG(124363046)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660211 writeData=061067061062     '1812'

    002223  0a   000116 7160 15   2193            xec       mp3d.id.pr_rl.pr,x5 " up-scale mantissa ?round?
    002224  0a   010077 0000 05   2194            arg       two_table,al
    002225  aa   500014 000013    2195            desc9fl   work|flt_dec_generic,x3
    002226  aa   500014 010030    2196            desc9ls   work|flt_dec_generic,24       " overlength for precision

DBG(124363044)> CPU REGDUMPAQI: A=000000000105 Q=000000000000 IR:~BAR OMASK Neg

105 seems kinda big...

    006571  aa  131 002 225 201   5-70  two_69:   ac4       "590295810358705651712"
    006572  aa  003 130 160 126
    006573  aa  121 161 040 000

Add some PRINTDECs:

op1:'590295810358705651712'
op2:'-1.0'
op3:'-590295810358705651712.0'

That's all good, assuming the AL of 0105 was what it wanted.

DBG(124363050)> CPU TRACE:     002237                        2214  flt_dec.flt_bin.up.enter:
DBG(124363050)> CPU TRACE:     002237  aa  0 00100 3055 00   2215     dtb       (pr),(pr)
DBG(124363050)> CPU TRACE: 00314:047611 4 000100305500 (DTB PR0|100) 000100 305(1) 0 0 0 00
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77425612  readData=500014010030
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=77425613  readData=500006000010
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660204  readData=055060060065
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660205  readData=071060062071
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660206  readData=065070061060
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660207  readData=063065070067
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660210  readData=060065066065
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660211  readData=061067061062
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660177  readData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660177 writeData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660177 writeData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660177 writeData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660177 writeData=000000000000
DBG(124363050)> CPU APPENDING: Read (Actual) Read:  iefpFinalAddress=66660176  readData=000004000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=000004000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=000004000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=000000000000
DBG(124363050)> CPU APPENDING: Write(Actual) Write: iefpFinalAddress=66660176 writeData=700000000000

dtb x -590295810358705651712
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License