Skip to content

Commit 02b76c4

Browse files
committed
Patch for undocumented LAM behavior (and comments to make gcc whine less)
1 parent 2df1949 commit 02b76c4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/smd.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ void smd_clock_pulse(){
207207
SMD_Xfer_Mode = SMD_RCmd.Bus_Word_Mode;
208208
if(SMD_Xfer_Mode == 1 && ((SMD_Xfer_Addr.raw&0x01) != 0)){ SMD_Xfer_Mode = 0; } // Not on word boundary
209209
SMD_Controller_State++;
210+
// Falls thru
210211
case 2: // Read
211212
if(SMD_Xfer_Mode == 1){
212213
SMD_IOPB.hword[SMD_Xfer_Count>>1] = multibus_word_read(SMD_Xfer_Addr);
@@ -279,6 +280,11 @@ void smd_clock_pulse(){
279280

280281
// Process command
281282
switch(SMD_IOPB.Command){
283+
case 0x56: // Cold load / LAM does this for some reason.
284+
// TREATING THIS AS AN ERROR CORRUPTED MY DISK
285+
// Maybe it's read?
286+
logmsgf(LT_SMD,0,"SMD: LAM/COLD UNKNOWN COMMAND: Interpreting as READ\n");
287+
// Falls thru
282288
case 0x81: // READ
283289
SMD_Controller_State = 20; // READ SETUP
284290
break;
@@ -349,6 +355,7 @@ void smd_clock_pulse(){
349355
SMD_Xfer_Mode = 0; // Not on word boundary
350356
}
351357
SMD_Controller_State++;
358+
// Falls thru
352359
case 11: // OBTAIN UIB
353360
if(SMD_Xfer_Mode == 1){
354361
SMD_UIB[SMD_IOPB.Unit].hword[SMD_Xfer_Count>>1] =
@@ -389,7 +396,8 @@ void smd_clock_pulse(){
389396
SMD_Sector_Counter = 0;
390397
SMD_Xfer_Addr.raw = SMD_IOPB.Buffer_Address;
391398
SMD_Xfer_Size = SMD_IOPB.DMA_Burst_Size;
392-
SMD_Controller_State++; // Fall into
399+
SMD_Controller_State++;
400+
// Falls thru
393401
case 21: // DISK READ SECTOR
394402
switch(SMD_IOPB.Unit){
395403
case 0:
@@ -450,7 +458,7 @@ void smd_clock_pulse(){
450458
SMD_Xfer_Mode = SMD_IOPB.Buffer_WordMode;
451459
if(SMD_Xfer_Mode == 1 && ((SMD_Xfer_Addr.raw&0x01) != 0)){ SMD_Xfer_Mode = 0; } // Not on word boundary
452460
SMD_Controller_State++;
453-
// Fall into
461+
// Falls thru
454462
case 23: // Write Loop
455463
{
456464
uint16_t BurstOffset = SMD_Xfer_Size*SMD_Burst_Counter;
@@ -490,7 +498,7 @@ void smd_clock_pulse(){
490498
SMD_Controller_State = 23;
491499
break;
492500
}
493-
// FALL INTO
501+
// Falls thru
494502
case 26: // Operation completed
495503
if(SDU_disk_trace){
496504
logmsgf(LT_SMD,10,"SMD: READ OPERATION COMPLETE: 0x%X bursts, 0x%X sectors of %X completed.\n",
@@ -557,7 +565,7 @@ void smd_clock_pulse(){
557565
SMD_Controller_State = 31;
558566
break;
559567
}
560-
// FALL INTO
568+
// Falls thru
561569
case 35: // WRITE SECTOR
562570
switch(SMD_IOPB.Unit){
563571
case 0:
@@ -926,7 +934,7 @@ void smd_write(uint8_t addr,uint8_t data){
926934
case 4: // IOPB Base (lower)
927935
// Lisp does this; Don't know why.
928936
SMD_IOPB_Base.raw <<= 8; // Move the other two up
929-
// fall into
937+
// Falls thru
930938
case 3: // IOPB Base (lo)
931939
SMD_IOPB_Base.byte[0] = data;
932940
break;

0 commit comments

Comments
 (0)