Jump to content
IGNORED

VBXE Exercise - Popeye WIP


woj

Recommended Posts

Had a chance for a quick experiment, it sort of did load on SDX (prerequisite being that 80 column VBXE driver had to be disabled) with the X command, but like with one other game I tried before (Lasermania) there are some weird unexplained problems manifesting themselves with slightly broken screen, and it also properly froze on saving the score list. So clearly the program is not (yet) SDX friendly. (I should perhaps also try with the FATFS driver disabled, forgot about that).

 

In the meantime yet again I refactored many things internally so that the next steps should go smoother :) These next steps is that I should have the still graphics elements displayed.

Link to comment
Share on other sites

Essentially with this:

 

score_file_name .byte 'D:POPEYEHS.DAT',$9B

save_scores
        ldx #$30
        lda #ic_op_open : sta iccom,x ; open
        lda #<score_file_name : sta icba,x
        lda #>score_file_name : sta icba+1,x
        lda #ic_mode_write : sta icax,x
        lda #0 : sta icax+1,x
        jsr ciov
        bmi save_scores_exit
        lda #ic_op_putchar : sta iccom,x
        lda #<score_list : sta icba,x
        lda #>score_list : sta icba+1,x
        lda #<score_list_len : sta icbl,x
        lda #>score_list_len : sta icbl+1,x
        jsr ciov
save_scores_exit
        lda #ic_op_close : sta iccom,x
        jsr ciov
        rts

 

But really, before I dive into dissecting this, which is not a priority at the moment, I should first re-read the SDX Programming Manual, I forgot everything I read in there a few months back. My money is on the file naming (D: on SDX not being what I think it is) or the IOCB channel number....

Link to comment
Share on other sites

9 minutes ago, woj said:

Essentially with this

I meant how do I cause the operation to happen so I can follow it in the debugger. ;) I don't see anything wrong with the code, anyway, and at the level of simply opening and reading/writing files, SDX is 100 per cent AtariDOS compatible.

 

PS: 'D:' works just as normal through the CIO (it only denotes drive #4 in SDX at the command line where kernel device IDs are used).

Edited by flashjazzcat
Link to comment
Share on other sites

Oh I see, sorry, tired. Start the game, with key 'c' score enough points to get on the list, then press 'k' or 'l' till you run out of lives, after the game over screen you should be entering your initials with left/right/fire on the joystick, after the last one the save happens. There is a time out if you leave the initial entering idle, 30 or 60 seconds, don't remember now.

  • Thanks 1
Link to comment
Share on other sites

27 minutes ago, woj said:

Start the game, with key 'c' score enough points to get on the list, then press 'k' or 'l' till you run out of lives, after the game over screen you should be entering your initials with left/right/fire on the joystick, after the last one the save happens.

Great - thanks.

 

You've left display list interrupts running during the CIO call. This may or may not cause problems with serial IO, but the reason it crashes here is the interrupt handler is at $467B, and SpartaDOS X banks its own code into the $4000-$7FFF banking window during IO when running in banked memory. Better keep interrupt handlers outside of the banked RAM window, or turn your NMIs off before calling CIO.

  • Like 2
Link to comment
Share on other sites

7 hours ago, flashjazzcat said:

Great - thanks.

 

You've left display list interrupts running during the CIO call. This may or may not cause problems with serial IO, but the reason it crashes here is the interrupt handler is at $467B, and SpartaDOS X banks its own code into the $4000-$7FFF banking window during IO when running in banked memory. Better keep interrupt handlers outside of the banked RAM window, or turn your NMIs off before calling CIO.

Sounds rather obvious now that you have said it, thanks a lot for looking into this! I bet the other problem I was seeing (triangles/arrows in the P2 score field during the game) has a similar cause.

  • Like 2
Link to comment
Share on other sites

Kudos @flashjazzcat! Relocating everything to $2000 makes the thing work (interestingly, saving to a floppy / Altirra ATR attached drive takes some considerable time on SDX, I am yet to try it on an APT partition, that I will do later on the real hardware). This is a temporary hack, as proper assignment to memory segments of my code, data, variables is on my TODO list, so far most of the things go in one bag starting from $4000 (now $2000).

 

The other thing, with triangles in the score bar, well, it also helped me to discover a nasty bug, classic I guess, I had "lda 0" in one place, instead of "lda #0". Without this SDX experiment I would not have found it for ages I believe.

 

I will probably later come back with a question of "how to cleanly exit back to DOS, considering I destroy all OS display lists and screen memory as well as having a lot of garbage in VBXE and needing to reset it to stock too." But really, not today, I have a lot of things to do with this game ;) 

 

EDIT: Attached the updated files (they have other changes I have been working on since Sunday).

popeye.atr popeye.xex

Edited by woj
  • Like 3
Link to comment
Share on other sites

Not that PIO will be in the least bit troubled by NMIs, but you might encounter problems later down the line performing IO with DLIs running if the host system happens to be running high-speed SIO. Unfortunately it's impossible to tell ahead of runtime, and the symptoms will either be stalled IO or screen corruption (if the SIO driver happens to disable NMIs arbitrarily below a certain POKEY divisor). This is a royal PITA but is unfortunately just one of those things (and the reason that ponderously slow custom SIO drivers are necessary with loaders whose visual effects depend on NMIs, at which point your HDD and DOS compatibility flies out of the window).

 

As for exiting to DOS: my method is generally to keep a copy of all the interrupt vectors beforehand, then upon exit, turn off interrupts, restore the vectors from the saved copy, close channel 0, re-open 'E:' on that channel, then jump through $0A (or just RTS if you happened to maintain the stack).

 

Will try the new XEX later, anyway.

Edited by flashjazzcat
  • Like 1
Link to comment
Share on other sites

This week's update is coming early, as I will not be able to work on this for the rest of the weekend. In the current version there is more (still) graphics displayed (essentially all non game active things) in round 1. With 'C' you can build up the heart collection, but filling it up will not cause anything noteworthy. Couple of bug fixes too. I now started the game on the real hardware from all the possible media that I have available (SIDE3, U1MB's SDX, SDrive), and it all works. In SDX you need to start it with the X command. 

 

I did (still do?) have a phantom bug on the real hardware, which would suggest that the actual hardware VBXE blitter is more sensitive to aggressive timing of things on my side than Altirra (or that my hardware / VBXE board has an issue). By phantom, I mean I was never able to reproduce it on Altirra, and on the real hardware it happened randomly like 4 out of 40 attempts. I think I fixed it now (the symptom was that some, 1 or 2, of the empty heartbox cells are not initialized ending up having garbage pixel pattern) after using just the force within me and my intuition of what it could be, but I am not 100% sure it was what I think it was.

 

New files and a (bad) screenshot attached. 

popeye.png

popeye.atr popeye.xex

  • Like 9
Link to comment
Share on other sites

  • 2 weeks later...

Weekly update! I experienced some more very weird problems with real hardware getting some letters in the status box blittered with a "color from nowhere", while everything working just perfect with Altirra. It seems yet again I fixed those, but the source or the mechanics of these problems are still a mistery to me, but then my 130XE had a long history of hardware problems, perhaps there are still some instabilities somewhere. 

 

In any case, attached new WIP binaries. I am still one step behind my own schedule, but now with 'C' you can score items (each now 500 points), and the game will go through all rounds once all items are collected. All still highres graphics are now also displayed in all rounds. And the rounds now have placeholders for intros, in round 1 and 3 you can see the fractions of it. Otherwise, the keys and the functionality is like before. You can walk around on rounds 2+, but only following round/level 1 geometry, this is my very next item on the todo list, including the trampoline jump in round 2 and the moving pad in round 3 (the former I know how to do, with the latter I still have some doubts if all my current code design will take this Popeye movement addition lightly...). Some screens for the eye too, can't be bothered to make videos, sorry...

 

screen1.png

screen2.png

screen3.png

popeye.atr popeye.xex

  • Like 10
  • Thanks 2
Link to comment
Share on other sites

20 minutes ago, _The Doctor__ said:

@phaeron might like to know the differences in real use vs emulator use, I'd provide side by side code and video of emu vs real

If I catch it again I will try, the problem seems to be totally random, I mean not easily reproducible on hw. One part of the problem I had was writing to the memac mapped blitter list while that blitter list was still in use by the blitter. This is an obvious thing not to do, but it's occurrence on real hw is not consistent, Altirra seemed to be a bit more forgiving here. But then I had something else, which might or might have not been related to this issue. The real source of the problem was that I decided to wait for the blitter to finish just before I need it again, rather than waiting for it to finish right after running it. This was an attempt to make the blitter run more in parallel with the rest of the code, rather than hanging the whole main program execution for the blitter to do it's job. Good idea in general, but one needs to be careful for sure (as with all parallel / concurrent programming). 

Link to comment
Share on other sites

10 minutes ago, flashjazzcat said:

Have you looked into using the blitter-completed IRQ?

Well, not yet, I was actually wondering how this works. Nevertheless, getting this information through IRQ does not help me much, I either can or cannot work on the blitter list at a given point in time, and the moments when I can't I have to wait nevertheless, be it with a busy wait or through an IRQ. How I imagine it could work, is to queue up my blitter requests and unload the queue one by one on the interrupt. Still, this requires for the blitter lists not to overlap / be reused. I have my code designed using a different principle, so reworking this would be a lot of work. Unless I got the whole idea totally wrong. In any case, the things that can be blitted in sequence are actually chained nevertheless, so anyway I look at it there is little to gain. And I still have plenty of frame left for the rest of the game, so I just need to be more careful with the way I do things ;) 

Link to comment
Share on other sites

7 hours ago, Rybags said:

Wrong colours - could it be attribute map if you're using that?

Or wrong blit mode such as XOR etc.

 

Certainly the latter, but not because I set the XOR field to a wrong value, but I (used to) set it at a wrong time. Attribute maps bring other kinds of issues and bugs (discovered one just after posting yesterday), but these are clear coding bugs on my side transferring things from paper to code (otherwise, so far, my attribute map puzzle still holds strong).

 

Link to comment
Share on other sites

11 hours ago, damanloox said:

Can't wait for this game to be completed! Great work @woj 

I'd love to see a physical cart being available for sale - I'd buy it instantly.

There won't be any. First, the way I decided to code excludes running the code from a read-only memory (deliberate choice, perhaps not the best one), rather than being cart friendly I made the game DOS friendly. Second, there is not going to be any profit making on this, for more or less obvious reasons. 

  • Like 2
Link to comment
Share on other sites

No Sunday update, I am afraid. I got so much done, essentially all Popeye movements in all rounds, including hanging on to the baloon etc. But I got totally entangled in the movement puzzle with the moving pad in round 3, and my head exploded, I need to start fresh with this tomorrow.

Edited by woj
  • Like 3
Link to comment
Share on other sites

56 minutes ago, woj said:

No Sunday update, I am afraid. I got so much done, essentially all Popeye movements in all rounds, including hanging on to the baloon etc. But I got totally entangled in the movement puzzle with the moving pad in round 3, and my head exploded, I need to start fresh with this tomorrow.

I'm incredibly impressed by what you've already accomplished. Thanks for doing this with VBXE!

  • Like 1
Link to comment
Share on other sites

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...
×
×
  • Create New...