You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: targets/mega65/dma65.c
+22-2Lines changed: 22 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,7 @@ struct ldm_st {
80
80
// source and target DMA "channels":
81
81
staticstructdma_channel_st {
82
82
intaddr; // address of the current operation, it's a fixed-point math value
83
+
Uint8addr_fract; // address fractional part, used during transition from DMA info fetch and starting the actual DMA, but not during the DMA (will be low byte of "addr", fixed point math!)
83
84
intbase; // base address for "addr", always a "pure" number! It also contains the "megabyte selection", pre-shifted by << 20
84
85
intstep; // step value, zero(HOLD)/negative/positive, this is a fixed point arithmetic value!!
85
86
Uint8step_fract; // step value during option read, fractional part only
@@ -345,6 +346,8 @@ void dma_write_reg ( int addr, Uint8 data )
345
346
source.mbyte=0; // source MB
346
347
target.mbyte=0; // target MB
347
348
length_byte3=0; // length byte for >=64K DMA sessions
349
+
source.addr_fract=0;
350
+
target.addr_fract=0;
348
351
// zero out LDM-specific options by default
349
352
memset(&source.ldm, 0, sizeofsource.ldm);
350
353
memset(&target.ldm, 0, sizeoftarget.ldm);
@@ -466,6 +469,12 @@ int dma_update ( void )
466
469
case0x90: // extra high byte of DMA length (bits 23-16) to allow to have >64K DMA
467
470
length_byte3=optval;
468
471
break;
472
+
case0x91: // set initial fractional part of the source
473
+
source.addr_fract=optval;
474
+
break;
475
+
case0x92: // set initial fractional part of the target
476
+
target.addr_fract=optval;
477
+
break;
469
478
case0x97: // DMA line drawing mode SOURCE - X col (LSB)
470
479
source.ldm.x_col= (source.ldm.x_col&0xFF0000U) + (optval << 8); // Xemu integer + 8 bit fractional part arithmetic!
// FIXME: this is a debug mesg, yeah, but with fractional step on M65, the step values needs to be interpreted with keep in mind the fixed point math ...
@@ -678,6 +687,17 @@ int dma_update ( void )
678
687
if (chained) { // chained?
679
688
DEBUGDMA("DMA: end of operation, but chained!"NL);
680
689
in_dma=0x81; // still busy then, with also bit0 set (chained)
690
+
#if0
691
+
// In case of chained DMA, fractonal part is carried over from the last state
692
+
// TODO: do we need this? As far as I can tell from the VHDL, we don't. So let's delete this part, if I am sure.
693
+
source.addr_fract=source.addr&0xFF;
694
+
target.addr_fract=target.addr&0xFF;
695
+
#else
696
+
source.addr_fract=0;
697
+
target.addr_fract=0;
698
+
#endif
699
+
// TODO/FIXME: I should really overview if any param should be reset here, like fractional stepping, byte3 of length, etc ...
700
+
// To put it into another way: enhanced mode options are "sticky" and always remaining for the chained sessions?
681
701
} else {
682
702
DEBUGDMA("DMA: end of operation, no chained next one."NL);
0 commit comments