News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_CPCLER

Overscan

Started by CPCLER, 10:45, 02 July 09

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CPCLER

Hi there

I need to setup a overscan screen on the CPC with screen memory from &8000 - &FFFF but somehow I can't make work.

I know I made it work a while back, but somehow have forgotten how it works. I used the below bit of code from the CPCWIKI. It had something to do with the MA11 and MA10 bit? ???

Hope someone can help!

Regards,
CPCLER

;; This example shows a simple method for a overscan
;; screen.
;;
;; This example will work on CPC, CPC  and KC Compact.
;;
;; This example uses the 6845 CRTC, and shows how
;; 32k of pixel data can be displayed by the CRTC.
;; This example is compatible with CRTC type 2. (MC6845)
;;
;; the screen is 48x35 visible characters in dimension,
;; and each character is 8 scanlines tall.
;; the visible window is moved so that the display
;; will fill the entire monitor screen.
;; The screen base address is initialised, so that
;; MA11=MA10=1, and the internal MA counter of the CRTC will
;; change MA12 during the display, and cause the CRTC to display
;; data from a 32k range. The actual visible display uses approx
;; 24k of RAM. After this setup, the screen does not need to
;; re-initialised for the overscan to be maintained.
;;
;; the screen is setup for a PAL display.
;;
;; This example will compile with the MAXAM assembler
;; or the built-in assembler of WinAPE32.
;;
;; Kevin Thacker 2002

;; the origin of this source code is not important
org &4000

;; initialise a display window of 48x35 characters
;; each character is 8 scanlines tall

;; set character height to 8 scanlines
ld bc,&bc09
out (c),c
ld bc,&bd00 7
out (c),c

;; set default horizontal total (set horizontal total to 64 CRTC characters
;; = 64 microseconds)
ld bc,&bc00
out (c),c
ld bc,&bd00 &3f
out (c),c

;; set default vertical total (set vertical total to 39 CRTC character-lines)
ld bc,&bc04
out (c),c
ld bc,&bd00 38
out (c),c

;; setup default horizontal and vertical sync widths
ld bc,&bc03
out (c),c
ld bc,&bd00 &8e
out (c),c

;; setup default vertical adjust
ld bc,&bc05
out (c),c
ld bc,&bd00
out (c),c

;; setup default interlace & skew
ld bc,&bc08
out (c),c
ld bc,&bd00
out (c),c

;; set width of display window
ld bc,&bc01
out (c),c
ld bc,&bd00 48
out (c),c

;; set horizontal sync position; and therefore the
;; horizontal position of the display window
;; within the monitor display
ld bc,&bc02
out (c),c
ld bc,&bd00 48
out (c),c

;; set height of display window
ld bc,&bc06
out (c),c
ld bc,&bd00 35
out (c),c

;; set vertical sync position; and therefore the
;; vertical position of the display window
;; within the monitor display
ld bc,&bc07
out (c),c
ld bc,&bd00 35
out (c),c

;; set display start
;; force MA11=MA10=1, so that the internal MA
;; counter will increment enough to change MA12.

;; the displayed data is &0000-&7fff
ld bc,&bc0c
out (c),c
ld bc,&bd00 &0c
out (c),c
ld bc,&bc0d
out (c),c
ld bc,&bd00 0
out (c),c

ret

Executioner

Quote from: CPCLER on 10:45, 02 July 09
I need to setup a overscan screen on the CPC with screen memory from &8000 - &FFFF but somehow I can't make work.

Just out &bc00,12:out &bd00,&2c will do it (ie. #0c = #0000..7fff, #1c=#4000..#bfff, #2c=#8000..#ffff and #3c=#c000..#3fff).

Cheers,
Richard

CPCLER

Thanks alot!

/CPCLER

Quote from: Executioner on 11:23, 02 July 09
Just out &bc00,12:out &bd00,&2c will do it (ie. #0c = #0000..7fff, #1c=#4000..#bfff, #2c=#8000..#ffff and #3c=#c000..#3fff).

Cheers,
Richard

Joseman

Hi

Only point out that out &bc00,12 is mistaken, out &bc00,0c (hex)

a little mistake, but perhaps can confuse somebody...

regards
Joseman

Executioner

Quote from: Joseman on 22:32, 07 July 09
Only point out that out &bc00,12 is mistaken, out &bc00,0c (hex)

&0c is the same as 12 decimal. what you've typed above will only generate a syntax error in BASIC since you missed the & character. I could have typed out &bc00,&c but I usually refer to the register number in decimal, even though my brain works almost equally well in hexadecimal.

CPCLER

Hi Executioner

I noticed this and it worked like a charm!

Thanks,
CPCLER

Quote from: Executioner on 10:01, 08 July 09
&0c is the same as 12 decimal. what you've typed above will only generate a syntax error in BASIC since you missed the & character. I could have typed out &bc00,&c but I usually refer to the register number in decimal, even though my brain works almost equally well in hexadecimal.

Joseman

Hi all

I've playing with overscan this days, and  i think that more or less i achieved it, but, the image that the cpc displays have some "extrange" behaviour on the center of the image.
the image was converted with convimgcpc:

what is wrong? the conversion?




Devilmarkus

Quote from: Joseman on 23:48, 08 July 09
Hi all

I've playing with overscan this days, and  i think that more or less i achieved it, but, the image that the cpc displays have some "extrange" behaviour on the center of the image.
the image was converted with convimgcpc:

what is wrong? the conversion?

How did you load it?
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

Joseman

Hi

with a simple cas_in_direct :S


Executioner

Quote from: Joseman on 00:43, 09 July 09
with a simple cas_in_direct :S

Unfortunately, the memory used by the overscan screen will overlap the upper firmware jumpblock and stack if you map it from #8000 to #ffff. This is fine if you're doing it from machine code and you move the stack etc, but it can't easily be done from BASIC. You have very limited options to use overscan from BASIC:

1. Set the screen start just higher than BASIC (#0170) and keep your BASIC program very small.

2. Use an interrupt routine to change the screen address part way through the screen, in which case you may as well not use the 32K screen mode at all.

3. Don't use BASIC, do it from machine code with your own disc/tape loaders.


CPCLER

Now the topic is on overscan..  :D

Is there a call to calculate the address of the byte on the line below. Just like the firmware call &bc26, just for overscan screens.

/CPCLER

Quote from: Executioner on 05:52, 09 July 09
Unfortunately, the memory used by the overscan screen will overlap the upper firmware jumpblock and stack if you map it from #8000 to #ffff. This is fine if you're doing it from machine code and you move the stack etc, but it can't easily be done from BASIC. You have very limited options to use overscan from BASIC:

1. Set the screen start just higher than BASIC (#0170) and keep your BASIC program very small.

2. Use an interrupt routine to change the screen address part way through the screen, in which case you may as well not use the 32K screen mode at all.

3. Don't use BASIC, do it from machine code with your own disc/tape loaders.

Joseman

Quote from: Executioner on 05:52, 09 July 09
Unfortunately, the memory used by the overscan screen will overlap the upper firmware jumpblock and stack if you map it from #8000 to #ffff. This is fine if you're doing it from machine code and you move the stack etc, but it can't easily be done from BASIC. You have very limited options to use overscan from BASIC:

1. Set the screen start just higher than BASIC (#0170) and keep your BASIC program very small.

2. Use an interrupt routine to change the screen address part way through the screen, in which case you may as well not use the 32K screen mode at all.

3. Don't use BASIC, do it from machine code with your own disc/tape loaders.

Hi Executioner

I'm doing all from machine code (with winape assembler  :D ) and a few calls to the firmware (cas in open, cas in direct, cas in close).

Changed the screen memory to start on &40, and then load with cas in direct all de 32 k's screen, then, i suppose that none of the firmware or any important call of the cpc are affected...

even played with the registers to move the screen horizontally en vertically, all seems to work fine, except this nasty garbage...

what can be happening?

Regards
Joseman

Executioner

Quote from: Joseman on 12:10, 09 July 09
Changed the screen memory to start on &40, and then load with cas in direct all de 32 k's screen, then, i suppose that none of the firmware or any important call of the cpc are affected...

If that's the case, it should be ok, unless either the data is corrupted or it has the wrong address mapping. The addresses used for 32K starting at #0040 are:

#0040..#07ff, #4000..#47ff    - Scan 0
#0840..#0fff, #4800..#4fff     - Scan 1
#1040..#17ff, #5000..#57ff    - Scan 2
#1840..#1fff, #5800..#5fff     - Scan 3
#2040..#27ff, #6000..#67ff    - Scan 2
#2840..#2fff, #6800..#6fff     - Scan 3
#3040..#37ff, #7000..#77ff    - Scan 2
#3840..#3fff, #7800..#7fff     - Scan 3

With an offset of #40,  the break (eg. #7ff .. #4000) will wrap part way through a scan line (depending on you Register 1 setting). It's usually best to avoid this by adjusting the start address slightly. I'd suggest creating a table with all the scan line addresses pre-calculated so you can work out the next scan line address. Alternatively, if you know the format of the original data, you may be able to either move parts of it after loading or create a data file with the correct desired memory layout.

mr_lou

mkay, now it's my turn to try loading an overscan image.
I managed to compile the code here, and even figured out how to do the OUT codes afterwards in BASIC to load the image at a certain address. But as far as I understand I need to move some firmware or stack or whatever, which I have no clue how to do. As a result the image doesn't load completely and since I have no clue about assembler code I'm stuck.

Can someone please post the source that simply allows me to load an overscan image at &8000 ? Or whatever address you feel like using. Just as long as I can load the image from BASIC afterwards. :) Thanks.

mr_lou

Doh! Nevermind!

Turns out CpcConvImg saves a binary file, which can be viewed just by doing RUN"file.scr"

To me it's just not that logical that an .SCR file can be executed, so obviously I tried to load it other ways.

Anyway. No need for any source code then.

mr_lou

Bummer. The binary file ConvImgCpc saves, isn't compatible with CRTC 2.

So I'm still on the lookout for some way to transfer my overscan image from GIF on my PC to my CPC. I'll be checking out Claudia as soon as Eliot mails me the latest version, since the older version doesn't work with CRTC 2 either.

Other procedures are most welcome too.

fano

I have another method with "my_cpc_toolkit" that accept gif but it's only for Windows.Anyway ,send me the gif , i'll convert it.
Else i have some overscan code in my archives if you want.
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

mr_lou

Thanks for the suggestion fano.

I downloaded my_cpc_toolkit and converted my image with it.

This can seemingly also be done with ConvImgCpc.


But when trying to load these linear conversions, all I get is noise.

This is what I do from BASIC

MEMORY &1FFFF
LOAD"OVERSCAN.BIN",&4000  ' Kevin Thackers code from the Wiki
CALL &4000
OUT &BC00,12
OUT &BD00,&1C
LOAD "IMAGE.PM0",&2000

What am I doing wrong?

fano

This is normal , you need some 'drawing' code.I'll try to post that tomorow , that should be usefull for the wiki too  ;)
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

mr_lou

That would be great.

I've also written Demoniak, asking for a new release of ConvImgCpc that saves binary overscan files with CRTC 2 support, but I've been told he's not that active anymore, so I don't think that'll happen.

fano

Demoniak is still present at phenixinformatique.

This a bit of code that show an image in 192*272 (mode 0) or 384*272 (mode 1).You image MUST have theses dimensions.

You just have to setup your palette "color_config" label (firmware colors) and to change image at the end of the file "image" label.
You can change the graphical mode with changing "ld BC,#7F8C" to "   ld BC,#7F8C+mode_you_want".

It is not firmware friendly because the screen start at #8000.
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

mr_lou

Thanks a lot fano.

I will try this out when I get home from work today.

Do I just insert Kevin's code above it somehow?

fano

Not needed, the code is self suffisant  ;)
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

eliot

#23
The CRTC configuration won't work on CRTC 2 : you have to add  the register 3 at a lower value than &8e, (as &89!) in .crtc_config  : #3,#89  

 

fano

Thanks Eliot ! i'll correct this ;) (was not aware about this incompatibility as my type 2 does not still own a disk drive)
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

Powered by SMFPacks Menu Editor Mod