Page 1 of 1
Changing color mode using Display Color Register $18063 does not work as expected
Posted: Tue Feb 04, 2020 7:10 pm
by grafvonb
When I run this code I expect the QL to change from 4 to 8 color mode. However it does not work.
If I run "mode 4" before and run the binary the screen background turns to magenta and fonts are corrupt (with blue lines or similar).
Code: Select all
move.b #%00001000,$18063 ;turn on 8 color mode
The other way (from 8 to 4 color mode by switching 3rd bit to zero, delivers similar result).
What is wrong with this snippet? I even tried to switch off interrupts but without effect.
(I use vasm as compiler on Windows and run the binary on real QL with Minerva (QemuLator behaves same))
Re: Changing color mode using Display Color Register $18063 does not work as expected
Posted: Tue Feb 04, 2020 7:42 pm
by tofro
grafvonb wrote:When I run this code I expect the QL to change from 4 to 8 color mode. However it does not work.
If I run "mode 4" before and run the binary the screen background turns to magenta and fonts are corrupt (with blue lines or similar).
Code: Select all
move.b #%00001000,$18063 ;turn on 8 color mode
The other way (from 8 to 4 color mode by switching 3rd bit to zero, delivers similar result).
What is wrong with this snippet? I even tried to switch off interrupts but without effect.
(I use vasm as compiler on Windows and run the binary on real QL with Minerva (QemuLator behaves same))
What you're doing is setting the hardware to 8-colour-mode (seen by the blue and magenta colours which are not available in four-colour-mode) but not telling the operating system. That's why it's thinking you're still using 4 colours and messes up the screen and fonts.
The proper way to do that is to use the MT.DMODE (see the QL Technical guide) trap which switches both the software and the hardware between modes.
Tobias
Re: Changing color mode using Display Color Register $18063 does not work as expected
Posted: Tue Feb 04, 2020 9:37 pm
by NormanDunbar
Re: Changing color mode using Display Color Register $18063 does not work as expected
Posted: Wed Feb 05, 2020 6:06 pm
by grafvonb
Thank you for the info about this trap. I changed the code to set 8 colors mode to the following and it works as expected!
Code: Select all
moveq #$10,d0 ;MT.DMODE Set or read the display mode
moveq #$8,d1 ;d1.b key, 1:read mode -> d1.b display mode, 0:mode is 4 colour, 8:mode is 8 colour
;d2.b key, 1:read mode -> d2.b display type, 0:monitor, 1:625-line TV, 2:525-line TV
;d3,a0,a1,a2,a3-preserved, a4-???
trap #1