Simple DMA example

Do you live and breathe hexadecimal? Do you like speaking to hardware directly?

Moderator: Programming Moderators

Ped7g
Posts: 256
Joined: Mon Jul 16, 2018 7:11 pm

Re: Simple DMA example

Postby Ped7g » Wed Feb 19, 2020 7:37 am

My test suite has three different DMA tests, one is interactive:

zxnDMA mode: snapshot !dma.sna
Image

https://github.com/MrKWatkins/ZXSpectru ... e/!dma.txt

Zilog mode (does work also with regular ZX48/128 with Datagear or MB-02/MB-03): snapshot zilogDMA.sna
Image

https://github.com/MrKWatkins/ZXSpectru ... logDMA.txt

Interactive Zilog mode (does work also with regular ZX48/128 with Datagear or MB-02/MB-03):
snapshot dmaDebug.sna
https://github.com/MrKWatkins/ZXSpectru ... aDebug.txt
^^ will need probably some time studying the txt to understand what it does...
There are few photos trying out various scenarios from ZX128+2 grey with MB-02 disk driver:
https://github.com/MrKWatkins/ZXSpectru ... _hw_photos
(from the name of the photo you may try to deduct what was being pressed)

You can maybe post few screens from the interactive one, to see what your board does respond like to the DMA commands.
AFAIK these did work with core 3.0.7, not sure if anyone tried already with 3.1.0

EDIT: but as the DMA is implemented with FPGA, I find it kinda weird you would have working Next with broken DMA... try maybe also reflash the firmware? But overall this sounds sort of "impossible", weird.

User avatar
gavin1969
Posts: 11
Joined: Sun Jul 16, 2017 8:20 pm

Re: Simple DMA example

Postby gavin1969 » Wed Feb 19, 2020 5:15 pm

I'd already tried reflashing too (tried all the obvious stuff), no change. I'll take a look at the stuff you're sharing there over the next day or so.
Thanks!

<edit!>
Just managed to take a quick look. If I'm understanding the test program correctly, it's looking like the next dma mode is working, but the zilog isn't (even if I select that mode in the NMI menu). Does that seem likely/correct? (Not sure what the intended behaviour is).

Ped7g
Posts: 256
Joined: Mon Jul 16, 2018 7:11 pm

Re: Simple DMA example

Postby Ped7g » Wed Feb 19, 2020 8:04 pm

Each test is using the specific mode (and it should select that mode itself, no need of user action), i.e. the "!dma" should use only zxnDMA mode, and "zilogDMA" + "dmaDebug" should use only Zilog mode, if you would somehow manage to mismatch the modes (like changing binary or hitting NMI before transfer and changing mode), the test should display "fail" results (some squares will be red).

The intended behaviour is what is shown on the photos, all the attribute blocks should be green/yellow (with 1x1 red dot pixel), if some of those attributes is red with green dot, that's bug. The zxnDMA test has extra area at bottom doing the slow transfer, that one should keep flashing with different colours (should fill whole area at ~18 FPS), the zilog test has extra top border effect (should be random "noise" on Next, looks like big letters on real Zilog DMA, but the difference doesn't matter as the transfer setup is illegal sequence), and has two flashing blocks in border just testing the transfer timing (both should be same high => 4T transfers).

I haven't pursued somebody with board to run the tests with latest core 3.1.0, but AFAIK there was no change about DMA, so I have no idea what is happening, I can't even imagine what's wrong - if zxnDMA test mode works and zilog does not. So far it doesn't ring the bell, seems like impossible situation (but I don't suspect faulty FPGA, that would be even less probably, to have it failing only in that specific part, so I guess there's some logical explanation and some small detail eluding us so far).

There was some talk about moving Zilog DMA to port $0B (default of MB-02/MB-03), but I'm not aware of Allen actually doing it already in 3.1.0
If that would be the case, you can try press "p" in the test to restart it with the other DMA port.

I will try to get somebody with board to test it with latest core, if it works or not, so we don't hunt some red herring... :)

EDIT: any chance to post the photos of screen of each test after launching it?

User avatar
SevenFFF
Posts: 565
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Simple DMA example

Postby SevenFFF » Wed Feb 19, 2020 8:40 pm

My code was extremely old, but it still does work on the Next with the latest core and NextZXOS.

I just rebuilt them for .nex. Try downloading the .nex files from github.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins

User avatar
gavin1969
Posts: 11
Joined: Sun Jul 16, 2017 8:20 pm

Re: Simple DMA example

Postby gavin1969 » Wed Feb 19, 2020 10:45 pm

Thanks both for your replies.

I think the zilog test (where the word zilog dma would appear on the border on a real machine) returns red blocks, but looked fine in next dma mode.

The nex files that Robin provided work fine - thanks for going to that trouble!

I'd built nex files as one of my attempts to determine what the issue was, but they hadn't worked. I note in the current asm files you've commented out the parasys calls, so that might be a thing. Or maybe I'm building with a version of Zeus that isn't happy with something?

I'll try to use all the content you've provided to see if I can work out what's different here.

If it's still helpful, I'll try to find some time at the weekend for screenshots of the test apps, but I'm going to try updating my firmware one more time, because I had a fragmented file warning using the Next Hardware Test app thingy, so want to eliminate that as another possibility.

Thanks again!

Ped7g
Posts: 256
Joined: Mon Jul 16, 2018 7:11 pm

Re: Simple DMA example

Postby Ped7g » Thu Feb 20, 2020 10:19 am

BTW, if you are building SNA files and launch it by SPECTRUM command (= browser), it will reconfigure the machine depending on the snapshot type (zx48/zx128), disabling most of the Next HW to avoid any collisions with legacy SW writing to bogus I/O ports, not expecting the peripherals there.

I think the DMA is then disabled for 48/128 SNA files and you have to re-enable it by writing to: https://wiki.specnext.dev/Internal_Port ... 7_Register (and maybe re-enable also other "HW").

Or you can simply rename the "SNA" to "SNX", then it will be loaded in "Next" mode with the HW extensions enabled by default.

I'm using SNA extension for those tests, but I did add HW-enabling into "TestStart" function, so AFAIK all three of them should work with latest core and NextZXOS, but I had to add this extra code, otherwise most of those tests did stop working with zero-day update.
(it's very new feature, as a result of many failures of legacy games being loaded in Next-mode)

edit: if you didn't update yet from the RTM version of system, then I think the old SNA files should still work with all stuff enabled, but I thought you already update firmware and files, then the SNA launching is more restrictive, clamping down the machine a lot.

User avatar
gavin1969
Posts: 11
Joined: Sun Jul 16, 2017 8:20 pm

Re: Simple DMA example

Postby gavin1969 » Thu Feb 20, 2020 11:40 am

That's useful to know, thanks! I am aware there have been a number of changes in the year or so since I first played with the Next, that's one of the reasons I stopped experimenting with it - as things kept changing all the time! :)
Thanks again!

edit:
The file extensions thing explains my initial problem, and why my code wasn't working via Parasys. I had a .z80 parasys loader which I was launching to allow me to send my Next code over, so the machine was in the wrong state to run the Next specific code...!
Created a .nex version of the same loader, now all my old code is running fine. (It's always something simple!!!!)
Thanks! :)

User avatar
varmfskii
Posts: 287
Joined: Fri Jun 23, 2017 1:13 pm
Location: Stone Mountain, GA USA

Re: Simple DMA example

Postby varmfskii » Fri Feb 21, 2020 6:47 pm

Funny, my reaction to the changes was to keep experimenting and documenting what I had found and learned from others.
Backer #2741 - TS2068, Byte, ZX Evolution

User avatar
SevenFFF
Posts: 565
Joined: Mon Jun 05, 2017 5:30 pm
Location: USA

Re: Simple DMA example

Postby SevenFFF » Fri Feb 21, 2020 6:58 pm

As well as .SNAs, .Z80 snapshots, TZXs and TAPs are also loaded with legacy settings in NextZXOS the former two happening unconditionally; the latter two depending on options chosen by the user in tzxload.bas and tapload.bas).

That was indeed why I switched to .NEX files for these examples, rather than spending time figuring which hardware needed re-enabling after it was running. Definitely best not to use legacy formats for non-legacy code, unless you have a really good reason.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins


Who is online

Users browsing this forum: No registered users and 1 guest