📄 424dhrys
字号:
// 0748
// 0748 ;{
// 0748 ; Ch_Loc = 'A'
60C80041 // 0748 MOV R25,'A'
// 074c
// 074c ; Int_Loc += 1;
60C60001 // 074c INC R24
// 0750 ;}
// 0750
6A060002 // 0750 CMP.f R24,2
FCF7FFF6 // 0754 Ble.a Func_2_1
01DD4018 // 0758 LD.b R27,R21,R24
// 075c
// 075c Func_2_2:
// 075c ;if(Ch_Loc >= 'W' && Ch_Loc < 'Z')
6A064057 // 075c CMP.f R25,'W'
FC680008 // 0760 Blt Func_2_3
6A064052 // 0764 CMP.f R25,'R'
6A06405A // 0768 CMP.f R25,'Z'
FC280005 // 076c Bge Func_2_3
6A064052 // 0770 CMP.f R25,'R'
// 0774
// 0774 ;not executed
60080774 // 0774 MOV R01,!
FF000000 // 0778 HALT
// 077c
// 077c ; Int_Loc = 7;
60C00007 // 077c MOV R24,7
// 0780
// 0780 Func_2_3:
// 0780 ;if(Ch_Loc == 'R')
// 0780 ;D CMP.f R25,'R'
FC800006 // 0780 Bne.a Func_2_4
61080015 // 0784 MOV R01,R21
// 0788
// 0788 ;not executed
60080788 // 0788 MOV R01,!
FF000000 // 078c HALT
// 0790
// 0790 ; return(true);
EB00001A // 0790 RET R26
60B80001 // 0794 MOV R23,1
// 0798
// 0798 Func_2_4:
// 0798 ;else
// 0798 ;{
// 0798 ;if(strcmp(Str_1_Par_Ref, Str_2_Par_Ref) > 0)
// 0798 ;D MOV R01,R21
80000207 // 0798 CALL strcmp
61100016 // 079c MOV R02,R22
// 07a0
6B00C000 // 07a0 TST.f R03
FC700008 // 07a4 Ble Func_2_5
49000000 // 07a8 NOP
// 07ac
// 07ac ;{
// 07ac ;not executed
600807AC // 07ac MOV R01,!
FF000000 // 07b0 HALT
// 07b4
// 07b4 ; Int_Loc += 7;
60C60007 // 07b4 ADD R24,R24,7
// 07b8
// 07b8 ; Int_Glob = Int_Loc;
61480018 // 07b8 MOV R09,R24
// 07bc
// 07bc ; return(true);
// 07bc ;}
EB00001A // 07bc RET R26
60B80001 // 07c0 MOV R23,1
// 07c4
// 07c4 Func_2_5:
// 07c4 ;else
// 07c4 ;{
// 07c4 ; return(false);
EB00001A // 07c4 RET R26
61B80000 // 07c8 CLR R23
// 07cc ;}
// 07cc
// 07cc
// 07cc ;******
// 07cc Func_3:
// 07cc ;******
// 07cc ; R28: Enum_Par_Val
// 07cc ; R29: return
// 07cc ; R30: RPC
// 07cc ;
// 07cc ;Enum_Loc = Enum_Par_Val;
// 07cc ;if (Enum_Loc == Ident_3)
6A070002 // 07cc CMP.f R28,Ident_3
FC000004 // 07d0 Bne Func_3_1
EAF04000 // 07d4 LRFS R30,RPC
// 07d8
// 07d8 ; return(true);
EB00001E // 07d8 RET R30
60E80001 // 07dc MOV R29,1
// 07e0
// 07e0 Func_3_1:
// 07e0 ;else
// 07e0 ; return(false);
// 07e0 ;not executed
600807E0 // 07e0 MOV R01,!
FF000000 // 07e4 HALT
// 07e8
EB00001E // 07e8 RET R30
60E80000 // 07ec MOV R29,0
// 07f0
// 07f0 ;******
// 07f0 strcpy:
// 07f0 ;******
// 07f0 ;String assignment:
// 07f0 ; R01: destination string address
// 07f0 ; R02: source string address
// 07f0 ; Required registers: R01-R05
// 07f0 ;
EA284000 // 07f0 LRFS R05, RPC
61180000 // 07f4 CLR R03
01208003 // 07f8 LD.b R04,R02,R03
68084001 // 07fc DEC R01
// 0800 strcpy2:
6018C001 // 0800 INC R03 ;for delayed load of R01
6B010000 // 0804 TST.f R04
21204003 // 0808 ST.b R04,R01,R03
FC87FFFD // 080c Bne.a strcpy2
01208003 // 0810 LD.b R04,R02,R03
// 0814
// 0814 strcpy_ret:
EB000005 // 0814 RET R05
49000000 // 0818 NOP
// 081c
// 081c ;******
// 081c strcmp:
// 081c ;******
// 081c ;String comparison:
// 081c ; R01=string address 1
// 081c ; R02=string address 2
// 081c ; R03=result of comparison (difference)
// 081c ; Required registers: R01-R06
// 081c ;
EA304000 // 081c LRFS R06,RPC
// 0820 ;i=0
61180000 // 0820 CLR R03
// 0824
// 0824 ;while(s[i] == t[i])
01204003 // 0824 LD.b R04,R01,R03
// 0828 strcmp_1:
01288003 // 0828 LD.b R05,R02,R03
6018C001 // 082c INC R03 ; if(s[i++] == 0)
6B010005 // 0830 CMP.f R04,R05
FC000006 // 0834 Bne strcmp_2
6B010000 // 0838 TST.f R04 ; if(s[i++] == 0)
// 083c
// 083c ; if(s[i++] == 0)
// 083c ;D INC R03
// 083c ;D TST.f R04
FC87FFFB // 083c Bne.a strcmp_1
01204003 // 0840 LD.b R04,R01,R03
// 0844
// 0844 ; return(0);
EB000006 // 0844 RET R06
61180000 // 0848 CLR R03
// 084c
// 084c strcmp_2:
// 084c ;return(s[i] - t[i]);
EB000006 // 084c RET R06
69190005 // 0850 SUB R03,R04,R05
// 0854
// 0854 ;************
// 0854 structassign:
// 0854 ;************
// 0854 ;Structure assignment, memory areas must not overlap
// 0854 ; ([R01]..[R01+R03-1])=([R02]..[R02+R03-1])
// 0854 ; Required registers: R01-R05
// 0854 ;
6A18C001 // 0854 SUB.F R03,R03,1
FC480008 // 0858 Bcs strass_lb1
EA284000 // 085c LRFS R05,RPC
// 0860
4018FFFC // 0860 AND R03,R03,$FFFFFFFC
60084004 // 0864 ADD R01,R01,4
// 0868 strass_lp1:
0F208003 // 0868 LDU R04,R02,R03
6A18C004 // 086c SUB.f R03,R03,4
FC0FFFFE // 0870 Bcc strass_lp1
2F204003 // 0874 ST R04,R01,R03
// 0878 strass_lb1:
EB000005 // 0878 RET R05
68084004 // 087c SUB R01,R01,4
// 0880
// 0880 ;**************
// 0880 Multiplication:
// 0880 ;**************
// 0880 ;Multiplication routine: [R04|R03]= R01 * R02
// 0880 ; Signed multiplication from vos.exe
// 0880 ; Required registers: R01-R06
// 0880 ;
61280000 // 0880 CLR R05 ; result sign positive
// 0884 ;
6B004000 // 0884 TST.f R01 ; Op1 positive ?
FC100004 // 0888 Bpl Mul1 ; clear high result register
61200000 // 088c CLR R04 ; if not, change
48297FFF // 0890 NOT R05, R05 ; result sign
69080001 // 0894 NEG R01, R01 ; Op1 positive
// 0898 ;
// 0898 Mul1:
6B008000 // 0898 TST.f R02 ; Op2 positive ?
FC100004 // 089c Bpl Mul2 ; clear low result register
61180000 // 08a0 CLR R03 ; if not, change
48297FFF // 08a4 NOT R05, R05 ; result sign
69100002 // 08a8 NEG R02, R02 ; Op2 positive
// 08ac ;
// 08ac ; To minimize runs of the following loop, it is ensured
// 08ac ; that the "shifted" register contains the smaller value
// 08ac ; and F2 > F1.
// 08ac Mul2:
6B008001 // 08ac CMP.f R02, R01 ;
FC280004 // 08b0 Bge Mul3 ; Op2 > Op1?
61300002 // 08b4 MOV R06, R02 ; exchange values
61100001 // 08b8 MOV R02, R01 ;
61080006 // 08bc MOV R01, R06 ;
// 08c0 ;
// 08c0 Mul3:
61300000 // 08c0 CLR R06 ; clear high F2
// 08c4 ;
// 08c4 ; Product := F2 * F1
// 08c4 ; {R04,R03}:={R06,R02}*R01
56084001 // 08c4 LSR.f R01, R01, 1 ; if no addition
// 08c8 Mul4:
FC880005 // 08c8 Bcc.a Mul5 ; shift
52108001 // 08cc LSL.f R02, R02, 1 ; low F2
6318C002 // 08d0 ADD.f R03, R03, R02 ; otherwise add low
65210006 // 08d4 ADDC R04, R04, R06 ; and high and shift
52108001 // 08d8 LSL.f R02, R02, 1 ; shift low F2
// 08dc Mul5:
65318006 // 08dc ADDC R06, R06, R06 ; shift high F2 with carry
6B004000 // 08e0 TST.f R01 ;
FC87FFF9 // 08e4 Bne.a Mul4 ; add again ?
56084001 // 08e8 LSR.f R01, R01, 1 ; add next time ?
// 08ec ;
// 08ec ; sign correction necessary ?
6B014000 // 08ec TST.f R05 ; sign of product
FC100004 // 08f0 Bpl Mul6 ;
EA304000 // 08f4 LRFS R06, RPC
6B180003 // 08f8 NEG.f R03, R03
6D200004 // 08fc NEGC R04, R04
// 0900 Mul6:
EB000006 // 0900 RET R06
49000000 // 0904 NOP
// 0908
// 0908 ;********
// 0908 Division:
// 0908 ;********
// 0908 ;Division routine: R03 = R01 DIV R02
// 0908 ; R04 = R01 MOD R02
// 0908 ; Signed division from vos.exe
// 0908 ; Required registers: R01-R06
// 0908
61280000 // 0908 CLR R05 ; result sign positive
// 090c ;
63200001 // 090c MOV.f R04, R01 ; dividend positive ?
FC100004 // 0910 Bpl Div1 ; clear high result register
63080002 // 0914 MOV.f R01, R02 ;
44294002 // 0918 OR R05, R05, %10 ; change sign
69200004 // 091c NEG R04, R04 ; dividend positive
// 0920 ;
// 0920 Div1:
// 0920 ;D MOV.f R01, R02 ; test divisor
FC400024 // 0920 Beq DivByZero ; if 0, branch to exception
61180000 // 0924 CLR R03 ; if positive:
FC100005 // 0928 Bpl Div2 ; clear low result register
60300001 // 092c MOV R06, 1 ;
44294001 // 0930 OR R05, R05, %01 ; change sign
69100002 // 0934 NEG R02, R02 ; divisor positive
61080002 // 0938 MOV R01, R02 ; save divisor
// 093c ;
// 093c ; shift as required
// 093c Div2:
52108001 // 093c LSL.f R02, R02, 1 ; is divisor*2
FC500004 // 0940 Bmi Div3 ; possible ?
6B010002 // 0944 CMP.f R04, R02 ; or < dividend ?
FCAFFFFD // 0948 Bge.a Div2 ; if yes, continue
50318001 // 094c LSL R06, R06, 1 ; and remember new position
// 0950 Div3:
54108001 // 0950 LSR R02, R02, 1 ; if no, correction
// 0954 ;
6B008004 // 0954 CMP.f R02, R04 ; compare divisor and dividend
// 0958 Div4:
FCA80005 // 0958 Bge.a Div5 ; divisor greater ?
56318001 // 095c LSR.f R06, R06, 1 ; if yes, correct position
69210002 // 0960 SUB R04, R04, R02 ; if no, subtract divisor
6118C006 // 0964 ADD R03, R03, R06 ; and update quotient
56318001 // 0968 LSR.f R06, R06, 1 ; and shift position right
// 096c Div5:
54108001 // 096c LSR R02, R02, 1 ; and divisor
FC87FFFA // 0970 Bne.a Div4 ; if not done,
6B008004 // 0974 CMP.f R02, R04 ; compare divisor and dividend
// 0978 ;
// 0978 ; correct result due to sign?
6A014000 // 0978 CMP.f R05, %00 ; (+) : (+) ?
FC40000A // 097c Beq Div8 ; if yes, no correction
6A014001 // 0980 CMP.f R05, %01 ; if no: (+) : (-) ?
FC400007 // 0984 Beq Div7 ; if yes, negate quotient
6B000004 // 0988 NEG.f R00, R04 ; remainder 0 (or "negative")?
FC400003 // 098c Beq Div6 ; 0, test, if correction
6518C000 // 0990 ADDC R03, R03, R00 ; negative, increase quotient
69204004 // 0994 SUB R04, R01, R04 ; correct remainder
// 0998 Div6:
6A014002 // 0998 CMP.f R05, %10 ; (-) : (+) ?
FCC00002 // 099c Beq.a Div8 ; if yes,
// 09a0 Div7:
69180003 // 09a0 NEG R03, R03 ; negate quotient
// 09a4 Div8:
EA304000 // 09a4 LRFS R06, RPC
EB000006 // 09a8 RET R06
49000000 // 09ac NOP
// 09b0 ;
// 09b0 DivByZero:
FF000000 // 09b0 HALT ; division by zero
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -