Article 69466 of comp.sys.cbm:
Path: news.acns.nwu.edu!merle!judd
From: judd@merle.acns.nwu.edu (Stephen Judd)
Newsgroups: comp.sys.cbm,comp.sys.sinclair,comp.emulators.cbm
Subject: Two more coding challenges -- Shootout part deux
Date: 15 Jun 1997 06:06:33 GMT
Organization: Northwestern University, Evanston, IL
Lines: 66
Message-ID: <5o00p9$gi9@news.acns.nwu.edu>
Reply-To: sjudd@nwu.edu (Stephen Judd)
NNTP-Posting-Host: merle.acns.nwu.edu
Xref: news.acns.nwu.edu comp.sys.cbm:69466 comp.sys.sinclair:39915 comp.emulators.cbm:21661


I would like to pose two additional problems to those posed in the
"Shootout at the 0K corral" thread.  (The purpose of these problems
is of course to compare the 6510 to the Z80 and the C64 to the Spectrum,
and to gain insight into different methods for tackling problems).

--
Coding Challenge #6:

Printing text to the screen seems like a useful thing to do, and both
upper and lower case are of course handy.

This problem is simply the first program many people write: Hello World.
The challenge is to print the string "Hello World" to the screen,
in assembly.

Here is a typical C64 solution:

	LDY #00					2
	LDA TEXT	;get char		4
:LOOP	STA 1024,Y	;put char on screen	4
	INY					2
	LDA TEXT,Y				4
	BNE :LOOP				3/2
	RTS

TEXT	TXT 'Hello World',00

Total = 6+13*n cycles, n=number of characters to print.
Size = 14 bytes (excluding RTS and string)

What does a Speccy version look like?

--
Coding Challenge #7:

This challenge is the oft-touted Spectrum software sprite routine.  It doesn't
have to have all of the capabilities of the C64's VIC, but it should:

	a) Be able to draw the sprite at any pixel location (i.e. upper
	   left corner at any coordinate).  Sometimes part if not all of a
	   sprite is inside the border/outside of the normal graphics screen,
	   so probably it should handle locations inside the borders.

	b) Identify collisions (although a C64 of course does it,
	   differentiating between sprite-sprite and sprite-background is
	   not necessary for this simple problem), possibly including 
	   collisions inside the borders.

--

Of course, anyone who is (actually :) interested is welcome to participate.

The first five problems posed were/are:

#1: 8x8->16 shift+add integer multiply  (Alvin Albrecht)
#2: Block memory copy			(Alvin Albrecht)
#3: Substring search			(Alvin Albrecht)
#4: Fast 8x8->16 bit integer multiply	(S. Judd)
#5: Line drawing routine		(S. Judd)

I think my curiosity will be satisfied, maybe even sated, once I see a
Spectrum solution to these problems.  Then I will go away :).  (And go
back to coding the 64 :).

	evetS-


Article 69784 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!dispatch.news.demon.net!demon!delos.dra.hmg.gb!server1.netnews.ja.net!warwick!bham!bhamcs!news.ox.ac.uk!news
From: imc@ecs.ox.ac.uk (Ian Collier)
Newsgroups: comp.sys.sinclair,comp.sys.cbm,comp.emulators.cbm,comp.sys.amstrad.8bit
Subject: Re: Spectrum Emulator for C64
Date: 18 Jun 1997 15:51:13 GMT
Organization: Oxford University Computing Laboratory, UK
Message-ID: <11303.imc@comlab.ox.ac.uk>
References: <337C5E94.388@actcom.co.il> <5o361v$f5r$11@morse.news.easynet.net> <11281.imc@comlab.ox.ac.uk> <5o5m2u$6k3$5@morse.news.easynet.net>
NNTP-Posting-Host: boothp2.ecs.ox.ac.uk
X-Local-Date: Wednesday, 18th June 1997 at 4:51pm BST
Lines: 35
Xref: news.acns.nwu.edu comp.sys.sinclair:40114 comp.sys.cbm:69784 comp.emulators.cbm:21853 comp.sys.amstrad.8bit:7037

In article <5o5m2u$6k3$5@morse.news.easynet.net>, "Cliff Lawson" <cliffl@amstrad.com> wrote:
>Another good question is, without looking it up, what are the opcodes for 

Well, someone has already answered, but...

>LD A,37  

I knew this (62,37).

>LD HL,1234 (OK easy peasy!)

And this, though I'd need a calculator to divide 1234 up into bytes
(33,210,4).

>IN A,(C) (maybe not quite so easy?)

And this (237,120)

>LDIR

and this (237,176)

>DEC (HL)

and given that DEC A is 61, this must be 53.  Sounds familiar, now I mention
it.

Questions for real spectrum hackers might include one such as "Where is
the routine in the ROM for ...". I recently posted variations on the ROM
routines for PLOT and DRAW.  In order to refresh my memory, I produced a
hexdump of my copy of the ROM and looked for addresses 22AA and 24BA,
respectively...
-- 
---- 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 70048 of comp.sys.cbm:
Path: news.acns.nwu.edu!newsfeed.acns.nwu.edu!news.luc.edu!chi-news.cic.net!newsxfer3.itd.umich.edu!vienna1-news-hub1.bbnplanet.com!cpk-news-hub1.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news-xfer.cybernet.dk!rill.news.pipex.net!pipex!server1.netnews.ja.net!warwick!bham!bhamcs!news.ox.ac.uk!news
From: imc@ecs.ox.ac.uk (Ian Collier)
Newsgroups: comp.sys.sinclair,comp.sys.cbm,comp.emulators.cbm,comp.sys.amstrad.8bit
Subject: Re: Spectrum Emulator for C64
Date: 20 Jun 1997 17:08:59 GMT
Organization: Oxford University Computing Laboratory
Lines: 19
Message-ID: <11320.imc@comlab.ox.ac.uk>
References: <337C5E94.388@actcom.co.il> <5o5m2u$6k3$5@morse.news.easynet.net> <11303.imc@comlab.ox.ac.uk> <5odome$f8o$3@morse.news.easynet.net>
NNTP-Posting-Host: gruffle.comlab.ox.ac.uk
X-Local-Date: Friday, 20th June 1997 at 6:08pm BST
Xref: news.acns.nwu.edu comp.sys.sinclair:40288 comp.sys.cbm:70048 comp.emulators.cbm:22007 comp.sys.amstrad.8bit:7113

In article <5odome$f8o$3@morse.news.easynet.net>, "Cliff Lawson" <cliffl@amstrad.com> wrote:
>I'm intrigued - someone who knows Z80 opcodes but in decimal rather than
>hex. Curious!

Hex is no use to anyone who wants to type in a machine code program now is
it?  :-)

To be honest though, I'm fairly bilingual.

>(I've been reading Internet RFCs recently and am always amused by the use
>of Octal for a lot of the constants which is a hangover from the very early
>PDP days).

Some uses of octal are really irritating, for example \nnn notation to
denote a character in tr, emacs and plenty of other utilities prevalent
on Unix.  Why octal in this day and age, for heaven's sake?!
-- 
---- Ian Collier : imc@comlab.ox.ac.uk : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html


