• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

Making a Game in Assembly with MDS 2.0

Mu0n

Well-known member
This is a magical thread. The popping sound solve is pure joy. Do you mind if your solution is heavily inspired from and adapted?
 

jkheiser

Well-known member
This is a magical thread. The popping sound solve is pure joy. Do you mind if your solution is heavily inspired from and adapted?
Hang on while I send you my standard NDA. ;)

Kidding! The attached disk image has the 128k ROM Sound Driver baked into MacKaboom’s resource fork. Have a look, help yourself, &cetera.
 

Attachments

  • mac-kaboom-031523.zip
    235.9 KB · Views: 3

jkheiser

Well-known member
Progress on MacKaboom has slowed because our house is getting renovated and my day job is draining. Also, the thing I’m trying to do right now—data structures and routines for the game sprites—has been tough to figure out.

And I’ve been fussing over the artwork. My first pass on the “mad bomber” looked like he spent all his jail time pumping iron, but the guy on the title screen (and in the TV commercial) looked more like John Belushi in Animal House: heavyset and impish. So I revised the the art with those characteristics in mind.
MacKaboom! Sprites
 

mdeverhart

Well-known member
Both look great (awesome pixel art!), but I agree, the 2nd version matches the style of the title screen better.
 

Crutch

Well-known member
Thanks @jkheiser for the tips, I now have a MAME setup running for the first time. It works! BUT … I could use a little advice if you know the answers …

1. When I emulate a maciicx or maciici, the mouse motion is extremely jerky. (The mouse usually moves 80+ pixels at a time so is basically unusable.). It seems fine with a Plus. Have you seen this at all?
2. Is there a way to run a HD image like one would normally use with Mini vMac etc? In my limited testing I can only get it to work with prefab “.chd” images I’ve found online. My .dsk images that run with Mini vMac seem to be ignored by MAME with the “-hard1” option.

The debugger looks really promising. Thanks for pointing me at this!
 

jkheiser

Well-known member
@Crutch You hit on one of MAME’s weak spots for me: I find the mouse to be really squirrelly with the 128k, 512k, and Plus. From what you’re telling me, it’s actually worse on later models?! That’s terrible. Maybe the ADB emulation is shaky. Sorry, I don’t have any tips for you here.

MAME’s NuBus emulation includes support for partition-less disk images with the “image” pseudo card. Try adding -nba image to your CLI arguments.
 

jkheiser

Well-known member
Springtime is here and so are its homeowning chores, so this project continues to languish. It was nice to hunker down and make progress when the weather was cold and snowy. Oh well.

Tonight I blew the cobwebs off my code and made sure I didn’t leave anything undocumented. Already I’m forgetting the particulars of some of these routines and record formats. Can’t let that happen!

One thing I forgot to share: an initialization routine for A5 globals. The DS (define storage) pseudo opcode tells your assembler to reserve storage for your A5 global variables. Initialization of them, however, is up to you. When your program starts, you can’t trust the values of any of these variables.

Several MacKaboom routines use the same A5 variable over and over. Typically it is an address of a handle for something. I want the routine to be able to assume the value is trustworthy if it’s not NIL, but I don’t want to manually initialize all my A5 variables to $0 because I’m lazy! So now there is a routine that does it for me.

Code:
; -----------------------------------------------------------------------------
; Initialize all global variables to NIL

INIT_GLOBALS

        LEA             BeginGlobals(A5),A0     ; Load first marker address
        LEA             EndGlobals(A5),A1       ; Load last marker address
        SUB.L           A0,A1                   ; Subtract to get bytes
        MOVE.L          A1,D0                   ; Move into data register
        SUB             #1,D0                   ; Subtract one for loop
@NIL    CLR.B           (A0)+                   ; Set byte to NIL
        DBRA            D0,@NIL                 ; Loop until done
        RTS                                     ; Return from subroutine

; -----------------------------------------------------------------------------
; Define global variables that are relative to A5

BeginGlobals        DS.L        0               ; (zero-byte address marker)

EvWindow            DS.L        1               ; Window where event happened
EvRecord            DS.W        0               ; Start of event record
    EvNum:          DS.W        1               ; Event number
    EvMessage:      DS.L        1               ; Additional information
    EvWhen:         DS.L        1               ; Time event happened
    EvPoint:        DS.L        1               ; Mouse coordinates of event
    EvModify:       DS.W        1               ; State of keys and button
Menu1               DS.L        1               ; Handle for menu 1 (Apple)
Menu2               DS.L        1               ; Handle for menu 2
Menu3               DS.L        1               ; Handle for menu 3

; ... lots more A5 variables ...

EndGlobals          DS.L        0               ; (zero-byte address marker)
 
Last edited:

Crutch

Well-known member
That’s a handy utility routine.

If you wanted to zealously optimize, you could even ASR #2, D0 to divide it by 4 and then use CLR.L to loop thru 4 times as fast, then handle the last 0-3 bytes as a special case. Hopefully you don’t have enough globals for that to matter though. 😊

If you haven’t looked at it, the ROM source code for BlockMove is a fun read. They use several little tricks like that.
 
Top