New Game - Pietro Bros [z88dk/Nirvana+]

PIETRO BROS

Pietro and Luizo were transported to pipe world after eating some rancid mushrooms on his pizza.

Help them to escape from this hell...

5Yk0gfs.png
YF5cm2y.png
HrkpQEG.png
ZP7TAFS.png

Download

Based on Mario Bros from the NES.
One or Two player Game
32 Levels of Fun.
Three modes of Play.
Nirvana+ Multicolour.
48 Sounds.
AY Music and Effects
Sinclair Joystick Only.
Spectrum 128kb Only.
More than a year of work.


This games was build on z88dk and using Nirvana+ for the multicolour graphic engine.

I really like to thanks Alvin Albrecht for his help, most of the magic come from his fingers. Also Einar Saukas for his marvelous Nirvana Library!


This is my christmas gift to all the Spectrum lovers!

Merry Christmas, Cheers!

2016 Cristian M. Gonzalez

Version 1.0
«13

Comments

  • Absolutely astonishing!!!
  • Un juego de plataformas muy colorido para la Navidad. Buen trabajo.

    (A very colourful platform game for Christmas. Great work.)

    #GoogleTranslate

    Merry Christmas,
    Derek.
    1985: ZX Spectrum+ 48K Interface 1 ZX81 16KB ASZMIC/SP ROM Philips 12" B/W TV Epson Dot Matrix Printer ZX Printer Now: 2021 M1 iMac 4.5K 24" screen 8 CPU cores 8GB RAM macOS 14.4.1 1TB SSD Drive Ext 1TB SSD Drive Ext 5TB USB 3.1 Hard Disk iPad R7 32GB iPadOS 17.4.1 iPhone SE R2 64GB iOS 17.4.1 Apple TV Gen 2
  • Great work. Fantastic colours and gameplay.
  • Really great work :) Someone want to explain to me though why it looks better in some emulators and not others? It's much more colorful in Spectacol than say running in Marvin.
  • Excelente trabajo amigo , mucho mejor de la anodina conversión oficial :-bd

    I noticed some occasional screen flicker - under emulation, didn't test it under real hardware yet - but nothing really serious. I am going to make a Turbo version of it soon ;)

    Gracias y feliz Navidad a todos! :D
  • ivanb303 wrote: »
    Someone want to explain to me though why it looks better in some emulators and not others?

    Not all emulators correctly support multicolor. Some need correct setting in config.

    Heavy on the disasm
  • What do you mean multicolor ? Is it doing something Speccy normally can't do because it does seem to be doing just that :)
  • Ivan,

    On Android only spectacol and spectaculator can accurately emulate multicolor effects.

  • And it would work also on a real Spectrum ?
  • Ivan

    Sure! On PAL machines only, I haven't have the chance of checking it, as all my hardware is NTSC. So if someone is willing to record a video I will really appreciate it.
  • Ahhh I forget to tell this also works on 48 thanks to Alvin
  • Great game! The multicolor is especially impressive. The playability is also good.

    There is an existing official Mario Bros on Zx Spectrum but it's total crap. Your game beats it totally.

    If you did it 1983 people would go crazy and you would be rich :)

    The are some problems with synchronisation, flicker etc. but nothing serious enough to take the pleasure from the player.

    T H A N K S !
  • S T U N N I N G !!!
  • Fantastic!
    Find my (mostly unfinished) games here
    https://www.facebook.com/groups/1694367894143130/
  • edited December 2016
    I hope Cristian doesn't mind but I've just built a version with Pentagon timing:

    Download - Pentagon


    I'm not sure if the pokes will also work on this version because the compiler is a bit non-deterministic.

    And thank you for the credit Cristian but it is overestimated :) The game is Cristian's work - my contribution is only on the periphery in the tools and ay effects.
    I am going to make a Turbo version of it soon ;)

    There is also a zx7-compressed build that is half size and will load in half time. I'm not sure if Cristain wants to go with that since the plain taps are easier to port to real machines or disk systems.
    Post edited by Alcoholics Anonymous on
    Thanked by 1abelenki
  • Wow great game, congratulations!!!
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • ivanb303 wrote: »
    Really great work :) Someone want to explain to me though why it looks better in some emulators and not others? It's much more colorful in Spectacol than say running in Marvin.

    Some emulators reproduce real machines perfectly. Other emulators are just simplified versions, good enough for most games, but not good enough for more sophisticated features like multicolor.

    ivanb303 wrote: »
    And it would work also on a real Spectrum ?

    Yes, it works on all real Spectrum official models (48K, 128K, +2, +2A, +2B, +3).
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • @Alessandro

    I created a build for you, ver 1.1 (just small fix on clearing pipes when an sprite dies)

    https://drive.google.com/file/d/0Bw3Nat5zkP-Hc3pCSzc4YzdVdEU/view?usp=sharing

    zx7 is great, we have it on the build script but takes a lot of time as it have compile the code twice.

    My plan is to release the sources on GitHub after some tweaking, to allow another speccy developers to use as a base for future speccy games. Also I like start working on the next year on "Pietro Kong". I think it won't be so difficult by using pietro source as base.

    So any help will be appreciated.

    Regards
    Thanked by 1Bedazzle
  • So, is there any way to fix this annoying flickering?
  • Pegaz wrote: »
    So, is there any way to fix this annoying flickering?

    I didn't think it was that bad :P

    The flickering is coming because the draws are occasionally taking too much time so that an interrupt occurs while the interrupts are disabled. If the ints are disabled, the nirvana engine misses a frame and regular attributes are shown for that one frame.

    I've also noticed there may be more flicker on some models, or at least I noticed there seems to be more flicker on the Pentagon. The Pentagon has a longer frame (I think) so this is a bit surprising and may indicate that there should be a nirvana_halt inserted someplace to sync up. Inserting a conservative nirvana_halt at a strategic location may also eliminate the flicker entirely at the expense of the game being one frame slower. Maybe that's something to have a look at.

    There has been code improvement done on the compiler in conjunction with this project (making the code faster) but the latest changes haven't had much impact on the flicker frequency.
    I am going to make a Turbo version of it soon ;)

    It may be a bit harder to wedge a custom loader in there but maybe some info will help.

    The first 32 bytes is the mini-loader loaded into the screen:
       di
       
       ld bc,$1ffd
     
       ld a,$04
       out (c),a                   ; +2A/+3 : disk motor off, 48k rom selected, normal paging
          
       ld b,$7f
          
       ld a,$10
       out (c),a                   ; 48k rom selected, bank 00 at top of ram
    
       ; Load main loader over basic area
       
       ld ix,__LOADER_head
       ld de,__LOADER_CODE_tail - __LOADER_head
    
       ld a,$ff
       scf
    
       call 0x0556
       di
       
       jp c, __LOADER_head
       rst 0                       ; if tape loading error
    

    which you probably don't have to change.

    Next the main loader is loaded to 23296 just after the display file. There is only 256 bytes available here, including the stack (the stack is moved to the top of this 256 byte page).

    The zx7 compressed loader only leaves about 30 bytes for the stack while loading. There are about 800-900 bytes available just before the nirvana engine at 56323 but that is space for the program to grow. There are also about 150 bytes at the top of memory available. The last byte segment is AY music and effects which are loaded into another memory bank (and would hide that high memory while loading).
  • Thanks a lot Carlos and AA for the files and information. I had started examining the 1.0 file with Tapir but that will help. I'll see what I can do... For now, congratulations again for such a great piece of code. :)
  • I got pulled away for Christmas before I gave you the loader code:

    Regular loader (not zx7 compressed), occupies 116 bytes out of 256 available (stack is in there too) at 23296
       jp pietro_loader
    
       pietro_loader:
          
          ; 1. SCREEN$
       
          ld ix,16384
          ld de,6912
       
          ld a,$ff
          scf
       
          call 0x0556
          di
          
          jp nc, 0                    ; if tape loading error
       
          ; 2. Nirvana+
       
          ld ix,56323
          ld de,9055
       
          ld a,$ff
          scf
       
          call 0x0556
          di
          
          jp nc, 0                    ; if tape loading error
       
          ; 3. Pietro Bros
       
          ld sp,__CODE_head                             ; move stack underneath program
          ld iy,128                                     ; move IY into ROM in case an im1 interrupt occurs
       
          ld ix,__CODE_head                             ; start of binary
          ld de,__CODE_END_tail - __CODE_head           ; length of binary
    
          ld a,$ff
          scf
    
          call 0x0556
          di
          
          jp nc, 0                    ; if tape loading error
    
          ; 4. AY Sound for 128k Spectrum
       
          ; check for 128k spectrum
       
          ld bc,$7ffd
          ld de,$1016
       
          ld hl,0xc000
          ld a,(hl)                   ; a = byte at 0xc000
       
          out (c),e                   ; enable BANK_06
       
          cpl
          ld (hl),a                   ; write complemented byte to 0xc000
          cpl
       
          out (c),d                   ; restore BANK_00
       
          cp (hl)                     ; did the byte change?
          ld (hl),a                   ; restore byte at 0xc000
       
          jp nz, __CODE_head          ; if the byte changed this is a 48k machine
       
          ; load extra bank for 128k machines
       
          out (c),e                   ; enable BANK_06
    
          push bc
          push de
    
          ld ix,0xc000
          ld de,__BANK_06_size
       
          ld a,$ff
          scf
       
          call 0x0556
          di
    
          pop de
          pop bc
       
          out (c),d                   ; restore BANK_00
    
          jp nc, __CODE_head          ; if tape loading error forget about sound effects
    
          ld a,$ff
          ld (_spec128),a             ; indicate 128k spectrum
          
          jp __CODE_head   ;; program start at 23552
    


    zx7-compressed loader occupies 226 bytes out of 256 available (stack is in there too) at 23296
       SECTION LOADER
    
          jp pietro_loader
    
       ;; l_ret is a library function used as an easy exit with built-in pop.
       ;; asm_dzx7_standard jumps into it so we explicitly place it here in
       ;; the loader so that it is available during the entire load process.
       
          pop hl
    
       l_ret:
    
          ret
       
    ;;;; linker will insert zx7 decompressor here
    
       SECTION LOADER_CODE
       
       PUBLIC pietro_loader
       PUBLIC l_ret
    
       EXTERN asm_dzx7_standard
       EXTERN __CODE_head, __CODE_END_tail, _spec128
       EXTERN LEN_SCREEN, LEN_NIRVANAP, LEN_PIETRO, LEN_BANK_06
    
       pietro_loader:
    
          ; 1. SCREEN$
       
          ld ix,32768                 ; load compressed screen$ to convenient spot
          ld de,LEN_SCREEN
       
          ld a,$ff
          scf
       
          call 0x0556
          di
          
          jp nc, 0                    ; if tape loading error
       
          ld hl,32768
          ld de,16384
      
          call asm_dzx7_standard      ; decompress to 16384
       
          ; 2. Nirvana+
       
          ld ix,32768                 ; load compressed nirvana+ to convenient spot
          ld de,LEN_NIRVANAP
       
          ld a,$ff
          scf
       
          call 0x0556
          di
          
          jp nc, 0                    ; if tape loading error
       
          ld hl,32768
          ld de,56323
       
          call asm_dzx7_standard      ; decompress to 56323
       
          ; 3. Pietro Bros
       
          ld sp,__CODE_head                             ; move stack underneath program
          ld iy,128                                     ; move IY into ROM in case an im1 interrupt occurs
       
          ld ix,__CODE_END_tail + 20 - LEN_PIETRO       ; load binary with really large & fixed 20 byte delta (see zx7 docs)
          ld de,LEN_PIETRO                              ; length of binary
    
          ld a,$ff
          scf
    
          call 0x0556
          di
       
          jp nc, 0                    ; if tape loading error
       
          ld hl,__CODE_END_tail + 20 - LEN_PIETRO
          ld de,__CODE_head
       
          call asm_dzx7_standard      ; perform overlapped decompression
       
          ; 4. AY Sound for 128k Spectrum
       
          ; check for 128k spectrum
       
          ld bc,$7ffd
          ld de,$1016
       
          ld hl,0xc000
          ld a,(hl)                     ; a = byte at 0xc000
       
          out (c),e                     ; enable BANK_06
       
          cpl
          ld (hl),a                     ; write complemented byte to 0xc000
          cpl
       
          out (c),d                     ; restore BANK_00
       
          cp (hl)                       ; did the byte change?
          ld (hl),a                     ; restore byte at 0xc000
       
          jp nz, __CODE_head            ; if the byte changed this is a 48k machine
       
          ; load extra bank for 128k machines
       
          out (c),e                     ; enable BANK_06
    
          push bc
          push de
    
          ld ix,0x10000 - LEN_BANK_06   ; load at top of bank to enable overlapped decompression
          ld de,LEN_BANK_06
       
          ld a,$ff
          scf
       
          call 0x0556
          di
          
          ld a,0
          jr nc, set_mode               ; if tape loading error stay in 48k mode
          
          ld hl,0x10000 - LEN_BANK_06
          ld de,0xc000
          
          call asm_dzx7_standard        ; decompress to 0xc000
    
          ld a,$ff
          
       set_mode:
     
          pop de
          pop bc
          
          out (c),d                     ; restore BANK_00
          ld (_spec128),a               ; indicate if 128k spectrum
      
          jp __CODE_head  ;; program start at 23552
    

    In the zx7 version the l_ret subroutine has to be at that position because it will be called by the game code.

    If you stick to it good luck :)
  • This game has intrigued me to look for some other Mario games and I found these two playable demos.
    The first is monochrome, but very well executed, almost like Super Mario Land on GameBoy.
    The second is also quite good.
    Does anyone know if there's a full versions of these two games?

  • I remember those demos, they have been circulating for quite a few years by now. As far as I know, they did not progress beyond the state of demos.
  • edited December 2016
    The flickering is coming because the draws are occasionally taking too much time so that an interrupt occurs while the interrupts are disabled. If the ints are disabled, the nirvana engine misses a frame and regular attributes are shown for that one frame.

    The best way to avoid this problem is, never draw anything yourself in NIRVANA. Use sprites instead, thus everything will be automatically drawn for you. Sprites don't interfere with interrupts and they don't take any CPU time from your code.

    NIRVANA gives you 8 sprites. If you reuse them for a different purpose every frame, you will be able to draw 50*8=400 multicolor tiles per second.

    Also method "fill" (to erase previous sprite positions when moving them) can be done with sprites using an empty tile. In this case, it's still possible to move (erase and redraw) 200 multicolor tiles per second at no cost. Or constantly move 4 tiles at 50tps, or 8 tiles at 25tps, or 16 tiles at 12.5tps, etc. That's good enough for most games...

    EDIT: In particular, SNAKE ESCAPE uses sprites instead of draw/fill for everything, except for drawing the screen at the beginning of each level when interrupts are disabled.

    EDIT2: The NIRVANA+ demo is a good example on how to quickly move tiles on screen using sprites.
    Post edited by Einar Saukas on
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • @Einar thanks for your fixes, I placed some other fixes on the repo but there still flickering, but is definitely less than 1.0.

    I will try to Branch and replace the paints routines with sprites, to see if we can fix it.

    On another subject, I cannot edit posts, can someone tell me how to edit a post?

    I want to edit the first post and add the new version and changelog, wen its done.
  • edited December 2016
    The best way to avoid this problem is, never draw anything yourself in NIRVANA. Use sprites instead, thus everything will be automatically drawn for you. Sprites don't interfere with interrupts and they don't take any CPU time from your code.

    Yesterday I ran out of time and started getting these glitches. I reworked my flying saucer drawing code to use sprites, as you suggested to me a few weeks ago, and immediately reduced it from 6500 t-states to 130 t-states. LITERALLY 50x FASTER!!

    Post edited by colonel32 on
    Robin Verhagen-Guest
    SevenFFF / Threetwosevensixseven / colonel32
    NXtel NXTP ESP Update ESP Reset CSpect Plugins
  • edited December 2016
    cgonzalez wrote: »
    @Einar thanks for your fixes, I placed some other fixes on the repo but there still flickering, but is definitely less than 1.0.

    I will try to Branch and replace the paints routines with sprites, to see if we can fix it.

    On another subject, I cannot edit posts, can someone tell me how to edit a post?

    I want to edit the first post and add the new version and changelog, wen its done.

    You are welcome!

    Unfortunately you cannot edit old posts...
    Post edited by Einar Saukas on
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • colonel32 wrote: »
    The best way to avoid this problem is, never draw anything yourself in NIRVANA. Use sprites instead, thus everything will be automatically drawn for you. Sprites don't interfere with interrupts and they don't take any CPU time from your code.

    Yesterday I ran out of time and started getting these glitches. I reworked my flying saucer drawing code to use sprites, as you suggested to me a few weeks ago, and immediately reduced it from 6500 t-states to 130 t-states. LITERALLY 50x FASTER!!

    Hurray!!! :)
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
Sign In or Register to comment.