News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_AMSDOS

Coloured Text

Started by AMSDOS, 09:37, 29 August 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AMSDOS

One of the interesting type-ins in AA56 from Jeroen Erkens allows you to have 3 Coloured Text in Mode 1. Unfortunately it only works in Mode 1. Some time ago I took the code (originally done in Assembly) and Disassembled it, unfortunately my relabelling of labels doesn't do the program justice in terms of it's readability! :( I'm guessing though that what happens in this program has something to do with the size of the cursor based on how each mode spreads a pixel across the screen - so in Mode 2 each pixel in 1 character along on the x-axis, 2 in Mode 1 and 4 in Mode 0, though I just cannot see where in the program where that is happening! :(


ORG &6000

CALL &BB51
LD A,&C3
LD HL,LOOP
LD (&BDD3),A
LD (&BDD4),HL
CALL &B903
CALL &B906
LD A,&00
CALL &BB5A
LD (SUBLOOP3),HL
RET
LOOP: PUSH AF
CALL &BC1A
LD (SUBLOOP2),HL
POP AF
LD E,A
LD D,&00
LD B,&03
LOOP2: SLA D
SLA E
JP NC,PROG1
INC D
PROG1: DJNZ LOOP2
LD HL,(SUBLOOP3)
ADD HL,DE
LD (SUBLOOP1),HL
CALL PROG2
CALL PROG2
LD B,&04
LOOP3: PUSH BC
CALL PROG3
POP BC
DJNZ LOOP3
CALL PROG4
CALL PROG4
RET
PROG2: CALL PROG5
PUSH AF
AND &F0
LD (HL),A
INC HL
POP AF
SLA A
SLA A
SLA A
SLA A
LD (HL),A
JP PROG6
PROG3: CALL PROG5
LD (SUBLOOP4),A
CALL PROG7
LD (HL),A
INC HL
LD A,(SUBLOOP4)
AND &0F
LD (HL),A
JP PROG6
CALL PROG5
LD (SUBLOOP4),A
CALL PROG7
ADD B
LD (HL),A
INC HL
LD A,(SUBLOOP4)
AND &0F
LD C,A
LD B,A
LD A,&00
SLA C
SLA C
SLA C
SLA C
LD A,C
ADD B
LD (HL),A
JP PROG6
PROG6: LD DE,&07FF
ADD HL,DE
LD (SUBLOOP2),HL
RET
PROG7: AND &F0
LD B,A
SRA A
SRA A
SRA A
SRA A
AND &0F
RET
PROG5: LD HL,(SUBLOOP1)
INC HL
LD (SUBLOOP1),HL
DEC HL
LD A,(HL)
LD HL,(SUBLOOP2)
RET
SUBLOOP1: DEFB 0,0
SUBLOOP2: DEFB 0,0
SUBLOOP3: DEFB 0,0
SUBLOOP4: DEFB 0,0
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

erikarn

Grab the CPC6128 firmware guide from the Wiki and start adding descriptions to those calls.

It's quite likely he's pulling the character masks out (iirc there's a call to do that for you given whatever mode you're in), doing something with the pen colours, and then writing that to the screen.

arnoldemu

Quote from: erikarn on 04:15, 06 September 10
Grab the CPC6128 firmware guide from the Wiki and start adding descriptions to those calls.

It's quite likely he's pulling the character masks out (iirc there's a call to do that for you given whatever mode you're in), doing something with the pen colours, and then writing that to the screen.
Devilmarkus presented an example that worked well, but I can't find the post right now.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AMSDOS

Yes it was Devilmarkus' thread which prompted me to post this - I was almost going to post it in his. It's at the top on Page 2 or here  ;)  But this routine doesn't redefine any UDGs it simply recolours the standard Amstrad Font with 3 Colours. I tried to get it working in CP/M, though I think it's one of those routines which won't work at all cause it's poking &BDD3 and &BDD4/5 which points to TXT WRITE CHAR. It also does something to the Disable the Upper ROM and then Enable it again with (&B903 & B906). It might have been this that CP/M doesn't like, but anyway I've got more interesting things I can do in my CP/M programs before worrying about stuff like this.

I simply posted it cause I was wondering about the Mode 1 thing and wondered what it would need in order to have it working just as well in Mode 0. Unfortunately the program I've provided isn't very readable cause I've Disassembled it and put my own Spin on it - looping it all over with Subprograms - reads like a poorly written BASIC program!  ;D   But defining which Firmware is being used would help. All I can see in it is &BB51 - which is TXT RESET - which resets the text VDU indirections and the control code table.  I've described &BDD3 and B903 & B906 with &BDD3 though "A" holds the character to be written, "H" holds the physical column number and "L" holds the physical line number. In this programs case it seems to poke that address to the main routine I called LOOP!  ;D  &BB5A everyone should know as TXT OUTPUT - Output a character or control code to the screen. On entry "A" holds the Character to output. The last one is &BC1A which relates to the SCR CHAR POSITION which gets the Memory address of the top left corner of a specified character position. On entry H contains the character physical column and L contains the character physical row. On exit HL contains the memory address of the top left corner of the character, B holds the width in bytes of a character in the present mode, AF is corrupt, and all other registered are preserved!  ;D
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Powered by SMFPacks Menu Editor Mod