Jump to content
IGNORED

Introducing P-Machinery 1.0 (beta)


DZ-Jay

Recommended Posts

Want to make your own Intellivision games but don't know how?



Know a bit of Assembly Language, but don't know where to start?



Did you take a look at Tag-Along-Todd but couldn't fathom how to alter it to your purposes, and feel daunted by the perceived complexity of it all?

 

Then fret no more!

 

Introducing P-Machinery 1.0, a very simple game engine and framework for programming games for the Intellivision.

 

P-Machinery includes a very basic game skeleton, with a state machine that supports a flexible set of game states such as "Title Screen," "Play," and "Game-Over." Support routines to change between states and handle background tasks make starting a new game easier than before. Just add game logic, graphics, and a bit of water*!

 

At its core, P-Machinery includes the three main components of a game engine:

  • A flexible game state machine and main event loop,
  • An event-driven controller input decoder,
  • A task scheduler, and queue manager.

Along with these basic components, it includes a whole set of macros and support routines to help in allocating and managing memory and graphics.

 

There's one (rather large) caveat, I haven't prepared documentation for it. I always intended to include the demo with a tutorial on how to implement a simple game (Pac-Man!), but I never got around to it. However, the code is obsessively commented, so it should be easy to follow what it's doing.

 

The first introductory chapter of the tutorial can be found in the "doc" folder. Once I finish the tutorial, I expect to release it into the Public Domain. I hope it is useful to somebody.

 

And just to prove that it works effectively, know that the demo is exactly the core of Christmas Carol devoid of any game logic and graphics driver.

 

* Water optional.

 

pmach.zip

  • Like 4
Link to comment
Share on other sites

Could you create a set of macros for your engine to obfuscate the assembly underpinnings a bit more? I know not assembly, but, stuff like:

SETSCORE 10000

ADDSCORE 500

MOVESPRITEA 24, 18

SETBGCOLOR $1F

etc..

 

Actually it has a lot of that (though perhaps not those functions specifically). It is not intended to replace Assembly, nor is it aimed at non-programmers. Its purpose is to streamline programming and letting beginners have a basic infrastructure ready upon which they can build game logic.

 

Most tutorials walk you through coding a title screen or how to set-up the ROM header for a game. With this framework, you have all that ready. You just need to provide your game specific logic and events, but the general skeleton is ready to go.

 

The engine will start the game, set-up the environment and display a basic title screen. At that point, it accepts any input from the title screen and automatically engages "Play" mode, which is the main game loop. During this mode, it polls the controller and triggers events when input is received. Your game can assign event handlers for these and do what it needs to do, and any tasks you add to the queue or schedule for later will automatically be run when ready.

 

All that basic functionality is already built-in. A lot of it is built using the SDK-1600 library provided by Joe Zbiciak.

 

It is a very basic but flexible model.

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

  • 2 weeks later...

sorry a bit more explanation: your package provide an assembler template? the template is calling external libraries made by you?

so you take the template and start from this?

 

I'm sorry, but it's nothing as sophisticated as that. I guess the best way to describe it would be to say that it is just a game skeleton. All the basic scaffolding is there to execute a game:

 

- The ROM header

- The ISR game loop

- The state machine

- The task queue

- The controller input decoder

 

If you take the source as is, assemble it, then run it, you'll have an executing game that does absolutely nothing more than display a title screen. However, under the hood, it is actually running the game loop and waiting reading the controllers; it just has no game logic to perform.

 

I intended to include a tutorial with it, teaching how to build a simple game step by step, but I never got around to it. I'll do so eventually. The code, however, is heavily commented and gives hints on what could be done at each point.

 

Does this make sense?

 

-dZ.

Link to comment
Share on other sites

Just to give you an idea of what the code skeleton provides, consider the following routine. This is the "Level Initialization" routine, intended to initialize the game world when a new level starts (or when the game starts, if there are no levels).

 

Notice that it has lots of comments on what it is doing, and gives you ideas of what else to add for your own game.


;;==========================================================================;;
;; Title:       P-Machinery Game Engine (State Machine)                     ;;
;; By:          DZ-Jay                                                      ;;
;; Description: Defines functions to handle the game's main state machine's ;;
;;              individual states.                                          ;;
;;                                                                          ;;
;; Copyright 2010-2011, James Pujals (DZ-Jay), <dz-game@techunlimited.net>. ;;
;;==========================================================================;;

;; ======================================================================== ;;
;;                                                                          ;;
;;  ----------------------------------------------------------------------- ;;
;;  WARNING! ACHTUNG! WARNING! ACHTUNG! WARNING! ACHTUNG! WARNING! ACHTUNG! ;;
;;  ----------------------------------------------------------------------- ;;
;;                                                                          ;;
;;  The initialization sequence, including state transitions and scheduled  ;;
;;  tasks, are arranged in a particular way.  This is by design.  Changing  ;;
;;  any step may impact the overall state of the intializer, causing        ;;
;;  unexpected results.                                                     ;;
;;                                                                          ;;
;;        DO NOT change unless you really know what you are doing!          ;;
;; ======================================================================== ;;

;; ======================================================================== ;;
;;  ST_LVL_INIT: ISR routine to handle game level initialization.           ;;
;; ======================================================================== ;;
ST_LVL_INIT     PROC
               DIS     ; Start Critical Section

               ; --------------------------------------
               ; Perform any level initialization here.
               ; The display is disabled so we have free
               ; reign over the bus to access the STIC
               ; and GRAM, with no time limit.
               ;
               ; Here is a good place to load all the
               ; graphics into GRAM, initialize sprites
               ; and draw the play-field.
               ;
               ; The level initialization routine can last
               ; as long as it needs to, and the screen
               ; will just remain blank in the meantime.
               ;
               ; At the end of initialization, we'll
               ; transition to the "Level Play" state,
               ; where the play-field and MOBs will be
               ; ready to go, and the display will be
               ; enabled.
               ; --------------------------------------

               ; Initialize the Color Stack
               MVII    #C_BLK, R0                      ; Set up the color stack
               MVO     R0,     STIC.cs0                ; 0 = Black
               MVO     R0,     STIC.cs1                ; 1 = Black
               MVO     R0,     STIC.cs2                ; 2 = Black
               MVO     R0,     STIC.cs3                ; 3 = Black
               MVO     R0,     STIC.bord               ; Set the border black too

                                                       ; Initialize environment for new game state
               CALL    STOPALLTASKS                    ;   1. Stop all tasks
               CALL    RESET_CTRL.Force                ;   2. Reset Input Controller values
               CALL    RESET_STIC                      ;   3. Reset the STIC (clone) registers
               CALL    CLRSCR                          ;   4. Clear the screen

               CLRR    R0
               MVII    #PLAYER_INFO.Score,     R4
               MVO@    R0,     R4                      ; \_ Reset score
               MVO@    R0,     R4                      ; /
               MVO@    R0,     R4                      ; Reset lives
               MVO@    R0,     R4                      ; Reset current direction
               MVO@    R0,     R4                      ; Reset stand-by direction

               MVII    #MAXTSK,                R0      ; \_ Activate all tasks, ready for play!
               MVO     R0,     TSKACT                  ; /

               ; Interrupts are enabled on return
               SET_GAME_STATE(LEVEL, Play, cNormal)    ; Engage the Level Play engine.
               IRET
               ENDP

 

And below is the main "Game Play" engine. This routine is called continuously from the game loop to update the game world. Notice how it just performs some "housekeeping" stuff like check for pause and process timers, but it hints as to what you could add for your game.

 

;; ======================================================================== ;;
;;  ST_LVL_ENGINE: ISR routine to handle a game level.                      ;;
;; ======================================================================== ;;
ST_LVL_PLAY     PROC
               ; --------------------------------------
               ; These access GRAM or the STIC, and so
               ; need to run as soon as possible at the
               ; top of the ISR routine.
               ; --------------------------------------
               ISR_ENABLE_DISPLAY
               CALL    POST_STIC_X

               ; --------------------------------------
               ; Perfom all engine tasks or add them
               ; to the task queue as necessary:
               ;   - Update STIC
               ;   - Update PSG
               ;   - Cycle GRAM cards
               ;   - Update score display
               ;   - Move all sprites
               ;   - Check collisions
               ;   - Animate sprites
               ;   - etc.
               ; --------------------------------------

               ; --------------------------------------
               ; Process all timed tasks and counters.
               ; --------------------------------------
               DCALL   DOTIMER, iEnabled
               CALL    PAUSE_GAME                      ; Check for pause
               IRET
               ENDP

Link to comment
Share on other sites

I see this is a very good work!

 

Thanks. As I mentioned above, this is the actual code of my Christmas Carol game, but without any game logic or graphics driver, so I know it works. :)

 

-dZ.

 

 

http://www.intellivi...l.asp?iwNws=212

 

any correction you tell me

 

Valter, just to give credit where it's due, my game engine uses Joe Zbiciak's SDK-1600 programming library, and was designed to use Joe's as1600 assembler. P-Mach just puts it all together into a re-usable skeleton, and builds upon it.

 

-dZ.

Link to comment
Share on other sites

I see this is a very good work!

 

Thanks. As I mentioned above, this is the actual code of my Christmas Carol game, but without any game logic or graphics driver, so I know it works. :)

 

-dZ.

 

 

http://www.intellivi...l.asp?iwNws=212

 

any correction you tell me

 

Valter, just to give credit where it's due, my game engine uses Joe Zbiciak's SDK-1600 programming library, and was designed to use Joe's as1600 assembler. P-Mach just puts it all together into a re-usable skeleton, and builds upon it.

 

-dZ.

 

done

Link to comment
Share on other sites

  • 4 weeks later...

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

Edited by vprette
Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

Edited by vprette
Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

 

pause.asm is the only one I miss

still having the same error message...

the problem is something else I guess because even deleting the include of pause.asm I have same error...

 

 

DZ-Jay can you help???

Edited by vprette
Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

 

pause.asm is the only one I miss

still having the same error message...

the problem is something else I guess because even deleting the include of pause.asm I have same error...

 

 

DZ-Jay can you help???

 

Valter,

First, I'm sorry I haven't responded. I'm away dealing with a family crisis and have limited Internet access.

 

Regarding your issue, the pause.asm is a new library file to be added to the SDK-1600, but perhaps it's not there yet.

 

I don't have the file with me right now, I can send it to you when I get home in a few days.

 

Also, I'm sorry for the messy set up. In my development machine I have all set up with environment variables so that they are all accessible. I guess my code assumes this setup.

 

I'll make sure to fix that and to include better instructions when I return.

 

What is other errors you get when assembling?

Edited by DZ-Jay
Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

 

pause.asm is the only one I miss

still having the same error message...

the problem is something else I guess because even deleting the include of pause.asm I have same error...

 

 

DZ-Jay can you help???

 

Valter,

First, I'm sorry I haven't responded. I'm away dealing with a family crisis and have limited Internet access.

 

Regarding your issue, the pause.asm is a new library file to be added to the SDK-1600, but perhaps it's not there yet.

 

I don't have the file with me right now, I can send it to you when I get home in a few days.

 

Also, I'm sorry for the messy set up. In my development machine I have all set up with environment variables so that they are all accessible. I guess my code assumes this setup.

 

I'll make sure to fix that and to include better instructions when I return.

 

What is other errors you get when assembling?

 

just that one, and it stop....

Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

 

pause.asm is the only one I miss

still having the same error message...

the problem is something else I guess because even deleting the include of pause.asm I have same error...

 

 

DZ-Jay can you help???

 

Valter,

First, I'm sorry I haven't responded. I'm away dealing with a family crisis and have limited Internet access.

 

Regarding your issue, the pause.asm is a new library file to be added to the SDK-1600, but perhaps it's not there yet.

 

I don't have the file with me right now, I can send it to you when I get home in a few days.

 

Also, I'm sorry for the messy set up. In my development machine I have all set up with environment variables so that they are all accessible. I guess my code assumes this setup.

 

I'll make sure to fix that and to include better instructions when I return.

 

What is other errors you get when assembling?

 

just that one, and it stop....

Some questions:

 

1. What operating system are you running?

2. What happens if you type "as1600" on the command line?

Link to comment
Share on other sites

sorry, I started looking for your p-mach

I have tedious questions :-|

 

when I try to compile the pmach-test asm, I got error because (I guess) compiler cannot find some include files.... what is missing?

 

I suppose it's missing

- cart.mac (??)

- gimini.asm (this one is into the jzintv /library right?)

- util.mac (this one is into the jzintv /library right?)

 

cart.mac comes from intelliwiki I think:

http://wiki.intelliv...?title=Cart.mac

util.mac is from jzintv/examples/macro/util.mac

gimini.asm is from jzintv/examples/library/gimini.asm

 

ohi ohi

I addedd all the 3 files in the folder but still cannot compile.....

 

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I guess those are still missing (I cannot find in jzintv library nor intelliwiki)

 

INCLUDE "task/taskq.asm"

INCLUDE "task/timer.asm"

INCLUDE "task/pause.asm"

The task folder is in jzintv/examples/task

. My copy doesn't have pause.asm in it. Maybe I don't have the latest version....

 

pause.asm is the only one I miss

still having the same error message...

the problem is something else I guess because even deleting the include of pause.asm I have same error...

 

 

DZ-Jay can you help???

 

Valter,

First, I'm sorry I haven't responded. I'm away dealing with a family crisis and have limited Internet access.

 

Regarding your issue, the pause.asm is a new library file to be added to the SDK-1600, but perhaps it's not there yet.

 

I don't have the file with me right now, I can send it to you when I get home in a few days.

 

Also, I'm sorry for the messy set up. In my development machine I have all set up with environment variables so that they are all accessible. I guess my code assumes this setup.

 

I'll make sure to fix that and to include better instructions when I return.

 

What is other errors you get when assembling?

 

just that one, and it stop....

Some questions:

 

1. What operating system are you running?

2. What happens if you type "as1600" on the command line?

 

1 xp pro

2 I use my dev environment Intelliware, that is setted up and running all the source I have from the jzintv library

Link to comment
Share on other sites

I get error "The program needs Include dependencies: you must save it in IW folder or a sub folder"

 

I'm guessing this error is coming from "Intelliware" somewhere. "IW folder" sounds like something to do with the Intelliware environment.

 

On my machine (a Macbook), I

1. downloaded pmach

2. found all the missing include files (except for pause.asm).

3. Then I commented out the include for pause.asm.

4. After that I was able to assemble and run the pmach-test program.

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...
  • Recently Browsing   0 members

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