📄 lib86.txt
字号:
03007 mov di,sp
03008 add di,cx
03009 sar cx,#1
03010 1:
03011 pop ax
03012 or ax,(di)
03013 stos
03014 loop 1b
03015 mov di,dx
03016 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/isar.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03100 .define .isar
03101 .text
03102
03103 .isar:
03104 pop cx
03105 pop ax
03106 cmp ax,#2
03107 .extern .unknown
03108 jne .unknown
03109 pop bx ! descriptor address
03110 pop ax ! index
03111 push cx
03112 .extern .sar2
03113 jmp .sar2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/lar2.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03200 .define .lar2
03201 .text
03202
03203 .lar2:
03204 ! bx, descriptor address
03205 ! ax, index
03206 pop cx
03207 pop dx ! base address
03208 push cx
03209 push si
03210 mov si,dx
03211 sub ax,(bx)
03212 mov cx,4(bx)
03213 imul cx
03214 add si,ax
03215 sar cx,#1
03216 jnb 1f
03217 xorb ah,ah
03218 lodsb
03219 pop si
03220 pop bx
03221 push ax
03222 jmp (bx)
03223 1:
03224 pop dx ! saved si
03225 mov ax,4(bx)
03226 pop bx ! return address
03227 sub sp,ax
03228 mov ax,di ! save di
03229 mov di,sp
03230 rep
03231 mov
03232 mov di,ax
03233 mov si,dx
03234 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/lfr6.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03300 .define .lfr6
03301 .text
03302 .extern .retarea
03303
03304 .lfr6:
03305 pop bx
03306 push .retarea+4
03307 push .retarea+2
03308 push .retarea
03309 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/lfr8.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03400 .define .lfr8
03401 .text
03402 .extern .retarea
03403
03404 .lfr8:
03405 pop bx
03406 push .retarea+6
03407 push .retarea+4
03408 push .retarea+2
03409 push .retarea
03410 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/loi.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03500 .define .loi
03501 .define .los
03502 .text
03503
03504 ! #bytes in cx
03505 ! address in bx
03506 ! save si/di. they might be register variables
03507 .los:
03508 mov dx,si
03509 mov si,bx
03510 pop bx
03511 mov ax,cx
03512 sar cx,#1
03513 jnb 1f
03514 xorb ah,ah
03515 lodsb
03516 mov si,dx
03517 push ax
03518 jmp (bx)
03519 1:
03520 sub sp,ax
03521 jmp 1f
03522
03523 .loi:
03524 ! only called with size > 4
03525 mov dx,si
03526 mov si,bx
03527 pop bx
03528 sub sp,cx
03529 sar cx,#1
03530 1:
03531 mov ax,di
03532 mov di,sp
03533 rep
03534 mov
03535 mov si,dx
03536 mov di,ax
03537 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/mli4.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03600 .define .mli4
03601 .text
03602
03603 yl=2
03604 yh=4
03605 ! x * y
03606 ! xl in ax
03607 ! xh in dx
03608
03609 .mli4:
03610 mov bx,sp
03611 push dx
03612 mov cx,ax
03613 mul yh(bx) ! xl*yh
03614 pop dx
03615 push ax
03616 mov ax,dx
03617 mul yl(bx) ! xh * yl
03618 pop dx
03619 add dx,ax ! xh*yl+xl*yh
03620 mov ax,cx
03621 mov cx,dx
03622 mul yl(bx) ! xl*yl
03623 add dx,cx
03624 ret 4
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/mon.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03700 .define .mon
03701 .text
03702
03703 .mon:
03704 .extern .stop
03705 call .stop
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/nop.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03800 .define .nop
03801 .text
03802 .nop:
03803 ret
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/rck.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
03900 .define .rck
03901 .text
03902
03903 ! descriptor address in bx
03904 ! value in ax, must be left there
03905 .rck:
03906 cmp ax,(bx)
03907 jl 2f
03908 cmp ax,2(bx)
03909 jg 2f
03910 ret
03911 2:
03912 push ax
03913 ERANGE = 1
03914 .extern .error
03915 mov ax,#ERANGE
03916 call .error
03917 pop ax
03918 ret
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/ret6.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04000 .define .ret6
04001 .text
04002 .extern .retarea
04003
04004 .ret6:
04005 pop bx
04006 pop .retarea
04007 pop .retarea+2
04008 pop .retarea+4
04009 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/ret8.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04100 .define .ret8
04101 .text
04102 .extern .retarea
04103
04104 .ret8:
04105 pop bx
04106 pop .retarea
04107 pop .retarea+2
04108 pop .retarea+4
04109 pop .retarea+6
04110 jmp (bx)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/retarea.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04200 .define .retarea
04201
04202 .bss
04203 .retarea:
04204 .zerow 8/2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/return.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04300 .define .sdret, .dsret, .sret, .dret, .cret
04301 .text
04302
04303 .dsret:
04304 pop di
04305 .sret:
04306 pop si
04307 .cret:
04308 mov sp,bp
04309 pop bp
04310 ret
04311
04312 .sdret:
04313 pop si
04314 .dret:
04315 pop di
04316 jmp .cret
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/rmi4.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04400 .define .rmi4
04401 .text
04402
04403 yl=6
04404 yh=8
04405 xl=10
04406 xh=12
04407
04408 .rmi4:
04409 push si
04410 push di
04411 mov si,sp ! copy of sp
04412 mov bx,yl(si)
04413 mov ax,yh(si)
04414 cwd
04415 cmp dx,ax
04416 jne 7f
04417 and dx,dx
04418 jge 1f
04419 neg bx
04420 je 7f
04421 1:
04422 xor dx,dx
04423 mov cx,xl(si)
04424 mov ax,xh(si)
04425 and ax,ax
04426 jge 2f
04427 neg ax
04428 neg cx
04429 sbb ax,dx
04430 2:
04431 div bx
04432 xchg ax,cx
04433 div bx ! dx= result(low), 0=result(high)
04434 xor bx,bx
04435 9:
04436 cmp xh(si),#0
04437 jge 1f
04438 neg bx
04439 neg dx
04440 sbb bx,#0
04441 1:
04442 ! bx is high order result
04443 ! dx is low order result
04444 mov ax,dx
04445 mov dx,bx ! result in ax/dx
04446 pop di
04447 pop si
04448 ret 8
04449
04450 7:
04451 mov di,ax
04452 xor bx,bx
04453 and di,di
04454 jge 1f
04455 neg di
04456 neg yl(si)
04457 sbb di,bx
04458 1:
04459 mov ax,xl(si)
04460 mov dx,xh(si)
04461 and dx,dx
04462 jge 1f
04463 neg dx
04464 neg ax
04465 sbb dx,bx
04466 1:
04467 mov cx,#16
04468 1:
04469 shl ax,#1
04470 rcl dx,#1
04471 rcl bx,#1
04472 cmp di,bx
04473 ja 3f
04474 jb 2f
04475 cmp yl(si),dx
04476 jbe 2f
04477 3:
04478 loop 1b
04479 ! dx=result(low), bx=result(high)
04480 jmp 9b
04481 2:
04482 sub dx,yl(si)
04483 sbb bx,di
04484 inc ax
04485 loop 1b
04486 1:
04487 ! dx=result(low), bx=result(high)
04488 jmp 9b
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/rmu4.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04500 .define .rmu4
04501 .text
04502
04503 yl=6
04504 yh=8
04505 xl=10
04506 xh=12
04507
04508 .rmu4:
04509 push si
04510 push di
04511 mov si,sp ! copy of sp
04512 mov bx,yl(si)
04513 mov ax,yh(si)
04514 or ax,ax
04515 jne 7f
04516 1:
04517 xor dx,dx
04518 mov cx,xl(si)
04519 mov ax,xh(si)
04520 2:
04521 div bx
04522 xchg ax,cx
04523 div bx
04524 xor bx,bx
04525 9:
04526 ! bx is high order result
04527 ! dx is low order result
04528 mov ax,dx
04529 mov dx,bx
04530 pop di
04531 pop si
04532 ret 8 ! result in ax/dx
04533
04534 7:
04535 mov di,ax
04536 xor bx,bx
04537 mov ax,xl(si)
04538 mov dx,xh(si)
04539 mov cx,#16
04540 1:
04541 shl ax,#1
04542 rcl dx,#1
04543 rcl bx,#1
04544 cmp di,bx
04545 ja 3f
04546 jb 2f
04547 cmp yl(si),dx
04548 jbe 2f
04549 3:
04550 loop 1b
04551 ! dx=result(low), bx=result(high)
04552 jmp 9b
04553 2:
04554 sub dx,yl(si)
04555 sbb bx,di
04556 inc ax
04557 loop 1b
04558 1:
04559 ! dx=result(low), bx=result(high)
04560 jmp 9b
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/lib/i86/em/sar2.s
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
04600 .define .sar2
04601 .text
04602
04603 .sar2:
04604 ! bx, descriptor address
04605 ! ax, index
04606 pop cx
04607 pop dx ! base address
04608 push cx
04609 xchg di,dx ! di = base address, dx is saved di
04610 sub ax,(bx)
04611 mov cx,4(bx)
04612 push dx
04613 imul cx
04614 pop dx
04615 add di,ax
04616 sar cx,#1
04617 jnb 1f
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -