News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_EgoTrip

Resetting the Display

Started by EgoTrip, 01:05, 14 November 13

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

EgoTrip

How do I reset the display in BASIC using OUT commands, so its 40x25 like when switched on?

Thanks in advance.

ralferoo

If you're doing it from BASIC, you'll want to just use MODE 1 or the firmware rather that doing it with an OUT. The reason being that the firmware will reset the mode every time an interrupt happens or whenever a firmware function is called, which will be almost any time BASIC does anything. This is because the port that controls the screen mode also controls the ROM banking.

If you really want to do this without clearing the screen, you could create an assembler function that does e.g.: DI:EXX:LD A,C:AND #FC:OR #01:LD C,A:OUT (C),C:EI:RET. The number in the OR specifies the mode you want to switch to.

Or do you mean that you've used something that's reconfigured the CRTC size, e.g. 32x24? If so, that's a simpler matter. e.g. OUT &BC00,1:OUT &BD00,40:OUT &BC00,6:OUT &BD00,25.

Devilmarkus

#2
JavaCPC Desktop can dump the CRTC registers as BASIC code, when you are running it in Desktop mode and have the Java Console enabled.

Default CRTC registers:

10 OUT &BC00,0: OUT &BD00,&3F
20 OUT &BC00,1: OUT &BD00,&28
30 OUT &BC00,2: OUT &BD00,&2E
40 OUT &BC00,3: OUT &BD00,&8E
50 OUT &BC00,4: OUT &BD00,&26
60 OUT &BC00,5: OUT &BD00,&00
70 OUT &BC00,6: OUT &BD00,&19
80 OUT &BC00,7: OUT &BD00,&1E
90 OUT &BC00,8: OUT &BD00,&00
100 OUT &BC00,9: OUT &BD00,&07
110 OUT &BC00,10: OUT &BD00,&00
120 OUT &BC00,11: OUT &BD00,&00
130 OUT &BC00,12: OUT &BD00,&30
140 OUT &BC00,13: OUT &BD00,&00
150 OUT &BC00,14: OUT &BD00,&00
160 OUT &BC00,15: OUT &BD00,&00


A (good) emulator shows you the CRTC registers somewhere.
JavaCPC does that in debugger -> periphery:

[attachimg=1]

Just write down the default values, and write your BASIC/ASM code based on these values... ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

EgoTrip

Thanks for the replies. I have a machine code program that changes the display to 32x24 so I needed to switch it back to 40x25 when it exits to BASIC.

Java is temperamental on my PC, I have nothing but problems with it which sucks cos JavaCPC is a cool emulator.

Devilmarkus

WinApe or WinCPC show you the register values, too, in their debuggers ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Powered by SMFPacks Menu Editor Mod