📄 lib86.txt
字号:
02153 or ax,4(bx)
02154 jne 1f ! zero result
02155 xor ax,ax
02156 mov bx,2(bx)
02157 mov (bx),ax
02158 mov 2(bx),ax
02159 mov 4(bx),ax
02160 ret
02161 1: ! otherwise unnormalized number
02162 mov cx,6(bx)
02163 and cx,#0100177
02164 mov dx,cx
02165 and cx,#0x8000
02166 mov ax,#-125
02167 2:
02168 test dx,#0x80
02169 jne 1f
02170 dec ax
02171 shl 4(bx),#1
02172 rcl dx,#1
02173 or dx,cx
02174 jmp 2b
02175 1:
02176 mov cx,4(bx)
02177 mov bx,2(bx)
02178 mov (bx),ax
02179 mov 2(bx),cx
02180 and dx,#0100177
02181 or dx,#0037400 ! load -1 exponent
02182 mov 4(bx),dx
02183 ret
02184
02185 .fef8:
02186 ! this could be simpler, if only the
02187 ! fxtract instruction was emulated properly
02188 mov bx,sp
02189 mov ax,10(bx)
02190 and ax,#077760
02191 je 1f ! zero exponent
02192 mov cx,#4
02193 shr ax,cl
02194 sub ax,#1022
02195 mov cx,ax ! exponent in cx
02196 mov ax,10(bx)
02197 and ax,#0100017
02198 or ax,#0037740 ! load -1 exponent
02199 push 8(bx)
02200 push 6(bx)
02201 push 4(bx)
02202 mov bx,2(bx)
02203 pop 2(bx)
02204 pop 4(bx)
02205 pop 6(bx)
02206 mov 8(bx),ax
02207 mov (bx),cx
02208 ret
02209 1: ! we get here on zero exp
02210 mov ax,10(bx)
02211 and ax,#017
02212 or ax,8(bx)
02213 or ax,6(bx)
02214 or ax,4(bx)
02215 jne 1f ! zero result
02216 xor ax,ax
02217 mov bx,2(bx)
02218 mov (bx),ax
02219 mov 2(bx),ax
02220 mov 4(bx),ax
02221 mov 6(bx),ax
02222 mov 8(bx),ax
02223 ret
02224 1: ! otherwise unnormalized number
02225 mov cx,10(bx)
02226 and cx,#0100017
02227 mov dx,cx
02228 and cx,#0x8000
02229 mov ax,#-1021
02230 2:
02231 test dx,#0x10
02232 jne 1f
02233 dec ax
02234 shl 4(bx),#1
02235 rcl 6(bx),#1
02236 rcl 8(bx),#1
02237 rcl dx,#1
02238 or dx,cx
02239 jmp 2b
02240 1:
02241 and dx,#0100017
02242 or dx,#0037740 ! load -1 exponent
02243 mov cx,8(bx)
02244 push 6(bx)
02245 push 4(bx)
02246 mov bx,2(bx)
02247 mov (bx),ax
02248 mov 8(bx),dx
02249 mov 6(bx),cx
02250 pop 2(bx)
02251 pop 4(bx)
02252 ret
02253
02254 .cif4:
02255 mov bx,sp
02256 cmp 2(bx),#2
02257 jne 1f
02258 wait
02259 filds 4(bx)
02260 wait
02261 fstps 2(bx)
02262 wait
02263 ret
02264 1:
02265 wait
02266 fildl 4(bx)
02267 wait
02268 fstps 4(bx)
02269 wait
02270 ret
02271
02272 .cif8:
02273 mov bx,sp
02274 cmp 2(bx),#2
02275 jne 1f
02276 wait
02277 filds 4(bx)
02278 wait
02279 fstpd 2(bx)
02280 wait
02281 ret
02282 1:
02283 wait
02284 fildl 4(bx)
02285 wait
02286 fstpd 2(bx)
02287 wait
02288 ret
02289
02290 .cuf4:
02291 mov bx,sp
02292 cmp 2(bx),#2
02293 jne 1f
02294 mov ax,4(bx)
02295 mov 2(bx),ax
02296 mov 4(bx),#0
02297 wait
02298 fildl 2(bx)
02299 wait
02300 fstps 2(bx)
02301 wait
02302 ret
02303 1:
02304 wait
02305 fildl 4(bx)
02306 wait
02307 cmp 6(bx),#0
02308 jge 1f
02309 2:
02310 wait
02311 fisubl bigmin
02312 wait
02313 fisubl bigmin
02314 1:
02315 wait
02316 fstps 4(bx)
02317 wait
02318 ret
02319
02320 .cuf8:
02321 mov bx,sp
02322 cmp 2(bx),#2
02323 jne 1f
02324 mov 6(bx),#0
02325 1:
02326 wait
02327 fildl 4(bx)
02328 wait
02329 cmp 6(bx),#0
02330 jge 1f
02331 2:
02332 wait
02333 fisubl bigmin
02334 wait
02335 fisubl bigmin
02336 1:
02337 wait
02338 fstpd 2(bx)
02339 wait
02340 ret
02341
02342 .cfi:
02343 mov bx,sp
02344 push bx
02345 wait
02346 fstcw -2(bx)
02347 wait
02348 mov dx,-2(bx)
02349 or -2(bx),#0xc00 ! truncating mode
02350 wait
02351 fldcw -2(bx)
02352 pop ax
02353 cmp 4(bx),#4
02354 jne 2f
02355 ! loc 4 loc ? cfi
02356 wait
02357 flds 6(bx)
02358 wait
02359 fistpl 6(bx)
02360 wait
02361 cmp 2(bx),#2
02362 jne 1f
02363 mov ax,6(bx)
02364 1:
02365 mov 4(bx),dx
02366 wait
02367 fldcw 4(bx)
02368 wait
02369 ret
02370 2:
02371 ! loc 8 loc ? cfi
02372 wait
02373 fldd 6(bx)
02374 wait
02375 fistpl 10(bx)
02376 wait
02377 cmp 2(bx),#2
02378 jne 1b
02379 mov ax,10(bx)
02380 jmp 1b
02381
02382 .cfu:
02383 mov bx,sp
02384 push bx
02385 wait
02386 fstcw -2(bx)
02387 wait
02388 mov dx,-2(bx)
02389 and -2(bx),#0xf3ff
02390 or -2(bx),#0x400 ! to -infinity
02391 wait
02392 fldcw -2(bx)
02393 wait
02394 pop ax
02395 cmp 4(bx),#4
02396 jne 2f
02397 ! loc 4 loc ? cfu
02398 flds 6(bx)
02399 wait
02400 fabs ! ???
02401 wait
02402 fiaddl bigmin
02403 fistpl 6(bx)
02404 wait
02405 mov ax,8(bx)
02406 sub ax,bigmin+2
02407 mov 8(bx),ax
02408 cmp 2(bx),#2
02409 jne 1f
02410 mov ax,6(bx)
02411 1:
02412 mov 4(bx),dx
02413 wait
02414 fldcw 4(bx)
02415 wait
02416 ret
02417 2:
02418 wait
02419 ! loc 8 loc ? cfu
02420 fldd 6(bx)
02421 wait
02422 fabs ! ???
02423 wait
02424 fiaddl bigmin
02425 fistpl 10(bx)
02426 wait
02427 mov ax,12(bx)
02428 sub ax,bigmin+2
02429 mov 12(bx),ax
02430 cmp 2(bx),#2
02431 jne 1b
02432 mov ax,10(bx)
02433 jmp 1b
02434
02435 .cff4:
02436 mov bx,sp
02437 wait
02438 fldd 2(bx)
02439 wait
02440 fstcw 2(bx)
02441 wait
02442 mov dx,2(bx)
02443 and 2(bx),#0xf3ff ! set to rounding mode
02444 wait
02445 fldcw 2(bx)
02446 wait
02447 fstps 6(bx)
02448 mov 2(bx),dx
02449 wait
02450 fldcw 2(bx)
02451 wait
02452 ret
02453
02454 .cff8:
02455 mov bx,sp
02456 wait
02457 flds 2(bx)
02458 wait
02459 fstpd 2(bx)
02460 wait
02461 ret
02462
02463 .cmf4:
02464 mov bx,sp
02465 push bx ! room for 8087 status word
02466 xor cx,cx
02467 wait
02468 flds 6(bx)
02469 wait
02470 flds 2(bx)
02471 wait
02472 fcompp ! compare and pop operands
02473 wait
02474 fstsw -2(bx)
02475 wait
02476 mov ax,-2(bx)
02477 sahf
02478 je 1f
02479 jb 2f
02480 dec cx
02481 jmp 1f
02482 2:
02483 inc cx
02484 1:
02485 mov ax,cx
02486 pop bx
02487 ret
02488
02489
02490 .cmf8:
02491 mov bx,sp
02492 push bx ! room for 8087 status word
02493 xor cx,cx
02494 wait
02495 fldd 10(bx)
02496 wait
02497 fldd 2(bx)
02498 wait
02499 fcompp ! compare and pop operands
02500 wait
02501 fstsw -2(bx)
02502 wait
02503 mov ax,-2(bx)
02504 sahf
02505 je 1f
02506 jb 2f
02507 dec cx
02508 jmp 1f
02509 2:
02510 inc cx
02511 1:
02512 mov ax,cx
02513 pop bx
02514 ret
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/gto.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02600 .define .gto
02601 .text
02602
02603 .gto:
02604 mov bp,4(bx)
02605 mov sp,2(bx)
02606 jmp @(bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/iaar.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02700 .define .iaar
02701 .text
02702
02703 .iaar:
02704 pop cx
02705 pop dx
02706 cmp dx,#2
02707 .extern .unknown
02708 jne .unknown
02709 pop bx ! descriptor address
02710 pop ax ! index
02711 sub ax,(bx)
02712 mul 4(bx)
02713 pop bx ! array base
02714 add bx,ax
02715 push cx
02716 ret
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/ilar.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02800 .define .ilar
02801 .text
02802
02803 .ilar:
02804 pop cx
02805 pop dx
02806 .extern .unknown
02807 cmp dx,#2
02808 jne .unknown
02809 pop bx ! descriptor address
02810 pop ax ! index
02811 push cx
02812 .extern .lar2
02813 jmp .lar2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/inn.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
02900 .define .inn
02901 .text
02902
02903 ! #bytes in cx
02904 ! bit # in ax
02905 .inn:
02906 xor dx,dx
02907 mov bx,#8
02908 div bx
02909 mov bx,sp
02910 add bx,#2
02911 add bx,ax
02912 cmp ax,cx
02913 jae 1f
02914 movb al,(bx)
02915 mov bx,dx
02916 testb al,bits(bx)
02917 jz 1f
02918 mov ax,#1
02919 jmp 2f
02920 1:
02921 xor ax,ax
02922 2:
02923 pop bx
02924 add sp,cx
02925 ! ax is result
02926 jmp (bx)
02927
02928 .data
02929 bits:
02930 .data1 1,2,4,8,16,32,64,128
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/ior.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03000 .define .ior
03001 .text
03002
03003 ! #bytes in cx
03004 .ior:
03005 pop bx ! return address
03006 mov dx,di
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -