<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title> words/char-scan.asm </title>
    <meta name="keywords" content="amforth programming language Forth ATmega ATMEL">
    <meta name="description" content="amforth - laguage Forth for ATMEL ATmega">
    <!-- AUTOINCLUDE START "Page/Head.en.ihtml" DO NOT REMOVE -->
    <link rel="StyleSheet" href="../../../../Web/CSS/MLAB.css" type="text/css" title="MLAB Basic Style">
    <link rel="StyleSheet" href="../../../../Web/CSS/MLAB_Print.css" type="text/css" media="print">
    <link rel="shortcut icon" type="image/x-icon" href="../../../../Web/PIC/MLAB.ico">
    <script type="text/javascript" src="../../../../Web/JS/MLAB_Menu.js"></script>
    <!-- AUTOINCLUDE END -->
  </head>

  <body lang="en">

    <!-- AUTOINCLUDE START "Page/Header.en.ihtml" DO NOT REMOVE -->
    <!-- ============== HEADER ============== -->
    <div class="Header">
      <script type="text/javascript">
      <!--
        SetRelativePath("../../../../");
        DrawHeader();
      // -->
      </script>
      <noscript>
        <p><b> JavaScript is required for including of the header </b></p>
      </noscript>
    </div>
    <!-- AUTOINCLUDE END -->

    <!-- AUTOINCLUDE START "Page/Menu.en.ihtml" DO NOT REMOVE -->
    <!-- ============== MENU ============== -->
    <div class="Menu">
      <script type="text/javascript">
      <!--
        SetRelativePath("../../../../");
        DrawMenu();
      // -->
      </script>
      <noscript>
        <p><b> JavaScript is required for including of the menu </b><p>
      </noscript>
    </div>
    <!-- AUTOINCLUDE END -->

    <!-- ============== TEXT ============== -->
    <div class="Text">

      <h1> words/char-scan.asm </h1>

      <p>
        <input type=button onClick="history.back()" value="Back">
        <input type=button onClick="history.forward()" value="Forward">
        <a href="../WordList.en.html">Jump to Vocabulary</a>
      </p>

      <pre>
; ( addr1 n1 c -- addr1 n2 ) String
; R( -- )
; Scan string at addr1/n1 until first c, leaving addr1/n2, char at n2 is last non-c character
VE_CSCAN:
    .db $05, &quot;cscan&quot;
    .dw VE_HEAD
    .set VE_HEAD = VE_CSCAN
XT_CSCAN:
    .dw DO_COLON
PFA_CSCAN:
    .dw XT_SWAP         ; ( -- addr1 c n1 )
    .dw XT_DUP          ; ( -- addr1 c n1 n1)
    .dw XT_TO_R         ; ( -- addr1 c n1)
    .dw XT_ZERO         ; ( -- addr1 c n1 0)
    .dw XT_DODO         ; ( -- addr1 c)
    .dw PFA_CSCAN3
PFA_CSCAN1:
    .dw XT_OVER         ; ( -- addr1 c addr1 )
    .dw XT_I            ; ( -- addr1 c addr1 i)
    .dw XT_PLUS         ; ( -- addr1 c addr')
    .dw XT_CFETCH       ; ( -- addr1 c c')
    .dw XT_OVER         ; ( -- addr1 c c' c)
    .dw XT_EQUAL        ; ( -- addr1 c f)
    .dw XT_DOCONDBRANCH ; ( -- addr1 c)
    .dw PFA_CSCAN2
    .dw XT_DROP         ; ( -- addr1 )
    .dw XT_I            ; ( -- addr1 n2)
    .dw XT_UNLOOP       ; ( -- addr1 n2)
    .dw XT_R_FROM       ; ( -- addr1 n2 n1)
    .dw XT_DROP         ; ( -- addr1 n2)
    .dw XT_EXIT
PFA_CSCAN2:
    .dw XT_DOLOOP
    .dw PFA_CSCAN1      ; ( -- addr1 c)
PFA_CSCAN3:
    .dw XT_DROP         ; ( -- addr1)
    .dw XT_R_FROM       ; ( -- addr1 n1)
    .dw XT_EXIT
</pre>

      <p>
        <input type=button onClick="history.back()" value="Back">
        <input type=button onClick="history.forward()" value="Forward">
        <a href="../WordList.en.html">Jump to Vocabulary</a>
      </p>

    </div>

    <!-- AUTOINCLUDE START "Page/Footer.en.ihtml" DO NOT REMOVE -->
    <!-- ============== FOOTER ============== -->
    <div class="Footer">
      <script type="text/javascript">
      <!--
        SetRelativePath("../../../../");
        DrawFooter();
      // -->
      </script>
      <noscript>
        <p><b> JavaScript is required for including of the footer </b></p>
      </noscript>
    </div>
    <!-- AUTOINCLUDE END -->

  </body>
</html>