0,0 → 1,219 |
<!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/find.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/find.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> |
; ( addr -- -- [ addr 0 ] | [ xt [-1|1]] ) Tools |
; R( -- ) |
; search dictionary |
VE_FIND: |
.db $04, "find", 0 |
.dw VE_HEAD |
.set VE_HEAD = VE_FIND |
XT_FIND: |
.dw DO_COLON |
PFA_FIND: |
.dw XT_DUP |
.dw XT_TO_R |
.dw XT_HEAD |
.dw XT_EFETCH |
PFA_FIND1: |
; ( addr ) |
.dw XT_DUP |
.dw XT_NOTEQUALZERO |
.dw XT_DOCONDBRANCH |
.dw PFA_FIND2 |
.dw XT_ICOMPARE |
; (addr-ram addr-flash -- addr-flash' 0|1 |
.dw XT_QDUP |
.dw XT_NOTEQUALZERO |
.dw XT_DOCONDBRANCH |
.dw PFA_FIND3 |
; we found the word |
.dw XT_SWAP |
.dw XT_1PLUS ; make XT |
.dw XT_SWAP |
.dw XT_R_FROM |
.dw XT_DROP |
|
.dw XT_EXIT |
|
PFA_FIND3: |
.dw XT_R_FROM |
.dw XT_DUP |
.dw XT_TO_R |
.dw XT_SWAP |
.dw XT_IFETCH |
.dw XT_DOBRANCH |
.dw PFA_FIND1 |
|
PFA_FIND2: |
.dw XT_DROP |
.dw XT_DROP |
.dw XT_R_FROM |
.dw XT_ZERO |
.dw XT_EXIT |
|
; private headerless routine |
; compares counted string in RAM with counted string in flash |
; |
; ( addr -- -- [ addr 0 ] | [ xt [-1|1]] ) |
; R( -- ) |
; search dictionary |
;VE_ICOMPARE: |
; .db $04, "icompare" |
; .dw VE_HEAD |
; .set VE_HEAD = VE_ICOMPARE |
XT_ICOMPARE: |
.dw DO_COLON |
PFA_ICOMPARE: |
; ( addr-ram addr-flash -- 0| +/-1 |
.dw XT_DUP |
.dw XT_IFETCH |
.dw XT_DUP |
.dw XT_DOLITERAL |
.dw $0080 |
.dw XT_AND |
.dw XT_TO_R ; send immediate flag to r-stack |
.dw XT_ZERO |
.dw XT_TO_R |
.dw XT_DOLITERAL |
.dw $001f |
.dw XT_AND |
.dw XT_2SLASH |
.dw XT_1PLUS |
.dw XT_TO_R |
PFA_ICOMPARE1: |
.dw XT_OVER |
.dw XT_OVER |
.dw XT_IFETCH |
.dw XT_DOLITERAL |
.dw $ff7f |
.dw XT_AND |
.dw XT_SWAP |
.dw XT_FETCH |
.dw XT_EQUAL |
.dw XT_DOCONDBRANCH |
.dw PFA_ICOMPARE3 |
; increment pointers, 1 CELL for FLASH, 2 bytes for RAM |
.dw XT_1PLUS |
.dw XT_SWAP |
.dw XT_1PLUS |
.dw XT_1PLUS |
.dw XT_SWAP |
; decrement cell counter, leave loop for zero |
.dw XT_R_FROM |
.dw XT_1MINUS |
.dw XT_DUP |
.dw XT_TO_R |
.dw XT_EQUALZERO |
.dw XT_DOCONDBRANCH |
.dw PFA_ICOMPARE2 |
; we found matching strings |
.dw XT_R_FROM |
.dw XT_R_FROM |
.dw XT_DROP |
.dw XT_DOLITERAL |
.dw 1 |
.dw XT_TO_R |
.dw XT_TO_R |
.dw XT_DOBRANCH |
.dw PFA_ICOMPARE3 |
PFA_ICOMPARE2: |
.dw XT_DOBRANCH |
.dw PFA_ICOMPARE1 |
|
PFA_ICOMPARE3: |
.dw XT_SWAP |
.dw XT_DROP |
.dw XT_R_FROM |
.dw XT_PLUS |
.dw XT_R_FROM |
.dw XT_R_FROM |
.dw XT_EQUALZERO |
.dw XT_DOCONDBRANCH |
.dw PFA_ICOMPARE4 |
.dw XT_NEGATE |
PFA_ICOMPARE4: |
.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> |