Groups | Search | Server Info | Login | Register


Groups > comp.sys.amstrad.8bit > #307

Re: CPC text mode

Date 2017-01-14 16:10 +0000
From Matthew Phillips <spam2011m@yahoo.co.uk>
Newsgroups comp.sys.amstrad.8bit
Subject Re: CPC text mode
Message-ID <dba55ffe55.Matthew@sinenomine.freeserve.co.uk> (permalink)
References <nl5pp4$iq7$1@dont-email.me> <b3e6f69855.Matthew@sinenomine.freeserve.co.uk> <98b46670-36cd-4ae0-bcf2-c2f030295391@googlegroups.com> <d858a7fc55.Matthew@sinenomine.freeserve.co.uk> <363b84c8-4b27-43e0-8519-3a2894d33570@googlegroups.com>

Show all headers | View raw


In message <363b84c8-4b27-43e0-8519-3a2894d33570@googlegroups.com>
 on 13 Jan 2017 CP/M User wrote:

> On Wednesday, 11 January 2017 19:01:13 UTC+11, Matthew Phillips  wrote:
> > In message on 11 Jan 2017 CP/M User wrote:
> > 
> > > On Saturday, 2 July 2016 04:09:47 UTC+10, Matthew Phillips  wrote:
> > > > In message on 1 Jul 2016 B. P. TBC wrote:
> > > > 
> > > > > Has the Amstrad CPC 464 a real text mode, like the C64? Or the CPC
> > > > > has  only graphics mode?
> > > > 
> > > > The CPC 464 only has three graphics modes.  All modes are 200 pixels
> > > > high (25 text lines of 8 pixels).  MODE 0 is 160 pixels wide, MODE 1
> > > > is 320 pixels wide and MODE 2 is 640 pixels, with 4, 2 and 1 bits per
> > > > pixel respectively, so all 16K.
> > > 
> > > The Amstrad has an 4 Graphics Mode if you include the more obscure 4
> > > coloured Mode 0, it works differently from MODE 0 in that a hidden
> > > screen can be drawn and displayed based on the INKs. From what I can
> > > tell it has't been widely used and as MODE 0 offers up to 16 colours,
> > > it's more effective to use that MODE when writing games.
> > 
> > It's not known to the MODE command, is it?  Nor is it mentioned in the
> > documentation of SCR SET MODE.
> 
> It is a mode in its own right, though I'm unsure if the firmware recognises
> it, There was an article about it along with a BASIC RSX driver program. I
> posted some examples on the CPC-Wiki a while ago:
> 
> http://www.cpcwiki.eu/forum/programming/double-buffering-and-frame-flyback/msg91485/#msg91485
> 
> using that program along with an example of my own, but found it wasn't
> really viable for using in games and for any games programmers who made any
> wire-framed graphical games (e.g. Tank busters), it would of been easier to
> just use MODE 0 and Flip to the visible INKs for drawing the graphics once
> they have been drawn.

Thanks for the reference. I fished the magazine off my shelf and had a go at
hand-disassembly of the RSX commands.

The |MODE command that puts the computer into the "MODE 3" of the article
does this:

XOR A
CALL &BC0E
DI
EXX
LD A,C
OR 3
LD C,A
EXX
EI
LD A,99
LD (&A9),A
RET

I suspect the final two commands before the RET are not crucial and are being
used to keep a record of which "screen" is in use.

So the 4-colour 20 x 25 mode is not known to the firmware. The EXX command,
which has to be done while interrupts are disabled, accesses the Z80
alternate register set.  Most of my books have no information about what the
alternate registers are used for, but the full Amsoft firmware guide covers
this in Appendix XI.  The register C' holds the current mode in bits 0 and 1,
and the lower and upper ROM states in bits 2 and 3.

So it is "MODE 3" after a fashion. The firmware is unaware of this mode,
whose existence is probably just a side-effect of the silicon implementation
of the gate array.

In this mode, only half of the bits of each byte of screen memory are used by
the video chip, but the firmware still thinks you are in mode 0 and,
depending on pen colour, will manipulate all the bits in each byte. Thus
setting up fresh content in the hidden half of each byte is not exactly
trivial.  The RSX provided in the article to switch between the visible and
the hidden content disassembles as follows:

LD A,(&A9)
CP 100
RET Z
INC A
LD (&A9),A
LD BC,&4000
LD HL,&C000
.loop
LD A,(HL)
RLCA
RLCA
LD (HL),A
INC HL
DEC BC
LD A,B
OR C
JR NZ,loop
RET

So it's not surprising you found it slow. The article claims that "games like
Design Design's Tankbusters use this mode" but I doubt anyone would have
bothered to go to this effort for so little gain.

There is also a mistake in line 120 of the listing, which should read GOTO
100 at the end instead of GOTO 110.  The listing works as written, but the
mistake means that some typing errors in the hexadecimal would not have been
picked up.

-- 
Matthew Phillips
Durham

Back to comp.sys.amstrad.8bit | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

CPC text mode "B. P. TBC" <tbc_z87@mailbox.hu> - 2016-07-01 15:04 +0200
  Re: CPC text mode Matthew Phillips <spam2011m@yahoo.co.uk> - 2016-07-01 19:09 +0100
    Re: CPC text mode "CP/M User" <cpm22_user@yahoo.com> - 2017-01-10 22:30 -0800
      Re: CPC text mode Matthew Phillips <spam2011m@yahoo.co.uk> - 2017-01-11 08:00 +0000
        Re: CPC text mode "CP/M User" <cpm22_user@yahoo.com> - 2017-01-13 13:48 -0800
          Re: CPC text mode Matthew Phillips <spam2011m@yahoo.co.uk> - 2017-01-14 16:10 +0000
            Re: CPC text mode "CP/M User" <cpm22_user@yahoo.com> - 2017-01-14 18:01 -0800

csiph-web