⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convbas.html

📁 关于ARM汇编的非常好的教程
💻 HTML
字号:
<!doctype html public "-//W3C//DTD HTML 3.2//EN"><html><head><title>Converting BASIC to assembler</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><meta http-equiv="content-language" content="en" /><meta name="resource-type" content="document"><meta name="copyright" content="This document copyright 2002 by Richard Murray. Use for non-profit and education purposes explicitly granted."><meta name="author" content="Richard Murray"><meta name="rating" content="general"></head><!--  /assembler/convbas.html            --><!--                                     --><!--  (C) Copyright 2002 Richard Murray  --><!--  Designed by Richard Murray         --><!--  rmurray@heyrick.co.uk              --><!--                                     --><body bgcolor="#f0f0f0" text="#000000" link="#0022dd" vlink="#002288"><table border = "0" width="100%">  <tr>    <td align=center width=100>      <img src="arm3.gif" width=79 height=78 align = middle>    </td>    <td>      <h1 align="center"><font color="#800080">Converting BASIC to assembler</font></h1>    </td>    <td align=center width=100>      <img src="arm3.gif" width=79 height=78 align = middle>    </td></table><p>&nbsp;<p>It is always seen as a fairly major thing to port BASIC programs to assembler; while it is arather deep and irksome thing to do, it must be remembered that the operating system is more thanwilling to help out.<p>Here are some examples...<h2>GET</h2>... <code>SWI &quot;OS_ReadC&quot;</code><p>&nbsp;<p><h2>INKEY</h2>Look at <code>OS_Byte 129</code> to check for a specific key <em>or</em> to read a key within agiven time.<p>&nbsp;<p><h2>INPUT var$</h2><pre>    ; read the input    ADR     R0, buffer    MOV     R1, #128       ; max. line length is 128 characters    MOV     R2, #32        ; min. ascii allowed is space (32)    MOV     R3, #126       ; max. ascii allowed is 126    SWI     &quot;OS_ReadLine&quot;    ; echo the string (optional)    ADR     R3, buffer  .echo_loop    LDRB    R0, [R3], #1   ; BASIC's INPUT does an echo of the    SWI     &quot;OS_WriteC&quot;    ; data entered, but you may prefer    CMP     R0, #13        ; not to do this. Up to you.    BNE     echo_loop    SWI     &quot;OS_NewLine&quot;    MOV     PC, R14        ; now return to caller  .buffer    EQUS    STRING$(128, CHR$(0))</pre><p>&nbsp;<p><h2>SPC</h2>Simply loop while outputting spaces 'n' times.<br>A quick way to output a space is <code>SWI 256+32</code>.<p>&nbsp;<p><h2>TAB(x,y)</h2>Use <code>VDU 31, x, y</code>, like:<pre>    MOV     R1, #100       ; X    MOV     R2, #200       ; Y    ; do it    SWI     256 + 31       ; VDU 31    MOV     R0, R1    SWI     &quot;OS_WriteC&quot;   ; output X    MOV     R0, R2    SWI     &quot;OS_WriteC&quot;   ; output Y</pre><p>&nbsp;<p>That simply scratches the surface. You need to stop thinking of 'integers' and 'strings' andinstead think of them as units. For example, a string is simply a sequence of bytes starting at a given location and continuing until a certain condition (such as a terminator byte or lengthcount) is met.<p>&nbsp;<p><hr size = 3><a href="index.html#04">Return to assembler index</a><hr size = 3><address>Copyright &copy; 2002 Richard Murray</address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -