Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
royaltm committed Jan 10, 2024
1 parent cbca43b commit 6472bfe
Show file tree
Hide file tree
Showing 11 changed files with 330 additions and 169 deletions.
69 changes: 33 additions & 36 deletions README_rdoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,51 +193,48 @@ <h2 id="label-A+Z80+assembler+powered+by+Ruby.">A <a href="Z80.html"><code>Z80</

<p>check the debug output:</p>

<pre>8000: 2A2080 ld hl, (8020H) -&gt; multiplicand
8003: 3A2280 ld a, (8022H) -&gt; multiplier
8006: C32380 jp 8023H -&gt; math.mul
8009: 00 00 00 00 00 00 00 00 ........
8011: 00 00 00 00 00 00 00 00 ........
8019: 00 00 00 00 00 00 00 .......
8020: 00 00 .. :multiplicand
8022: 00 . :multiplier
8023: :math
<pre>8000: 2A0980 ld hl, (8009H) -&gt; multiplicand
8003: 3A0B80 ld a, (800bH) -&gt; multiplier
8006: C30C80 jp 800cH -&gt; math.mul
8009: 00 00 .. :multiplicand
800B: 00 . :multiplier
800C: :math
============== MyZXMath ==============
8023: --- begin --- :mul
8023: 5D ld e, l
8024: 54 ld d, h
8025: 210000 ld hl, 0000H
8028: CB3F srl a :mul.loop1
802A: 3003 jr NC, 802fH -&gt; noadd
802C: 19 add hl, de
802D: 380B jr C, 803aH -&gt; EOC
802F: 2807 jr Z, 8038H :mul.noadd -&gt; ok
8031: CB23 sla e
8033: CB12 rl d
8035: D22880 jp NC, 8028H -&gt; loop1
8038: :mul.ok
8038: 4D ld c, l
8039: 44 ld b, h
803A: --- end --- :mul.EOC
803A: D0 ret NC
803B: CF rst 08H
803C: 0A .
800C: --- begin --- :mul
800C: 5D ld e, l
800D: 54 ld d, h
800E: 210000 ld hl, 0000H
8011: CB3F srl a :mul.loop1
8013: 3003 jr NC, 8018H -&gt; noadd
8015: 19 add hl, de
8016: 380B jr C, 8023H -&gt; EOC
8018: 2807 jr Z, 8021H :mul.noadd -&gt; ok
801A: CB23 sla e
801C: CB12 rl d
801E: D21180 jp NC, 8011H -&gt; loop1
8021: :mul.ok
8021: 4D ld c, l
8022: 44 ld b, h
8023: --- end --- :mul.EOC
8023: D0 ret NC
8024: CF rst 08H
8025: 0A .
^^^^^^^^^^^^^^ MyZXMath ^^^^^^^^^^^^^^</pre>

<p>wait, there&#39;s more…</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;zxlib/basic&#39;</span>

<span class="ruby-identifier">prog</span> = <span class="ruby-constant">ZXLib</span><span class="ruby-operator">::</span><span class="ruby-constant">Basic</span>.<span class="ruby-identifier">parse_source</span> <span class="ruby-identifier">&lt;&lt;-END</span>
<span class="ruby-value"> 10 CLEAR 32767
20 LOAD &quot;multiply&quot;CODE
30 INPUT &quot;Multiplicand: &quot;, x
40 INPUT &quot;Multiplicator: &quot;, y
50 POKE 32800, x-INT(x/256)*256
60 POKE 32801, INT(x/256)
70 POKE 32802, y
<span class="ruby-value"> 10 CLEAR #{calc.org-1}
20 LOAD &quot;&quot;CODE
30 INPUT &quot;Multiplicand: &quot;,x
40 INPUT &quot;Multiplier: &quot;,y
50 POKE #{calc[:multiplicand]},x-INT (x/256)*256
60 POKE #{calc[:multiplicand]+1},INT (x/256)
70 POKE #{calc[:multiplier]},y
80 PRINT &quot;x: &quot;, x, &quot;y: &quot;, y
90 PRINT USR 32768
90 PRINT USR #{calc.org}
100 GO TO 30
</span><span class="ruby-identifier">END</span>

Expand Down
235 changes: 194 additions & 41 deletions Z80/MathInt/Macros.html

Large diffs are not rendered by default.

47 changes: 28 additions & 19 deletions ZXLib/Sys/Macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="find_def_fn_args-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1026</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1031</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">find_def_fn_args</span>(<span class="ruby-identifier">argnum</span>=<span class="ruby-identifier">b</span>, <span class="ruby-value">subroutine:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">not_found:</span><span class="ruby-keyword">nil</span>, <span class="ruby-value">cf_on_direct:</span><span class="ruby-keyword">false</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">not_found_blk</span>)
<span class="ruby-identifier">isolate</span> <span class="ruby-value">use:</span> <span class="ruby-value">:vars</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">eoc</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">ld</span> <span class="ruby-identifier">b</span>, <span class="ruby-identifier">argnum</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">argnum</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">b</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">argnum</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
Expand Down Expand Up @@ -824,7 +824,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="mmu128_select_bank-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1131</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1136</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mmu128_select_bank</span>(<span class="ruby-value">bank:</span><span class="ruby-keyword">nil</span>, <span class="ruby-value">screen:</span><span class="ruby-keyword">nil</span>, <span class="ruby-value">disable_intr:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">enable_intr:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">mmu_port_in_bc:</span><span class="ruby-keyword">false</span>, <span class="ruby-value">sys128:</span><span class="ruby-keyword">self</span>.<span class="ruby-identifier">sys128</span>)
<span class="ruby-identifier">mask</span> = <span class="ruby-value">0b11111111</span>
<span class="ruby-identifier">merg</span> = <span class="ruby-value">0b00000000</span>
Expand Down Expand Up @@ -907,7 +907,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="mmu128_swap_screens-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1176</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1181</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mmu128_swap_screens</span>(<span class="ruby-value">swap_bank:</span><span class="ruby-keyword">false</span>, <span class="ruby-value">disable_intr:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">enable_intr:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">mmu_port_in_bc:</span><span class="ruby-keyword">false</span>, <span class="ruby-value">sys128:</span><span class="ruby-keyword">self</span>.<span class="ruby-identifier">sys128</span>)
<span class="ruby-identifier">swap_bits</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">swap_bank</span> <span class="ruby-keyword">then</span> <span class="ruby-value">0b00001010</span> <span class="ruby-keyword">else</span> <span class="ruby-value">0b00001000</span> <span class="ruby-keyword">end</span>
<span class="ruby-identifier">isolate</span> <span class="ruby-keyword">do</span>
Expand Down Expand Up @@ -956,7 +956,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="move_basic_above_scld_screen_memory-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1195</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1200</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">move_basic_above_scld_screen_memory</span>(<span class="ruby-value">check_ensure:</span><span class="ruby-keyword">false</span>)
<span class="ruby-identifier">isolate</span> <span class="ruby-value">use:</span> [<span class="ruby-value">:memT2k</span>, <span class="ruby-value">:vars</span>, <span class="ruby-value">:rom</span>] <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">eoc</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">ld</span> <span class="ruby-identifier">hl</span>, <span class="ruby-identifier">memT2k</span>.<span class="ruby-identifier">rambot</span>
Expand Down Expand Up @@ -1022,7 +1022,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="read_arg_string-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 990</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 995</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">read_arg_string</span>(<span class="ruby-identifier">adh</span>=<span class="ruby-identifier">d</span>, <span class="ruby-identifier">adl</span>=<span class="ruby-identifier">e</span>, <span class="ruby-identifier">lenh</span>=<span class="ruby-identifier">b</span>, <span class="ruby-identifier">lenl</span>=<span class="ruby-identifier">c</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">if</span> [<span class="ruby-identifier">adh</span>, <span class="ruby-identifier">adl</span>, <span class="ruby-identifier">lenl</span>].<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">h</span>, <span class="ruby-identifier">l</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">r</span>) }
<span class="ruby-identifier">isolate</span> <span class="ruby-keyword">do</span>
Expand Down Expand Up @@ -1050,7 +1050,7 @@ <h3>Public Instance Methods</h3>

<div class="method-heading">
<span class="method-name">read_integer32_value</span><span
class="method-args">(th=de, tl=bc)</span>
class="method-args">(t3=d, t2=e, t1=b, t0=c)</span>

<span class="method-click-advice">click to toggle source</span>

Expand All @@ -1065,30 +1065,39 @@ <h3>Public Instance Methods</h3>
<dl class="rdoc-list note-list"><dt><code>hl</code>
<dd>
<p>must point to the 1st byte of the FP-value.</p>
</dd><dt><code>th</code>
</dd><dt><code>t3</code>
<dd>
<p>most significant 16-bit output register pair.</p>
</dd><dt><code>tl</code>
<p>most significant 8-bit output register.</p>
</dd><dt><code>t2</code>
<dd>
<p>8-bit output register.</p>
</dd><dt><code>t1</code>
<dd>
<p>least significant 16-bit output register pair.</p>
<p>8-bit output register.</p>
</dd><dt><code>t0</code>
<dd>
<p>least significant 8-bit output register.</p>
</dd></dl>

<p>The result is being loaded into <code>th</code>|<code>tl</code>. CF=1 signals that the FP-value is too big to fit into a 32-bit integer. ZF=1 signals that the FP-value is positive. In this instance accumulator <code>a</code> = 0. ZF=0 signals that the FP-value is negative. In this instance accumulator <code>a</code> = 0xFF. If the value is negative the integer WON&#39;T BE a twos complement number.</p>
<p>The result is being loaded into <code>t3</code>|<code>t2</code>|<code>t1</code>|<code>t0</code>. CF=1 signals that the FP-value is too big to fit into a 32-bit integer. ZF=1 signals that the FP-value is positive. In this instance accumulator <code>a</code> = 0. ZF=0 signals that the FP-value is negative. In this instance accumulator <code>a</code> = 0xFF. If the value is negative the integer WON&#39;T BE a twos complement number.</p>

<p><code>hl</code> will always point to the last byte of the FP-value.</p>

<p>Modifies: <code>af</code>, <code>af&#39;</code>, <code>hl</code>, <code>th</code>, <code>tl</code>.</p>
<p>Modifies: <code>af</code>, <code>af&#39;</code>, <code>hl</code>, <code>bc</code>, <code>de</code>.</p>




<div class="method-source-code" id="read_integer32_value-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 958</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">read_integer32_value</span>(<span class="ruby-identifier">th</span>=<span class="ruby-identifier">de</span>, <span class="ruby-identifier">tl</span>=<span class="ruby-identifier">bc</span>)
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">unless</span> [<span class="ruby-identifier">th</span>, <span class="ruby-identifier">tl</span>].<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> <span class="ruby-keyword">and</span>
[<span class="ruby-identifier">th</span>, <span class="ruby-identifier">tl</span>].<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">bc</span>, <span class="ruby-identifier">de</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">t</span>)}
<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t0</span> = <span class="ruby-identifier">tl</span>.<span class="ruby-identifier">split</span>
<span class="ruby-identifier">t3</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">th</span>.<span class="ruby-identifier">split</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 960</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">read_integer32_value</span>(<span class="ruby-identifier">t3</span>=<span class="ruby-identifier">d</span>, <span class="ruby-identifier">t2</span>=<span class="ruby-identifier">e</span>, <span class="ruby-identifier">t1</span>=<span class="ruby-identifier">b</span>, <span class="ruby-identifier">t0</span>=<span class="ruby-identifier">c</span>)
<span class="ruby-comment"># legacy arguments handling (th, tl)</span>
<span class="ruby-keyword">if</span> [<span class="ruby-identifier">t3</span>, <span class="ruby-identifier">t2</span>].<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">bc</span>, <span class="ruby-identifier">de</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">t</span>)}
<span class="ruby-identifier">t1</span>, <span class="ruby-identifier">t0</span> = <span class="ruby-identifier">t2</span>.<span class="ruby-identifier">split</span>
<span class="ruby-identifier">t3</span>, <span class="ruby-identifier">t2</span> = <span class="ruby-identifier">t3</span>.<span class="ruby-identifier">split</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword">unless</span> [<span class="ruby-identifier">t3</span>,<span class="ruby-identifier">t2</span>,<span class="ruby-identifier">t1</span>,<span class="ruby-identifier">t0</span>].<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> <span class="ruby-keyword">and</span>
[<span class="ruby-identifier">t3</span>,<span class="ruby-identifier">t2</span>,<span class="ruby-identifier">t1</span>,<span class="ruby-identifier">t0</span>].<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">b</span>,<span class="ruby-identifier">c</span>,<span class="ruby-identifier">d</span>,<span class="ruby-identifier">e</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">t</span>)}
<span class="ruby-identifier">isolate</span> <span class="ruby-keyword">do</span>
<span class="ruby-identifier">ld</span> <span class="ruby-identifier">a</span>, [<span class="ruby-identifier">hl</span>]
<span class="ruby-identifier">inc</span> <span class="ruby-identifier">hl</span>
Expand Down Expand Up @@ -1458,7 +1467,7 @@ <h3>Public Instance Methods</h3>


<div class="method-source-code" id="return_with_fp-source">
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1085</span>
<pre><span class="ruby-comment"># File lib/zxlib/sys.rb, line 1090</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">return_with_fp</span>(<span class="ruby-value">pop_ret_address:</span><span class="ruby-keyword">true</span>, <span class="ruby-value">rom:</span><span class="ruby-keyword">self</span>.<span class="ruby-identifier">rom</span>, <span class="ruby-value">restore_iy:</span><span class="ruby-keyword">self</span>.<span class="ruby-identifier">vars_iy</span>, <span class="ruby-value">restore_hl_alt:</span><span class="ruby-identifier">rom</span>.<span class="ruby-identifier">end_calc</span>)
<span class="ruby-identifier">isolate</span> <span class="ruby-keyword">do</span>
<span class="ruby-identifier">pop</span> <span class="ruby-identifier">hl</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">pop_ret_address</span>
Expand Down
8 changes: 4 additions & 4 deletions created.rid
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Mon, 08 Jan 2024 05:09:53 +0100
README.rdoc Sun, 07 Jan 2024 02:36:17 +0100
Wed, 10 Jan 2024 02:26:31 +0100
README.rdoc Mon, 08 Jan 2024 22:28:06 +0100
LICENSE.md Tue, 12 Nov 2019 19:21:22 +0100
CHANGELOG.md Thu, 04 Jan 2024 05:06:44 +0100
lib/z80.rb Wed, 04 Jan 2023 15:29:22 +0100
lib/z80/labels.rb Wed, 04 Jan 2023 15:09:14 +0100
lib/z80/macros.rb Wed, 04 Jan 2023 15:09:46 +0100
lib/z80/math_i.rb Mon, 08 Jan 2024 04:48:55 +0100
lib/z80/math_i.rb Wed, 10 Jan 2024 02:10:54 +0100
lib/z80/mnemonics.rb Wed, 04 Jan 2023 15:13:54 +0100
lib/z80/registers.rb Wed, 04 Jan 2023 15:14:26 +0100
lib/z80/select.rb Wed, 04 Jan 2023 15:14:50 +0100
Expand All @@ -20,7 +20,7 @@ lib/zxlib/ay_sound.rb Tue, 02 Nov 2021 19:23:20 +0100
lib/zxlib/basic.rb Wed, 04 Jan 2023 15:18:40 +0100
lib/zxlib/gfx.rb Tue, 23 Nov 2021 01:49:00 +0100
lib/zxlib/math.rb Tue, 02 Nov 2021 19:23:37 +0100
lib/zxlib/sys.rb Thu, 11 Nov 2021 23:08:56 +0100
lib/zxlib/sys.rb Wed, 10 Jan 2024 01:32:06 +0100
lib/zxlib/gfx/bobs.rb Sun, 14 Nov 2021 16:06:20 +0100
lib/zxlib/gfx/clip.rb Fri, 29 Oct 2021 02:54:09 +0200
lib/zxlib/gfx/draw.rb Fri, 26 Nov 2021 23:26:23 +0100
Expand Down
Binary file modified examples/calculator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/calculator.tap
Binary file not shown.
Binary file modified examples/quat3d128.tap
Binary file not shown.
Loading

0 comments on commit 6472bfe

Please sign in to comment.