Author Topic: How load overscan image and run program in basic loader  (Read 4103 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Hello, i open once again this subject  ;D ,
but i haven't found how load a overscan image (192x272 mode 0) then run a program from a basic loader.

With convimgcpc i have generated and displayed a .scr, but when i press a key the CPC reset and my program is not launched.

Same problem with cpctelera, my image is displayed but when i exit my introduction program, the cpc reset.

Here my attempt in basic.

Code: [Select]
10 mode 0
20 border 0
30 bc = &bc00:bd = &bd00
40 out bc,1:out bd,48
50 out bc,2:out bd,50
60 out bc,6:out bd,34
70 out bc,7:out bd,35
80 out bc,12:out bd,12
90 out bc,13:out bd,&D0
100 load"intro.scr",&D0

What i was thinking, configure CRTC to set video (R12) from 0 to 0x3FFF. Apply a offset 0xD0 (R13) in order to not overwrite basic and load the picture at this memory address.

Thanks for help.
« Last Edit: 23:11, 23 April 17 by Arnaud »

Online robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.423
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1102
  • Likes Given: 2685
Re: How load overscan image and run program in basic loader
« Reply #1 on: 23:46, 23 April 17 »
By looking at the MC6845 datasheet, I see that registers 12 and 13 form the address from which to read the data shown on screen.


In that case, your error is that you are loading the data in the wrong place.


Code: [Select]
80 out bc,12:out bd,12
90 out bc,13:out bd,&D0


This sets the address to &CD0 (12 is &C in hex)


So line 100 should be:


Code: [Select]
100 load"intro.scr",&CD0

Maybe you were trying to load it at &12D0, in which case your code would be:
Code: [Select]
80 out bc,12:out bd,&12
90 out bc,13:out bd,&D0
100 load"intro.scr",&12D0


Hope this helps!

Online andycadley

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.003
  • Liked: 487
  • Likes Given: 82
Re: How load overscan image and run program in basic loader
« Reply #2 on: 21:10, 24 April 17 »


Register 12 doesn't quite map directly to an address like that. If you wanted a 32K screen starting at &D0, you'd need to program a value of &0C into R12 and &68 into R13. This is because the upper bits of the address don't map directly into the upper two bits of R12  but instead into bits 12 & 13, and you also need to set bits 10 & 11 to 1 in order to cause an address overflow (necessary to get a 32K screen buffer). And you have to remember the entire offset is measured in 2 byte chunks (which is why everything scrolls in Mode 1 characters).


Edit: third time mathematically lucky (hopefully!)


« Last Edit: 21:29, 24 April 17 by andycadley »

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.413
  • Country: 00
  • Liked: 1335
  • Likes Given: 2051
Re: How load overscan image and run program in basic loader
« Reply #3 on: 22:06, 24 April 17 »
Hello, i open once again this subject  ;D ,
but i haven't found how load a overscan image (192x272 mode 0) then run a program from a basic loader.
Could you post the overscan screen and program here (or via PM)?

Offline Morri

  • CPC6128
  • ****
  • Posts: 284
  • Country: nz
  • Liked: 237
  • Likes Given: 216
Re: How load overscan image and run program in basic loader
« Reply #4 on: 22:08, 24 April 17 »
Also try:
Code: [Select]
10 OPENOUT"D":MEMORY &1FF:LOAD"FILE.SCR":CALL &811

Edit: Not my own code - got it from this thread
« Last Edit: 22:28, 24 April 17 by Morri »
Keeping it Kiwi since 1977

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #5 on: 12:23, 25 April 17 »
Also try:
Code: [Select]
10 OPENOUT"D":MEMORY &1FF:LOAD"FILE.SCR":CALL &811

It's near to work, the picture is displayed but when i press a key the picture disappeared before loading my program. I'd like to have the picture displayed while loading, but i'm not sure if it's possible.
Could you post the overscan screen and program here (or via PM)?

Here my disk with the basic loader, overscan screen and program to load.

The basic loader :
Code: [Select]
10 OPENOUT"D":MEMORY &1FF:LOAD"YENEFER.SCR":CALL &811
20 RUN"LOADER

I found another solution with an old utility but it's more complicated to do.

http://www.cpc-power.com/index.php?page=detail&num=5177


 
« Last Edit: 15:09, 25 April 17 by Arnaud »

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.413
  • Country: 00
  • Liked: 1335
  • Likes Given: 2051
Re: How load overscan image and run program in basic loader
« Reply #6 on: 20:40, 25 April 17 »
Here my disk with the basic loader, overscan screen and program to load.

Attached is an updated version of your loader. It loads the screen to &0200, CALLs &0800 and then RUNs the CPCtelera program.

However, there are a number of issues you will need to overcome going forward;
-1. The CPCtelera program needs to reset the &C000 screen correctly!
-2. The CPCtelera program is currently set to memory address &4000 which is half-way through the loading screen. You can just see the code appear as it loads. Moving it to &8000 will fix this!
-3. Because an overscan screen takes up 32k of memory, it limits the amount of data you can load in. I recommend compacting everything and then expanding it to the required memory location once loaded.

NOTE: The overscan screen now uses a different "viewer" to Markus's original code.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #7 on: 20:52, 25 April 17 »
Thanks @SuTeKH/Epyteor.

-3. Because an overscan screen takes up 32k of memory, it limits the amount of data you can load in. I recommend compacting everything and then expanding it to the required memory location once loaded.

Effectively, i understand why there're not so many loading overscan screen in games. I think i have to use only 16ko screen to my loading screen.


 

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.413
  • Country: 00
  • Liked: 1335
  • Likes Given: 2051
Re: How load overscan image and run program in basic loader
« Reply #8 on: 21:26, 25 April 17 »
Effectively, i understand why there're not so many loading overscan screen in games. I think i have to use only 16ko screen to my loading screen.

You can still use an overscan loading screen (basically because they look so dang good on a real monitor), but I recommend using Exomizer or BITBuster to compress the "game code", LOAD it to &8000-&A500 or even to &C000-&FFFF, decompress it to the required memory address and then CALL the start address as normal.

Also, you have to remember that an overscan screen is actually ~24k in size, but fits in ~32k... so you have an extra ~8k to hide "game code". For example, if you look at the CPC-Wiki remix of ZYNAPS, you will see that a compressed version of the game fits in the upper screen bank (&C000-&FFFF) and within the blank lines of the amazing overscan screen by TotO. It took a lot of LDIR commands to move the data around, but the screen, music, cheats and game fit in a single ~22k file. Unpacked it's about 90k in total!
« Last Edit: 21:31, 25 April 17 by SuTeKH/Epyteor »

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #9 on: 22:54, 25 April 17 »
I recommend using Exomizer or BITBuster to compress the "game code", LOAD it to &8000-&A500 or even to &C000-&FFFF, decompress it to the required memory address and then CALL the start address as normal.

How decompress with exomizer from Basic ? The asm unexo code must be included in basic listing ?

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.413
  • Country: 00
  • Liked: 1335
  • Likes Given: 2051
Re: How load overscan image and run program in basic loader
« Reply #10 on: 06:47, 26 April 17 »
How decompress with exomizer from Basic ? The asm unexo code must be included in basic listing ?
It would be easier to have the decompressor as part of the game-code. If you want the overscan screen compressed as well, then find an unused area in memory to store the decompressor code, decompress the screen, LOAD the game-code, decompress it with the same decompressor routine and CALL the start address.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #11 on: 09:47, 26 April 17 »
It would be easier to have the decompressor as part of the game-code. If you want the overscan screen compressed as well, then find an unused area in memory to store the decompressor code, decompress the screen, LOAD the game-code, decompress it with the same decompressor routine and CALL the start address.

But in this case, all is loaded in the same time, overscan screen and game. This is not a waiting loading screen.
Or i have to load the game code separatly, but for moment there's no file load and save with CPCTelera, i have to use firmware et no memory left to use it.

Interesting discussion in all case.
« Last Edit: 09:51, 26 April 17 by Arnaud »

Offline NiNxPe

  • CPC664
  • ***
  • Posts: 92
  • Liked: 254
  • Likes Given: 38
Re: How load overscan image and run program in basic loader
« Reply #12 on: 10:40, 26 April 17 »
In the same idea, I'm looking for a loader for pictures made with Perfect Pix  :D

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.413
  • Country: 00
  • Liked: 1335
  • Likes Given: 2051
Re: How load overscan image and run program in basic loader
« Reply #13 on: 12:21, 26 April 17 »
But in this case, all is loaded in the same time, overscan screen and game. This is not a waiting loading screen.
Or i have to load the game code separatly, but for moment there's no file load and save with CPCTelera, i have to use firmware et no memory left to use it.
I have an upcoming TAPE-only musicdisk that has an overscan loading screen (&01A0-&7FFF). The main code is then loaded into &C000-7FFF and &9000-&A500 as separate files. From there, I move all the code to &0100- and CALL the start address from there. All in all, the main-code loading time is about 4 minutes; enough to get used (and bored with) the loading screen! ^_^

Firmware is still intact with this method (until I initialise some rasters)!

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.236
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1143
  • Likes Given: 806
Re: How load overscan image and run program in basic loader
« Reply #14 on: 13:35, 26 April 17 »
Hello, i open once again this subject  ;D ,
but i haven't found how load a overscan image (192x272 mode 0) then run a program from a basic loader.

With convimgcpc i have generated and displayed a .scr, but when i press a key the CPC reset and my program is not launched.

Same problem with cpctelera, my image is displayed but when i exit my introduction program, the cpc reset.

Here my attempt in basic.

Code: [Select]
10 mode 0
20 border 0
30 bc = &bc00:bd = &bd00
40 out bc,1:out bd,48
50 out bc,2:out bd,50
60 out bc,6:out bd,34
70 out bc,7:out bd,35
80 out bc,12:out bd,12
90 out bc,13:out bd,&D0
100 load"intro.scr",&D0

What i was thinking, configure CRTC to set video (R12) from 0 to 0x3FFF. Apply a offset 0xD0 (R13) in order to not overwrite basic and load the picture at this memory address.

Thanks for help.


Have you ever used IMPdraw who allows you to Load full screen screen using a simple Load or Run ?
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcomed !

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #15 on: 14:31, 26 April 17 »

Have you ever used IMPdraw who allows you to Load full screen screen using a simple Load or Run ?

Yes i tried but i have problem with it (lite v1.132) on emulator :

 [ You are not allowed to view attachments ]

The screen is moving.

Offline demoniak

  • CPC664
  • ***
  • Posts: 107
  • Country: fr
  • Liked: 146
  • Likes Given: 82
Re: How load overscan image and run program in basic loader
« Reply #16 on: 18:10, 26 April 17 »
With an overscan image made by ConvImgCpc, before CALL &811, you can do a POKE &830,&C3

This will let the picture display on screen after pressing a key.

(Or do a POKE &830,&C9 to not wait for a key)

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.236
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1143
  • Likes Given: 806
Re: How load overscan image and run program in basic loader
« Reply #17 on: 00:07, 27 April 17 »

Yes i tried but i have problem with it (lite v1.132) on emulator :

 [ You are not allowed to view attachments ]

The screen is moving.
iMPdraw only works on Crtc 1 or 3 (Cpc Plus).
Use Ctrl+1 for crtc 1
or Ctrl+3 for Crtc 3
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcomed !

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.236
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1143
  • Likes Given: 806
Re: How load overscan image and run program in basic loader
« Reply #18 on: 12:40, 27 April 17 »
So Arnaud, did it work ?
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcomed !

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #19 on: 13:01, 27 April 17 »
So Arnaud, did it work ?

Yes, it works.

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.236
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1143
  • Likes Given: 806
Re: How load overscan image and run program in basic loader
« Reply #20 on: 13:25, 27 April 17 »

Did you find all you wanted ?


You could find the lastest iMPdraw v1.2 version here!
« Last Edit: 13:28, 27 April 17 by Ast »
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcomed !

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 695
  • Country: fr
  • Liked: 617
  • Likes Given: 1304
Re: How load overscan image and run program in basic loader
« Reply #21 on: 14:40, 27 April 17 »
You could find the lastest iMPdraw v1.2 version here!

The v1.2 contains interesting functionnality, but i'm not sure if it solves my problem, namely displaying a overscan image while loading my code.

My current problem is the loading data erase the memory location of image.



Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.236
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1143
  • Likes Given: 806
Re: How load overscan image and run program in basic loader
« Reply #22 on: 15:10, 27 April 17 »

The v1.2 contains interesting functionnality, but i'm not sure if it solves my problem, namely displaying a overscan image while loading my code.

My current problem is the loading data erase the memory location of image.
@Arnaud : Chat ?
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcomed !