<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Sun, 28 Nov 2004 15:28:38 +0000 (GMT)
From   : Andrew W <a.weston2@...>
Subject: Re: ...at line ___

In <URL:news:local.misc> on Sun 28 Nov, Pete Turnbull wrote:

> 
> I edited the above slightly to remove the comment, and put the code at
> scan1 al on the same line (was it originally three lines or two?).  Is
> it exactly what you have?  You don't get the error if &75 contains 39?
>
In fact I do get the error when it equals 39. It was originally one
line but I separated it. 
> If there are no other lines (ie nothing changes A in between the tests)
> you could rewrite the above as
> 
> ..scan1 LDA&75:CMP#39:BEQ scan4
> ..scan5 CMP#79:BEQ scan4
> ..scan6 CMP#119:BNE scan2
> ..scan4
>
Changed it to this but still get the error as soon as it reaches 39.

> What's at scan4?  You are running two assembler passes through this,
> with a loop, setting OPT correctly each time, aren't you?
> 
It's basically an attempt to implement this in machine code:
==========================================================================
FORt2%=0 TO (?&8A)-1:IF (tx5%?t2%)=32 ?&77=?&75
IF?&75=39 OR?&75=79 OR?&75=119 IF?&76=0 IF(tx5%?(?&75))<>32 ?&76=1:?&71=?&77
?&75=?&75+1
NEXTt2%
===========================================================================



Thus, before .scan1 is
LDY#0 .scan
LDA(&84),Y
CMP#32:BNE scan1
LDA&75:STA&77         \first line of above BASIC

Then:
> ..scan1 LDA&75:CMP#39:BEQ scan4
> ..scan5 CMP#79:BEQ scan4
> ..scan6 CMP#119:BNE scan2
> ..scan4
LDA&76       \ a flag that's set once per loop
CMP#0
BNE scan2    \IF?&76=0 go to this bit:


STY&72               \ temporarily store Y counter - goes from 0 to &8A

LDY&75:LDA(&84),Y:CMP#32:BEQ scan3    \  IF(tx5%?(?&75))<>32 

LDA#1:STA&76:LDA&77:STA&71:LDY&72    \ ?&76=1:?&71=?&77

JMP scan2
.scan3 LDY&72         \ restore Y counter if necessary
.scan2 INC&75         \ increment as part of the loop
INY:CPY&8A:BNE scan   \ if counter has reaches &8A return to BASIC

RTS

A.Weston
-- 
Staffordshire, UK of GB&NI. 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>