-
Notifications
You must be signed in to change notification settings - Fork 9
/
FPMaths.asm
1623 lines (1475 loc) · 80.2 KB
/
FPMaths.asm
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;; MATHS ROUTINES
;;=============================================================================
;;
;;Limited documentation for these can be found at
;;https://www.cpcwiki.eu/index.php/BIOS_Function_Summary
;;=============================================================================
;; REAL: PI to DE
REAL_PI_to_DE: ;{{Addr=$2f73 Code Calls/jump count: 0 Data use count: 1}}
ld de,PI_const ;{{2f73:11782f}}
jr REAL_copy_atDE_to_atHL;{{2f76:1819}}
;;+
;;PI const
PI_const: ;{{Addr=$2f78 Data Calls/jump count: 0 Data use count: 1}}
defb $a2,$da,$0f,$49,$82 ; PI in floating point format 3.14159265
;;===========================================================================================
;; REAL: ONE to DE
REAL_ONE_to_DE: ;{{Addr=$2f7d Code Calls/jump count: 4 Data use count: 0}}
ld de,ONE_const ;{{2f7d:11822f}}
jr REAL_copy_atDE_to_atHL;{{2f80:180f}} (+&0f)
;;+
;;ONE const
ONE_const: ;{{Addr=$2f82 Data Calls/jump count: 0 Data use count: 2}}
defb $00,$00,$00,$00,$81 ; 1 in floating point format
;;===========================================================================================
;;REAL copy atHL to b10e swapped
REAL_copy_atHL_to_b10e_swapped: ;{{Addr=$2f87 Code Calls/jump count: 3 Data use count: 0}}
ex de,hl ;{{2f87:eb}}
;;= REAL move DE to b10e
REAL_move_DE_to_b10e: ;{{Addr=$2f88 Code Calls/jump count: 1 Data use count: 0}}
ld hl,internal_REAL_store_3;{{2f88:210eb1}}
jr REAL_copy_atDE_to_atHL;{{2f8b:1804}} (+&04)
;;---------------------------------------
;;REAL copy atHL to b104
_real_move_de_to_b10e_2: ;{{Addr=$2f8d Code Calls/jump count: 3 Data use count: 0}}
ld de,internal_REAL_store_1;{{2f8d:1104b1}}
;;= REAL copy atHL to atDE swapped
REAL_copy_atHL_to_atDE_swapped: ;{{Addr=$2f90 Code Calls/jump count: 2 Data use count: 0}}
ex de,hl ;{{2f90:eb}}
;;=---------------------------------------
;; REAL copy atDE to atHL
;; HL = points to address to write floating point number to
;; DE = points to address of a floating point number
REAL_copy_atDE_to_atHL: ;{{Addr=$2f91 Code Calls/jump count: 3 Data use count: 1}}
push hl ;{{2f91:e5}}
push de ;{{2f92:d5}}
push bc ;{{2f93:c5}}
ex de,hl ;{{2f94:eb}}
ld bc,$0005 ;{{2f95:010500}} ##LIT##;WARNING: Code area used as literal
ldir ;{{2f98:edb0}}
pop bc ;{{2f9a:c1}}
pop de ;{{2f9b:d1}}
pop hl ;{{2f9c:e1}}
scf ;{{2f9d:37}}
ret ;{{2f9e:c9}}
;;============================================================================================
;; REAL: INT to real
REAL_INT_to_real: ;{{Addr=$2f9f Code Calls/jump count: 2 Data use count: 1}}
push de ;{{2f9f:d5}}
push bc ;{{2fa0:c5}}
or $7f ;{{2fa1:f67f}}
ld b,a ;{{2fa3:47}}
xor a ;{{2fa4:af}}
ld (de),a ;{{2fa5:12}}
inc de ;{{2fa6:13}}
ld (de),a ;{{2fa7:12}}
inc de ;{{2fa8:13}}
ld c,$90 ;{{2fa9:0e90}}
or h ;{{2fab:b4}}
jr nz,_real_int_to_real_21;{{2fac:200d}} (+&0d)
ld c,a ;{{2fae:4f}}
or l ;{{2faf:b5}}
jr z,_real_int_to_real_23;{{2fb0:280d}} (+&0d)
ld l,h ;{{2fb2:6c}}
ld c,$88 ;{{2fb3:0e88}}
jr _real_int_to_real_21;{{2fb5:1804}} (+&04)
_real_int_to_real_18: ;{{Addr=$2fb7 Code Calls/jump count: 1 Data use count: 0}}
dec c ;{{2fb7:0d}}
sla l ;{{2fb8:cb25}}
adc a,a ;{{2fba:8f}}
_real_int_to_real_21: ;{{Addr=$2fbb Code Calls/jump count: 2 Data use count: 0}}
jp p,_real_int_to_real_18;{{2fbb:f2b72f}}
and b ;{{2fbe:a0}}
_real_int_to_real_23: ;{{Addr=$2fbf Code Calls/jump count: 1 Data use count: 0}}
ex de,hl ;{{2fbf:eb}}
ld (hl),e ;{{2fc0:73}}
inc hl ;{{2fc1:23}}
ld (hl),a ;{{2fc2:77}}
inc hl ;{{2fc3:23}}
ld (hl),c ;{{2fc4:71}}
pop bc ;{{2fc5:c1}}
pop hl ;{{2fc6:e1}}
ret ;{{2fc7:c9}}
;;============================================================================================
;; REAL: BIN to real
REAL_BIN_to_real: ;{{Addr=$2fc8 Code Calls/jump count: 0 Data use count: 1}}
push bc ;{{2fc8:c5}}
ld bc,$a000 ;{{2fc9:0100a0}}
call _real_5byte_to_real_1;{{2fcc:cdd32f}}
pop bc ;{{2fcf:c1}}
ret ;{{2fd0:c9}}
;;============================================================================================
;; REAL 5-byte to real
REAL_5byte_to_real: ;{{Addr=$2fd1 Code Calls/jump count: 0 Data use count: 1}}
ld b,$a8 ;{{2fd1:06a8}}
_real_5byte_to_real_1: ;{{Addr=$2fd3 Code Calls/jump count: 1 Data use count: 0}}
push de ;{{2fd3:d5}}
call Process_REAL_at_HL;{{2fd4:cd9c37}}
pop de ;{{2fd7:d1}}
ret ;{{2fd8:c9}}
;;============================================================================================
;; REAL to int
REAL_to_int: ;{{Addr=$2fd9 Code Calls/jump count: 1 Data use count: 1}}
push hl ;{{2fd9:e5}}
pop ix ;{{2fda:dde1}}
xor a ;{{2fdc:af}}
sub (ix+$04) ;{{2fdd:dd9604}}
jr z,_real_to_int_22 ;{{2fe0:281b}} (+&1b)
add a,$90 ;{{2fe2:c690}}
ret nc ;{{2fe4:d0}}
push de ;{{2fe5:d5}}
push bc ;{{2fe6:c5}}
add a,$10 ;{{2fe7:c610}}
call x373d_code ;{{2fe9:cd3d37}}
sla c ;{{2fec:cb21}}
adc hl,de ;{{2fee:ed5a}}
jr z,_real_to_int_20 ;{{2ff0:2808}} (+&08)
ld a,(ix+$03) ;{{2ff2:dd7e03}}
or a ;{{2ff5:b7}}
_real_to_int_16: ;{{Addr=$2ff6 Code Calls/jump count: 1 Data use count: 0}}
ccf ;{{2ff6:3f}}
pop bc ;{{2ff7:c1}}
pop de ;{{2ff8:d1}}
ret ;{{2ff9:c9}}
_real_to_int_20: ;{{Addr=$2ffa Code Calls/jump count: 1 Data use count: 0}}
sbc a,a ;{{2ffa:9f}}
jr _real_to_int_16 ;{{2ffb:18f9}} (-&07)
_real_to_int_22: ;{{Addr=$2ffd Code Calls/jump count: 1 Data use count: 0}}
ld l,a ;{{2ffd:6f}}
ld h,a ;{{2ffe:67}}
scf ;{{2fff:37}}
ret ;{{3000:c9}}
;;============================================================================================
;; REAL to bin
REAL_to_bin: ;{{Addr=$3001 Code Calls/jump count: 1 Data use count: 1}}
call REAL_fix ;{{3001:cd1430}}
ret nc ;{{3004:d0}}
ret p ;{{3005:f0}}
_real_to_bin_3: ;{{Addr=$3006 Code Calls/jump count: 1 Data use count: 0}}
push hl ;{{3006:e5}}
ld a,c ;{{3007:79}}
_real_to_bin_5: ;{{Addr=$3008 Code Calls/jump count: 1 Data use count: 0}}
inc (hl) ;{{3008:34}}
jr nz,_real_to_bin_12;{{3009:2006}} (+&06)
inc hl ;{{300b:23}}
dec a ;{{300c:3d}}
jr nz,_real_to_bin_5 ;{{300d:20f9}} (-&07)
inc (hl) ;{{300f:34}}
inc c ;{{3010:0c}}
_real_to_bin_12: ;{{Addr=$3011 Code Calls/jump count: 1 Data use count: 0}}
pop hl ;{{3011:e1}}
scf ;{{3012:37}}
ret ;{{3013:c9}}
;;============================================================================================
;; REAL fix
REAL_fix: ;{{Addr=$3014 Code Calls/jump count: 3 Data use count: 1}}
push hl ;{{3014:e5}}
push de ;{{3015:d5}}
push hl ;{{3016:e5}}
pop ix ;{{3017:dde1}}
xor a ;{{3019:af}}
sub (ix+$04) ;{{301a:dd9604}}
jr nz,_real_fix_13 ;{{301d:200a}} (+&0a)
ld b,$04 ;{{301f:0604}}
_real_fix_8: ;{{Addr=$3021 Code Calls/jump count: 1 Data use count: 0}}
ld (hl),a ;{{3021:77}}
inc hl ;{{3022:23}}
djnz _real_fix_8 ;{{3023:10fc}} (-&04)
ld c,$01 ;{{3025:0e01}}
jr _real_fix_45 ;{{3027:1828}} (+&28)
_real_fix_13: ;{{Addr=$3029 Code Calls/jump count: 1 Data use count: 0}}
add a,$a0 ;{{3029:c6a0}}
jr nc,_real_fix_46 ;{{302b:3025}} (+&25)
push hl ;{{302d:e5}}
call x373d_code ;{{302e:cd3d37}}
xor a ;{{3031:af}}
cp b ;{{3032:b8}}
adc a,a ;{{3033:8f}}
or c ;{{3034:b1}}
ld c,l ;{{3035:4d}}
ld b,h ;{{3036:44}}
pop hl ;{{3037:e1}}
ld (hl),c ;{{3038:71}}
inc hl ;{{3039:23}}
ld (hl),b ;{{303a:70}}
inc hl ;{{303b:23}}
ld (hl),e ;{{303c:73}}
inc hl ;{{303d:23}}
ld e,a ;{{303e:5f}}
ld a,(hl) ;{{303f:7e}}
ld (hl),d ;{{3040:72}}
and $80 ;{{3041:e680}}
ld b,a ;{{3043:47}}
ld c,$04 ;{{3044:0e04}}
xor a ;{{3046:af}}
_real_fix_37: ;{{Addr=$3047 Code Calls/jump count: 1 Data use count: 0}}
or (hl) ;{{3047:b6}}
jr nz,_real_fix_43 ;{{3048:2005}} (+&05)
dec hl ;{{304a:2b}}
dec c ;{{304b:0d}}
jr nz,_real_fix_37 ;{{304c:20f9}} (-&07)
inc c ;{{304e:0c}}
_real_fix_43: ;{{Addr=$304f Code Calls/jump count: 1 Data use count: 0}}
ld a,e ;{{304f:7b}}
or a ;{{3050:b7}}
_real_fix_45: ;{{Addr=$3051 Code Calls/jump count: 1 Data use count: 0}}
scf ;{{3051:37}}
_real_fix_46: ;{{Addr=$3052 Code Calls/jump count: 1 Data use count: 0}}
pop de ;{{3052:d1}}
pop hl ;{{3053:e1}}
ret ;{{3054:c9}}
;;============================================================================================
;; REAL int
REAL_int: ;{{Addr=$3055 Code Calls/jump count: 0 Data use count: 1}}
call REAL_fix ;{{3055:cd1430}}
ret nc ;{{3058:d0}}
ret z ;{{3059:c8}}
bit 7,b ;{{305a:cb78}}
ret z ;{{305c:c8}}
jr _real_to_bin_3 ;{{305d:18a7}} (-&59)
;;================================================================
;; REAL prepare for decimal
REAL_prepare_for_decimal: ;{{Addr=$305f Code Calls/jump count: 0 Data use count: 1}}
call REAL_SGN ;{{305f:cd2737}}
ld b,a ;{{3062:47}}
jr z,_real_prepare_for_decimal_55;{{3063:2852}} (+&52)
call m,_real_negate_2 ;{{3065:fc3437}}
push hl ;{{3068:e5}}
ld a,(ix+$04) ;{{3069:dd7e04}}
sub $80 ;{{306c:d680}}
ld e,a ;{{306e:5f}}
sbc a,a ;{{306f:9f}}
ld d,a ;{{3070:57}}
ld l,e ;{{3071:6b}}
ld h,d ;{{3072:62}}
add hl,hl ;{{3073:29}}
add hl,hl ;{{3074:29}}
add hl,hl ;{{3075:29}}
add hl,de ;{{3076:19}}
add hl,hl ;{{3077:29}}
add hl,de ;{{3078:19}}
add hl,hl ;{{3079:29}}
add hl,hl ;{{307a:29}}
add hl,de ;{{307b:19}}
ld a,h ;{{307c:7c}}
sub $09 ;{{307d:d609}}
ld c,a ;{{307f:4f}}
pop hl ;{{3080:e1}}
push bc ;{{3081:c5}}
call nz,_real_exp_a_2 ;{{3082:c4c830}}
_real_prepare_for_decimal_27: ;{{Addr=$3085 Code Calls/jump count: 1 Data use count: 0}}
ld de,Jumpblock_BD76_constant_a;{{3085:11bc30}}
call _real_compare_2 ;{{3088:cde236}}
jr nc,_real_prepare_for_decimal_36;{{308b:300b}} (+&0b)
ld de,powers_of_10_constants;{{308d:11f530}} start of power's of ten
call REAL_multiplication;{{3090:cd7735}}
pop de ;{{3093:d1}}
dec e ;{{3094:1d}}
push de ;{{3095:d5}}
jr _real_prepare_for_decimal_27;{{3096:18ed}} (-&13)
_real_prepare_for_decimal_36: ;{{Addr=$3098 Code Calls/jump count: 2 Data use count: 0}}
ld de,Jumpblock_BD76_constant_b;{{3098:11c130}}
call _real_compare_2 ;{{309b:cde236}}
jr c,_real_prepare_for_decimal_45;{{309e:380b}} (+&0b)
ld de,powers_of_10_constants;{{30a0:11f530}} start of power's of ten
call REAL_division ;{{30a3:cd0436}}
pop de ;{{30a6:d1}}
inc e ;{{30a7:1c}}
push de ;{{30a8:d5}}
jr _real_prepare_for_decimal_36;{{30a9:18ed}} (-&13)
_real_prepare_for_decimal_45: ;{{Addr=$30ab Code Calls/jump count: 1 Data use count: 0}}
call REAL_to_bin ;{{30ab:cd0130}}
ld a,c ;{{30ae:79}}
pop de ;{{30af:d1}}
ld b,d ;{{30b0:42}}
dec a ;{{30b1:3d}}
add a,l ;{{30b2:85}}
ld l,a ;{{30b3:6f}}
ret nc ;{{30b4:d0}}
inc h ;{{30b5:24}}
ret ;{{30b6:c9}}
_real_prepare_for_decimal_55: ;{{Addr=$30b7 Code Calls/jump count: 1 Data use count: 0}}
ld e,a ;{{30b7:5f}}
ld (hl),a ;{{30b8:77}}
ld c,$01 ;{{30b9:0e01}}
ret ;{{30bb:c9}}
;;=Jumpblock BD76 constant a
Jumpblock_BD76_constant_a: ;{{Addr=$30bc Data Calls/jump count: 0 Data use count: 1}}
defb $f0,$1f,$bc,$3e,$96 ;3124999.98
;;=Jumpblock BD76 constant b
Jumpblock_BD76_constant_b: ;{{Addr=$30c1 Data Calls/jump count: 0 Data use count: 1}}
defb $fe,$27,$6b,$6e,$9e ;Manual fix (corrected to data from a ROM dump) 1e+09
;30c1 defb &fe,&27,&7b,&6e,&9e ;(original line from disassembly listing) 1.00026e+09
;;============================================================================================
;; REAL exp A
REAL_exp_A: ;{{Addr=$30c6 Code Calls/jump count: 0 Data use count: 1}}
cpl ;{{30c6:2f}}
inc a ;{{30c7:3c}}
_real_exp_a_2: ;{{Addr=$30c8 Code Calls/jump count: 1 Data use count: 0}}
or a ;{{30c8:b7}}
scf ;{{30c9:37}}
ret z ;{{30ca:c8}}
ld c,a ;{{30cb:4f}}
jp p,_real_exp_a_9 ;{{30cc:f2d130}}
cpl ;{{30cf:2f}}
inc a ;{{30d0:3c}}
_real_exp_a_9: ;{{Addr=$30d1 Code Calls/jump count: 2 Data use count: 0}}
ld de,_powers_of_10_constants_12;{{30d1:113131}}
sub $0d ;{{30d4:d60d}}
jr z,_real_exp_a_28 ;{{30d6:2815}} (+&15)
jr c,_real_exp_a_19 ;{{30d8:3809}} (+&09)
push bc ;{{30da:c5}}
push af ;{{30db:f5}}
call _real_exp_a_28 ;{{30dc:cded30}}
pop af ;{{30df:f1}}
pop bc ;{{30e0:c1}}
jr _real_exp_a_9 ;{{30e1:18ee}} (-&12)
_real_exp_a_19: ;{{Addr=$30e3 Code Calls/jump count: 1 Data use count: 0}}
ld b,a ;{{30e3:47}}
add a,a ;{{30e4:87}}
add a,a ;{{30e5:87}}
add a,b ;{{30e6:80}}
add a,e ;{{30e7:83}}
ld e,a ;{{30e8:5f}}
ld a,$ff ;{{30e9:3eff}}
adc a,d ;{{30eb:8a}}
ld d,a ;{{30ec:57}}
_real_exp_a_28: ;{{Addr=$30ed Code Calls/jump count: 2 Data use count: 0}}
ld a,c ;{{30ed:79}}
or a ;{{30ee:b7}}
jp p,REAL_division ;{{30ef:f20436}}
jp REAL_multiplication;{{30f2:c37735}}
;;===========================================================================================
;; power's of 10 constants
;; in internal floating point representation
;;
powers_of_10_constants: ;{{Addr=$30f5 Data Calls/jump count: 0 Data use count: 2}}
defb $00,$00,$00,$20,$84 ; 10 (10^1) (Data corrected to match that from a ROM dump) 10
;30f5 defb &00,&00,&00,&00,&84 ;; 10 (10^1) (Original line from disassembly) 8
defb $00,$00,$00,$48,$87 ; 100 (10^2) 100
defb $00,$00,$00,$7A,$8A ; 1000 (10^3) 1000
defb $00,$00,$40,$1c,$8e ; 10000 (10^4) (1E+4) 10000
defb $00,$00,$50,$43,$91 ; 100000 (10^5) (1E+5) 100000
defb $00,$00,$24,$74,$94 ; 1000000 (10^6) (1E+6) 1000000
defb $00,$80,$96,$18,$98 ; 10000000 (10^7) (1E+7) 10000000
defb $00,$20,$bc,$3e,$9b ; 100000000 (10^8) (1E+8) 100000000
defb $00,$28,$6b,$6e,$9e ; 1000000000 (10^9) (1E+9) 1e+09
defb $00,$f9,$02,$15,$a2 ; 10000000000 (10^10) (1E+10) 1e+10
defb $40,$b7,$43,$3a,$a5 ; 100000000000 (10^11) (1E+11) 1e+11
defb $10,$a5,$d4,$68,$a8 ; 1000000000000 (10^12) (1E+12) 1e+12
_powers_of_10_constants_12: ;{{Addr=$3131 Data Calls/jump count: 0 Data use count: 1}}
defb $2a,$e7,$84,$11,$ac ; 10000000000000 (10^13) (1E+13) 1e+13
;;===========================================================================================
;; REAL init random number generator
;;Called (only) at start of BASIC ROM and at start of RANDOMIZE seed (below).
;;The data locations appear to store the last random number generated.
;;Possibly initialise/reset of random number generator?
REAL_init_random_number_generator:;{{Addr=$3136 Code Calls/jump count: 1 Data use count: 1}}
ld hl,$8965 ;{{3136:216589}}
ld (last_random_number),hl;{{3139:2202b1}}
ld hl,$6c07 ;{{313c:21076c}}
ld (C6_last_random_number),hl;{{313f:2200b1}}
ret ;{{3142:c9}}
;;============================================================================================
;; REAL: RANDOMIZE seed
REAL_RANDOMIZE_seed: ;{{Addr=$3143 Code Calls/jump count: 0 Data use count: 1}}
ex de,hl ;{{3143:eb}}
call REAL_init_random_number_generator;{{3144:cd3631}}
ex de,hl ;{{3147:eb}}
call REAL_SGN ;{{3148:cd2737}}
ret z ;{{314b:c8}}
ld de,C6_last_random_number;{{314c:1100b1}}
ld b,$04 ;{{314f:0604}}
_real_randomize_seed_7: ;{{Addr=$3151 Code Calls/jump count: 1 Data use count: 0}}
ld a,(de) ;{{3151:1a}}
xor (hl) ;{{3152:ae}}
ld (de),a ;{{3153:12}}
inc de ;{{3154:13}}
inc hl ;{{3155:23}}
djnz _real_randomize_seed_7;{{3156:10f9}} (-&07)
ret ;{{3158:c9}}
;;============================================================================================
;; REAL rnd
REAL_rnd: ;{{Addr=$3159 Code Calls/jump count: 0 Data use count: 1}}
push hl ;{{3159:e5}}
ld hl,(last_random_number);{{315a:2a02b1}}
ld bc,$6c07 ;{{315d:01076c}}
call _real_rnd0_7 ;{{3160:cd9c31}}
push hl ;{{3163:e5}}
ld hl,(C6_last_random_number);{{3164:2a00b1}}
ld bc,$8965 ;{{3167:016589}}
call _real_rnd0_7 ;{{316a:cd9c31}}
push de ;{{316d:d5}}
push hl ;{{316e:e5}}
ld hl,(last_random_number);{{316f:2a02b1}}
call _real_rnd0_7 ;{{3172:cd9c31}}
ex (sp),hl ;{{3175:e3}}
add hl,bc ;{{3176:09}}
ld (C6_last_random_number),hl;{{3177:2200b1}}
pop hl ;{{317a:e1}}
ld bc,$6c07 ;{{317b:01076c}}
adc hl,bc ;{{317e:ed4a}}
pop bc ;{{3180:c1}}
add hl,bc ;{{3181:09}}
pop bc ;{{3182:c1}}
add hl,bc ;{{3183:09}}
ld (last_random_number),hl;{{3184:2202b1}}
pop hl ;{{3187:e1}}
;;============================================================================================
;; REAL rnd0
REAL_rnd0: ;{{Addr=$3188 Code Calls/jump count: 0 Data use count: 1}}
push hl ;{{3188:e5}}
pop ix ;{{3189:dde1}}
ld hl,(C6_last_random_number);{{318b:2a00b1}}
ld de,(last_random_number);{{318e:ed5b02b1}}
ld bc,$0000 ;{{3192:010000}} ##LIT##;WARNING: Code area used as literal
ld (ix+$04),$80 ;{{3195:dd360480}}
jp _process_real_at_hl_13;{{3199:c3ac37}}
_real_rnd0_7: ;{{Addr=$319c Code Calls/jump count: 3 Data use count: 0}}
ex de,hl ;{{319c:eb}}
ld hl,$0000 ;{{319d:210000}} ##LIT##;WARNING: Code area used as literal
ld a,$11 ;{{31a0:3e11}}
_real_rnd0_10: ;{{Addr=$31a2 Code Calls/jump count: 3 Data use count: 0}}
dec a ;{{31a2:3d}}
ret z ;{{31a3:c8}}
add hl,hl ;{{31a4:29}}
rl e ;{{31a5:cb13}}
rl d ;{{31a7:cb12}}
jr nc,_real_rnd0_10 ;{{31a9:30f7}} (-&09)
add hl,bc ;{{31ab:09}}
jr nc,_real_rnd0_10 ;{{31ac:30f4}} (-&0c)
inc de ;{{31ae:13}}
jr _real_rnd0_10 ;{{31af:18f1}} (-&0f)
;;============================================================================================
;; REAL log10
REAL_log10: ;{{Addr=$31b1 Code Calls/jump count: 0 Data use count: 1}}
ld de,const_0301029996;{{31b1:112a32}}
jr _real_log_1 ;{{31b4:1803}} (+&03)
;;============================================================================================
;; REAL log
REAL_log: ;{{Addr=$31b6 Code Calls/jump count: 1 Data use count: 1}}
ld de,const_0693147181;{{31b6:112532}}
_real_log_1: ;{{Addr=$31b9 Code Calls/jump count: 1 Data use count: 0}}
call REAL_SGN ;{{31b9:cd2737}}
dec a ;{{31bc:3d}}
cp $01 ;{{31bd:fe01}}
ret nc ;{{31bf:d0}}
push de ;{{31c0:d5}}
call _real_division_121;{{31c1:cdd336}}
push af ;{{31c4:f5}}
ld (ix+$04),$80 ;{{31c5:dd360480}}
ld de,const_0707106781;{{31c9:112032}}
call REAL_compare ;{{31cc:cddf36}}
jr nc,_real_log_16 ;{{31cf:3006}} (+&06)
inc (ix+$04) ;{{31d1:dd3404}}
pop af ;{{31d4:f1}}
dec a ;{{31d5:3d}}
push af ;{{31d6:f5}}
_real_log_16: ;{{Addr=$31d7 Code Calls/jump count: 1 Data use count: 0}}
call REAL_copy_atHL_to_b10e_swapped;{{31d7:cd872f}}
push de ;{{31da:d5}}
ld de,ONE_const ;{{31db:11822f}}
push de ;{{31de:d5}}
call REAL_addition ;{{31df:cda234}}
pop de ;{{31e2:d1}}
ex (sp),hl ;{{31e3:e3}}
call x349a_code ;{{31e4:cd9a34}}
pop de ;{{31e7:d1}}
call REAL_division ;{{31e8:cd0436}}
call process_inline_parameters;{{31eb:cd4034}} Code takes inline parameter block
;Inline parameter block
defb $04 ;Parameter count
defb $4c,$4b,$57,$5e,$7f ; 0.434259751
defb $0d,$08,$9b,$13,$80 ; 0.576584342
defb $23,$93,$38,$76,$80 ; 0.961800762
defb $20,$3b,$aa,$38,$82 ; 2.88539007
;Return address
push de ;{{3203:d5}}
call REAL_multiplication;{{3204:cd7735}}
pop de ;{{3207:d1}}
ex (sp),hl ;{{3208:e3}}
ld a,h ;{{3209:7c}}
or a ;{{320a:b7}}
jp p,_real_log_41 ;{{320b:f21032}}
cpl ;{{320e:2f}}
inc a ;{{320f:3c}}
_real_log_41: ;{{Addr=$3210 Code Calls/jump count: 1 Data use count: 0}}
ld l,a ;{{3210:6f}}
ld a,h ;{{3211:7c}}
ld h,$00 ;{{3212:2600}}
call REAL_INT_to_real ;{{3214:cd9f2f}}
ex de,hl ;{{3217:eb}}
pop hl ;{{3218:e1}}
call REAL_addition ;{{3219:cda234}}
pop de ;{{321c:d1}}
jp REAL_multiplication;{{321d:c37735}}
;;= const 0_707106781
const_0707106781: ;{{Addr=$3220 Data Calls/jump count: 0 Data use count: 1}}
defb $34,$f3,$04,$35,$80 ; 0.707106781
;;= const 0_693147181
const_0693147181: ;{{Addr=$3225 Data Calls/jump count: 0 Data use count: 1}}
defb $f8,$17,$72,$31,$80 ; 0.693147181
;;= const 0_301029996
const_0301029996: ;{{Addr=$322a Data Calls/jump count: 0 Data use count: 1}}
defb $85,$9a,$20,$1a,$7f ; 0.301029996
;;============================================================================================
;; REAL exp
REAL_exp: ;{{Addr=$322f Code Calls/jump count: 1 Data use count: 1}}
ld b,$e1 ;{{322f:06e1}}
call x3492_code ;{{3231:cd9234}}
jp nc,REAL_ONE_to_DE ;{{3234:d27d2f}}
ld de,exp_constant_c ;{{3237:11a232}}
call REAL_compare ;{{323a:cddf36}}
jp p,REAL_at_IX_to_max_pos;{{323d:f2e837}}
ld de,exp_constant_d ;{{3240:11a732}}
call REAL_compare ;{{3243:cddf36}}
jp m,_process_real_at_hl_42;{{3246:fae237}}
ld de,exp_constant_b ;{{3249:119d32}}
call x3469_code ;{{324c:cd6934}}
ld a,e ;{{324f:7b}}
jp p,_real_exp_14 ;{{3250:f25532}}
neg ;{{3253:ed44}}
_real_exp_14: ;{{Addr=$3255 Code Calls/jump count: 1 Data use count: 0}}
push af ;{{3255:f5}}
call _real_addition_119;{{3256:cd7035}}
call _real_move_de_to_b10e_2;{{3259:cd8d2f}}
push de ;{{325c:d5}}
call _process_inline_parameters_1;{{325d:cd4334}} Code takes inline parameter block
;Inline parameter block
defb $03 ;Parameter count
defb $f4,$32,$eb,$0f,$73 ; 6.86258e-05
defb $08,$b8,$d5,$52,$7b ; 2.57367e-02
;;= exp constant a
exp_constant_a: ;{{Addr=$326b Data Calls/jump count: 0 Data use count: 3}}
defb $00,$00,$00,$00,$80 ; 0.5
;Return address
ex (sp),hl ;{{3270:e3}}
call _process_inline_parameters_1;{{3271:cd4334}} Code takes inline parameter block
;Inline parameter block
defb $02 ;parameter count
defb $09,$60,$de,$01,$78 ; 1.98164e-03
defb $f8,$17,$72,$31,$7e ; 0.173286795
;Return address
call REAL_multiplication;{{32ff:cd7735}}
pop de ;{{3282:d1}}
push hl ;{{3283:e5}}
ex de,hl ;{{3284:eb}}
call x349a_code ;{{3285:cd9a34}}
ex de,hl ;{{3288:eb}}
pop hl ;{{3289:e1}}
call REAL_division ;{{328a:cd0436}}
ld de,exp_constant_a ;{{328d:116b32}}
call REAL_addition ;{{3290:cda234}}
pop af ;{{3293:f1}}
scf ;{{3294:37}}
adc a,(ix+$04) ;{{3295:dd8e04}}
ld (ix+$04),a ;{{3298:dd7704}}
scf ;{{329b:37}}
ret ;{{329c:c9}}
;;= exp constant b
exp_constant_b: ;{{Addr=$329d Data Calls/jump count: 0 Data use count: 1}}
defb $29,$3b,$aa,$38,$81 ; 1.44269504
;;= exp constant c
exp_constant_c: ;{{Addr=$32a2 Data Calls/jump count: 0 Data use count: 1}}
defb $c7,$33,$0f,$30,$87 ; 88.0296919
;;= exp constant d
exp_constant_d: ;{{Addr=$32a7 Data Calls/jump count: 0 Data use count: 1}}
defb $f8,$17,$72,$b1,$87 ; -88.7228391
;;============================================================================================
;; REAL sqr
REAL_sqr: ;{{Addr=$32ac Code Calls/jump count: 0 Data use count: 1}}
ld de,exp_constant_a ;{{32ac:116b32}}
;;============================================================================================
;; REAL power
REAL_power: ;{{Addr=$32af Code Calls/jump count: 0 Data use count: 1}}
ex de,hl ;{{32af:eb}}
call REAL_SGN ;{{32b0:cd2737}}
ex de,hl ;{{32b3:eb}}
jp z,REAL_ONE_to_DE ;{{32b4:ca7d2f}}
push af ;{{32b7:f5}}
call REAL_SGN ;{{32b8:cd2737}}
jr z,_real_power_29 ;{{32bb:2825}} (+&25)
ld b,a ;{{32bd:47}}
call m,_real_negate_2 ;{{32be:fc3437}}
push hl ;{{32c1:e5}}
call _real_power_72 ;{{32c2:cd2433}}
pop hl ;{{32c5:e1}}
jr c,_real_power_38 ;{{32c6:3825}} (+&25)
ex (sp),hl ;{{32c8:e3}}
pop hl ;{{32c9:e1}}
jp m,_real_power_35 ;{{32ca:faea32}}
push bc ;{{32cd:c5}}
push de ;{{32ce:d5}}
call REAL_log ;{{32cf:cdb631}}
pop de ;{{32d2:d1}}
call c,REAL_multiplication;{{32d3:dc7735}}
call c,REAL_exp ;{{32d6:dc2f32}}
_real_power_22: ;{{Addr=$32d9 Code Calls/jump count: 1 Data use count: 0}}
pop bc ;{{32d9:c1}}
ret nc ;{{32da:d0}}
ld a,b ;{{32db:78}}
or a ;{{32dc:b7}}
call m,REAL_Negate ;{{32dd:fc3137}}
scf ;{{32e0:37}}
ret ;{{32e1:c9}}
_real_power_29: ;{{Addr=$32e2 Code Calls/jump count: 1 Data use count: 0}}
pop af ;{{32e2:f1}}
scf ;{{32e3:37}}
ret p ;{{32e4:f0}}
call REAL_at_IX_to_max_pos;{{32e5:cde837}}
xor a ;{{32e8:af}}
ret ;{{32e9:c9}}
_real_power_35: ;{{Addr=$32ea Code Calls/jump count: 1 Data use count: 0}}
xor a ;{{32ea:af}}
inc a ;{{32eb:3c}}
ret ;{{32ec:c9}}
_real_power_38: ;{{Addr=$32ed Code Calls/jump count: 1 Data use count: 0}}
ld c,a ;{{32ed:4f}}
pop af ;{{32ee:f1}}
push bc ;{{32ef:c5}}
push af ;{{32f0:f5}}
ld a,c ;{{32f1:79}}
scf ;{{32f2:37}}
_real_power_44: ;{{Addr=$32f3 Code Calls/jump count: 1 Data use count: 0}}
adc a,a ;{{32f3:8f}}
jr nc,_real_power_44 ;{{32f4:30fd}} (-&03)
ld b,a ;{{32f6:47}}
call _real_move_de_to_b10e_2;{{32f7:cd8d2f}}
ex de,hl ;{{32fa:eb}}
ld a,b ;{{32fb:78}}
_real_power_50: ;{{Addr=$32fc Code Calls/jump count: 2 Data use count: 0}}
add a,a ;{{32fc:87}}
jr z,_real_power_63 ;{{32fd:2815}} (+&15)
push af ;{{32ff:f5}}
call _real_addition_119;{{3300:cd7035}}
jr nc,_real_power_67 ;{{3303:3016}} (+&16)
pop af ;{{3305:f1}}
jr nc,_real_power_50 ;{{3306:30f4}} (-&0c)
push af ;{{3308:f5}}
ld de,internal_REAL_store_1;{{3309:1104b1}}
call REAL_multiplication;{{330c:cd7735}}
jr nc,_real_power_67 ;{{330f:300a}} (+&0a)
pop af ;{{3311:f1}}
jr _real_power_50 ;{{3312:18e8}} (-&18)
_real_power_63: ;{{Addr=$3314 Code Calls/jump count: 1 Data use count: 0}}
pop af ;{{3314:f1}}
scf ;{{3315:37}}
call m,_real_multiplication_72;{{3316:fcfb35}}
jr _real_power_22 ;{{3319:18be}} (-&42)
_real_power_67: ;{{Addr=$331b Code Calls/jump count: 2 Data use count: 0}}
pop af ;{{331b:f1}}
pop af ;{{331c:f1}}
pop bc ;{{331d:c1}}
jp m,_process_real_at_hl_42;{{331e:fae237}}
jp REAL_at_IX_to_max_pos_or_max_neg;{{3321:c3ea37}}
_real_power_72: ;{{Addr=$3324 Code Calls/jump count: 1 Data use count: 0}}
push bc ;{{3324:c5}}
call REAL_move_DE_to_b10e;{{3325:cd882f}}
call REAL_fix ;{{3328:cd1430}}
ld a,c ;{{332b:79}}
pop bc ;{{332c:c1}}
jr nc,_real_power_79 ;{{332d:3002}} (+&02)
jr z,_real_power_82 ;{{332f:2803}} (+&03)
_real_power_79: ;{{Addr=$3331 Code Calls/jump count: 1 Data use count: 0}}
ld a,b ;{{3331:78}}
or a ;{{3332:b7}}
ret ;{{3333:c9}}
_real_power_82: ;{{Addr=$3334 Code Calls/jump count: 1 Data use count: 0}}
ld c,a ;{{3334:4f}}
ld a,(hl) ;{{3335:7e}}
rra ;{{3336:1f}}
sbc a,a ;{{3337:9f}}
and b ;{{3338:a0}}
ld b,a ;{{3339:47}}
ld a,c ;{{333a:79}}
cp $02 ;{{333b:fe02}}
sbc a,a ;{{333d:9f}}
ret nc ;{{333e:d0}}
ld a,(hl) ;{{333f:7e}}
cp $27 ;{{3340:fe27}}
ret c ;{{3342:d8}}
xor a ;{{3343:af}}
ret ;{{3344:c9}}
;;============================================================================================
;; REAL set degrees or radians
REAL_set_degrees_or_radians: ;{{Addr=$3345 Code Calls/jump count: 0 Data use count: 1}}
ld (DEG__RAD_flag_),a;{{3345:3213b1}}
ret ;{{3348:c9}}
;;============================================================================================
;; REAL cosine
REAL_cosine: ;{{Addr=$3349 Code Calls/jump count: 1 Data use count: 1}}
call REAL_SGN ;{{3349:cd2737}}
call m,_real_negate_2 ;{{334c:fc3437}}
or $01 ;{{334f:f601}}
jr _real_sin_1 ;{{3351:1801}} (+&01)
;;============================================================================================
;; REAL sin
REAL_sin: ;{{Addr=$3353 Code Calls/jump count: 1 Data use count: 1}}
xor a ;{{3353:af}}
_real_sin_1: ;{{Addr=$3354 Code Calls/jump count: 1 Data use count: 0}}
push af ;{{3354:f5}}
ld de,sin_constant_b ;{{3355:11b433}}
ld b,$f0 ;{{3358:06f0}}
ld a,(DEG__RAD_flag_);{{335a:3a13b1}}
or a ;{{335d:b7}}
jr z,_real_sin_9 ;{{335e:2805}} (+&05)
ld de,sin_constant_c ;{{3360:11b933}}
ld b,$f6 ;{{3363:06f6}}
_real_sin_9: ;{{Addr=$3365 Code Calls/jump count: 1 Data use count: 0}}
call x3492_code ;{{3365:cd9234}}
jr nc,_sin_code_block_2_1;{{3368:303a}} (+&3a)
pop af ;{{336a:f1}}
call x346a_code ;{{336b:cd6a34}}
ret nc ;{{336e:d0}}
ld a,e ;{{336f:7b}}
rra ;{{3370:1f}}
call c,_real_negate_2 ;{{3371:dc3437}}
ld b,$e8 ;{{3374:06e8}}
call x3492_code ;{{3376:cd9234}}
jp nc,_process_real_at_hl_42;{{3379:d2e237}}
inc (ix+$04) ;{{337c:dd3404}}
call process_inline_parameters;{{337f:cd4034}} Code pops parameter block address from stack
;Inline parameter block
defb $06 ;Parameter count (6)
defb $1b,$2d,$1a,$e6,$6e ; -3.42879e-06
defb $f8,$fb,$07,$28,$74 ; 1.60247e-04
defb $01,$89,$68,$99,$79 ; -4.68165e-03
defb $e1,$df,$35,$23,$7d ; 7.96926e-02
defb $28,$e7,$5d,$a5,$80 ; -0.645964095
;;=sin constant a
sin_constant_a: ;{{Addr=$339c Data Calls/jump count: 0 Data use count: 1}}
defb $a2,$da,$0f,$49,$81 ; 1.57079633
;;=Sin code block 2
;Code returns here
jp REAL_multiplication;{{33a1:c37735}}
_sin_code_block_2_1: ;{{Addr=$33a4 Code Calls/jump count: 1 Data use count: 0}}
pop af ;{{33a4:f1}}
jp nz,REAL_ONE_to_DE ;{{33a5:c27d2f}}
ld a,(DEG__RAD_flag_);{{33a8:3a13b1}}
cp $01 ;{{33ab:fe01}}
ret c ;{{33ad:d8}}
ld de,sin_constant_d ;{{33ae:11be33}}
jp REAL_multiplication;{{33b1:c37735}}
;;=sin constant b
sin_constant_b: ;{{Addr=$33b4 Data Calls/jump count: 0 Data use count: 1}}
defb $6e,$83,$f9,$22,$7f ; 0.318309886
;;=sin constant c
sin_constant_c: ;{{Addr=$33b9 Data Calls/jump count: 0 Data use count: 1}}
defb $b6,$60,$0b,$36,$79 ; 5.55556e-03
;;=sin constant d
sin_constant_d: ;{{Addr=$33be Data Calls/jump count: 0 Data use count: 1}}
defb $13,$35,$fa,$0e,$7b ; 1.74533e-02
;;=sin constant e
sin_constant_e: ;{{Addr=$33c3 Data Calls/jump count: 0 Data use count: 1}}
defb $d3,$e0,$2e,$65,$86 ; 57.2957795
;;============================================================================================
;; REAL tan
REAL_tan: ;{{Addr=$33c8 Code Calls/jump count: 0 Data use count: 1}}
call _real_move_de_to_b10e_2;{{33c8:cd8d2f}}
push de ;{{33cb:d5}}
call REAL_cosine ;{{33cc:cd4933}}
ex (sp),hl ;{{33cf:e3}}
call c,REAL_sin ;{{33d0:dc5333}}
pop de ;{{33d3:d1}}
jp c,REAL_division ;{{33d4:da0436}}
ret ;{{33d7:c9}}
;;============================================================================================
;; REAL arctan
REAL_arctan: ;{{Addr=$33d8 Code Calls/jump count: 0 Data use count: 1}}
call REAL_SGN ;{{33d8:cd2737}}
push af ;{{33db:f5}}
call m,_real_negate_2 ;{{33dc:fc3437}}
ld b,$f0 ;{{33df:06f0}}
call x3492_code ;{{33e1:cd9234}}
jr nc,_real_arctan_26;{{33e4:304a}} (+&4a)
dec a ;{{33e6:3d}}
push af ;{{33e7:f5}}
call p,_real_multiplication_72;{{33e8:f4fb35}}
call process_inline_parameters;{{33eb:cd4034}} Code which takes an inline parameter block
;Inline paremeter blcok, address retrieved from the call stack
defb $0b ;Parameter count (11)
defb $ff,$c1,$03,$0f,$77 ; 1.09112e-03
defb $83,$fc,$e8,$eb,$79 ; -0.007199405
defb $6f,$ca,$78,$36,$7b ; 2.22744e-02
defb $d5,$3e,$b0,$b5,$7c ; -4.43575e-02
defb $b0,$c1,$8b,$09,$7d ; 6.71611e-02
defb $af,$e8,$32,$b4,$7d ; -8.79877e-02
defb $74,$6c,$65,$62,$7d ; 0.110545013
defb $d1,$f5,$37,$92,$7e ; -0.142791596
defb $7a,$c3,$cb,$4c,$7e ; 0.199996046
defb $83,$a7,$aa,$aa,$7f ; -0.333333239
defb $fe,$ff,$ff,$7f,$80 ; 1
call REAL_multiplication;{{3426:cd7735}} Return address after data block
pop af ;{{3429:f1}}
ld de,sin_constant_a ;{{342a:119c33}}
call p,REAL_reverse_subtract;{{342d:f49e34}}
_real_arctan_26: ;{{Addr=$3430 Code Calls/jump count: 1 Data use count: 0}}
ld a,(DEG__RAD_flag_);{{3430:3a13b1}}
or a ;{{3433:b7}}
ld de,sin_constant_e ;{{3434:11c333}}
call nz,REAL_multiplication;{{3437:c47735}}
pop af ;{{343a:f1}}
call m,_real_negate_2 ;{{343b:fc3437}}
scf ;{{343e:37}}
ret ;{{343f:c9}}
;;=====================================================
;; process inline parameters
;This code takes a list of parameters starting at the next byte after the call.
;It pops the return value off the stack, reads in the values, and eventually returns
;to the address after the data block.
;The first byte of the data block is the count of the number of parameters. Each
;parameter is five bytes long (a real).
process_inline_parameters: ;{{Addr=$3440 Code Calls/jump count: 3 Data use count: 0}}
call _real_addition_119;{{3440:cd7035}}
_process_inline_parameters_1: ;{{Addr=$3443 Code Calls/jump count: 2 Data use count: 0}}
call REAL_copy_atHL_to_b10e_swapped;{{3443:cd872f}}
pop hl ;{{3446:e1}} Pop the return address/address of data block
ld b,(hl) ;{{3447:46}} Parameter count
inc hl ;{{3448:23}} First parameter
call REAL_copy_atHL_to_atDE_swapped;{{3449:cd902f}}
_process_inline_parameters_6: ;{{Addr=$344c Code Calls/jump count: 1 Data use count: 0}}
inc de ;{{344c:13}} Advance to next parameter
inc de ;{{344d:13}}
inc de ;{{344e:13}}
inc de ;{{344f:13}}
inc de ;{{3450:13}}
push de ;{{3451:d5}} Possible return address
ld de,internal_REAL_store_2;{{3452:1109b1}}
dec b ;{{3455:05}}
ret z ;{{3456:c8}}
push bc ;{{3457:c5}}
ld de,internal_REAL_store_3;{{3458:110eb1}}
call REAL_multiplication;{{345b:cd7735}}
pop bc ;{{345e:c1}}
pop de ;{{345f:d1}} Get back address of next parameter
push de ;{{3460:d5}}
push bc ;{{3461:c5}}
call REAL_addition ;{{3462:cda234}}
pop bc ;{{3465:c1}}
pop de ;{{3466:d1}}
jr _process_inline_parameters_6;{{3467:18e3}} (-&1d)
;;=======================================================
x3469_code: ;{{Addr=$3469 Code Calls/jump count: 1 Data use count: 0}}
xor a ;{{3469:af}}
x346a_code: ;{{Addr=$346a Code Calls/jump count: 1 Data use count: 0}}
push af ;{{346a:f5}}
call REAL_multiplication;{{346b:cd7735}}
pop af ;{{346e:f1}}
ld de,exp_constant_a ;{{346f:116b32}}
call nz,REAL_addition ;{{3472:c4a234}}
push hl ;{{3475:e5}}
call REAL_to_int ;{{3476:cdd92f}}
jr nc,x348e_code ;{{3479:3013}} (+&13)
pop de ;{{347b:d1}}
push hl ;{{347c:e5}}
push af ;{{347d:f5}}
push de ;{{347e:d5}}
ld de,internal_REAL_store_2;{{347f:1109b1}}
call REAL_INT_to_real ;{{3482:cd9f2f}}
ex de,hl ;{{3485:eb}}
pop hl ;{{3486:e1}}
call x349a_code ;{{3487:cd9a34}}
pop af ;{{348a:f1}}
pop de ;{{348b:d1}}
scf ;{{348c:37}}
ret ;{{348d:c9}}
x348e_code: ;{{Addr=$348e Code Calls/jump count: 1 Data use count: 0}}
pop hl ;{{348e:e1}}
xor a ;{{348f:af}}
inc a ;{{3490:3c}}
ret ;{{3491:c9}}
x3492_code: ;{{Addr=$3492 Code Calls/jump count: 4 Data use count: 0}}
call _real_division_121;{{3492:cdd336}}
ret p ;{{3495:f0}}
cp b ;{{3496:b8}}
ret z ;{{3497:c8}}
ccf ;{{3498:3f}}
ret ;{{3499:c9}}
x349a_code: ;{{Addr=$349a Code Calls/jump count: 3 Data use count: 0}}
ld a,$01 ;{{349a:3e01}}
jr _real_addition_1 ;{{349c:1805}} (+&05)
;;============================================================================================
;; REAL reverse subtract
REAL_reverse_subtract: ;{{Addr=$349e Code Calls/jump count: 1 Data use count: 1}}
ld a,$80 ;{{349e:3e80}}
jr _real_addition_1 ;{{34a0:1801}} (+&01)
;;============================================================================================
;; REAL addition
REAL_addition: ;{{Addr=$34a2 Code Calls/jump count: 5 Data use count: 1}}
xor a ;{{34a2:af}}
; A = function, &00, &01 or &80
_real_addition_1: ;{{Addr=$34a3 Code Calls/jump count: 2 Data use count: 0}}
push hl ;{{34a3:e5}}
pop ix ;{{34a4:dde1}}
push de ;{{34a6:d5}}
pop iy ;{{34a7:fde1}}
ld b,(ix+$03) ;{{34a9:dd4603}}