- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
; загрузка из cfg-файла переменной Gravity
seg011:06CA fld [dbl_45A48] ; 0.2
seg011:06CF add sp, -8
seg011:06D2 fstp [bp+var_16] ; default=0.2
seg011:06D6 push ds
seg011:06D7 mov ax, offset aGravity
seg011:06DA push ax ; key="GRAVITY"
seg011:06DB wait
seg011:06DD push cs
seg011:06DE call near ptr cfg_ReadDbl
seg011:06E1 add sp, 12
seg011:06E4 fstp [curGravity] ; cur=cfg_ReadDbl()
; проверка загруженного значения на диапазон [0,05..10,0]
seg011:06E9 fld [flt10]
seg011:06EE add sp, -8
seg011:06F1 fstp [bp+var_16] ; max = 10.0
seg011:06F5 fld [minGravity]
seg011:06FA add sp, -8
seg011:06FD fstp [bp+var_1E] ; min = 0.05
seg011:0701 fld [curGravity]
seg011:0706 add sp, -8
seg011:0709 fstp [bp+var_26] ; cur
seg011:070D wait
seg011:070F push cs
seg011:0710 call near ptr CheckRangeDbl
seg011:0713 fstp st ; результат нах...
seg011:0716 add sp, 24
<....cut....>
; double CheckRangeDbl(double cur, double min, double max)
seg011:0077 proc CheckRangeDbl far
seg011:0077 var_2 = word ptr -2
seg011:0077 @@cur = qword ptr 6
seg011:0077 @@min = qword ptr 0Eh
seg011:0077 @@max = qword ptr 16h
seg011:0077 push bp
seg011:0078 mov bp, sp
seg011:007A dec sp
seg011:007B dec sp
seg011:007C fld [bp+@@cur]
seg011:0080 fcomp [bp+@@min]
seg011:0084 fnstsw [bp+var_2]
seg011:0088 wait
seg011:008A mov ax, [bp+var_2]
seg011:008D sahf
seg011:008E jnb @@chk_max ; if (cur < min)
seg011:0090 fld [bp+@@min] ; st(0) = min
seg011:0094 jmp @@exit
seg011:0096 @@chk_max: ; else
seg011:0096 fld [bp+@@cur]
seg011:009A fcomp [bp+@@max]
seg011:009E fnstsw [bp+var_2]
seg011:00A2 wait
seg011:00A4 mov ax, [bp+var_2]
seg011:00A7 sahf
seg011:00A8 jbe @@ret_cur ; if (cur > max)
seg011:00AA fld [bp+@@max] ; st(0) = max
seg011:00AE jmp @@exit
seg011:00B0 @@ret_cur: ; else
seg011:00B0 fld [bp+@@cur] ; st(0) = cur
seg011:00B4 @@exit:
seg011:00B4 fst [bp+@@cur]
seg011:00B8 wait
seg011:00BA mov sp, bp
seg011:00BC pop bp
seg011:00BD retf ; return st(0)
seg011:00BD endp CheckRangeDbl