Subject: Re: That Z80 line routine

From: [email-masked] (Ian Collier)
Date: 20 Jun 1997 17:27:25 GMT

In article <[email-masked]>, "Bruce R. McFarling" <[email-masked]> wrote:
>On 19 Jun 1997, Stephen Judd wrote:
>> The 6510 signals subtraction underflow by clearing the carry flag, and
>> I assume the Z80 does something similar,

>	Is this right? It's been a decade, but I would have sworn that the
>Z80 used a straight carry for borrow flag, rather than the 6502's inverted
>carry.

You are correct, as a described a few posts ago.  But Stephen didn't claim
that the Z80 was _exactly_ the same as the 6502.

>                                  So to subtract in 2's complement, you
>can just invert all of the appropriate signals, use the add with carry
>circuit, and invert the carry for a borrow.  Hence, inverted carry as
>borrow for subtract.

>	But, AFAIR, the Z80 doesn't do this: it does it the long way
>around (hence the high gate count)

Really?  And what is the long way round?  (If I were implementing it I
would do it the way you said.)
-- 
---- Ian Collier : [email-masked] : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

---

From: [email-masked] (Ian Collier)
Date: 20 Jun 1997 17:21:45 GMT

In article <[email-masked]>, [email-masked] (Stephen Judd) wrote:
>Ahhh, I see now.  Somehow I didn't realize that the Z80 graphics memory
>was part of the normal RAM (I thought it might be ported or something).

To be fair, you should say "Spectrum graphics".  Who knows what someone
somewhere might have attached to a Z80? :-)

>Well, for what it's worth, a C64 version generally looks like:

>	LDY #00
>	TYA
>:LOOP	STA BASE,Y	;BASE=$8000 say for bitmap at $8000
>	STA BASE+256,Y
>	STA BASE+512,Y
>	... [32 times]
>	INY
>	BNE :LOOP

>...a little bit over 4 cycles/byte (which I still find oppressive since it
>takes a total of like 2 frames).

The Z80 stack-based version took a little over 5.5 cycles per byte, which is
a clear winner at last. :-)  At that rate it would take just over half a
frame on a Spectrum.
-- 
---- Ian Collier : [email-masked] : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

---

From: "Bruce R. McFarling" <[email-masked]>
Date: Sun, 22 Jun 1997 17:35:14 +1000

> would do it the way you said.)

	"Long way around" is probably a misleading way to say it. 
Inverting the carry flag internally, instead of simply specifying that the
borrow flag is an inverted carry, prolly doesn't take more time, just
extra gates. 

Virtually,

Bruce R. McFarling, Newcastle, NSW
[email-masked]

---

From: [email-masked] (Stephen Judd)
Date: 23 Jun 1997 05:21:22 GMT

There is a letter from Clive Sinclair in the latest (June 21) issue
of The Economist.

Just thought some of you Speccy guys might be interested...

-S

---

From: [email-masked] (Stephen Judd)
Date: 23 Jun 1997 06:03:41 GMT

In article <[email-masked]>, Ian Collier <[email-masked]> wrote:
>To be fair, you should say "Spectrum graphics".

Hah, that's error #3 for me :).  Time to start paying attention I guess :).

>Who knows what someone

I once knew a guy who put an 8-cylinder engine into his Z80, and... oops,
wait, that was a 280Z.

Yes indeed, there are some things just not worth speculating about.  Who
knows what sorts of things these degenerate Spectrum fiends might be trying
out, late at night... fiddling with their 3.5" floppies... peeking,
poking random locations, and otherwise practicing unsafe hex... 

What?  Why are you all looking at me like that?

>a clear winner at last. :-)  At that rate it would take just over half a

Yep, no doat aboat it, Speccy clobbers the 64 on that one.

	evetS-

---

From: [email-masked] (Stephen Judd)
Date: 24 Jun 1997 04:52:11 GMT

In article <[email-masked]>, Geoff <[email-masked]> wrote:
> Stephen Judd wrote in article <[email-masked]>...
>>
>Scan it in!!!!!!

Well, to be honest, it's a very short letter and not of any profound
importance, just one of those points of interest speckling the 8-bit
landscape.

Besides, posting it would undermine my subversive attempt to get more
people to read The Economist :).  One of the few news magazines worth
more than the paper it is printed on.

...to take part in "a severe contest between intelligence, which presses
forward, and an unworthy, timid ignorance obstructing our progress."

   e
         v
	    e
	      t
	       S
	        -

>Geoff

---

From: Greg King <[email-masked]>
Date: Tue, 24 Jun 1997 03:31:25 -0700

Stephen Judd wrote:
> In article <[email-masked]>,
> Bruce R. McFarling <[email-masked]> wrote:
> >> I assume the Z80 does something similar, so the CP H gets taken care of
> >> automatically by the subtraction.  And since you're subtracting, you never
> >> have problems with overflow, so the JR C,Diag isn't necessary either.
> >
> >       Is this right?
>
> Since it was a question based on my deep and profound general ignorance
> on most matters, it is probably not, indeed is not, right. :)

"They" use Carry for both add and subtract.  "We" use Carry for add, and Borrow for subtract.  (The mnemonic 
really should be SBB.)

---

From: [email-masked] (Spike)
Date: 16 Jun 1997 18:40:35 GMT

Ian Collier ([email-masked]) wrote:
:     LD DE,msg
:     XOR A
:     JP $0C0A
: 
: msg:DEFB $80,"Hello Worl","d"+$80
: 
: Slow as hell but quite short.

I thought it was RST16 to access the ROM print routine.....
-- 
______________________________________________________________________________
[email-masked]| "Are you pondering what I'm pondering Pinky?"   |
|Andrew Halliwell          |                                                 |
|Principal subjects in:-   | "I think so brain, but this time, you control   |
|Comp Sci & Electronics    |  the Encounter suit, and I'll do the voice..."  |
------------------------------------------------------------------------------
|GCv3.1 GCS/EL>$ d---(dpu) s+/- a- C++ U N++ o+ K- w-- M+/++ PS+++ PE- Y t+  |
|5++ X+/++ R+ tv+ b+ D G e>PhD h/h+ !r! !y-|I can't say F**K either now! :(  |
------------------------------------------------------------------------------

---

From: [email-masked] (Ian Collier)
Date: 25 Jun 1997 13:05:42 GMT

>I thought it was RST16 to access the ROM print routine.....

You can print a character with RST 16, yes.  But to print a whole message
you can find other routines.  One such is at 0C0A (it's used for printing
the error reports and also for expanding tokens).  Another is at 203C,
which is part of the PRINT routine - it prints BC characters starting from
(DE) (it is this which messes up when you press a mode key at the "scroll?"
prompt because listing the current line corrupts the DE register).
-- 
---- Ian Collier : [email-masked] : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

---

From: [email-masked] (Ian Collier)
Date: 20 Jun 1997 17:23:28 GMT

In article <[email-masked]>, [email-masked] (Stephen Judd) wrote:
>Well, you are basically doing
>
>	A = H/2
>loop	A = A + dx
>	if A>dy then A=A-dy : y=y+1
>
>which is exactly the same as doing
>
>	A = H/2
>loop	A = A - dx
>	if A<0 then A=A+dy : y=y+1

OK, cool.  I wonder why the programmers of the ROM never noticed. :-)
-- 
---- Ian Collier : [email-masked] : WWW page (including Spectrum section):
------ http://www.comlab.ox.ac.uk/oucl/users/ian.collier/imc.html

---

From: [email-masked] (Spike)
Date: 23 Jun 1997 17:41:04 GMT

Stephen Judd ([email-masked]) wrote:
: Yes indeed, there are some things just not worth speculating about.  Who
: knows what sorts of things these degenerate Spectrum fiends might be trying
: out, late at night... fiddling with their 3.5" floppies... peeking,
: poking random locations, and otherwise practicing unsafe hex... 

LOL!
Errrr. Guys...
I think this ones getting a little too close to the truth...

Should we send "Da boyz" out to get 'im?

-- 
______________________________________________________________________________
[email-masked]|                                                 |
|Andrew Halliwell          | "ARSE! GERLS!! DRINK! DRINK! DRINK!!!"          |
|Principal subjects in:-   | "THAT WOULD BE AN ECUMENICAL MATTER!...FECK!!!! |
|Comp Sci & Electronics    | - Father Jack in "Father Ted"                   |
------------------------------------------------------------------------------
|GCv3.1 GCS/EL>$ d---(dpu) s+/- a- C++ U N++ o+ K- w-- M+/++ PS+++ PE- Y t+  |
|5++ X+/++ R+ tv+ b+ D G e>PhD h/h+ !r! !y-|I can't say F**K either now! :(  |
------------------------------------------------------------------------------