News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_ukmarkh

ghouls'n goblins gx4000

Started by ukmarkh, 04:01, 24 February 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ast

So, i'm waiting for your example... I never use that way, but why not ?
_____________________

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 welcome !

Gryzor

I actually wish the hero sprite was changed to something better... loved the game, even on the CPC, but I always hated that ugly mess!

Executioner

If you're using an overscan screen there's only about 32 scan lines between the VSYNC interrupt and the top of the screen. If you previously set PRI to 0, set up the CRTC correctly at this point, you can have R9=0 (1 scan line per char), Adjust the Vertical Total (R4) to include the number of scan lines you wish before the top split (should be approximately R7 plus 32), set your screen address (R12 and R13) to use data from just about any contiguous block of memory so long as it doesn't cross an #800 boundary. You can also pre-set your Split Screen scan-line and address, and make sure sprites are hidden during the top section (mag 0). You can then set up PRI to happen after N scan lines, at which point you change R9 to 7 and enable all the sprites you need. If you use the ASIC split screen you'll have to add N * 8 to the Y position for all sprites.

Making sure you don't get part of your sprites convering your top score section is the hardest task since using either method it's difficult as the ASIC doesn't clip them to the split-screen and the CRTC split will restart the scan line counter (VCC * 8 + VLC). It's not possible to change the magnification of every sprite during the horizontal retrace period of a single scan line, so I'd probably recommend adding an extra scan line and set Horizontal displayed to 0 for that scan line.

One of the things I like to do is place some static timed code in sections where you have a little time to waste, such as displaying score characters, eg. render the whole score and high-score every frame rather than adding an extra interrupt handler for close rasters. You may be able to get a few characters drawn between raster palette changes for example.

The calculations to ensure you have 312 scan lines can be difficult when you mix different R9 values. Using the example 4 character (32 scan line) from Toto with R9 = 0 (these calculations are only approximate and would need to be tested).

Since your top screen uses 33 characters to display 33 scan lines, rather than 4 characters to display 32 scan lines your value for R7 should be adjusted by 33 - 4 (within one scan line). For example, if you want the top of your display somewhere near the top of the monitor that'd be 33 - 4 + 34 = 63. R4 should have 33 - 4 added and if you set R9 to 0 on the VSYNC you'd need (39 - Normal VSYNC) * 7 added also, so R4 = 33 - 4 + 38 + (38 - 34) * 7 = 94. R6 would also need to be adjusted by 33 scan lines, so R6=33+28=61 for pretty well full overscan.

andycadley

#78
Quote from: Ast on 14:54, 29 February 16
So, i'm waiting for your example... I never use that way, but why not ?
Here goes. Not exactly demo of the year, but it probably gets the point across. Tweaking the DMA list REPEAT slightly can start the effect going in the other direction. Obviously you can get a lot more sophisticated with much longer DMA lists, causing different patterns of "movement" in the interrupt sequence by playing with the overall length and the spacing of interrupts.

Only tested in WinAPE, so hopefully not hitting any of the Plus bugs.  ;)


org &2000
run &2000

di

ld sp,&c000

;Unlock the ASIC so we can use Plus functionality
ld b,&bc
ld hl,bootasicsequence
ld e,17
seq:
ld a,(hl)
out (c),a
inc hl
dec e
jr nz,seq

; Put an EI;RET combo for the interrupt handler, so the firmware doesn't
; get in the way and start altering things
ld hl,&c9fb
ld (&0038),hl
ld (&8080),hl
di

;; enable asic ram (will be visible in range &4000-&7fff)
ld bc,&7fb8
out (c),c

; Reset the display file
ld bc, &bc0d
out (c),c
inc b
xor a
out (c),a
dec b
dec c
out (c),c
inc b
ld a, &30
out (c),a

; Put the display into MODE 0, ROMs disabled
ld bc,&7f8c
out (c),c

; Clear the screen
ld hl, &c000
ld de, &c001
ld bc, &3fff
xor a
ld (hl),a
ldir

; Set the border colour
xor a
ld hl,&6421
ld (hl),a
dec l
ld a, &6c
ld (hl),a

; Setup a DMA list
ld hl,dmalist
ld de,&8100
ld bc,dmalistend - dmalist
ldir

; Configure interrupts
ld hl,0
ld (&8000),hl
ld hl,0
ld (&8002),hl
ld hl,dma0int
ld (&8004),hl
ld hl,rasterint
ld (&8006),hl

ld a,1
ld (&6805),A ; Set the IVR to use a vector of 0, autoclear disabled
ld a,&80
ld i,a
im 2

; Configure a PRI at line 1
ld a,1
ld (&6800),A
ei

donothing: halt
jp donothing

rasterint:
; First time through, our Raster Int initializes the DMA
ld hl,&8100
ld (&6c00), hl ; Set our DMA list
ld a,1
ld (&6c0f), a ; Turn on DMA channel 0

; Set the raster int so it will no longer start the DMA list
ld hl,rasterint2
ld (&8006),hl

rasterint2:
ei
ret

dma0int:
; clear DMA interrupt
ld a,(&6c0f)
set 6,a
ld (&6c0f),a

; modify the border colour
ld a,(&6420)
rrca
rrca
ld (&6420), a

; keep count of how many interrupts we've serviced
ld a,(count)
inc a
ld (count),a
cp 4
jp nz, dma0intdone

; Once we've serviced them all, restart the DMA list
xor a
ld (count),a
ld hl,&8100
ld (&6c00), hl ; Reset our DMA list

dma0intdone: ei
ret

count: defb 0

dmalist:
defw &2000 + 312-20-1 ; Repeat (This is just enough to make our DMA list "too short")
defw &4001 ; Loop
defw &4010 ; Int
defw &1002 ; Pause 2
defw &4010 ; Int
defw &1004 ; Pause 4
defw &4010 ; Int
defw &1008 ; Pause 8
defw &4010 ; Int
defw &4020 ; STOP
dmalistend:

bootasicsequence:
defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee


P.S. Was based on some cart code I had, which is why there is a little bit of redundant copying into bits of RAM....

Ast

Quote from: andycadley on 21:28, 29 February 16
Here goes. Not exactly demo of the year, but it probably gets the point across. Tweaking the DMA list REPEAT slightly can start the effect going in the other direction. Obviously you can get a lot more sophisticated with much longer DMA lists, causing different patterns of "movement" in the interrupt sequence by playing with the overall length and the spacing of interrupts.

Only tested in WinAPE, so hopefully not hitting any of the Plus bugs.  ;)


org &2000
run &2000

di

ld sp,&c000

;Unlock the ASIC so we can use Plus functionality
ld b,&bc
ld hl,bootasicsequence
ld e,17
seq:
ld a,(hl)
out (c),a
inc hl
dec e
jr nz,seq

; Put an EI;RET combo for the interrupt handler, so the firmware doesn't
; get in the way and start altering things
ld hl,&c9fb
ld (&0038),hl
ld (&8080),hl
di

;; enable asic ram (will be visible in range &4000-&7fff)
ld bc,&7fb8
out (c),c

; Reset the display file
ld bc, &bc0d
out (c),c
inc b
xor a
out (c),a
dec b
dec c
out (c),c
inc b
ld a, &30
out (c),a

; Put the display into MODE 0, ROMs disabled
ld bc,&7f8c
out (c),c

; Clear the screen
ld hl, &c000
ld de, &c001
ld bc, &3fff
xor a
ld (hl),a
ldir

; Set the border colour
xor a
ld hl,&6421
ld (hl),a
dec l
ld a, &6c
ld (hl),a

; Setup a DMA list
ld hl,dmalist
ld de,&8100
ld bc,dmalistend - dmalist
ldir

; Configure interrupts
ld hl,0
ld (&8000),hl
ld hl,0
ld (&8002),hl
ld hl,dma0int
ld (&8004),hl
ld hl,rasterint
ld (&8006),hl

ld a,1
ld (&6805),A ; Set the IVR to use a vector of 0, autoclear disabled
ld a,&80
ld i,a
im 2

; Configure a PRI at line 1
ld a,1
ld (&6800),A
ei

donothing: halt
jp donothing

rasterint:
; First time through, our Raster Int initializes the DMA
ld hl,&8100
ld (&6c00), hl ; Set our DMA list
ld a,1
ld (&6c0f), a ; Turn on DMA channel 0

; Set the raster int so it will no longer start the DMA list
ld hl,rasterint2
ld (&8006),hl

rasterint2:
ei
ret

dma0int:
; clear DMA interrupt
ld a,(&6c0f)
set 6,a
ld (&6c0f),a

; modify the border colour
ld a,(&6420)
rrca
rrca
ld (&6420), a

; keep count of how many interrupts we've serviced
ld a,(count)
inc a
ld (count),a
cp 4
jp nz, dma0intdone

; Once we've serviced them all, restart the DMA list
xor a
ld (count),a
ld hl,&8100
ld (&6c00), hl ; Reset our DMA list

dma0intdone: ei
ret

count: defb 0

dmalist:
defw &2000 + 312-20-1 ; Repeat (This is just enough to make our DMA list "too short")
defw &4001 ; Loop
defw &4010 ; Int
defw &1002 ; Pause 2
defw &4010 ; Int
defw &1004 ; Pause 4
defw &4010 ; Int
defw &1008 ; Pause 8
defw &4010 ; Int
defw &4020 ; STOP
dmalistend:

bootasicsequence:
defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee


P.S. Was based on some cart code I had, which is why there is a little bit of redundant copying into bits of RAM....

Ok, as i see you're using Ivr... Well Done and I've ever do that too :-P
_____________________

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 welcome !

arnoldemu

#80
Traditional split ("rupture") with PRI. Written so you can just drop it into code, because I used interrupts in a nice way :)


Each PRI is done on last scanline of each section.

Top panel is R9=0, bottom panel is R9=0, middle is R9=7. NOTE: Pri thinks char height is 8, so pri for top panel and bottom panel is calculated as if R9=7, but it's not ;)

PRI made this really easy.

I used R8 instead of R6 to control border ;) Why?

R8 can be used at any time, R6 must be set *before* the split.

PROBLEM: Sprite near top of main area will repeat on all the others :(

EDIT: ARGGHHH! Pasting it in, and it's removing the "8 )" and making it into smileys.
I will have to attach the code.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

arnoldemu

#81
Quote from: andycadley on 21:28, 29 February 16
Here goes. Not exactly demo of the year, but it probably gets the point across. Tweaking the DMA list REPEAT slightly can start the effect going in the other direction. Obviously you can get a lot more sophisticated with much longer DMA lists, causing different patterns of "movement" in the interrupt sequence by playing with the overall length and the spacing of interrupts.
Ok I see the effect in winape. a raster bar going up/down.

Arnold just flashes the border. I wonder what a real plus will do... and it's ok on a real Plus. damn. :D I like your tests Andy ;)

@andycadley: Your code doesn't initialise the prescalar for dma channel 0.
So it relies on the value at power on.. I assumed it was random - I have a TODO to test that at power on, clearly it's 0 or something like that.



My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

andycadley

Oops. Entirely unintentional, I'd forgotten that. Interesting though as the documentation seems to suggest it shouldn't be reset at power on.

arnoldemu

Quote from: andycadley on 22:49, 29 February 16
Oops. Entirely unintentional, I'd forgotten that. Interesting though as the documentation seems to suggest it shouldn't be reset at power on.
no problem, it has encouraged me to add that test.
Exactly, doc says it shouldn't be reset. I'm guessing it's like some of the other registers, 0 most of the time, 1 sometimes. So far only the palette registers seem to be totally random at power on.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Executioner

Using DMA lists is great if you don't want to use them for music and sound effects, in which case it can be nice to have one DMA list per AY channel.

You can easily do these sort of split screens on a normal CPC, then just tweak some values for the Plus. Here's a routine which could actually be used on both a real CPC and Plus (it currently uses HALT for timing rather than interrupt routines). The timing has to be accurate for the switch to/from R9=0 and R9=7 or everthing blows up. This could be achieved using PRI on the Plus more easily, and the R4 values would need some tweaking to get it working on a normal CPC.


;; Overscan split test
org #40
run #40

di
ld hl,#c9fb
ld (#38),hl

ei

ld bc,#7f10
out (c),c
ld c,#53
out (c),c

ld bc,#bc01
out (c),c
ld bc,#bd20
out (c),c

ld bc,#bc02
out (c),c
ld bc,#bd2a
out (c),c

call waitffb

ld bc,#bc09
out (c),c
ld bc,#bd02
out (c),c

ld b,10
djnz $

ld bc,#bd00
out (c),c

ld bc,#bc04
out (c),c
ld bc,#bd40        ; Initial value from
out (c),c

ld bc,#bc07
out (c),c
ld bc,#bd7f
out (c),c

ld bc,#bc0c
out (c),c
ld bc,#bd30
out (c),c

ld bc,#bc0d
out (c),c
ld bc,#bd20
out (c),c

ld bc,#bc06
out (c),c
ld bc,#bd3f
out (c),c

halt
ld bc,#bc04
out (c),c
ld bc,#bd63
out (c),c

ld bc,#bc07
out (c),c
ld bc,#bd41
out (c),c

ld b,224
.loop
djnz $

ld bc,#bc01
out (c),c
ld bc,#bd00
out (c),c

ld b,50
djnz $

ld bc,#bd20
out (c),c

ld bc,#bc09
out (c),c
ld bc,#bd07
out (c),c

ei

call waitffb

ld bc,#bc09
out (c),c
ld bc,#bd02
out (c),c

ld b,10
djnz $

ld bc,#bd00
out (c),c

halt

ld b,230
jr loop

.waitffb
ld b,#f5
halt
in a,(c)
rra
jr nc,waitffb + 2
ret


The resulting screen layout looks like:




Xifos

Hem, i did as i said and stopped using r9 at 1 for the score board.
Now i can have a 31*4 char hud, even at the top.
And the sprites don't go over it.

[attachimg=1]


All your fantastic ways of setting hud with r9 at 0 are beyond my level (too complex)...
(and i thought that dma list were only for the psg...)
:)


Ast

Try to use TotO's hud which is more beautiful than yours.
@TotO : Can you help him for graphics or are you too busy ?
_____________________

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 welcome !

TotO

#87
In answer to both posts, you have to considerate the game as Work In Progress.
That means, all you see is not what you will get.  :-\

About the HUD, the informations are now at the good place. It is just a graphic update to acheive.
I think that is definitively not a priority... But yes, I will help if required.  8)

---

Quote from: Ast on 10:52, 01 March 16
Try to use TotO's hud which is more beautiful than yours.
@TotO : Can you help him for graphics or are you too busy ?

Quote from: Gryzor on 15:07, 29 February 16
I actually wish the hero sprite was changed to something better... loved the game, even on the CPC, but I always hated that ugly mess!
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

Xifos

The graphics need to be redrawn by a true graphic artist.
If Toto agrees, it would be an honor to have such a graphist.
But it's a lot of work to get mode 0 graphics from the arcade "mode 1 pixels"...
So i was afraid to ask...

fano

Quote from: Xifos on 12:21, 01 March 16But it's a lot of work to get mode 0 graphics from the arcade "mode 1 pixels"...
So i was afraid to ask...
Don't be afraid, first he loves to do that , second he already made some before, third he owns a great and very fast technic  :P 
"NOP" is the perfect program : short , fast and (known) bug free

Follow Easter Egg products on Facebook !

xenon

Outstanding demo and project!  ;)

Regards,

Salva

arnoldemu

I tested dma prescale value at power on time.

These percentages are not accurate, but a "feeling" of how often this happens. I need to count up and work out a real percentage for each.

About 90% of the time dma channel 0 prescale is 0.
About 70% of the time dma channel 1 prescale is 0.
About 30% of the time dma channel 2 prescale is 0.

Damn it's not a simple thing.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

geoanas

Awesome project ! Thanks for your work !

Ast

Xifos, do you go on your project or is it over? We want to know...
_____________________

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 welcome !

Xifos

#94
Hi,




Things are going on...

||C|-|E||


Dr Tiger Ninestein


Xifos

Thanks !

The 6 levels are done, the 7th (astaroth fight) in progress.
But it won't be released until i have TotO's agreement !
;)

TotO

Quote from: Xifos on 08:43, 18 September 16
Thanks !

The 6 levels are done, the 7th (astaroth fight) in progress.
But it won't be released until i have TotO's agreement !
;)
I'm not sure that I was to me to agree about your videos. But, I will be pleased to see it.
"You make one mistake in your life and the internet will never let you live it down" (Keith Goodyer)

||C|-|E||

Do you still require any help with the sprites or the tiles?  :)

Powered by SMFPacks Menu Editor Mod