View Single Post
Old 11 January 2024, 03:46   #1
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
PTPlayer in a C program - VBR?

I'm working on a roguelike written in C. I recently incorporated ptplayer. I'm getting a MuForce hit on read/write from $78. That is happening in mt_install_cia:

Code:
_mt_install_cia:
; Install a CIA-B interrupt for calling mt_music.
; a6 = CUSTOM
; a0 = VectorBase
; d0 = PALflag.b (0 is NTSC)

	ifnd	SDATA
	move.l	a4,-(sp)
	lea	mt_data(pc),a4
	endc

	clr.b	mt_Enable(a4)

	; remember level 6 vector and interrupt enable
	lea	$78(a0),a0
docs:
Code:
; _mt_install_cia(a6=CUSTOM, a0=VectorBase, d0=PALflag.b)
;   Install a CIA-B interrupt for calling mt_music or mt_sfxonly.
;   The music module is replayed via mt_music when _mt_Enable is non-zero.
;   Otherwise the interrupt handler calls mt_sfxonly to play sound
;   effects only. VectorBase is 0 for 68000, otherwise set it to the CPU's
;   VBR register. A non-zero PALflag selects PAL-clock for the CIA timers
;   (NTSC otherwise).
I'm targeting 68000 machines running 1.3 up through 680x0 running 3.2.2. (I can't test other combinations than that).

What's my best plan for getting the right VBR value to pass to mt_install_cia?

One more point of info: I am trying to make this an OS-friendly game, not a take-over-the-hardware game. I noticed today that the docs for ptplayer frown on, but don't totally poo-poo that:

Code:
  This player is intended for games/demos which take over the hardware
  and disable the OS. Running with the OS alive may work, as the OS
  doesn't use the CIA-B timers, but it is not recommended.
So hopefully there's a way I can do whatever detection I need to without doing bad things to the system.

Here's a thread I found with some ASM code, but I can't evaluate this and am not sure how I could use this:

https://eab.abime.net/showthread.php...&highlight=VBR

(and reading follow-up from Toni Willen, seems like it wouldn't be best for my situation, even if I could transplant that).

FWIW, the player seems to work so far on 68030 and 68000, passing 0 for VBR:
[ Show youtube player ]

(game starts at about 11:25).
Warty is offline  
 
Page generated in 0.04376 seconds with 11 queries