Jump to content
IGNORED

Wizzy on the 7800?


karri

Recommended Posts

NTSC vs PAL music question.

 

The xtal in the SN cart has NTSC frequency. So I assume that to get correct pitch I should choose NTSC in Furnace tracker.

The pitch should be the same on both systems because the xtal is on the cart.

 

But to get the same play speed I want to write the tune for 50 Hz interrupts and perhaps skip 10 interrupts per second on NTSC systems.

Like:

NTSC: 1, 2, 3, 4, 5, skip, 1, 2, 3, 4, 5, skip

PAL: 1, 2, 3, 4, 5, 1, 2, 3, 4, 5

 

Is this something that has been done before? And is it a bad idea?

 

I would only skip audio processing...

Link to comment
Share on other sites

2 hours ago, karri said:

Is this something that has been done before? And is it a bad idea?

Yes. I did that with some of pokey music for A7800

In Atari 8 bit it is common practice. 
Also you could use DLI to play more accurate (but not worth it)
 

 

 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Eagle said:

Yes. I did that with some of pokey music for A7800

In Atari 8 bit it is common practice. 
Also you could use DLI to play more accurate (but not worth it)

Thanks! I did it now and Walter just confirmed that it works on both consoles (NTSC and PAL).

I also have the same mod for sfx effects.

  • Like 1
Link to comment
Share on other sites

I have spent time in order to understand sporadic errors in the drawing. The errors never occur when I do things slowly by hand. But when there is a lot of action the updating of zones appear to fail. The code is simply "zone.hpos += 8" or "zone.hpos -= 8".

 

;
; h[i].hpos -= 8;
;
    lda     M0001
    ldx     M0001+1
    jsr     aslax2
    clc
    adc     M0005
    sta     ptr1
    txa
    adc     M0005+1
    sta     ptr1+1
    ldy     #$03
    lda     (ptr1),y
    sec
    sbc     #$08
    sta     (ptr1),y


You can see the sporadic errors in the video clip when I scroll around the playfield. As I cannot detect when the error happens I re-draw the screen after the scrolling.

 

Do you have an idea what kind of race there could be?

 

Edit: My guess is that there is two processes messing with the same structure. One process running during vblank and the other running during display. The "display" process is the main one using the C stack while the vblank parts are all in asm. Perhaps I must do all DLL and zone processing in asm during vblank? Unfortunately it means that I need handshaking between the processes.

  • Like 1
Link to comment
Share on other sites

Getting rid of initializing code after startup.

 

I just got an idea to put all the initialisation code in BANK 5 ($d000). It is mapped there at startup and as soon as I got everything running I don't need to map it anymore. This cleans up a lot of code run only once from the $f000 segment.

 

The fixed banks $8000, $9000, $b000 and $f000 should mainly contain library routines needed all the time.

 

The bank  $d000 could contain the level dependent code that you run once you have set up the tiles, maps and the music.

 

Here is a layout of how Wizzy uses the SN cart:

Name                   Start     End    Size 
---------------------------------------------
EXEHDR                000000  00007F  000080 
ZEROPAGE              000040  000059  00001A 
EXTZP                 00005A  00006B  000012 
DATA                  001800  00187D  00007E 
BSS                   00187E  001C90  000413 

MAP0                  004000  004FFF  001000 RAM0 RAM1
TILE0                 005000  005FFF  001000 RAM0
TILE1                 006000  006FFF  001000 RAM0
COLLCHAOS             005000  006485  001486      RAM1
FURHUFF               005000  00620B  00120C      RAM1
FONT                  007000  007FFF  001000 RAM0
FIGHTTUNE             007000  007544  000545      RAM1
HUFFMUNCH             007E71  007FFF  00018F      RAM1

CODE                  008000  00925D  00125E 
RODATA                009300  009414  000115
WIZIDLE               00A000  00AFFF  001000 HERO
WIZRUN                00A000  00AFFF  001000 HERO
COMMONA               00B000  00B000  000000 
SPIDER                00C000  00CFFF  001000 MONSTER/NPC
ONCE                  00D000  00D01D  00001E TRANSFER BANK
INITS                 00D01E  00D2EF  0002D2 
NPC                   00E000  00EFFF  001000 MONSTER/NPC
COMMONB               00F000  00F1B1  0001B2 
STARTUP               00FF3F  00FF79  00003B 
ENCRYPTION            00FF7A  00FFF9  000080 
VECTORS               00FFFA  00FFFF  000006 

 

Link to comment
Share on other sites

Below my few examples of horizontal and vertical scrolls in MADS

https://forums.atariage.com/topic/337580-scrolling-from-memory-buffer-and-256-characters/

 

But I think you need double buffering screen.

What is size of your tiles? How many sprites you will use on screen at this same time.

Are you gonna mix 160A and 160B? What will be height of the screen (192?)?

How many bytes per tile you are using in your map data?

Will your scrolling be by pixel or tile?

Link to comment
Share on other sites

Thanks! I should take a look at your examples.

 

I was thinking about double buffering. But usually double buffering is good when you have to re-draw everything for every frame. In the case of 7800 I was afraid of the extra time it would take to set up the DLL's and zones.

 

Once I get the bugs fixed I believe that I just allocate one more column to hide the draw of the new column. That should be pretty smooth.

 

My tiles are 16x32 pixels. The number of sprites on screen is 10 x 12. But for the height I need two zones. One for the top half of the tile and one for the bottom half.

The tiles are 160A, the sprites are 160A and 160B.

The height of the screen is 384 lines, I think.

My map is 64 x 64. 1 byte per tile.

I am scrolling by 8 pixels horizontally and 1 zone (16 pixels) vertically.

Link to comment
Share on other sites

46 minutes ago, Eagle said:

Are you using 4 bytes headers now?

 

🤔 Maximum height is 192. 

Yes, I am using 4 byte headers for the background tiles.

 

I don't obviously know what I am doing. It may be that I have tiles outside my screen.

 

Edit: I checked this. I have 224 lines on the screen. That is 14 tiles of 16 pixels. It works on both NTSC and PAL.

Link to comment
Share on other sites

38 minutes ago, karri said:

Yes, I am using 4 byte headers for the background tiles.

 

Just FYI, if I remember correctly when using 160B sprites you have to "reset" back to 160A before the next line.

 

49 minutes ago, karri said:

I have 224 lines on the screen.

IMHO is too high, in NTSC you will have only  38 scanlines CPU left free of Maria DMA usage

 

On 1/27/2023 at 4:59 PM, karri said:
TILE0                 005000  005FFF  001000 RAM0
TILE1                 006000  006FFF  001000 RAM0

Are you using Tile0 for the top zone of tile and Tile1 for the bottom one? 

Link to comment
Share on other sites

6 minutes ago, Eagle said:

Just FYI, if I remember correctly when using 160B sprites you have to "reset" back to 160A before the next line.

When in 160 pix mode, 160B mode is set (or rather must-be set) on a per-object basis, via a bit in the 5-byte header for each object.... If only 4-byte headers are used, the object can/will only use 160A mode.

  • Like 1
Link to comment
Share on other sites

22 minutes ago, Eagle said:

Just FYI, if I remember correctly when using 160B sprites you have to "reset" back to 160A before the next line.

Yes. I read about it.

22 minutes ago, Eagle said:

IMHO is too high, in NTSC you will have only  38 scanlines CPU left free of Maria DMA usage

According to Walter the music and the game works on a NTSC machine. So I go with it for now.

 

I did try lower viewports with less tiles but I did not like it. It feels too cramped and you cannot see where you are going.

 

22 minutes ago, Eagle said:

Are you using Tile0 for the top zone of tile and Tile1 for the bottom one?

Actually, just the opposite. Tile0 is the bottom 16 lines of a tile and Tile1 the top 16 lines of a tile.

 

I also plan to re-use the tile set with some custom colour palettes in the dungeon section. I just found out that there is several free palettes I have not used yet.

 

PS. Today I had some discussions with my kids about the UI and controls. And they convinced me to take Wizzy to a different direction. So half of the talents are gone now. The SELECT button is also out. So I am optimistically planning for a Silly Ventures release this year :) 

 

The nice thing is that this releases about half of the banks as there is no longer AOE or DOT damage. The only things left are:

- travel mode (witch on a broom)

- witch mode (shoot and quick turn to travel)

- barbarian (tank and melee)

- mage (stealth and crowd control)

 

The switch between modes is a long press on FIRE2 + joystick to choose.

 

This allows me to use a lot more text and images to tell the story. And to keep the gameplay very simple.

  • Like 2
Link to comment
Share on other sites

30 minutes ago, splendidnut said:

When in 160 pix mode, 160B mode is set (or rather must-be set) on a per-object basis, via a bit in the 5-byte header for each object.... If only 4-byte headers are used, the object can/will only use 160A mode.

I just checked quickly and 4 byte header can be use as 160B as well

 

DisplayListListFirst
		:5	.byte	$0d,>emptyline,<emptyline
		 .byte $0F,>line1,<line1
		 .byte $0F,>line2,<line2
		 .byte $0F,>line3,<line3
		:8	.byte	$0f,>emptyline,<emptyline

emptyline .byte 0,0 

line1
		.byte <$E000,$c0,>$E000,$1a,10		;5 byte header - 160B mode on
		.byte 0,0


line2
		.byte <$E000,$1a,>$E000,20			;4 byte header
		.byte 0,0

line3
		.byte <$E000,$1a,>$E000,30			;4 byte header
		.byte 0,0

 

 

Below result we have 3 sprites in 160B mode. I remembered this because cost me lot of problems one day :D 

 

 

image.thumb.png.ac728f0af46b2039327051d08ecec456.png

Edited by Eagle
  • Thanks 2
Link to comment
Share on other sites

I did manage to move scrolling to the IRQ's. But obviously I need to drop something instead. So I cut the IRQ rate for the music temporarily. The effect is very noticable, unfortunately.

 

Is there some good ideas of how to maintain the illusion of speed in the music without giving away that the update rate is going down?

 

One way might be to use irq slots like:

1 music

2 other services

3 music

4 other sevices

5 music

 

I already have lots of "other services" like scroll vertical, load blocks to RAM banks 0 and 1, start music from a new bank.

 

Then I could compose something in 30Hz rate (if Furnace tracker supports it).

This could be used when you have lots of action on the screen.

 

Link to comment
Share on other sites

I know that this is of no interest to most people. But after weeks of fighting with interrupts and a large screen 224 lines PAL + NTSC I have finally been able to use Furnace tracker music, sfx sound effects and scrolling background. And this is with no artifacts when scrolling stops. And no crashes so far.

 

Enjoy the full screen with 10 * 7 tiles = 160 x 224 pixels.

The music is from the SN76489AN chip on the cart run at 30Hz. The scrolling eats the rest of the interrupts.

 

I did not want to start with the animation until I have the fundamentals done. The game itself will not be double buffered or free from artifacts during draw. I rather use the time of the CPU for the characters and playability.

  • Like 6
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...