?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  2. ;@                                                                            @
  3. ;@                 S Y M B O S   S Y S T E M   L I B R A R Y                  @
  4. ;@                    - SYMSHELL TEXT TERMINAL FUNCTIONS -                    @
  5. ;@                                                                            @
  6. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  7.  
  8. ;Author     Prodatron / Symbiosis
  9. ;Date       28.03.2015
  10.  
  11. ;SymShell provides a program environment with a text terminal. The input and
  12. ;output can be redirected from and to different sources and destinations.
  13. ;This library supports you in using the SymShell functions.
  14.  
  15. ;The existance of
  16. ;- "App_PrcID" (a byte, where the ID of the applications process is stored)
  17. ;- "App_MsgBuf" (the message buffer, 14 bytes, which are placed in the transfer
  18. ;  ram area)
  19. ;- "App_BnkNum" (a byte, where the number of the applications' ram bank (0-15)
  20. ;  is stored)
  21. ;- "App_BegCode" (the first byte/word of the header/code area, which also
  22. ;  includes the total length of the code area)
  23. ;is required.
  24.  
  25.  
  26. ;### SUMMARY ##################################################################
  27.  
  28. ;;   SyShell_PARALL              ;Fetches parameters/switches from command line
  29. ;;   SyShell_PARSHL              ;Parses SymShell info switch
  30. ;use_SyShell_PARFLG      equ 0   ;Validates present switches
  31. ;use_SyShell_CHRINP      equ 0   ;Reads a char from the input source
  32. ;use_SyShell_STRINP      equ 0   ;Reads a string from the input source
  33. ;use_SyShell_CHROUT      equ 0   ;Sends a char to the output destination
  34. ;use_SyShell_STROUT      equ 0   ;Sends a string to the output destination
  35. ;use_SyShell_PTHADD      equ 0   ;...
  36. ;;   SyShell_EXIT                ;Informs SymShell about an exit event
  37.  
  38.  
  39. ;### GLOBAL VARIABLES #########################################################
  40.  
  41. SyShell_CmdParas   ds 8*3   ;command line parameters (1W address, 1B length)
  42. SyShell_CmdSwtch   ds 8*3   ;command line switches
  43. SyShell_PrcID      db 0     ;shell process ID
  44. SyShell_TermX      db 0     ;x length in chars of the text terminal window
  45. SyShell_TermY      db 0     ;y length in chars of the text terminal window
  46. SyShell_Vers       db 0     ;SymShell version (e.g. 21 decimal for 2.1)
  47.  
  48.  
  49. ;### MAIN FUNCTIONS ###########################################################
  50.  
  51. SyShell_PARALL
  52. ;******************************************************************************
  53. ;*** Name           SymShell_Parameters_All
  54. ;*** Input          -
  55. ;*** Output         (SyShell_CmdParas) = list of parameters; 3 bytes/entry
  56. ;***                                     Byte0,1 = pointer
  57. ;***                                     Byte2   = length
  58. ;***                (SyShell_CmdSwtch) = list of switches (see above; a switch
  59. ;***                                     is recognized with a % at the
  60. ;***                                     beginning, which is skipped in this
  61. ;***                                     list)
  62. ;***                D                  = number of parameters
  63. ;***                E                  = number of switches
  64. ;***                ZF                 = if 1, no parameters and switches
  65. ;*** Destroyed      AF,BC,HL,IX,IY
  66. ;*** Description    This function fetches all parameters and switches from the
  67. ;***                command line and generates two pointer tables. A switch is
  68. ;***                recognized with a leading "%" char. A pointer to a switch
  69. ;***                links to the first char behind the %. All parameters and
  70. ;***                switches are zero terminated.
  71. ;*** Example        A\>EXAMPLE.COM filename.ext %x %all hello123
  72. ;***                This will generate two entries in the parameter table:
  73. ;***                - pointer to "filename.ext", length=12
  74. ;***                - pointer to "hello123", length=8
  75. ;***                And two entries in the switch table:
  76. ;***                - pointer to "x", length=1
  77. ;***                - pointer to "all", length=3
  78. ;***                Please note, that SymShell itself will add an own switch to
  79. ;***                the command line (see "SymShell_Parameters_Shell").
  80. ;******************************************************************************
  81.         ld hl,(App_BegCode)
  82.         ld de,App_BegCode
  83.         dec h
  84.         add hl,de                   ;HL = CodeEnd = Command line
  85.         ld ix,SyShell_CmdParas      ;IX = Parameter List
  86.         ld iy,SyShell_CmdSwtch      ;IY = Switch    List
  87.         ld bc,8*256+8       ;B=8-number of parameters, C=8-number of switches
  88. SyHPAl1 push bc
  89.         call SyHPAl2
  90.         pop bc
  91.         jr z,SyHPAl7
  92.         ld a,(hl)
  93.         cp "%"
  94.         jr z,SyHPAl6
  95.         ld (ix+0),l         ;Parameter
  96.         ld (ix+1),h
  97.         push hl
  98.         call SyHPAl4
  99.         pop hl
  100.         ld (ix+2),e
  101.         ld de,3
  102.         add ix,de
  103.         dec b
  104.         jr nz,SyHPAl1
  105.         jr SyHPAl7
  106. SyHPAl6 inc hl              ;Switch
  107.         ld (iy+0),l
  108.         ld (iy+1),h
  109.         push hl
  110.         call SyHPAl4
  111.         pop hl
  112.         ld (iy+2),e
  113.         ld de,3
  114.         add iy,de
  115.         dec c
  116.         jr nz,SyHPAl1
  117. SyHPAl7 ld a,8
  118.         sub c
  119.         ld e,a
  120.         ld a,8
  121.         sub b
  122.         ld d,a
  123.         or e
  124.         ret
  125. ;HL=position inside the string -> jump to next string -> HL=next string, ZF=1 end reached
  126. SyHPAl2 ld a,(hl)
  127.         inc hl
  128.         or a
  129.         ret z
  130.         cp " "
  131.         jr nz,SyHPAl2
  132.         dec hl
  133.         ld (hl),0
  134. SyHPAl3 inc hl
  135.         ld a,(hl)
  136.         cp " "
  137.         jr z,SyHPAl3
  138.         ld a,1
  139.         or a
  140.         ret
  141. ;HL=position inside the string -> E=length until the end
  142. SyHPAl4 ld e,0
  143. SyHPAl5 ld a,(hl)
  144.         or a
  145.         ret z
  146.         cp " "
  147.         ret z
  148.         inc e
  149.         inc hl
  150.         jr SyHPAl5
  151.  
  152. SyShell_PARSHL
  153. ;******************************************************************************
  154. ;*** Name           SymShell_Parameters_Shell
  155. ;*** Input          (SyShell_CmdSwtch) = list of switches
  156. ;***                E                  = number of switches
  157. ;*** Output         CF     = error state (0 = ok, 1 = no valid shell parameters
  158. ;***                         found; application should quit itself at once)
  159. ;***                (SyShell_PrcID) = shell process ID
  160. ;***                (SyShell_TermX) = width in chars of the terminal window
  161. ;***                (SyShell_TermY) = height in chars of the terminal window
  162. ;***                (SyShell_Vers)  = shell version (e.g. 21 decimal for 2.1)
  163. ;*** Destroyed      AF,BC,DE,HL,IX
  164. ;*** Description    This function parses the SymShell info switch from the
  165. ;***                command line. The info switch is built like this:
  166. ;***                %spPPXXYYVV
  167. ;***                PP is the process ID of SymShell itself, XX and YY is the
  168. ;***                size of the text terminal window and VV is the version of
  169. ;***                SymShell. If VV is not present, it is a version below 2.0
  170. ;***                and (SyShell_Vers) will stay 0.
  171. ;***                Every SymShell-based application has to parse this switch
  172. ;***                with the help of this function, as at least the process ID
  173. ;***                is required for any communication with SymShell. You have
  174. ;***                to call SyShell_PARALL first before you call this function,
  175. ;***                as the switch table already has to be present.
  176. ;***                For additional information see also "Symshell Command Line
  177. ;***                Information" in the chapter "SymShell Text Terminal" of the
  178. ;***                Symbos Developer Documentation.
  179. ;******************************************************************************
  180.         ld a,e
  181.         or a
  182.         jr z,SyHPSh6            ;no switches -> error
  183.         ld ix,SyShell_CmdSwtch
  184.         ld bc,3
  185. SyHPSh1 ld l,(ix+0)
  186.         ld h,(ix+1)
  187.         ld a,(hl)
  188.         cp "s"
  189.         jr nz,SyHPSh2
  190.         inc hl
  191.         ld a,(hl)
  192.         cp "p"
  193.         jr  z,SyHPSh3
  194. SyHPSh2 add ix,bc
  195.         dec e
  196.         jr nz,SyHPSh1
  197. SyHPSh6 scf                     ;no Shell-Data -> error
  198.         ret
  199. SyHPSh3 inc hl
  200.         call SyHPSh4
  201.         ld (SyShell_PrcID),a
  202.         call SyHPSh4
  203.         ld (SyShell_TermX),a
  204.         call SyHPSh4
  205.         ld (SyShell_TermY),a
  206.         ld a,(hl)
  207.         or a
  208.         ret z
  209.         call SyHPSh4
  210.         ld (SyShell_Vers),a
  211.         or a
  212.         ret
  213. ;(HL)=2digit number -> A=number, HL=HL+2
  214. SyHPSh4 call SyHPSh5
  215.         add a
  216.         ld d,a
  217.         add a:add a
  218.         add d
  219.         ld d,a
  220.         call SyHPSh5
  221.         add d
  222.         ret
  223. SyHPSh5 ld a,(hl)
  224.         sub "0"
  225.         cp 10
  226.         inc hl
  227.         ret c
  228.         pop hl      ;clear stack
  229.         pop hl
  230.         scf         ;wrong number -> error
  231.         ret
  232.  
  233. if use_SyShell_PARFLG=1
  234. SyShell_PARFLG
  235. ;******************************************************************************
  236. ;*** Name           SymShell_Parameters_Switches
  237. ;*** Input          (SyShell_CmdSwtch) = list of switches
  238. ;***                E                  = number of present switches
  239. ;***                IY                 = list with allowed switches
  240. ;***                                     word 0 = points to valid switch string
  241. ;***                                              (terminated by 0 or colon)
  242. ;***                                     word 1 = will be filled with pointer
  243. ;***                                              behind colon, if found
  244. ;***                                     list is terminated by a 0-word
  245. ;*** Output         CF = 0 -> all switches are valid; HL = bitfield of detected
  246. ;***                          switches
  247. ;***                CF = 1 -> invalid switch found; HL points to invalid switch
  248. ;***                          string (including the % char)
  249. ;*** Destroyed      AF,BC,DE,HL,IX,IY
  250. ;*** Description    This function validates the present switches with a list of
  251. ;***                allowed switches. Switches can have a parameter attached
  252. ;***                which is separated by a colon from the switch. If such a
  253. ;***                switch is found, the function will insert the pointer to
  254. ;***                its parameter into the validation list. If only valid
  255. ;***                switches have been found the function returns with a
  256. ;***                bitfield in HL of the present switches (bit0=1 -> first
  257. ;***                switch in the validation list is present), therefore the
  258. ;***                maximum amount of switches is 16.
  259. ;***                The function returns with an error, if an invalid switch
  260. ;***                has been found.
  261. ;******************************************************************************
  262.         ld hl,0
  263.         ld (SyHPFlb),hl
  264.         ld a,e
  265.         or a
  266.         ret z
  267.         ld b,e              ;b=number of present switches
  268.         ld ix,SyShell_CmdSwtch
  269. SyHPFl1 push iy         ;** present switch loop
  270.         ld c,0              ;iy=validation list, c=number of valid switch
  271. SyHPFl2 ld l,(iy+0)     ;** valid switch loop
  272.         ld h,(iy+1)         ;hl=next valid switch
  273.         ld e,(ix+0)         ;de=next present switch
  274.         ld d,(ix+1)
  275.         ld a,l
  276.         or h
  277.         jr nz,SyHPFl3
  278.         pop hl
  279.         dec de              ;switch not found in validation switch -> error
  280.         ex de,hl
  281.         scf
  282.         ret
  283. SyHPFl3 ld a,(de)           ;test, if shell switch
  284.         cp "s"
  285.         jr nz,SyHPFl9
  286.         inc de
  287.         ld a,(de)
  288.         dec de
  289.         cp "p"
  290.         jr z,SyHPFla        ;yes -> ignore
  291. SyHPFl8 ld a,(de)           ;compare switches
  292. SyHPFl9 cp "A"
  293.         jr c,SyHPFlc
  294.         cp "Z"+1
  295.         jr nc,SyHPFlc
  296.         add "a"-"A"
  297. SyHPFlc cp (hl)
  298.         jr nz,SyHPFl7       ;not equal, compare with next valid
  299.         inc hl
  300.         inc de
  301.         or a
  302.         jr z,SyHPFl4
  303.         cp ":"
  304.         jr nz,SyHPFl8
  305.         ld (iy+2),e         ;switch contains colon -> set pointer to parameter
  306.         ld (iy+3),d
  307. SyHPFl4 ld hl,1             ;switch found -> set bit
  308.         inc c
  309. SyHPFl5 dec c
  310.         jr z,SyHPFl6
  311.         add hl,hl
  312.         jr SyHPFl5
  313. SyHPFl6 ld de,(SyHPFlb)
  314.         add hl,de
  315.         ld (SyHPFlb),hl
  316. SyHPFla ld de,3
  317.         add ix,de
  318.         pop iy
  319.         djnz SyHPFl1
  320.         ld hl,(SyHPFlb)
  321.         ret                 ;all present switches are valid -> CF=0, HL=switch-bitfield
  322. SyHPFl7 ld de,4             ;continue with next valid
  323.         add iy,de
  324.         inc c
  325.         jr SyHPFl2
  326.  
  327. SyHPFlb dw 0                ;recognized switches
  328. endif
  329.  
  330. if use_SyShell_CHRINP=1
  331. SyShell_CHRINP0 ld e,0
  332. SyShell_CHRINP
  333. ;******************************************************************************
  334. ;*** Name           SymShell_CharInput_Command
  335. ;*** Input          E  = Channel (0=Standard, 1=Keyboard)
  336. ;*** Output         CF = Error state (0 = ok, 1 = error; A = error code)
  337. ;***                - If error status is 0
  338. ;***                ZF = EOF status (0=EOF)
  339. ;***                - If error status is 0 and there is no EOF:
  340. ;***                A  = Char
  341. ;*** Destroyed      F,BC,DE,HL,IX,IY
  342. ;*** Description    Reads a char from an input source. The input source can be
  343. ;***                the standard channel or the console keyboard. Usually the
  344. ;***                standard channel is the console keyboard, too, but it can also
  345. ;***                be a textfile or another source, if redirection or piping is
  346. ;***                active.
  347. ;***                If the keyboard is used, this function won't return as long as
  348. ;***                no key is pressed. If the user pressed Control+C or if the end
  349. ;***                of the file (EOF) has been reached, the EOF flag will be set.
  350. ;******************************************************************************
  351.         ld bc,MSR_SHL_CHRINP*256+MSC_SHL_CHRINP
  352.         call SyShell_DoCommand
  353.         ret c
  354.         ld a,(iy+2)
  355.         ret
  356. endif
  357.  
  358. if use_SyShell_STRINP=1
  359. SyShell_STRINP0 ld e,0
  360. SyShell_STRINP
  361. ;******************************************************************************
  362. ;*** Name           SymShell_StringInput_Command
  363. ;*** Input          E  = Channel (0=Standard, 1=Keyboard)
  364. ;***                HL = String buffer address (must have a size of 256 bytes)
  365. ;*** Output         CF = Error state (0 = ok, 1 = error; A = error code)
  366. ;***                - If error status is 0
  367. ;***                ZF = EOF status (0=EOF)
  368. ;***                - If error status is 0 and there is no EOF, the string
  369. ;***                  buffer contains the read line.
  370. ;*** Destroyed      F,BC,DE,HL,IX,IY
  371. ;*** Description    Reads a string from an input source. The input source can be
  372. ;***                the standard channel or the console keyboard. Usually the
  373. ;***                standard channel is the console keyboard, too, but it can also
  374. ;***                be a textfile or another source, if redirection or piping is
  375. ;***                active.
  376. ;***                The maximum lenght of a string is 255 chars, so the buffer must
  377. ;***                have a size of 256 bytes (255 + terminator). A string is always
  378. ;***                terminated by 0.
  379. ;***                If the keyboard is used, this function won't return until the
  380. ;***                user typed in a text line and pressed the Return key. If the
  381. ;***                user pressed Control+C or if the end of the file (EOF) has been
  382. ;***                reached, the EOF flag will be set.
  383. ;******************************************************************************
  384.         ld bc,MSR_SHL_STRINP*256+MSC_SHL_STRINP
  385.         ld a,(App_BnkNum)
  386.         ld d,a
  387.         jp SyShell_DoCommand
  388. endif
  389.  
  390. if use_SyShell_CHROUT=1
  391. SyShell_CHROUT0 ld e,0
  392. SyShell_CHROUT
  393. ;******************************************************************************
  394. ;*** Name           SymShell_CharOutput_Command
  395. ;*** Input          E  = Channel (0=Standard, 1=Screen)
  396. ;***                D  = Char
  397. ;*** Output         CF = Error state (0 = ok, 1 = error; A = error code)
  398. ;*** Destroyed      F,BC,DE,HL,IX,IY
  399. ;*** Description    Sends a char to the output destination. The output destination
  400. ;***                can be the standard channel or the console text screen. Usually
  401. ;***                the standard channel is the console text screen, too, but it
  402. ;***                can also be a textfile or another destination, if redirection
  403. ;***                or piping is active.
  404. ;******************************************************************************
  405.         ld bc,MSR_SHL_CHROUT*256+MSC_SHL_CHROUT
  406.         jp SyShell_DoCommand
  407. endif
  408.  
  409. if use_SyShell_STROUT=1
  410. SyShell_STROUT0 ld e,0
  411. SyShell_STROUT
  412. ;******************************************************************************
  413. ;*** Name           SymShell_StringOutput_Command
  414. ;*** Input          E  = Channel (0=Standard, 1=Screen)
  415. ;***                HL = String address (terminated by 0)
  416. ;*** Output         CF = Error state (0 = ok, 1 = error; A = error code)
  417. ;*** Destroyed      F,BC,DE,HL,IX,IY
  418. ;*** Description    Sends a string to the output destination. The output
  419. ;***                destination can be the standard channel or the console text
  420. ;***                screen. Usually the standard channel is the console text
  421. ;***                screen, too, but it can also be a textfile or another
  422. ;***                destination, if redirection or piping is active.
  423. ;***                A string has always to be terminated by 0.
  424. ;******************************************************************************
  425.         ld a,(App_BnkNum)
  426.         ld d,a
  427.         push hl
  428.         xor a
  429.         ld bc,255
  430.         cpir
  431.         ld a,254
  432.         sub c       ;A=string length
  433.         pop hl
  434.         ret z
  435.         ld bc,MSR_SHL_STROUT*256+MSC_SHL_STROUT
  436.         jp SyShell_DoCommand
  437. endif
  438.  
  439. if use_SyShell_PTHADD=1
  440. SyShell_PTHADD
  441. ;******************************************************************************
  442. ;*** Name           SymShell_PathAdd_Command
  443. ;*** Input          DE = address of base path (0=actual shell path)
  444. ;***                HL = address of additional path component
  445. ;***                BC = buffer address for new full path
  446. ;***                     (must have a size of 256 bytes)
  447. ;*** Output         DE = position behind last char in new path
  448. ;***                HL = position behind last / in new path
  449. ;***                A  = Bit[0]=1 -> new path ends with /
  450. ;***                     Bit[1]=1 -> new path contains wildcards
  451. ;*** Destroyed      F,BC,IX,IY
  452. ;*** Description    ...
  453. ;******************************************************************************
  454.         ld a,(App_BnkNum)
  455.         ld (App_MsgBuf+7),a
  456.         ld a,b
  457.         ld (App_MsgBuf+6),a
  458.         ld b,c
  459.         ld c,MSC_SHL_PTHADD
  460.         call SyShell_SendMessage
  461. SyHPtA1 call SyShell_WaitMessage
  462.         cp MSR_SHL_PTHADD
  463.         jr nz,SyHPtA1
  464.         ld de,(App_MsgBuf+1)
  465.         ld hl,(App_MsgBuf+3)
  466.         ld a,(App_MsgBuf+5)
  467.         ret
  468. endif
  469.  
  470. SyShell_EXIT
  471. ;******************************************************************************
  472. ;*** Name           SymShell_Exit_Command
  473. ;*** Input          E  = Exit type (0 = quit, 1 = blur)
  474. ;*** Output         -
  475. ;*** Destroyed      AF,BC,DE,HL,IX,IY
  476. ;*** Description    The application informs SymShell about an exit event.
  477. ;***                If an application quits itself, SymShell has to be informed
  478. ;***                about that, so that it can remove the application from its
  479. ;***                internal management table. In this case the exit type has to be
  480. ;***                0 ("quit").
  481. ;***                If an application doesn't require the focus inside the text
  482. ;***                terminal anymore, it has to send exit type 1 ("blur"). The
  483. ;***                background is, that SymShell can run multiple applications in
  484. ;***                the same text terminal at the same time. User text inputs will
  485. ;***                only be sent to the application which has been started at first
  486. ;***                until it releases the focus and goes into blur mode. In this
  487. ;***                case the next application or the command line interpreter of
  488. ;***                the shell itself will receive the focus (the user can force the
  489. ;***                shell to get back focus at once by appending "&" at the end of
  490. ;***                the command line).
  491. ;******************************************************************************
  492.         ld c,MSC_SHL_EXIT
  493.         jp SyShell_SendMessage
  494.  
  495.  
  496. ;### SUB ROUTINES #############################################################
  497.  
  498. SyShell_SendMessage
  499. ;******************************************************************************
  500. ;*** Input          C  = Command
  501. ;***                DE = Parameter 1/2
  502. ;***                HL = Parameter 3/4
  503. ;***                B  = Parameter 5
  504. ;*** Output         -
  505. ;*** Destroyed      AF,BC,DE,HL,IX,IY
  506. ;*** Description    Sends a message to the SymShell process
  507. ;******************************************************************************
  508.         ld iy,App_MsgBuf
  509.         ld (iy+0),c
  510.         ld (App_MsgBuf+1),de
  511.         ld (App_MsgBuf+3),hl
  512.         ld (iy+5),b
  513.         ld a,(SyShell_PrcID)
  514.         db #dd:ld h,a
  515.         ld a,(App_PrcID)
  516.         db #dd:ld l,a
  517.         rst #10
  518.         ret
  519.  
  520. SyShell_WaitMessage
  521. ;******************************************************************************
  522. ;*** Input          -
  523. ;*** Output         IY = message buffer
  524. ;***                A  = first byte in the Message buffer (IY+0)
  525. ;*** Destroyed      F,BC,DE,HL,IX
  526. ;*** Description    Waits for a response message from the SymShell process.
  527. ;******************************************************************************
  528.         ld iy,App_MsgBuf
  529. SyHWMs1 ld a,(SyShell_PrcID)
  530.         db #dd:ld h,a
  531.         ld a,(App_PrcID)
  532.         db #dd:ld l,a
  533.         rst #08             ;wait for a SymShell message
  534.         db #dd:dec l
  535.         jr nz,SyHWMs1
  536.         ld a,(iy+0)
  537.         ret
  538.  
  539. SyShell_DoCommand
  540. ;******************************************************************************
  541. ;*** Input          C       = Command
  542. ;***                DE,HL,A = additional parameters
  543. ;***                B       = Response type
  544. ;*** Output         CF      = Error state (0 = ok, 1 = error, A = error code)
  545. ;***                ZF      = EOF status (0=EOF) [optional]
  546. ;*** Destroyed      F,BC,DE,HL,IX,IY
  547. ;*** Description    Executes a complete SymShell command.
  548. ;******************************************************************************
  549.         push bc
  550.         ld b,a
  551.         call SyShell_SendMessage
  552.         pop bc
  553. SyHGRs1 push bc
  554.         call SyShell_WaitMessage
  555.         pop bc
  556.         cp b
  557.         jr nz,SyHGRs2
  558.         ld a,(iy+3)     ;Error state
  559.         ld c,(iy+1)     ;EOF (0=no eof)
  560.         cp 1
  561.         ccf             ;CF=0 no error
  562.         inc c
  563.         dec c           ;ZF=0 EOF
  564.         ret
  565. SyHGRs2 push bc         ;wrong message (from another event) -> re-send
  566.         ld a,(SyShell_PrcID)
  567.         db #dd:ld l,a
  568.         ld a,(App_PrcID)
  569.         db #dd:ld h,a
  570.         rst #10
  571.         rst #30
  572.         pop bc
  573.         jr SyHGRs1
  574.