Chroma 81 - SCART and Colour interface for the ZX81
- nitrofurano
- Posts: 24
- Joined: Fri May 09, 2014 5:18 pm
- Contact:
Re: Chroma 81 - SCART and Colour interface for the ZX81
i’m interested to access Chroma81 colour attribute area from Boriel’s ZX-Basic Compiler (what i have done up to now for ZX81 using this cross-compiler is at http://www.boriel.com/wiki/en/index.php ... ams_-_ZX81 )
where from can we can get documentation about, or examples in assembly (Pasmo), or zx81 interpreted Basic (using poke)?
where from can we can get documentation about, or examples in assembly (Pasmo), or zx81 interpreted Basic (using poke)?
Re: Chroma 81 - SCART and Colour interface for the ZX81
A description of the colour modes can be found at the end of the document available from here.
Re: Chroma 81 - SCART and Colour interface for the ZX81
From http://www.boriel.com/wiki/en/index.php/Main_Page
Is this relevant?ZX BASIC
ZX Basic main page.
The ZX Basic compiler project documentation.
ZX BASIC is a BASIC compiler for the ZX Spectrum vintage machine. Alphabetical Keyword List
Language Reference & Syntax
5-TS1000,UK ZX81<-Sheelagh, US ZX81, 2-TS1500/KDLX , 3-TS2040 printer, 2-TS2020 cassette decks, ZXPAND+AY, ZeddyNET, ZXBlast, UDG, ZX8CCB, AERCO, BUILDS/REPAIRS ZX Spectrum, ZX80 Minstrel, ZXMAX48 v1 v2, 2-TS-2068, ROM, 16kRAM
- nitrofurano
- Posts: 24
- Joined: Fri May 09, 2014 5:18 pm
- Contact:
Re: Chroma 81 - SCART and Colour interface for the ZX81
partially - by using this cross-compiler, i bypassed the speciffic zx-spectrum specific parts, including custom routines specifically for zx81, and this way i wanted to extend to chroma81 display hardware as wellgammaray wrote: ↑Sun Dec 31, 2017 4:31 am From http://www.boriel.com/wiki/en/index.php/Main_Page
Is this relevant?ZX BASIC
ZX Basic main page.
The ZX Basic compiler project documentation.
ZX BASIC is a BASIC compiler for the ZX Spectrum vintage machine. Alphabetical Keyword List
Language Reference & Syntax
- nitrofurano
- Posts: 24
- Joined: Fri May 09, 2014 5:18 pm
- Contact:
Re: Chroma 81 - SCART and Colour interface for the ZX81
i guess it is where it says "Colour Attribute File [Colour Mode 1] (appears in memory map between $C000-$FFFF, at DFILE+$8000)"
so if we poke randomly between 0xC000 and 0xFFFF we will have some colour appearing?
(i can’t remember where dfile is... is it an address provided from a system variable somewhere?)
- 1024MAK
- Posts: 5332
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Chroma 81 - SCART and Colour interface for the ZX81
Yes, the current value of D_FILE is stored in the system variables area (two bytes at 16396), because D_FILE moves around in memory. It moves whenever the BASIC program length changes.
See chapter 27 and 28 in the ZX81 BASIC Programming manual.
Mark
See chapter 27 and 28 in the ZX81 BASIC Programming manual.
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...
ZX81 Chip Pin-outs
ZX81 Video Transistor Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Autumn is here. Bye bye summer 2024...
- nitrofurano
- Posts: 24
- Joined: Fri May 09, 2014 5:18 pm
- Contact:
- nitrofurano
- Posts: 24
- Joined: Fri May 09, 2014 5:18 pm
- Contact:
Re: Chroma 81 - SCART and Colour interface for the ZX81
so i guess this might work somehow (i’m going to test it soon on Boriel’s ZX-Basic Compiler):
another question: the colours available from chroma81 are those like from zx-spectrum’s bright 1 (or bright 0)?
Code: Select all
for eee=0 to 767
seed=smsrnd(seed)
dfile=peek uinteger(16396)
poke dfile+$8000+eee,seed
next
Re: Chroma 81 - SCART and Colour interface for the ZX81
Here’s some example assembler code to show the basic mechanisms for accessing the two colour modes provided by the Chroma 81 interface.
CHECK AVAILABILITY
Reading I/O port $7FEF can be used to check whether the Chroma colour facility is enabled:
The A register will hold $00 if Chroma colour is available, else $20. A program can therefore be designed to only use the Chroma colour facilities if they are present and enabled, e.g. the games from Bob's Stuff that include support for Chroma colour perform check for the colour facilities at start up but if not found then the games fall back to running in black and white.
SELECT COLOUR MODE
Writing to I/O port $7FEF is used to select between the two colour modes (bit 4) and to enable the colour mechanism (bit 5). It is also used to set the border colour (bits 0-3). Bits 6 and 7 are reserved for use in future revisions of the interface and should both be set to 0.
BORDER COLOUR
The border colour is set at the same time as selecting the colour mode and enabling the colour facility. Bits 2-0 defines the colour (GRB), with bit 3 defining whether the colour is BRIGHT or not.
COLOUR MODE 0
Colour mode 0 allows specific colours to be assigned to each character of the character set. Each character will be displayed in its colours no matter where it appears on the screen. This mode allows games to colourised without changing the actual game code. The table of colour values is located at $C000. It consists of the colour definitions for the 64 non-inverted characters ($C000-$C1FF) followed by the definitions for the inverse characters ($C200-$C3FF). Different colours can be defined for the 8 lines that make up each character.
The above example sets the same colour scheme for the 8 lines that make up the first character, i.e. the SPACE character.
COLOUR MODE 1
Colour mode 1 allows specific colours to be assigned to each display position irrespective of which characters are being shown. This mode is similar to the Spectrum’s attributes file. However, unlike on the Spectrum the Chroma attribute file does not reside at a fixed location. It mirrors the position of the display file but in the 48K-64K memory region, i.e. (DFILE)+$8000. The attributes file follows the same layout as the display file, i.e. if the display file is collapsed then so too is the attributes file. Note that if the display file moves up or down in memory, e.g. because BASIC lines are added or removed, then the location of the attributes file will also move but its contents will not be automatically shifted.
The above example sets the same colour throughout a fully expanded attributes file. Note that the attributes file includes positions corresponding to the NEWLINE characters in the display file. However, the contents of these locations are ignored.
ATTRIBUTE BYTES
The format of colour attributes is the same for colour modes 0 and 1 and follows a pattern similar (but not identical) to that of the Spectrum’s attributes. Bits 2-0 defines the INK colour (GRB), with bit 3 defining BRIGHT for INK. Bits 6-4 defines the PAPER colour (GRB), with bit 7 defining BRIGHT for PAPER. So instead of a shared BRIGHT bit and a FLASH bit as on the Spectrum, Chroma supports separate BRIGHT bits for the ink and paper and there are no FLASH bits.
CHECK AVAILABILITY
Reading I/O port $7FEF can be used to check whether the Chroma colour facility is enabled:
Code: Select all
LD BC,$7FEF
IN A,(C)
AND $20
SELECT COLOUR MODE
Writing to I/O port $7FEF is used to select between the two colour modes (bit 4) and to enable the colour mechanism (bit 5). It is also used to set the border colour (bits 0-3). Bits 6 and 7 are reserved for use in future revisions of the interface and should both be set to 0.
BORDER COLOUR
The border colour is set at the same time as selecting the colour mode and enabling the colour facility. Bits 2-0 defines the colour (GRB), with bit 3 defining whether the colour is BRIGHT or not.
COLOUR MODE 0
Colour mode 0 allows specific colours to be assigned to each character of the character set. Each character will be displayed in its colours no matter where it appears on the screen. This mode allows games to colourised without changing the actual game code. The table of colour values is located at $C000. It consists of the colour definitions for the 64 non-inverted characters ($C000-$C1FF) followed by the definitions for the inverse characters ($C200-$C3FF). Different colours can be defined for the 8 lines that make up each character.
Code: Select all
LD A,$20+border_colour
LD BC,$7FEF
OUT (C),A
LD HL,$C000
LD B,$08
LOOP:
LD (HL),attribute_colour
INC HL
DJNZ LOOP
COLOUR MODE 1
Colour mode 1 allows specific colours to be assigned to each display position irrespective of which characters are being shown. This mode is similar to the Spectrum’s attributes file. However, unlike on the Spectrum the Chroma attribute file does not reside at a fixed location. It mirrors the position of the display file but in the 48K-64K memory region, i.e. (DFILE)+$8000. The attributes file follows the same layout as the display file, i.e. if the display file is collapsed then so too is the attributes file. Note that if the display file moves up or down in memory, e.g. because BASIC lines are added or removed, then the location of the attributes file will also move but its contents will not be automatically shifted.
Code: Select all
LD A,$30+border_colour
LD BC,$7FEF
OUT (C),A
LD HL,($400C)
INC HL
SET 7,H
LD C,$18
LOOP_ROW:
LD B,$20
LOOP_COL:
LD (HL),attribute_colour
INC HL
DJNZ LOOP_COL
INC HL
DEC C
JR NZ,LOOP_ROW
ATTRIBUTE BYTES
The format of colour attributes is the same for colour modes 0 and 1 and follows a pattern similar (but not identical) to that of the Spectrum’s attributes. Bits 2-0 defines the INK colour (GRB), with bit 3 defining BRIGHT for INK. Bits 6-4 defines the PAPER colour (GRB), with bit 7 defining BRIGHT for PAPER. So instead of a shared BRIGHT bit and a FLASH bit as on the Spectrum, Chroma supports separate BRIGHT bits for the ink and paper and there are no FLASH bits.
Re: Chroma 81 - SCART and Colour interface for the ZX81
The above code does not take into account the 'NEWLINE' positions within the attributes file.nitrofurano wrote: ↑Tue Jan 02, 2018 9:18 pmCode: Select all
for eee=0 to 767 seed=smsrnd(seed) dfile=peek uinteger(16396) poke dfile+$8000+eee,seed next
The attributes file begins with a position corresponding to the initial NEWLINE character in the display file, followed by 32 positions for the 32 columns of the first row, then another NEWLINE position, then the 32 columns for the second row, etc. Although the NEWLINE positions are reproduced in the attributes file, they are ignored by the Chroma interface and so they do not need to be populated with a NEWLINE character. Having the attributes file replicate the 'shape' of the display file allows a program to easily handle both a fully expanded display file or collapsed display files where some rows don't contain the full 32 columns. When a program writes into the display file, it can simply follow it by setting bit 15 of the address to access the corresponding attributes file location.