Welcome, Guest. Please login or register.

Author Topic: PED81C - pseudo-native, no C2P chunky screens for AGA  (Read 2633 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline saimoTopic starter

PED81C - pseudo-native, no C2P chunky screens for AGA
« on: March 05, 2022, 10:29:14 AM »
PED81C is a video system for AGA Amigas that provides pseudo-native chunky screens, i.e. screens where each byte in CHIP RAM corresponds to a dot on the display. In short, it offers chunky screens without chunky-to-planar conversion or any CPU/Blitter/Copper sweat.

Download: https://www.retream.com/PED81C

These videos show a few examples:
* https://www.youtube.com/watch?v=4eikEo45v1I
* https://www.youtube.com/watch?v=tLtLhJXInOY
Notes:
 * due to the nature of the system, the videos must be watched in their original size (1920x1080);
 * YouTube's video processing has slightly reduced the visual quality (i.e. the result is better on real machines).

For the details, please check out the documentation included in the archive.

Originally I had planned to use PED81C to make a new game. However, I could not come up with a satisfactory idea; moreover, due to personal reasons, I had to stop software development. Given that I could not predict when/if I would able to produce something with PED81C and given that the war in Ukraine put the world in deep uncertainty, I decided that it was better to release PED81C to avoid that it went wasted and also as a gift to the Amiga community.
I must admit I have been tempted to provide an implementation of PED81C in the form of a library or of a collection of functions, but since setting up PED81C screens is easy and since general-purpose routines would perform worse than tailor-made ones, I decided to let programmers implement it in the way that fits best their projects.
« Last Edit: June 21, 2023, 04:04:13 PM by saimo »
RETREAM - retro dreams for Amiga, Commodore 64 and PC
 
The following users thanked this post: klx300r

Offline klx300r

  • Amiga 1000+AmigaOne X1000
  • Hero Member
  • *****
  • Join Date: Sep 2007
  • Posts: 3237
  • Country: ca
  • Thanked: 19 times
  • Gender: Male
    • Show only replies by klx300r
    • http://mancave-ramblings.blogspot.ca/
Re: PED81C - pseudo-native, no C2P chunky screens for AGA
« Reply #1 on: March 05, 2022, 09:23:13 PM »
I think it will be awesome for a new horizontal shooter ;D
____________________________________________________________________
c64-dual sids, A1000, A1200-060@50, A4000-CSMKIII
Indivision AGA & Catweasel MK4+= Amazing
! My Master Miggies-Amiga 1000 & AmigaOne X1000 !
--- www.mancave-ramblings.blogspot.ca ---
  -AspireOS.com & Amikit- Amiga for your netbook-
***X1000- I BELIEVE *** :angel:
 

Offline saimoTopic starter

Re: PED81C - pseudo-native, no C2P chunky screens for AGA
« Reply #2 on: June 21, 2023, 04:05:16 PM »
Uploaded an archive with updated documentation.
While at it, given that I was asked for a source code example, I whipped up an AMOS Professional program that shows how to set up a PED81C screen and to perform some basic operations on it - hopefully, this will be easy to understand and also open the door to AMOS programmers. The program source is included in the archive.

Code: [Select]
'-----------------------------------------------------------------------------
'$VER: PED81C example 1.0 (c) 2023 RETREAM
'Legal terms: please refer to the accompanying documentation.
'www.retream.com/PED81C 
'ped81c@retream.com 
'-----------------------------------------------------------------------------

'-----------------------------------------------------------------------------
'DESCRIPTION
'This shows how to set up a PED81C screen and to perform some basic operations
'on it.
'Screen features:
' * equivalent to a 319x256 LORES screen
' * 160 dots wide raster
' * single buffer
' * blanked border
' * 64-bit bitplanes fetch mode
' * CMYW color model
'
'NOTES
'The code is written to be readable, not to be general-purpose/optimal.
'-----------------------------------------------------------------------------

'-----------------------------------------------------------------------------
'GLOBAL VARIABLES

Global RASTERADDRESS,RASTERWIDTH,RASTERHEIGHT,RASTERSIZE

RASTERWIDTH=160
RASTERHEIGHT=256
RASTERSIZE=RASTERWIDTH*RASTERHEIGHT

'-----------------------------------------------------------------------------
'MAIN

'Initialize everything.

_INITIALIZE_AMOS_ENVIRONMENT
_INITIALIZE_SCREEN

'If the initialization succeeded, load a picture into the raster and, in case
'of success, execute a simple effect on it.

If Param
   _LOAD_PICTURE_INTO_RASTER["picture-160x256.raw"]
   If Param
      _TURN_DISPLAY_DMA_ON[0]
      _RANDOMIZE_RASTER
      _TURN_DISPLAY_DMA_OFF
   End If
End If

'Deinitialize everything.

_DEINITIALIZE_SCREEN
_RESTORE_AMOS_ENVIRONMENT

'-----------------------------------------------------------------------------
'ROUTINES

Procedure _ALLOCATE_BITPLANE[BANKINDEX,SIZE]
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Allocates a CHIP RAM buffer to be used as a bitplane.
   '
   'INPUT
   'BANKINDEX = index of bank to use
   'SIZE      = size [bytes] of bitplane
   '
   'OUTPUT
   '64-bit-aligned bitplane address (0 = error)
   '
   'WARNINGS
   'The buffer must be freed with Erase BANKINDEX or Erase All.
   '--------------------------------------------------------------------------   
   
   Trap Reserve As Chip Data BANKINDEX,SIZE+8
   If Errtrap=0 Then A=(Start(BANKINDEX)+7) and $FFFFFFF8
   
End Proc[A]
Procedure _DEINITIALIZE_SCREEN
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Deinitializes the screen.
   '
   'WARNINGS
   'Can be called only if the display is off.
   '--------------------------------------------------------------------------
   
   Erase All
   Doke $DFF1FC,0 : Rem FMODE
   
End Proc
Procedure _INITIALIZE_AMOS_ENVIRONMENT
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Ensures the program cannot be interrupted or brought to back, and turns
   'off the AMOS video system.
   '--------------------------------------------------------------------------
   
   Break Off
   Amos Lock
   Comp Test Off
   Auto View Off
   Update Off
   Copper Off
   _TURN_DISPLAY_DMA_OFF
   
End Proc
Procedure _INITIALIZE_SCREEN
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Initializes the screen.
   '
   'OUTPUT
   '-1/0 = OK/error
   '
   'WARNINGS
   '_DEINITIALIZE_SCREEN[] must be called also in case of failure. 
   '
   'NOTES
   'Sets RASTERADDRESS.
   '--------------------------------------------------------------------------
   
   'Allocate the raster.
   
   _ALLOCATE_BITPLANE[10,RASTERSIZE] : If Param=0 Then Pop Proc[0]
   RASTERADDRESS=Param
   
   'Allocate and fill the selector bitplanes.
   
   _ALLOCATE_BITPLANE[11,RASTERSIZE] : If Param=0 Then Pop Proc[0]
   B3A=Param
   Fill B3A To B3A+RASTERSIZE,$55555555
   
   _ALLOCATE_BITPLANE[12,RASTERSIZE] : If Param=0 Then Pop Proc[0]
   B4A=Param
   Fill B4A To B4A+RASTERSIZE,$33333333
   
   'Set the chispet.
   
   Doke $DFF100,$4241 : Rem BPLCON0
   Doke $DFF102,$10 : Rem BPLCON1
   Doke $DFF104,$224 : Rem BPLCON2
   Doke $DFF106,$20 : Rem BPLCON3
   Doke $DFF108,0 : Rem BPLMOD1
   Doke $DFF10A,0 : Rem BPLMOD2
   Doke $DFF092,$38 : Rem DDFSTRT
   Doke $DFF094,$D0 : Rem DDFSTOP
   Doke $DFF08E,$2C82 : Rem DIWSTRT
   Doke $DFF090,$2CC1 : Rem DIWSTOP
   Doke $DFF1E4,$A100 : Rem DIWHIGH
   Doke $DFF1FC,$3 : Rem FMODE
   
   'Set COLORxx. 
   
   Doke $DFF180,0
   Doke $DFF182,$88
   Doke $DFF184,$88
   Doke $DFF186,$FF
   Doke $DFF188,$0
   Doke $DFF18A,$808
   Doke $DFF18C,$808
   Doke $DFF18E,$F0F
   Doke $DFF190,$0
   Doke $DFF192,$880
   Doke $DFF194,$880
   Doke $DFF196,$FF0
   Doke $DFF198,$0
   Doke $DFF19A,$888
   Doke $DFF19C,$888
   Doke $DFF19E,$FFF
   
   'Build a Copperlist that sets the bitplanes pointers. 
   
   Cop Movel $E0,RASTERADDRESS
   Cop Movel $E4,RASTERADDRESS
   Cop Movel $E8,B3A
   Cop Movel $EC,B4A
   Cop Swap
   
End Proc[-1]
Procedure _LOAD_PICTURE_INTO_RASTER[FILEPATH$]
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Loads a raw 8-bit chunky picture into the raster, ensuring that its size
   'is correct.
   '
   'OUTPUT
   '-1/0 = OK/error
   '--------------------------------------------------------------------------
   
   Trap Open In 1,FILEPATH$ : If Errtrap Then Pop Proc[0]
   L=Lof(1)
   Close(1)
   If L<>RASTERSIZE Then Pop Proc[0]
   Trap Bload FILEPATH$,RASTERADDRESS
   
End Proc[Errtrap=0]
Procedure _RANDOMIZE_RASTER
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Randomizes the raster by swapping 16 dots per frame, until a mouse button
   'is pressed.
   '--------------------------------------------------------------------------
   
   XM=RASTERWIDTH-1
   YM=RASTERHEIGHT-1
   Repeat
      C=16
      While C
         X0=Rnd(XM)
         Y0=Rnd(YM)
         X1=Rnd(XM)
         Y1=Rnd(YM)
         A0=Y0*RASTERWIDTH+X0+RASTERADDRESS
         A1=Y1*RASTERWIDTH+X1+RASTERADDRESS
         C0=Peek(A0)
         Poke A0,Peek(A1)
         Poke A1,A0
         Dec C
      Wend
      _WAIT_SCREEN_BOTTOM
   Until Mouse Click
   
End Proc
Procedure _RESTORE_AMOS_ENVIRONMENT
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Restores the AMOS environment.
   '--------------------------------------------------------------------------
   
   Copper On
   Update On
   Auto View On
   Amos Unlock
   Break On
   _TURN_DISPLAY_DMA_ON[$20]
   
End Proc
Procedure _TURN_DISPLAY_DMA_OFF
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Disables the bitplanes, Copper and sprites DMA.
   '--------------------------------------------------------------------------
   
   _WAIT_SCREEN_BOTTOM
   Doke $DFF096,$3A0 : Rem DMACON
   
End Proc
Procedure _TURN_DISPLAY_DMA_ON[SSPRITESFLAG]
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Enables the bitplanes and Copper DMA.
   '
   'INPUT
   'SSPRITESFLAG = $20/0 = turn / do not turn sprites on
   '
   'WARNINGS
   'The chipset must have been set up properly.
   '--------------------------------------------------------------------------
   
   _WAIT_SCREEN_BOTTOM
   Doke $DFF096,$8380 or SSPRITESFLAG : Rem DMACON
   
End Proc
Procedure _WAIT_SCREEN_BOTTOM
   '--------------------------------------------------------------------------
   'DESCRIPTION
   'Waits for the bottom of the screen.
   '--------------------------------------------------------------------------
   
   While Deek($DFF004) and $3 : Wend
   Repeat : Until(Leek($DFF004) and $3FF00)>$12C00
   
End Proc
RETREAM - retro dreams for Amiga, Commodore 64 and PC
 

Offline Coolrasta

  • Newbie
  • *
  • Join Date: Jul 2023
  • Posts: 1
    • Show only replies by Coolrasta
Re: PED81C - pseudo-native, no C2P chunky screens for AGA
« Reply #3 on: July 18, 2023, 08:41:40 AM »
It's wonderful to see that you've included a source code example for PED81C! This will undoubtedly aid programmers in understanding how to set up a PED81C screen and perform some basic operations on it.

Your detailed documentation and the comments within the code are also very helpful in understanding how each section of the program functions. This demonstrates the attention you've put into making it as accessible and comprehensible as possible for other developers.

Thank you again for sharing these resources.

My website : www.la-crypte-aux-monnaies.fr
« Last Edit: September 11, 2023, 03:36:37 PM by Coolrasta »
 

Offline saimoTopic starter

Re: PED81C - pseudo-native, no C2P chunky screens for AGA
« Reply #4 on: July 18, 2023, 08:44:30 PM »
@Coolrasta

Thank you for the nice comments. I'm glad you appreciate the documentation.
RETREAM - retro dreams for Amiga, Commodore 64 and PC