| |
aeeben
Registered: May 2002 Posts: 45 |
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.... |
| |
JackAsser
Registered: Jun 2002 Posts: 2020 |
Also check boot.s in my EotB repo for an EF boot with kernel support |
| |
aeeben
Registered: May 2002 Posts: 45 |
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 |
| |
chatGPZ
Registered: Dec 2001 Posts: 11433 |
which of those should we look at? :) |
| |
tlr
Registered: Sep 2003 Posts: 1793 |
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? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11433 |
shouldnt that be $7f ? :D |
| |
JackAsser
Registered: Jun 2002 Posts: 2020 |
Nah. They want to start a timer (for sample playback), but not acking before nor setting up vector is extremly bad practise |
| |
Martin Piper
Registered: Nov 2007 Posts: 726 |
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. |
| |
aeeben
Registered: May 2002 Posts: 45 |
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? |
| |
tlr
Registered: Sep 2003 Posts: 1793 |
Quoting aeebenBut 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. |
| |
Martin Piper
Registered: Nov 2007 Posts: 726 |
Being edge triggered, means if it is held low (before and after ack), it won't trigger again... |
Previous - 1 | 2 | 3 - Next |