MODULELadderDrive[IeJ]I[II??????????????????????????????H?????????????????????????? ???????????????????????????????? B???????????????????????[ 0?[0 0??????????????????????????????? C??????????????????????????$0???????????????????????????????? B???????????????????????[ 0?[0 0??????????????????????????????? B???????????????????????[ ?[0 ??????????????????????????????? B???????????????????????[ ?[0 ? ??????????????????????????? ??????????????????????????????????????????????????????????????J??????????????????????????????   ?????????????????????????$0????????????????????????????????   ?????????????????????????$0??0??????????????????????????'0 ?????????????????????????????$0 ?????0 ?????????????????]  0 ]  0 ]0  0???????????????????????????$0????????????????????????????? ????????????????????????????????(??????????????????????????? ??)B??????????????????????????&0?????????????????????????????????????????????????????????????? -0 ????????????????????????? ???????????????????????????????? 0B????????????????????] 0] 0]0 0?????????????????????????????? 3??????????????????????????? ?????????????????????????????????????????????????????????????? 7  ?????????????????????????$0????????????????????????????????J?????????????????????????????? <B??????????????????????????Q ???????????????????????????????? ?B???????????????????????[00?[000??????????????????????????????????????????????????????????????????????????????????????????? E00????????????????????????? ???????????????????????????????? HB???????????????????????[ 0?[0 0??????????????????????????????? K??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? PB???????????????????????[0?[00??????????????????????????????? S0 ?????????????????????????$?? U0!?????????????????????????$?? U????????????????????????????? X0"????????????????????????? ?? X??????????????????????????????????????????????????????????? \B????????????????????p  p   p0  ?????????????????????????????? _0#?????????????????????????? ???????????????????????????????? bB???????????????????????[ ?[0 ??????????????????????????????? eB?????????????????????????? ?? g??????????????????????????? ???????????????????????????????? iB???????????????????????[ ?[0 ??????????????????????????????? l??????????????????????????? ???????????????????????????????? n??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? sB???????????????????????[0$?[00%??????????????????????????????? v0&?????????????????????????$?? x0'?????????????????????????$?? x????????????????????????????? {0(?????????????????????????$?? {????????????????????????????? ~0)?????????????????????????$?? ~????????????????????????????? 0*?????????????????????????$?? ????????????????????????????? 0+????????????????????????? ?? ??????????????????????????????????????????????????????????? B??????????????????????????Q ???????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? B???????????????????????[0,?[00-??????????????????????????????? 0.?????????????????????????$?? 0/????????????????????????? ?? ??????????????????????????????????????????????????????????? B??????????????????????????&I???????????????????????????????? B???????????????????????X??n ????????????????????????????????  ?????????????????????????$00???????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? B???????????????????????[01?[002??????????????????????????????? 03?????????????????????????$?? 04?????????????????????????$ ?? ????????????????????????????? 05????????????????????????? ??  ??????????????????????????????????????????????????????????? 06??????????????????????????$07???????????????????????????????? ??????????????????????????? ??????????????????????????????????????????????????????????????9?????????????????????????????? B???????????????????????[08?[009??????????????????????????????? 0:?????????????????????????$ ?? 0;????????????????????????? ??  ??????????????????????????????????????????????????????????? B???????????????????????X??m ???????????????????????????????? 0<??????????????????????????$0=???????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? B???????????????????????[0>?[00???????????????????????????????? 0@?????????????????????????$ ?? 0A?????????????????????????$ ??  ????????????????????????????? 0B????????????????????????? ??  ??????????????????????????????????????????????????????????? 0C??0D???????????????????????$0E???????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? B???????????????????????[0F?[00G??????????????????????????????? 0H?????????????????????????$ ?? 0I?????????????????????????$??  ????????????????????????????? 0J????????????????????????? ?? ??????????????????????????????????????????????????????????? 0K??????????????????????????$0L?? 0M??????????????????????????????????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? B???????????????????????[0N?[00O??????????????????????????????? 0P?????????????????????????$?? 0Q????????????????????????? ?? ??????????????????????????????????????????????????????????? 0R??????????????????????????$0S???????????????????????????????? ??????????????????????????? ??????????????????????????????????????????????????????????????9?????????????????????????????? B???????????????????????[0T?[00U??????????????????????????????? 0V?????????????????????????$?? 0W????????????????????????? ?? ??????????????????????????????????????????????????????????? 0X??????????????????????????$0Y???????????????????????????????? B??????????????????????????Q ???????????????????????????????? ??????????????????????????? ??????????????????????????????????????????????????????????????r?????????????????????????????? "B???????????????????????[0Z ?[00[ ??????????????????????????????? % 0\????????????????????????? ???????????????????????????????? (0]?????????????????????????? ???????????????????????????????? +B??????????????????????????$0^???????????????????????????????? .B??????????????????????????Q ???????????????????????????????? 1B?????????????????????????? ?? 3??????????????????????????? ?????????????????????????????????????????????????????????????? 6B??????????????????????????Q ???????????????????????????????? 9??????????????????????????? ???????????????????????????????? ;??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? @B???????????????????????[0_ ?[00` ??????????????????????????????? C 0a????????????????????????? ???????????????????????????????? F0b?????????????????????????? ???????????????????????????????? IC??????????????????????????$0c???????????????????????????????? LB??????????????????????????Q ???????????????????????????????? OB?????????????????????????? ?? Q??????????????????????????? ?????????????????????????????????????????????????????????????? TB??????????????????????????Q ???????????????????????????????? W??????????????????????????? ???????????????????????????????? Y??????????????????????????? ???????????????????????????????????????????????????????????????????????????????????????????? ^0d?????????????????????????? ???????????????????????????????? aB??????????????????????????2 ??????????????????????????????? dB?????????????????????????? ?? f??????????????????????????? ???????????????????????????????? hB??????????????????????????3 ??????????????????????????????? k??????????????????????????? ??????????????????????????????????????????????????????????????9?????????????????????????????? pB???????????????????????[0e ?[00f ??????????????????????????????? s 0g?????????????????????????$?? u 0h?????????????????????????$?? u????????????????????????????? x 0i?????????????????????????$?? x????????????????????????????? { 0j????????????????????????? ?? {??????????????????????????????????????????????????????????? B????????????????????q  q   q0  ?????????????????????????????? B???????????????????????[ ?[0 ??????????????????????????????? ??????????????????????????? ????????????????????????????????C??X0k??e0l??J????????????????? ????????????????????????????? ?????????????????????????????????????????????????????????????? ?????????????????????????????? B???????????????????????[0m ?[00n ???????????????????????????????  0o????????????????????????? ???????????????????????????????? 0p?????????????????????????? ???????????????????????????????? B??????????????????????????2 ??????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B??????????????????????????3 ??????????????????????????????? ??????????????????????????? ???????????????????????????????? 0q?????????????????????????? ???????????????????????????????? B??????????????????????????2 ??????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B??????????????????????????3 ??????????????????????????????? ??????????????????????????? ???????????????????????????????? 0r?????????????????????????? ???????????????????????????????? B??????????????????????????2 ??????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B??????????????????????????3 ??????????????????????????????? ??????????????????????????? ???????????????????????????????? ??????????????????????????? ???????????????????????????????????????????????????????????<??????????????????????????????????????????????????????????????????????????????????????????R ????????????????????????????????(?????????????????????????????? B??????????????X0s????????a ??Y0t???????????????????????????????? B??????????????X0u?????Y ??[ 0v?[0 0w??????????????????????????????? B???????????X0x????????a ??X??e ?? J?????????????????????????? ???????????????????????????????? B????????????????????X0y??l ??Y0z???????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B????????????????????X0{??g ??Y0|???????????????????????????????? ??????????????????????????? ???????????????????????????????? B?????????????????X0}?????^ ??Y0~?????????????????????????????S????????????????????????????????????????????????????????????R ????????????????????????????????(?????????????????????????????? B??????????????X0????????a ??Y0???????????????????????????????? B???????????X0????????a ??X??e ?? *J?????????????????????????? ???????????????????????????????? -B??????????????X0?????Y ??[ 0?[0 0??????????????????????????????? 6B?????????????????????????? ?? 8??????????????????????????? ???????????????????????????????? :B??X0?????Y ??X ??m ??Y ??X0????? ? : ??????????^ ??Y ??X ??l ??h ??Y0???????????????????????????????? W??????????????????????????? ???????????????????????????????? YB?????????????????X0?????^ ??Y0??b???????????????????????????S?????????????????????????????????d???????????????????????????R ?????????????????????????????????????????????????????????????? gB??????????????????????????Q ???????????????????????????????? jB???????????????????????[00?[000??????????????????????????????? m 0 ?????????????????????????$0???????????????????????????????? p0?????????????????????????? ???????????????????????????????? s 0 ?????????????????????????$0???????????????????????????????? v0?????????????????????????? ???????????????????????????????? yB??????????????????????????Q ???????????????????????????????? |B?????????????????????????? ?? ~??????????????????????????? ???????????????????????????????? B??????????????????????????Q ???????????????????????????????? ??????????????????????????? ???????????????????????????????? B???????????????????????[00?[000??????????????????????????????? B????????????????????X0??g ??Y0???????????????????????????????? B???????????????????????[0?[00???????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ??  ??????????????????????????$0?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[ 0?[0 0? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[ 0?[0 0? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[ 0?[0 0? $B?????????????????????????? ?? &??????????????????????????? ?????????????????????????????????????????????????????????????? )C??????????????????????????$0???????????????????????????????? ,B???????????????????????[ 0?[0 0??????????????????????????????? /??????????????????????????? ?? 0??????????????????????????? ?? 1??????????????????????????? ?? 2??????????????????????????? ?? 3??????????????????????????? ?? 4??????????????????????????? ?? 5??????????????????????????? ?? 6??????????????????????????? ?? 7??????????????????????????? ?? 8??????????????????????????? ???????????????????????????????? :B?????????????????????????? ?? <??????????????????????????? ???????????????????????????????? >B???????????????????????[00?[000??????????????????????????????? A??????????????????????????? ??C???????????????????????????S?????????????????????????????????E???????????????????????????R ????????????????????????????????~?????????????????????????????? HB??????????????????????????Q ???????????????????????????????? KB???????????????????????[00?[000??????????????????????????????? N 0 ?????????????????????????$0???????????????????????????????? Q0?????????????????????????? ???????????????????????????????? T 0 ?????????????????????????$0???????????????????????????????? W0?????????????????????????? ???????????????????????????????? ZB??????????????????????????Q ???????????????????????????????? ]B?????????????????????????? ?? _??????????????????????????? ???????????????????????????????? aB??????????????????????????Q ???????????????????????????????? d??????????????????????????? ???????????????????????????????? fB???????????????????????[00?[000??????????????????????????????? iB????????????????????X0??g ??Y0???????????????????????????????? pB???????????????????????[0?[00??????????????????????????????? s ????????????????????????? ???????????????????????????????? vB????????????????????X0?????Y ?? |0??????????????????????????$ ?? ~B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ?? 0??????????????????????????$ ?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ?? 0??????????????????????????$ ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ?? 0??????????????????????????$ ?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B????????????????????X0?????Y ?? 0??????????????????????????$ ?? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[0 ?[00 ? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[0 ?[00 ? B?????????????????????????? ?? ??????????????????????????? ????????????????????????????????  ????????????????????????? ???????????????????????????????? B??????????????X0?????Y ??[0 ?[00 ??????????????????????????????? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B?????????????????????????? ?? ??????????????????????????? ???????????????????????????????? B???????????????????????[00?[000??????????????????????????????? ??????????????????????????? ?????????????????????????????S??????????????????????????????=???????????????????????????????????????????????????????????????3 

Initialize"program_counter = 0 error = FALSE memory_count = 0 2SD_DEVICES[LD_SD_TO_PLC_STATUS] = 0 2 SD_DEVICES[LD_SD_FROM_PLC_STATUS] = 0,

Execuet a request from pc.Breq_pause = bld(SD_DEVICES[LD_SD_TO_PLC_STATUS], 1) Hreq_clear_program = bld(SD_DEVICES[LD_SD_TO_PLC_STATUS], 2)#

Execute the cycle*IF program_counter = 0 THEN J FMOV($ffff, SD_DEVICES[LD_SD_I_BSTACK], LD_SD_SIZE_BSTACK)  END IF C#current_bit_value = BLD(SD_DEVICES[LD_SD_I_BSTACK], 0)&CALL(#1) !(operand = fetch_data*

END(,if operand = opr_end then #. program_counter = 0 0end if *2

push stacks; MPS MRD MPP"4SELECT CASE operand ,6CASE opr_mps,opr_mrd, opr_mpp H< WSR(SD_DEVICES[LD_SD_I_BSTACK], LD_SD_SIZE_BSTACK - 1,1) )> if current_bit_value then 3@ SD_DEVICES[LD_SD_I_BSTACK] = $FFFF B ELSE 3E SD_DEVICES[LD_SD_I_BSTACK] = $FFFE G END IF IEND SELECT?K

read from a bit device; LD DLI AND ANI OR ORI"MSELECT CASE operand EOCASE opr_ld,opr_ldi, opr_and, opr_ani, opr_or, opr_ori [ CALL(#3) ]END SELECT%_

pop bstack; ORB ANB"aselect case operand $ccase opr_orb, opr_anb g SET(CR2009) 2i rra(SD_DEVICES[LD_SD_I_BSTACK], 1) =k read_bit = bld(SD_DEVICES[LD_SD_I_BSTACK], 0) mend select*o

invert bit; LDI ANI ORI"qselect case operand -scase opr_ldi, opr_ani, opr_ori 'y read_bit = not read_bit {end select}

load; LD LDI"select case operand #case opr_ld, opr_ldi 2 SLA(SD_DEVICES[LD_SD_I_BSTACK], 1) , current_bit_value = read_bit end select"

and; ANB AND ANI"select case operand -case opr_anb, opr_and, opr_ani B current_bit_value = current_bit_value and read_bit end select

or; ORB OR ORI"select case operand ,case opr_orb, opr_or, opr_ori A current_bit_value = current_bit_value or read_bit end select-

invert output bit; INV OUTI"select case operand %case opr_inv, opr_outi 9 current_bit_value = not current_bit_value end select&

output bit; OUT OUTI"select case operand %case opr_out, opr_outi - write_bit = current_bit_value  CALL(#4) end select

set; SET"select case operand case opr_set ) if current_bit_value then ! write_bit = true  CALL(#4)  else : ' dummy read for inclease program pointer  CALL(#3)  end if end select

reset; RST"select case operand case opr_rst ) if current_bit_value then " write_bit = false  CALL(#4)  else : ' dummy read for inclease program pointer  CALL(#3)  end if end select +

after executing mnenonic.(if current_bit_value then 3 BSET(SD_DEVICES[LD_SD_I_BSTACK], 0) else 3 BRES(SD_DEVICES[LD_SD_I_BSTACK], 0) end if /

pop bstacks; OUT OUTI SET RST"select case operand 7case opr_out, opr_outi, opr_set, opr_rst M wsl(SD_DEVICES[LD_SD_I_BSTACK + 1], LD_SD_SIZE_BSTACK - 1, 1) J  SD_DEVICES[LD_SD_I_BSTACK + LD_SD_SIZE_BSTACK - 1] = $ffff  end selectF 

continue to execute next mnenonic if it's not ended.+

outputs after done cycle."select case operand case opr_end % IF cycle_running THEN ; BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 0)  ELSE ; BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 0)  END IF !! IF ack_pause THEN ;# BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) % ELSE ;( BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) * END IF ), IF ack_clear_program THEN ;. BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) 0 ELSE ;3 BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) 5 END IF 7end select&;

=== SUB ROUTINES ===<

fetch 1 byte/?prog_index = program_counter / 2 5Afetch_data = PROGRAM_TABLE[prog_index] 0Cif program_counter mod 2 = 0 then /F fetch_data = sra(fetch_data, 8) Helse /K fetch_data = fetch_data and $ff Mend if 2Oprogram_counter = program_counter + 1R

fetch 2 bytes/Uprog_index = program_counter / 2 0Wif program_counter mod 2 = 0 then 6Z fetch_data = PROGRAM_TABLE[prog_index] \else g_ fetch_data = SLA(PROGRAM_TABLE[prog_index], 8) or SRA(PROGRAM_TABLE[prog_index + 1], 8) bend if 4dprogram_counter = program_counter + 2 g

read datajcall(#1) $lopecode1 = fetch_data /nnon_immidiate = BLD(opecode1, 7) $pif non_immidiate then (r len16 = BLD(opecode1, 4) t if len16 then v CALL(#2) x else { CALL(#1) } end if % opecode2 = fetch_data ' work1 = opecode1 and $f ! select case work1  case 0 0 read_bit = XY_DEVICES[opecode2]  case 1 0 read_bit = XY_DEVICES[opecode2]  case 2 / read_bit = M_DEVICES[opecode2]  case 4 . read_bit = C_DEVICES:opecode2  case 5 . read_bit = T_DEVICES:opecode2  case 6 / read_bit = L_DEVICES[opecode2]  case 7 0 read_bit = SC_DEVICES[opecode2]  case 10 0 read_word = D_DEVICES[opecode2]  case 14 0 read_word = H_DEVICES[opecode2]  case 15 1 read_word = SD_DEVICES[opecode2]  case else ! read_bit = false  read_word = 0  end select else $ read_data = opecode1 end if 

write datacall(#1) $opecode1 = fetch_data /non_immidiate = BLD(opecode1, 7) $if non_immidiate then ( len16 = BLD(opecode1, 4)  if len16 then  CALL(#2)  else  CALL(#1)  end if % opecode2 = fetch_data ' work1 = opecode1 and $f ! select case work1  case 0 1 XY_DEVICES[opecode2] = write_bit  case 1 1 XY_DEVICES[opecode2] = write_bit   case 2 0 M_DEVICES[opecode2] = write_bit  'case 4 0 ' C_DEVICES:opecode2 = write_bit  'case 5 0 ' T_DEVICES:opecode2 = write_bit  case 6 0 L_DEVICES[opecode2] = write_bit  case 7 1  SC_DEVICES[opecode2] = write_bit % case 10 1' D_DEVICES[opecode2] = write_word + case 14 1- H_DEVICES[opecode2] = write_word 1 case 15 23 SD_DEVICES[opecode2] = write_word 5 end select >else $A read_data = opecode1 Cend if program_counter = 0 error = FALSE memory_count = 0 SD_DEVICES[LD_SD_TO_PLC_STATUS] = 0 SD_DEVICES[LD_SD_FROM_PLC_STATUS] = 0IIII I I req_pause = bld(SD_DEVICES[LD_SD_TO_PLC_STATUS], 1) req_clear_program = bld(SD_DEVICES[LD_SD_TO_PLC_STATUS], 2)IF program_counter = 0 THEN FMOV($ffff, SD_DEVICES[LD_SD_I_BSTACK], LD_SD_SIZE_BSTACK) END IF "current_bit_value = BLD(SD_DEVICES[LD_SD_I_BSTACK], 0)g%CALL(#1) operand = fetch_data+if operand = opr_end then program_counter = 0 end if :3SELECT CASE operand CASE opr_mps,opr_mrd, opr_mpp WSR(SD_DEVICES[LD_SD_I_BSTACK], LD_SD_SIZE_BSTACK - 1,1) if current_bit_value then SD_DEVICES[LD_SD_I_BSTACK] = $FFFF ELSE SD_DEVICES[LD_SD_I_BSTACK] = $FFFE END IF END SELECTLSELECT CASE operand CASE opr_ld,opr_ldi, opr_and, opr_ani, opr_or, opr_ori CALL(#3) END SELECT`select case operand case opr_orb, opr_anb SET(CR2009) rra(SD_DEVICES[LD_SD_I_BSTACK], 1) read_bit = bld(SD_DEVICES[LD_SD_I_BSTACK], 0) end selectpselect case operand case opr_ldi, opr_ani, opr_ori read_bit = not read_bit end select~select case operand case opr_ld, opr_ldi SLA(SD_DEVICES[LD_SD_I_BSTACK], 1) current_bit_value = read_bit end selectselect case operand case opr_anb, opr_and, opr_ani current_bit_value = current_bit_value and read_bit end selectselect case operand case opr_orb, opr_or, opr_ori current_bit_value = current_bit_value or read_bit end selectselect case operand case opr_inv, opr_outi current_bit_value = not current_bit_value end selectselect case operand case opr_out, opr_outi write_bit = current_bit_value CALL(#4) end selectselect case operand case opr_set if current_bit_value then write_bit = true CALL(#4) else ' dummy read for inclease program pointer CALL(#3) end if end selectselect case operand case opr_rst if current_bit_value then write_bit = false CALL(#4) else ' dummy read for inclease program pointer CALL(#3) end if end select if current_bit_value then BSET(SD_DEVICES[LD_SD_I_BSTACK], 0) else BRES(SD_DEVICES[LD_SD_I_BSTACK], 0) end if select case operand case opr_out, opr_outi, opr_set, opr_rst wsl(SD_DEVICES[LD_SD_I_BSTACK + 1], LD_SD_SIZE_BSTACK - 1, 1) SD_DEVICES[LD_SD_I_BSTACK + LD_SD_SIZE_BSTACK - 1] = $ffff end selectselect case operand case opr_end IF cycle_running THEN BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 0) ELSE BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 0) END IF IF ack_pause THEN BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) ELSE BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) END IF IF ack_clear_program THEN BSET(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) ELSE BRES(SD_DEVICES[LD_SD_FROM_PLC_STATUS], 1) END IF end select->prog_index = program_counter / 2 fetch_data = PROGRAM_TABLE[prog_index] if program_counter mod 2 = 0 then fetch_data = sra(fetch_data, 8) else fetch_data = fetch_data and $ff end if program_counter = program_counter + 1FTprog_index = program_counter / 2 if program_counter mod 2 = 0 then fetch_data = PROGRAM_TABLE[prog_index] else fetch_data = SLA(PROGRAM_TABLE[prog_index], 8) or SRA(PROGRAM_TABLE[prog_index + 1], 8) end if program_counter = program_counter + 2 Yicall(#1) opecode1 = fetch_data non_immidiate = BLD(opecode1, 7) if non_immidiate then len16 = BLD(opecode1, 4) if len16 then CALL(#2) else CALL(#1) end if opecode2 = fetch_data work1 = opecode1 and $f select case work1 case 0 read_bit = XY_DEVICES[opecode2] case 1 read_bit = XY_DEVICES[opecode2] case 2 read_bit = M_DEVICES[opecode2] case 4 read_bit = C_DEVICES:opecode2 case 5 read_bit = T_DEVICES:opecode2 case 6 read_bit = L_DEVICES[opecode2] case 7 read_bit = SC_DEVICES[opecode2] case 10 read_word = D_DEVICES[opecode2] case 14 read_word = H_DEVICES[opecode2] case 15 read_word = SD_DEVICES[opecode2] case else read_bit = false read_word = 0 end select else read_data = opecode1 end if 2call(#1) opecode1 = fetch_data non_immidiate = BLD(opecode1, 7) if non_immidiate then len16 = BLD(opecode1, 4) if len16 then CALL(#2) else CALL(#1) end if opecode2 = fetch_data work1 = opecode1 and $f select case work1 case 0 XY_DEVICES[opecode2] = write_bit case 1 XY_DEVICES[opecode2] = write_bit case 2 M_DEVICES[opecode2] = write_bit 'case 4 ' C_DEVICES:opecode2 = write_bit 'case 5 ' T_DEVICES:opecode2 = write_bit case 6 L_DEVICES[opecode2] = write_bit case 7 SC_DEVICES[opecode2] = write_bit case 10 D_DEVICES[opecode2] = write_word case 14 H_DEVICES[opecode2] = write_word case 15 SD_DEVICES[opecode2] = write_word end select else read_data = opecode1 end if %*program_counter*program_counter*error*memory_count*memory_count*req_pause*req_clear_program*req_pause* cycle_running* ack_pause* req_clear_program* PROGRAM_TABLE_SIZE* PROGRAM_TABLE_SIZE*PROGRAM_TABLE_SIZE*ack_clear_program*cycle_running*program_counter*LD_SD_SIZE_BSTACK*LD_SD_SIZE_BSTACK*LD_SD_SIZE_BSTACK*current_bit_value*fetch_data*operand*fetch_data*operand*operand*opr_end*program_counter*program_counter*operand*operand* opr_mps*!opr_mrd*"opr_mpp*#current_bit_value*$operand*%operand*&opr_ld*'opr_ldi*(opr_and*)opr_ani**opr_or*+opr_ori*,operand*-operand*.opr_orb*/opr_anb*0read_bit*1operand*2operand*3opr_ldi*4opr_ani*5opr_ori*6read_bit*7read_bit*8operand*9operand*:opr_ld*;opr_ldi*<read_bit*=current_bit_value*>operand*?operand*@opr_anb*Aopr_and*Bopr_ani*Ccurrent_bit_value*Dread_bit*Ecurrent_bit_value*Foperand*Goperand*Hopr_orb*Iopr_or*Jopr_ori*Kcurrent_bit_value*Lcurrent_bit_value*Mread_bit*Noperand*Ooperand*Popr_inv*Qopr_outi*Rcurrent_bit_value*Scurrent_bit_value*Toperand*Uoperand*Vopr_out*Wopr_outi*Xcurrent_bit_value*Ywrite_bit*Zoperand*[operand*\opr_set*]current_bit_value*^write_bit*_operand*`operand*aopr_rst*bcurrent_bit_value*cwrite_bit*dcurrent_bit_value*eoperand*foperand*gopr_out*hopr_outi*iopr_set*jopr_rst*koperand*lopr_end*moperand*noperand*oopr_end*pcycle_running*qack_pause*rack_clear_program*sprogram_counter*tprog_index*uprog_index*vfetch_data*wfetch_data*xprogram_counter*yfetch_data*zfetch_data*{fetch_data*|fetch_data*}program_counter*~program_counter*program_counter*prog_index*program_counter*prog_index*fetch_data*fetch_data*prog_index*prog_index*fetch_data*program_counter*program_counter*fetch_data*opecode1*fetch_data*opecode1*opecode1*non_immidiate*non_immidiate*opecode1*len16*len16*fetch_data*opecode2*fetch_data*opecode2*opecode1*work1*work1*work1*opecode2*read_bit*opecode2*read_bit*opecode2*read_bit*opecode2*read_bit*opecode2*read_bit*opecode2*read_bit*opecode2*read_bit*opecode2*read_word*read_word*opecode2*read_word*read_word*opecode2*read_word*read_word*read_bit*read_word*read_word*opecode1*read_data*opecode1*read_data*fetch_data*opecode1*fetch_data*opecode1*opecode1*non_immidiate*non_immidiate*opecode1*len16*len16*fetch_data*opecode2*fetch_data*opecode2*opecode1*work1*work1*work1*opecode2*write_bit*opecode2*write_bit*opecode2*write_bit*opecode2*write_bit*opecode2*write_bit*opecode2*write_word*write_word*opecode2*write_word*write_word*opecode2*write_word*write_word*opecode1*read_data*opecode1*read_dataNN?NN?A*6I2d0_program_counterd0^prog_indexd0\operandd0>operand_bitsd0[opecode1d0Zopecode2d0Ywork1d0Xwork2d0Tsub_argsd0Pread_b_argsd0>len16d0>errord0Oindexd0>read_bitd0Nread_wordd0>bit_or_wordd0>non_immidiated0> memory_bitsd0Mmemory_countd0>write_bitd0Lwrite_wordd0Kdev_typed0>current_bit_valued0Jcurrent_word_valued0Itemp_wordd0>cycle_runningd0>req_paused0>ack_paused0>req_clear_programd0>ack_clear_programd0Fread_datad0Gfetch_datad opr_endd opr_ldd opr_ldid opr_andd !opr_anid 0opr_ord 1opr_orid Bopr_mpsd Copr_mrdd Dopr_mppd opr_orbd opr_anbd opr_invd @opr_outd Aopr_outid Popr_setd Qopr_rstd `opr_ff)q.eJ ;\I$[Iq.eJ