File tree 2 files changed +9
-10
lines changed
2 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -471,24 +471,21 @@ static void pre_exec_recalibrate(void) {
471
471
472
472
// We don't have to actually move the head. The drive is immediately ready
473
473
int_status = true;
474
+ // Update the status register with the drive info and the seek end flag
475
+ status_register [ST0 ] = drive ;
474
476
}
475
477
476
478
// Sense interrupt:
477
479
static void post_exec_sense_interrupt (void ) {
478
- // TODO(giuliof): last accessed drive
479
- uint8_t drive = 0 ;
480
+ // Last accessed drive number is in ST0
481
+ uint8_t drive = status_register [ ST0 ] & FDC_ST0_US ;
480
482
481
483
// After reading interrupt status, ready can be deasserted
482
484
int_status = false;
483
485
484
486
LOG_DEBUG ("FDC Sense Interrupt\n" );
485
487
/* Status Register 0 */
486
- // Drive number
487
- result [0 ] = drive ;
488
- // head address (last addressed) - TODO(giulio)
489
- // result[0] |= ...;
490
- // Seek End - TODO(giulio)
491
- result [0 ] |= FDC_ST0_SE ;
488
+ result [0 ] = status_register [ST0 ] | FDC_ST0_SE ;
492
489
/* PCN - (current track position) */
493
490
result [1 ] = track [drive ];
494
491
}
@@ -617,6 +614,8 @@ static void pre_exec_seek(void) {
617
614
618
615
// We don't have to actually move the head. The drive is immediately ready
619
616
int_status = true;
617
+ // Update the status register with the drive info and the seek end flag
618
+ status_register [ST0 ] = drive ;
620
619
}
621
620
622
621
/* * * * * * * * * * * * * * * Utility routines * * * * * * * * * * * * * * */
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ Test(ceda_fdc, seekCommand) {
113
113
assert_fdc_sr (FDC_ST_RQM | FDC_ST_CB );
114
114
115
115
// First argument is number of drive
116
- fdc_out (FDC_ADDR_DATA_REGISTER , 0x00 );
116
+ fdc_out (FDC_ADDR_DATA_REGISTER , 0x02 );
117
117
// Second argument is cylinder position
118
118
fdc_out (FDC_ADDR_DATA_REGISTER , 5 );
119
119
@@ -132,7 +132,7 @@ Test(ceda_fdc, seekCommand) {
132
132
133
133
// First response byte is SR0 with interrupt code = 0 and Seek End = 1
134
134
data = fdc_in (FDC_ADDR_DATA_REGISTER );
135
- cr_expect_eq (data , FDC_ST0_SE );
135
+ cr_expect_eq (data , FDC_ST0_SE | 2 );
136
136
137
137
// FDC has another byte of response
138
138
assert_fdc_sr (FDC_ST_RQM | FDC_ST_DIO | FDC_ST_CB );
You can’t perform that action at this time.
0 commit comments