Article 71308 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.ece.nwu.edu!news.cse.psu.edu!rutgers!cam-news-feed2.bbnplanet.com!cam-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!europa.clark.net!newsfeeds.sol.net!sol.net!spool.mu.edu!newsspool.sol.net!munnari.OZ.AU!metro!metro!seagoon.newcastle.edu.au!cc.newcastle.edu.au!ecbm
From: "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au>
Newsgroups: comp.sys.sinclair,comp.sys.cbm
Subject: Re: Spectrum Emulator for C64
Date: Fri, 11 Jul 1997 17:23:40 +1000
Organization: The University of Newcastle
Lines: 52
Message-ID: <Pine.PMDF.3.95.970711171652.676044269B-100000@cc.newcastle.edu.au>
References: <339d8a2a.3224107@news.demon.co.uk> <Pine.PMDF.3.95.970706162639.675957918C-100000@cc.newcastle.edu.au> <11408.imc@comlab.ox.ac.uk> <Pine.PMDF.3.95.970708181108.675979785A-100000@cc.newcastle.edu.au> <11440.imc@comlab.ox.ac.uk>
NNTP-Posting-Host: cc.newcastle.edu.au
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <11440.imc@comlab.ox.ac.uk>
Xref: news.acns.nwu.edu comp.sys.sinclair:41201 comp.sys.cbm:71308

On 10 Jul 1997, Ian Collier wrote:

> In article <Pine.PMDF.3.95.970708181108.675979785A-100000@cc.newcastle.edu.au>,
> "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au> wrote:
> >	BTW, a fully unrolled loop (obviously) doesn't care about byte
> >order. However, if we restricted the 8-byte BCD number to be page aligned,
> >the following can be put into RAM somewhere (you'll notice that it aint
> >ROMMable)
> 
> >op2 = *+11
> > Surely 11 is not the right number if you are referring to the $FF00 below?

	Why not? Actually, I meant that literally, rather than
rhetorically, since I don't have it in front of me at this office.
Remember that all instructions are one byte, all zero-page address modes
add one byte, and all absolute address modes add two bytes, and OP1 is on
the zero page.

> It would be easier and clearer if you coded it as x+1 where x is the label
> which you have called "-".

	The "-" is a technique used in some 6502 assemblers to handle the
many short loops that the 6502 encourages you to write: it is a purely
relative reference that means "one back" -- where BCC -- would skip past
the first previous "-" to the next previous "-" (similarly for "BCC +" and
"BCC ++").
	And soitanly it would have been easier and clearer to write

OP2	= OP2_LOAD+1

; ...

OP2_LOAD:
  -	LDA $FF00,X	


> ...
> Making assumptions about page alignment allows you to write INC L (4)
> instead of INC HL (6) to advance the pointer on each step.  Other than
> that, "misbehaving" can't really help you as everything is done in registers
> so there's no point in modifying a constant in the code (since there aren't
> any, and putting one in would make it slower).

	OK, I'll subtract however many 2 clock cycles that makes it and
refigure.  Then someone can post a 65816 routine that shows what an
upgraded C64 can do.

Virtually,

Bruce R. McFarling, Newcastle, NSW
ecbm@cc.newcastle.edu.au



Article 71309 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.ece.nwu.edu!news.cse.psu.edu!rutgers!cam-news-feed2.bbnplanet.com!cam-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!paladin.american.edu!news.ecn.uoknor.edu!munnari.OZ.AU!metro!metro!seagoon.newcastle.edu.au!cc.newcastle.edu.au!ecbm
From: "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au>
Newsgroups: comp.sys.sinclair,comp.sys.cbm
Subject: Re: Spectrum Emulator for C64
Date: Fri, 11 Jul 1997 17:26:03 +1000
Organization: The University of Newcastle
Lines: 14
Message-ID: <Pine.PMDF.3.95.970711172414.676044269C-100000@cc.newcastle.edu.au>
References: <339d8a2a.3224107@news.demon.co.uk> <Pine.PMDF.3.95.970706162639.675957918C-100000@cc.newcastle.edu.au> <11408.imc@comlab.ox.ac.uk> <Pine.PMDF.3.95.970708181108.675979785A-100000@cc.newcastle.edu.au> <11441.imc@comlab.ox.ac.uk>
NNTP-Posting-Host: cc.newcastle.edu.au
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <11441.imc@comlab.ox.ac.uk>
Xref: news.acns.nwu.edu comp.sys.sinclair:41202 comp.sys.cbm:71309

On 10 Jul 1997, Ian Collier wrote:

> PS I notice that you didn't seem to set decimal mode in that example.

	Did someone erase a SED between Australia and c.s.*? Dagnab those
nasty net gremlins.  Did it also steal the PHP and PLP? Those are the
cycle stealers SEx and CLx instructions are fairly cheap when the
processor status doesn't have to be restored.

Virtually,

Bruce R. McFarling, Newcastle, NSW
ecbm@cc.newcastle.edu.au



Article 71307 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.ece.nwu.edu!news.cse.psu.edu!rutgers!cam-news-feed2.bbnplanet.com!cam-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!paladin.american.edu!news.ecn.uoknor.edu!munnari.OZ.AU!metro!metro!seagoon.newcastle.edu.au!cc.newcastle.edu.au!ecbm
From: "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au>
Newsgroups: comp.sys.sinclair,comp.sys.cbm,comp.emulators.cbm
Subject: Re: Spectrum Emulator for C64
Date: Fri, 11 Jul 1997 17:08:44 +1000
Organization: The University of Newcastle
Lines: 25
Message-ID: <Pine.PMDF.3.95.970711170459.676044269A-100000@cc.newcastle.edu.au>
References: <339d8a2a.3224107@news.demon.co.uk> <Pine.PMDF.3.95.970706162639.675957918C-100000@cc.newcastle.edu.au> <5ppnb4$1036@ds2.acs.ucalgary.ca> <Pine.PMDF.3.95.970708133410.675981792B-100000@cc.newcastle.edu.au> <5pv3b0$nkc@news.acns.nwu.edu>
NNTP-Posting-Host: cc.newcastle.edu.au
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <5pv3b0$nkc@news.acns.nwu.edu>
Xref: news.acns.nwu.edu comp.sys.sinclair:41200 comp.sys.cbm:71307 comp.emulators.cbm:22820

On 9 Jul 1997, Stephen Judd wrote:

[Quoth I]:
> >	Rather 'many' than 'few' variables.  Having few enough variables
> >that they can be maintained in the Z80 register set without shuffling is
> >an *advantage* for the 6502.
>   dis
> or
> 			Z80
> :)

	Well, put a bow tie on Beaker and color me red. #-8
Actually now that I read it again, it ought to have been:

> >an *advantage* over the 6502.

But I wasn't playing close enough attention and my fingers refused to type
it that way.  BTW, I take it that cycles in Z80 land are M cycles and not
T cycles?

Virtually,

Bruce R. McFarling, Newcastle, NSW
ecbm@cc.newcastle.edu.au



Article 71465 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.ece.nwu.edu!news.cse.psu.edu!uwm.edu!spool.mu.edu!sol.net!spool.mu.edu!newsspool.sol.net!howland.erols.net!europa.clark.net!dispatch.news.demon.net!demon!delos.dra.hmg.gb!server1.netnews.ja.net!server5.netnews.ja.net!server6.netnews.ja.net!server4.netnews.ja.net!server2.netnews.ja.net!news.ox.ac.uk!news
From: imc@ecs.ox.ac.uk (Ian Collier)
Newsgroups: comp.sys.sinclair,comp.sys.cbm
Subject: Re: Spectrum Emulator for C64
Date: 14 Jul 1997 17:21:55 GMT
Organization: Oxford University Computing Laboratory, UK
Message-ID: <11470.imc@comlab.ox.ac.uk>
References: <339d8a2a.3224107@news.demon.co.uk> <Pine.PMDF.3.95.970708181108.675979785A-100000@cc.newcastle.edu.au> <11440.imc@comlab.ox.ac.uk> <Pine.PMDF.3.95.970711171652.676044269B-100000@cc.newcastle.edu.au>
NNTP-Posting-Host: boothp2.ecs.ox.ac.uk
X-Local-Date: Monday, 14th July 1997 at 6:21pm BST
Lines: 38
Xref: news.acns.nwu.edu comp.sys.sinclair:41418 comp.sys.cbm:71465

In article <Pine.PMDF.3.95.970711171652.676044269B-100000@cc.newcastle.edu.au>, "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au> wrote:
>On 10 Jul 1997, Ian Collier wrote:
>> >op2 = *+11
>> > Surely 11 is not the right number if you are referring to the $FF00 below?

>	Why not? Actually, I meant that literally, rather than
>rhetorically, since I don't have it in front of me at this office.
>Remember that all instructions are one byte, all zero-page address modes
>add one byte, and all absolute address modes add two bytes, and OP1 is on
>the zero page.

op2 = *+11                               offset
ADD16DEC:
        STA OP2+1       ; 4              0
        CLC             ; 2              3
        TYA             ; 2              4
        ADC #8          ; 2              5
        STA OP2         ; 4              7
        CLC             ; 2             10
        LDX #(0-8)      ; 2             11
  -     LDA $FF00,X     ; 5             13

Am I wrong?

>	The "-" is a technique used in some 6502 assemblers to handle the
>many short loops that the 6502 encourages you to write: it is a purely
>relative reference that means "one back" -- where BCC -- would skip past
>the first previous "-" to the next previous "-" (similarly for "BCC +" and
>"BCC ++").

If it's _really_ short, I write the number of bytes directly.

inc l:jr nz,1:inc h

Otherwise I stick a label in.  It's not _that_ much effort, surely? :-)
-- 
---- Ian Collier : imc@comlab.ox.ac.uk : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html


Article 71571 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.luc.edu!chi-news.cic.net!howland.erols.net!gatech!purdue!nick.arc.nasa.gov!news.Hawaii.Edu!munnari.OZ.AU!metro!metro!seagoon.newcastle.edu.au!cc.newcastle.edu.au!ecbm
From: "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au>
Newsgroups: comp.sys.sinclair,comp.sys.cbm
Subject: Re: Spectrum Emulator for C64
Date: Tue, 15 Jul 1997 19:50:40 +1000
Organization: The University of Newcastle
Lines: 75
Message-ID: <Pine.PMDF.3.95.970714154435.676054565D-100000@cc.newcastle.edu.au>
References: <339d8a2a.3224107@news.demon.co.uk> <Pine.PMDF.3.95.970706162639.675957918C-100000@cc.newcastle.edu.au> <11408.imc@comlab.ox.ac.uk> <Pine.PMDF.3.95.970708181108.675979785A-100000@cc.newcastle.edu.au> <11440.imc@comlab.ox.ac.uk>
Reply-To: "Bruce R. McFarling" <ecbm@cc.newcastle.edu.au>
NNTP-Posting-Host: cc.newcastle.edu.au
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
In-Reply-To: <11440.imc@comlab.ox.ac.uk>
Xref: news.acns.nwu.edu comp.sys.sinclair:41545 comp.sys.cbm:71571

On 10 Jul 1997, Ian Collier wrote:

> >op2 = *+11
> 
> Surely 11 is not the right number if you are referring to the $FF00 below?
> It would be easier and clearer if you coded it as x+1 where x is the label
> which you have called "-".

	Surely it's not (the right number, that is). I tacked it on at the
end. Here are some more. These are for a 16-digit value located at a given
location in memory, targetted at a 16-digit span in the zero page passed
in the X register.  There are 8 of these, ADD_OP2, ADD_OP2_2, to
ADD_OP2_9. 

ADD_OP2_x
	PHP
	SED
	LDY #7
	TXA
	CLC
	ADC #7
	TAX
	CLC
  -	LDA OP2_x,Y
	ADC OP1,X
	STA OP1,X
	DEX
	DEY
	BNE -
	LDA OP2_x
	ADC OP1,X
	STA OP1,X
	PLP
	RTS

	This one fills a multiplication table with the products of the 15
digit quantity at OP2 ... OP2+7 (which also serves the role of the
product of one) :

TARGET	= OP2+8
FINAL	= 8*8

	PHP
	SED
	LDX #7
  -	LDY #7
	CLC
  -	LDA OP2,Y
	ADC OP2,X
	STA TARGET,X
	DEX
	DEY
	BNE -
  -	LDA OP2	ADC OP2,X
	STA TARGET,X
	TXA
	CLC
	ADC #15
	TAX
	CMP #72
	BMI --
	PLP
	RTS

	Fixes, cycle counts and superior solutions for this particular
problem welcome.  And, surely it's clear what this particular problem is,
since the quickest way I have to find out how fast a Z80 can do a
multi-digit BCD multiplication is to post one for a 6502.

Virtually,

Bruce R. McFarling, Newcastle, NSW
ecbm@cc.newcastle.edu.au




