Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > EasyFlash 3 question, I/O init / Dodo Sampler
2024-03-08 07:47
aeeben

Registered: May 2002
Posts: 42
EasyFlash 3 question, I/O init / Dodo Sampler

I got feedback that the instrument programs written from Dodo Sampler V1.0 (see the 202 block examples on the disk) don't work when ran from EasyFlash 3: There's no sound, so I suspect the sample playback NMI's are not firing.

I don't have EasyFlash, so I cannot test and there's only a few bytes free in the player.

What exactly is needed to start up a program from EasyFlash 3 so that it runs like if standard KERNAL was booted up and program file was loaded from disk?

Any single or two subroutine calls from $fce2 / 64738 that are enough to have CIA's and SID in a known state?

Am I missing something crucial in the Dodo sampler player init for why EasyFlash 3 doesn't like it? :D

InitSamplePlayer	subroutine
	ldx	#$1f
.2
	lda	NMI_image,x
	sta	$e0,x
	lda	#$00		; init SID
	sta	$d400,x
	dex
	bpl	.2

	lda	#$0f		; Mahoney DAC setup
	sta	$d405 
	sta	$d40c 
	sta	$d413 
	lda	#$ff
	sta	$d406 
	sta	$d40d 
	sta	$d414 
	lda	#$49
	sta	$d404 
	sta	$d40b 
	sta	$d412 
	lda	#$ff
	sta	$d415 
	sta	$d416 
	lda	#$03
	sta	$d417

	lda	#$00		; stop CIA 2 timer A
	sta	$dd0e
	sta	round		; also clear round robin pointer (for mode 7)

	lda	#$1e		; disable any other NMI triggers
	sta	$dd0d
	lda	#$81		; enable CIA 2 timer A NMI
	sta	$dd0d

	bit	$dd0d		; clear any pending NMI's

	ldx	#$e0		; NMI
	stx	$fffa
	lda	#$00
	sta	$fffb
	;
	stx	$dd04		; frequency
	sta	$dd05		

	rts
 
... 11 posts hidden. Click here to view all posts....
 
2024-03-09 18:05
JackAsser

Registered: Jun 2002
Posts: 1989
Also check boot.s in my EotB repo for an EF boot with kernel support
2024-03-09 20:58
aeeben

Registered: May 2002
Posts: 42
Quote: Quoting aeeben
@chatGPZ It's not a real .crt cartridge program, but a 202-block prg they've converted to .crt using Cart Maker.

Shouldn't the Cart Maker boot be doing a somewhat full init before moving code to RAM and running it? Otherwise tons of prg's, especially older ones, would fail immediately? Also, KERNAL CHROUT and GETIN are working, because the SID type query at Dodo startup uses these and works fine.

Interesting problem, can we have the .crt to examine?

Of course the Cart Maker should do a full init, but maybe it doesn't. Or perhaps there's some unusual things you unintentionally rely on like memory contents.


@tlr .crt here https://we.tl/t-VXLt93xVHt
2024-03-09 21:37
chatGPZ

Registered: Dec 2001
Posts: 11118
which of those should we look at? :)
2024-03-10 00:01
tlr

Registered: Sep 2003
Posts: 1714
Quoting aeeben
@tlr .crt here


This piece (dodoef.crt):
.C:0a3f  A9 81       LDA #$81
.C:0a41  8D 0D DD    STA $DD0D
.C:0a44  2C 0D DD    BIT $DD0D  <--- fires an NMI here
.C:0a47  A2 E0       LDX #$E0
.C:0a49  8E FA FF    STX $FFFA
.C:0a4c  A9 00       LDA #$00
.C:0a4e  8D FB FF    STA $FFFB


Is there a reason why you want to enable and ack NMIs before setting up the NMI vector?
2024-03-10 02:11
chatGPZ

Registered: Dec 2001
Posts: 11118
shouldnt that be $7f ? :D
2024-03-10 07:52
JackAsser

Registered: Jun 2002
Posts: 1989
Nah. They want to start a timer (for sample playback), but not acking before nor setting up vector is extremly bad practise
2024-03-10 12:31
Martin Piper

Registered: Nov 2007
Posts: 634
Don't forget that EF3 starts in ultimax mode, so it's entirely replacing the kernal and there isn't any standard kernal startup being run before your code.

The first thing I do when running from EF3 is immediately copy from the current bank a small bit of code into RAM, the stack is good, and run from there. That code turns off ultimax mode, turns on 8K bank mode, sets a good known bank, probably bank 0, then does the usual sei, ldx #$ff, txs, cld, lda#$37, sta $01 then proceeds to call the standard kernal init.

jsr IOINIT ;prepare i/o
jsr RAMTAS ;init memory
jsr RESTOR ;init i/o
And maybe:
jsr CINT

This means you get practically the same state as you would get with a cartridge using the ($8000) vector.
2024-03-10 12:46
aeeben

Registered: May 2002
Posts: 42
Ah, finally got to test his .crt images in VICE -- First I thought it could be the cart menu possibly leaving a raster interrupt hanging and waiting, but... good catch tlr, it was indeed related to the flaky NMI init.

I must have been code-blind and just copy-pasting lines around to reuse values in registers or something there :D

I simply changed
LDA #$81
STA $DD0D
BIT $DD0D

to
BIT $DD0D
LDA #$81
STA $DD0D

...and it works on EasyFlash 3. Any other changes to the original code are not required.

Adding bit $dd0d at start of program did the same thing.

Thanks all, I'll go fix that :)

But why did it work on stock machine and never failed? Does the cartridge cause a "reset" or "run/stop & restore" NMI at boot and leaves that unacknowledged when starting a prg?
2024-03-10 14:28
tlr

Registered: Sep 2003
Posts: 1714
Quoting aeeben
But why did it work on stock machine and never failed? Does the cartridge cause a "reset" or "run/stop & restore" NMI at boot and leaves that unacknowledged when starting a prg?

It could be. NMI is edge triggered, so if the NMI line is held low and you ack it, a new interrupt will happen immediately.
2024-03-11 02:26
Martin Piper

Registered: Nov 2007
Posts: 634
Being edge triggered, means if it is held low (before and after ack), it won't trigger again...
Previous - 1 | 2 | 3 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Black/Angels
metalux/G★P
Yazoo/Arsenic
Mason/Unicess
Frostbyte/Artline De..
Freeze/Blazon
Asphodel
Guests online: 152
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.06 sec.