Skip to content

Commit 5407544

Browse files
committed
PDP11: RP11-C (RP02/03) disk implementation
1 parent 645ea51 commit 5407544

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

PDP11/pdp11_rr.c

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ static MTAB rr_mod[] = {
474474

475475
DEVICE rr_dev = {
476476
"RR", rr_unit, rr_reg, rr_mod, RP_NUMDR,
477-
8/*address radix*/, 24/*address width*/, 1/*address increment*/,
478-
8/*data radix*/, RPWRDSZ/*data width*/,
477+
DEV_RDX/*address radix*/, 26/*address width*/, 1/*address increment*/,
478+
DEV_RDX/*data radix*/, RPWRDSZ/*data width*/,
479479
NULL/*examine()*/, NULL/*deposit()*/,
480480
rr_reset, rr_boot, rr_attach, rr_detach,
481481
&rr_dib,
@@ -535,10 +535,10 @@ static t_stat rr_rd (int32 *data, int32 PA, int32 access)
535535
uptr = rr_dev.units + GET_DRIVE(rpcs); /* selected unit */
536536
rpds &= RPDS_ATTN; /* attention bits */
537537
if (!(uptr->flags & UNIT_DIS)) { /* not disabled? */
538+
rpds |= RPDS_ONLN;
538539
if (GET_DTYPE(uptr->flags))
539540
rpds |= RPDS_RP03;
540541
if (uptr->flags & UNIT_ATT) { /* attached? */
541-
rpds |= RPDS_ONLN;
542542
if (uptr->flags & UNIT_WPRT) /* write locked? */
543543
rpds |= RPDS_WLK;
544544
if (uptr->SEEKING) /* still seeking? */
@@ -1189,9 +1189,57 @@ static t_stat rr_set_wloa (UNIT *uptr, int32 val, CONST char *cptr, void *desc)
11891189

11901190
/* Device bootstrap */
11911191

1192+
#define BOOT_START 02000 /* start */
1193+
#define BOOT_ENTRY (BOOT_START + 002) /* entry */
1194+
#define BOOT_UNIT (BOOT_START + 010) /* unit number */
1195+
#define BOOT_CSR (BOOT_START + 014) /* CSR + 12 */
1196+
#define BOOT_LEN (sizeof (rr_boot_rom) / sizeof (rr_boot_rom[0]))
1197+
1198+
static const uint16 rr_boot_rom[] = {
1199+
/* EXPECTED M9312 REGISTER USE FOR BOOT PROMS: *
1200+
* R0 = UNIT NUMBER *
1201+
* R1 = CONTROLLER CSR *
1202+
* R2, R3 = TEMPORARIES *
1203+
* R4 = ALWAYS POINTS TO PROM BASE + 20 (HELPS LOCATE BOOTED DEVICE DESIGNATION) *
1204+
* R5 = LAST COMMAND DATA (E.G. LOAD ADDR, EXAM DATA; OTHERWISE, JUNK) *
1205+
* R6(SP) = PC OF THE COMMAND START (IN M9312 POINTS TO WHERE THE BOOT COMMAND ORIGINATED FROM) */
1206+
/* .TITLE RP11 BOOT M9312 STYLE - TONY LAWRENCE (C) 2023 */
1207+
/* .ASECT */
1208+
/* 002000 .=2000 */
1209+
/* 002000 */ 0042120, /* START: .WORD "PD ; "DP" (DEVICE DESIGNATION) */
1210+
/* 002002 */ 0012706, BOOT_ENTRY, /* BOOT: MOV #BOOT, SP ; ENTRY POINT PC */
1211+
/* 002006 */ 0112700, 0000000, /* MOVB #0, R0 ; UNIT NUMBER */
1212+
/* 002012 */ 0012701, 0176726, /* MOV #176726, R1 ; RPCS + 12 */
1213+
/* 002016 */ 0012704, BOOT_START+020, /* MOV #<START+20>, R4 ; BACKLINK TO ROM W/OFFSET 20 */
1214+
/* 002022 */ 0005041, /* CLR -(R1) ; DISK ADDRESS */
1215+
/* 002024 */ 0005041, /* CLR -(R1) ; CYLINDER ADDRESS */
1216+
/* 002026 */ 0005041, /* CLR -(R1) ; MEMORY ADDRESS */
1217+
/* 002030 */ 0012741, 0177000, /* MOV #-512., -(R1) ; WORD COUNT */
1218+
/* 002034 */ 0010003, /* MOV R0, R3 */
1219+
/* 002036 */ 0000303, /* SWAB R3 ; MOVE UNIT# INTO POSITION */
1220+
/* 002040 */ 0052703, 0000005, /* BIS #5, R3 ; COMBINE READ+GO FUNCTION */
1221+
/* 002044 */ 0010341, /* MOV R3, -(R1) ; DO IT! */
1222+
/* 002046 */ 0005005, /* CLR R5 ; M9312 USES FOR DISPLAY */
1223+
/* 002050 */ 0105711, /* 1$: TSTB (R1) ; READY? */
1224+
/* 002052 */ 0100376, /* BPL 1$ ; BR IF NOT */
1225+
/* 002054 */ 0005711, /* TST (R1) ; ERROR? */
1226+
/* 002056 */ 0100002, /* BPL 2$ ; BR IF NOT */
1227+
/* 002060 */ 0000005, /* RESET */
1228+
/* 002062 */ 0000747, /* BR BOOT ; START OVER */
1229+
/* 002064 */ 0105011, /* 2$: CLRB (R1) ; CLEAR CONTROLLER */
1230+
/* 002066 */ 0005007 /* CLR PC ; JUMP TO BOOTSTRAP */
1231+
/* .END */
1232+
};
1233+
11921234
static t_stat rr_boot (int32 unitno, DEVICE *dptr)
11931235
{
1194-
return SCPE_NOFNC;
1236+
size_t i;
1237+
for (i = 0; i < BOOT_LEN; ++i)
1238+
WrMemW(BOOT_START + (2 * i), rr_boot_rom[i]);
1239+
WrMemW(BOOT_UNIT, unitno & (RP_NUMDR - 1));
1240+
WrMemW(BOOT_CSR, (rr_dib.ba & DMASK) + (014/*CSR*/ + 012));
1241+
cpu_set_boot(BOOT_ENTRY);
1242+
return SCPE_OK;
11951243
}
11961244

11971245
/* Misc */

0 commit comments

Comments
 (0)