Author Topic: ROM board with a tiny DMA engine  (Read 6057 times)

0 Members and 1 Guest are viewing this topic.

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 154
Re: ROM board with a tiny DMA engine
« Reply #50 on: 22:52, 12 March 18 »
Doragasu cannot log in right now, so I'm posting news on his behalf...


Quote from: doragasu
After a long hiatus, I am resuming this project. I got the PCB fabricated and assembled a prototype. Plugged it to a CPC, and after a bit of debugging, I got basic ROM switch function almost working. And I say almost because ROMs apparently get properly enumerated (the ones printing messages on screen, print them as intended), but once the "READY" prompt appears, the CPC freezes: there is no response to keypresses... I would appreciate help to debug this thing, because I am currently out of ideas.
Also while debugging this, I have noticed something that looks strange. If I unplug the CPC and test continuity between #EXP (pin 48) and GND, I find there is a short. In the schematic I have, this pin is only connected to the PIO and to a 2k2 pull-up, so I suppose I should not see this short! I have 2 CPCs, and this is happening in both of them, so if the PIO has been damaged (presubably because of the ROMBA), it has happened in both of them. So is my PIO broken, or am I missing something? Can anyone please check if there is a short between pin 48 of the expansion port and GND.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 10.025
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 3372
Re: ROM board with a tiny DMA engine
« Reply #51 on: 10:29, 13 March 18 »
Answer to doragasu: If you look at the schematics of the disk drive section of the 6128, you'll see that /EXP is connected to GND via LK7. I suspect that Amstrad intended using the EXP signal to detect whether a disk drive is connected (the DDI-1 does the same thing when connected to a 464). Because of this, the EXP signal can't be used on the CPC for anything else.
So your CPCs aren't broken, that's the way it's meant to be.

Bryce.

Offline rpalmer

  • 464 Plus
  • *****
  • Posts: 465
  • Country: au
  • Liked: 312
Re: ROM board with a tiny DMA engine
« Reply #52 on: 13:08, 13 March 18 »
Bryce,

You can still use the /EXP pin on the expansion port provided that the Disk Interface is not connected.

rpalmer

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 10.025
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 3372
Re: ROM board with a tiny DMA engine
« Reply #53 on: 13:10, 13 March 18 »
On a 464 yes, but on a 6128 the "interface" is always connected.

Bryce.

Online gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.238
  • Liked: 891
Re: ROM board with a tiny DMA engine
« Reply #54 on: 17:33, 13 March 18 »
And on a 6128, if you open the link, your cpc will try to boot from a CPM floppy. No more basic  :o

Offline rpalmer

  • 464 Plus
  • *****
  • Posts: 465
  • Country: au
  • Liked: 312
Re: ROM board with a tiny DMA engine
« Reply #55 on: 22:48, 13 March 18 »
And on a 6128, if you open the link, your cpc will try to boot from a CPM floppy. No more basic  :o

The reason being is the DISC ROM initialisation. If the ROM is detected zero then boot cp/m else the initialisation continues and returns to BASIC.
see below (I have disassembled to the DISCROM from KDS and added comments over a decade ago):

LC1BC
;***************************************************************
;  INITIALISATION OF DISC ROM
;  INPUT
;      C FLAG IF ROM NOT IN SLOT 7
;  CALLED BY
;      NONE.
;
;***************************************************************
       JR   C,LC1C4
       CALL &B912       ;CHECK CURRENT ROM
       OR   A           ;ROM ZER0 ?
       JR   Z,LC1DC     ;YES, REBOOT CP/M
LC1C4  PUSH IY          ;NO
       PUSH DE
       LD   DE,&FB00    ;-&4FF
       ADD  HL,DE        ;SIZE OF WORK SPACE NEEDED FOR DISC ROM
       PUSH HL
       INC  HL
       PUSH HL
       POP  IY
       CALL LC5DD       ;SETUP DPB'S AND SEND SPECIFY COMMAND
       CALL LCCA0       ;SETUP AMSDOS CALLS TO DISC ROM
       POP  HL
       POP  DE
       POP  IY
       SCF
       RET
;
LC1DC
; PURPOSE  BOOT CP/M SYSTEM.
; INPUT
;      NONE
; CALLED BY
;      LC1BC - COMMON ENTRY POINT FOR AUTO BOOT and |CPM
;
       LD   SP,&C000
       LD   IY,&AC48    ;Chain Address to next ticker block
       LD   DE,&AD33    ;ADDRESS OF AREA TO CLEAR
       LD   BC,&A5      ;165 BYTES
       CALL LCAAF       ;CLEAR MEMORY FROM &AD33 TO &ADD8
       LD   HL,&AD41
       DEC  (HL)
       LD   A,&81
       LD   (03),A
       XOR  A
       LD   (04),A
       LD   HL,LC033    ;START OF CONTROL-? JUMP ENTRIES
       LD   DE,&BE80    ;LOCATION TO STORE JUMP TABLE
       LD   BC,&3F      ;SIZE = 63 BYTES
       LDIR             ;DOWNLOAD RSX JUMP TABLE
       CALL LC0C0
       CALL LC5DD       ;SETUP DPB'S AND SEND FDC SPECIFY COMMAND
LC20A  LD   C,&41       ;SECTOR &41
       LD   DE,00       ;(REG E) DRIVE A, (REG D) TRACK = 0
       LD   HL,&0100    ;LOAD ADDRESS
       CALL LC666       ;READ IN BOOT SECTOR
       CALL C,LC2AC     ;CHECK SECTOR CONTENTS
       JR   NC,LC224    ;READ FAILED OR EMPTY BOOT SECTOR
       EX   DE,HL       ;PUT LOAD ADDRESS INTO REG DE
       LD   BC,LC17F    ;ADDRESS OF JUMP VECTOR
       LD   SP,&AD33    ;SET STACK POINTER
       JP   LC177       ;SETUP INTERRUPT ADDRESS & JUMP TO &100
LC224  LD   A,&0F       ;CP/M BOOT FAILED AERT NUMBER
       CALL LCAB8       ;DISPLAY ALERT
       JR   LC20A       ;TRY AGAIN

Offline doragasu

  • CPC464
  • **
  • Posts: 34
  • Country: es
  • Liked: 29
Re: ROM board with a tiny DMA engine
« Reply #56 on: 01:38, 17 March 18 »
At last I recovered access to my account  ;D

Thanks for the replies. Finally I found the problem and got the ROMBA working (at least as a simple Rombox).

Now I have Augusto working on a test program for the DMA modes  ;)

Offline doragasu

  • CPC464
  • **
  • Posts: 34
  • Country: es
  • Liked: 29
Re: ROM board with a tiny DMA engine
« Reply #57 on: 23:04, 17 April 18 »
Guess what, DMA is working!!! Both DMA modes in fact:
- We can play digital audio with approximately 0% CPU overhead. The limits are the bits per sample ( 8 ) and the maximum sample length (64 KiB). Sampling rate can be configured on the fly, and ranges from 3906 Hz to 50 kHz (and beyond).
- We can transfer data from external ROM to internal CPC RAM at 1 byte per microsecond. While doing DMA the Z80 is stopped, but this is much faster than doing the copy using software routines.

Too bad the CPLD is not bigger, because on a bigger one, I could try making a 2D DMA engine, and THAT could be really useful to speed up rendering sprites!

Offline doragasu

  • CPC464
  • **
  • Posts: 34
  • Country: es
  • Liked: 29
Re: ROM board with a tiny DMA engine
« Reply #58 on: 23:07, 18 April 18 »
Quick and dirty DMA test ROM by Augusto Ruiz. The ROM does the following:

1. Display the CPCTelera logo while playing "Hadouken" audio sample (using DMA).
2. Copy the background (16 KiB) to the video memory 50 times using a SW routine, then scroll it a bit.
3. Copy the background (16 KiB) to the video memory 50 times using DMA, then scroll it a bit.
4. Print the screen green.


https://www.youtube.com/watch?v=Yejb4n5Q0BQ

Using DMA is about 5 times faster!  :o 8)

Offline GUNHED

  • 464 Plus
  • *****
  • Posts: 336
  • Country: us
  • Reincarnation of TFM
  • Liked: 149
Re: ROM board with a tiny DMA engine
« Reply #59 on: 01:29, 19 April 18 »
Quite nice!  :) :) :)


And everybody else always told me that DMA wouldn't be possible on CPC.  ;)
« Last Edit: 01:30, 19 April 18 by GUNHED »