Author Topic: Overscan  (Read 9214 times)

0 Members and 1 Guest are viewing this topic.

Offline CPCLER

  • CPC664
  • ***
  • Posts: 104
  • Country: dk
  • Pecunia non olet
  • Liked: 3
  • Likes Given: 37
Overscan
« on: 12:45, 02 July 09 »
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

Code: [Select]
;; 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

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: Overscan
« Reply #1 on: 13:23, 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

Offline CPCLER

  • CPC664
  • ***
  • Posts: 104
  • Country: dk
  • Pecunia non olet
  • Liked: 3
  • Likes Given: 37
Re: Overscan
« Reply #2 on: 19:43, 02 July 09 »
Thanks alot!

/CPCLER

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

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 806
  • Country: es
  • Liked: 675
  • Likes Given: 489
Re: Overscan
« Reply #3 on: 00:32, 08 July 09 »
Hi

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

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

regards
Joseman

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: Overscan
« Reply #4 on: 12:01, 08 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.

Offline CPCLER

  • CPC664
  • ***
  • Posts: 104
  • Country: dk
  • Pecunia non olet
  • Liked: 3
  • Likes Given: 37
Re: Overscan
« Reply #5 on: 15:55, 08 July 09 »
Hi Executioner

I noticed this and it worked like a charm!

Thanks,
CPCLER

&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.

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 806
  • Country: es
  • Liked: 675
  • Likes Given: 489
Re: Overscan
« Reply #6 on: 01:48, 09 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?




Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: Overscan
« Reply #7 on: 02:32, 09 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

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 806
  • Country: es
  • Liked: 675
  • Likes Given: 489
Re: Overscan
« Reply #8 on: 02:43, 09 July 09 »
Hi

with a simple cas_in_direct :S


Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: Overscan
« Reply #9 on: 07:52, 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.


Offline CPCLER

  • CPC664
  • ***
  • Posts: 104
  • Country: dk
  • Pecunia non olet
  • Liked: 3
  • Likes Given: 37
Re: Overscan
« Reply #10 on: 13:14, 09 July 09 »
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

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.

Offline Joseman

  • 6128 Plus
  • ******
  • Posts: 806
  • Country: es
  • Liked: 675
  • Likes Given: 489
Re: Overscan
« Reply #11 on: 14:10, 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

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: Overscan
« Reply #12 on: 04:44, 10 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.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #13 on: 18:26, 12 June 10 »
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.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #14 on: 20:05, 12 June 10 »
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.

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #15 on: 21:28, 12 June 10 »
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.

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 836
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 291
  • Likes Given: 618
Re: Overscan
« Reply #16 on: 13:29, 13 June 10 »
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 !

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #17 on: 16:05, 13 June 10 »
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?

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 836
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 291
  • Likes Given: 618
Re: Overscan
« Reply #18 on: 23:57, 13 June 10 »
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 !

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #19 on: 08:07, 14 June 10 »
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.

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 836
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 291
  • Likes Given: 618
Re: Overscan
« Reply #20 on: 08:44, 14 June 10 »
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 !

Offline mr_lou

  • 6128 Plus
  • ******
  • Posts: 3.206
  • Country: dk
    • index.php?action=treasury
    • 8-bit Memoirs - a Blu-ray diskmag-like eBook about the 8-bit era
  • Liked: 1370
  • Likes Given: 2694
Re: Overscan
« Reply #21 on: 08:51, 14 June 10 »
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?

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 836
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 291
  • Likes Given: 618
Re: Overscan
« Reply #22 on: 09:11, 14 June 10 »
Not needed, the code is self suffisant  ;)
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

Offline eliot

  • CPC664
  • ***
  • Posts: 87
  • Country: fr
    • Benediction - demogroup since 1995
  • Liked: 58
  • Likes Given: 27
Re: Overscan
« Reply #23 on: 11:39, 14 June 10 »
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  

 
« Last Edit: 11:48, 14 June 10 by eliot »

Offline fano

  • Supporter
  • 6128 Plus
  • *
  • Posts: 836
  • Country: fr
  • Easter Egg Programmer
    • Easter Egg
  • Liked: 291
  • Likes Given: 618
Re: Overscan
« Reply #24 on: 13:31, 14 June 10 »
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 !