Improve ROM boot

This commit is contained in:
dschmenk 2014-02-15 19:53:09 -08:00
parent 14b8ff2e11
commit 6cc5e45424
3 changed files with 112 additions and 82 deletions

8
debian/changelog vendored
View File

@ -1,3 +1,9 @@
a2pi (0.1.8-5) unstable; urgency=low
* Stabilize request/pidrive interaction
-- David Schmenk <dschmenk@gmail.com> Sat, 15 Feb 2014 13:15:00 -0800
a2pi (0.1.8-4) unstable; urgency=low
* Fix FUSE create file function
@ -5,7 +11,7 @@ a2pi (0.1.8-4) unstable; urgency=low
* Fix recursive call request (FUSE mount w/ pidrive active)
* Fix symlinks for A2VDx.PO updating
* Add UTILS.PO image for comms programs and file manipulation
* Run PIDRIVE from STARTUP:wq
* Run PIDRIVE from STARTUP
-- David Schmenk <dschmenk@gmail.com> Tue, 13 Feb 2014 15:31:23 -0800

View File

@ -78,16 +78,47 @@ PDWRPRT EQU $2B
;*
;* INIT ACIA
;*
STY PAD1 ; CLEAR SYNCED FLAG
STY ACIASR ; RESET STATUS REGISTER
LDY #$0B
STY ACIACR ; SET CONTROL REGISTER
LDY #$10
STY ACIAMR ; SET COMMAND REGISTER (115K BAUD)
LDA #$0B
STA ACIACR ; SET CONTROL REGISTER
LDA #$10
STA ACIAMR ; SET COMMAND REGISTER (115K BAUD)
;*
;* CREATE COMMAND BUFFER FOR BOOT BLOCK
;*
STY PDUNIT
STY PDBUFL
STY PDBLKL
STY PDBLKH
INY ; LDY #PDREAD
STY PDCMD
LDY #$08
STY PDBUFH
JSR DOCMD
BCC BOOT
LDA $00
BEQ CONT
RTS
CONT: JMP $FABA ; JUMP BACK TO AUTOSTART BOOT SCANNER ROM
BOOT: LDX #BOOTDEV
STX PDUNIT
JMP $801
;*
;* PRODOS INTELLIGENT DEVICE ENTRYPOINT
;*
DOCMD: PHP
SEI
LDA PAD1
CMP #$81
BEQ SNDCMD
;*
;* SYNC WITH HOST
;*
SYNC: LDA #$80
STA ACIADR
LDA INDCTR
PHA
INX
TXA
AND #$07
@ -96,51 +127,27 @@ SYNC: LDA #$80
STA INDCTR
LDA #$FF
JSR WAIT
LDA #$A0
PLA
STA INDCTR
LDA KEYBD
BMI SKIPBOOT
LDA ACIASR
BPL CHKRSP
STA STROBE
BMI IOERR
SPIN: DB $A1, $AF, $AD, $DC, $A1, $AF, $AD, $DC
CHKRSP: LDA ACIASR
AND #$08
BEQ SYNC
LDY ACIADR
CPY #$81
LDA ACIADR
CMP #$81
BNE SYNC
BEQ BOOT
SPIN: DB $A1, $AF, $AD, $DC, $A1, $AF, $AD, $DC
SKIPBOOT: STA STROBE
LDA $00
BNE NOAUTO
JMP $FABA ; JUMP BACK TO AUTOSTART BOOT SCANNER ROM
NOAUTO: RTS
;*
;* CREATE COMMAND BUFFER FOR BOOT BLOCK
;*
BOOT: LDY #PDREAD
STY PDCMD
;LDA #$08
STA PDBUFH
LDX #BOOTDEV
STX PDUNIT
LDA #$00
STA PDBUFL
STA PDBLKL
STA PDBLKH
JSR DOCMD
LDX #BOOTDEV
JMP $801
;*
;* PRODOS INTELLIGENT DEVICE ENTRYPOINT
;*
DOCMD: LDA PDUNIT
STA PAD1
SNDCMD: LDA PDUNIT
ASL
LDA PDCMD
ROL
ASL
ORA #$A0
PHP
STA PAD0
SEI
JSR SENDACC
LDA PDBLKL
JSR SENDACC
@ -207,6 +214,6 @@ ENDCMD:
.ENDREP
DB "Pi"
DW 0
DB $A7
DB $97
DB <DOCMD
.ASSERT * = $C000+(ROMSLOT+1)*256, error, "Code not page size"

View File

@ -589,21 +589,6 @@ void main(int argc, char **argv)
gpclk(271); /* divisor for ~1.8 MHz => (500/271) MHz */
sleep(1); /* give clock chance to settle down */
#endif
/*
* Open socket.
*/
prlog("a2pid: Open server socket\n");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(6551);
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
srvfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (srvfd < 0)
die("error: socket create");
if (bind(srvfd,(struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
die("error: bind socket");
if (listen(srvfd, MAX_CLIENT - 1) < 0)
die("error: listen socket");
/*
* Open serial port.
*/
@ -645,6 +630,21 @@ void main(int argc, char **argv)
}
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
tcsetattr(a2fd, TCSANOW, &newtio);
/*
* Open socket.
*/
prlog("a2pid: Open server socket\n");
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(6551);
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
srvfd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (srvfd < 0)
die("error: socket create");
if (bind(srvfd,(struct sockaddr *)&servaddr, sizeof(servaddr)) < 0)
die("error: bind socket");
if (listen(srvfd, MAX_CLIENT - 1) < 0)
die("error: listen socket");
/*
* Come basck here on RESET.
*/
@ -791,6 +791,7 @@ reset:
state = RESET;
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
tcsetattr(a2fd, TCSANOW, &newtio);
a2reqlist->type |= AWAIT_COMPLETE;
}
else
state = RESET;
@ -829,7 +830,11 @@ reset:
iopkt[0] = vdrvstatus((iopkt[0] >> 1) & 0x01);
write(a2fd, iopkt, 1);
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
write(a2fd, &(a2reqlist->type), 1);
{
iopkt[0] = a2reqlist->type;
write(a2fd, iopkt, 1);
printf("vdrive: status resend request %04X\n", a2reqlist->type);
}
break;
case 0xA4: /* virtual drive 1 READ call */
case 0xA6: /* virtual drive 2 READ call */
@ -839,7 +844,11 @@ reset:
iopkt[0] = vdrvread(a2fd, (iopkt[0] >> 1) & 0x01, iopkt[1] | (iopkt[2] << 8));
write(a2fd, iopkt, 1);
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
write(a2fd, &(a2reqlist->type), 1);
{
iopkt[0] = a2reqlist->type;
write(a2fd, iopkt, 1);
printf("vdrive: read resend request %04X\n", a2reqlist->type);
}
break;
case 0xA8: /* virtual drive 1 WRITE call */
case 0xAA: /* virtual drive 2 WRITE call */
@ -853,15 +862,23 @@ reset:
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
tcsetattr(a2fd, TCSANOW, &newtio);
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
write(a2fd, &(a2reqlist->type), 1);
{
iopkt[0] = a2reqlist->type;
write(a2fd, iopkt, 1);
printf("vdrive: write resend request %04X\n", a2reqlist->type);
}
break;
case 0xAC: /* virtual clock TIME call */
//printf("vclock: TIME\n");
iopkt[3] = 0xAD; /* ack */
write(a2fd, &iopkt[3], 1);
iopkt[0] = 0xAD; /* ack */
write(a2fd, iopkt, 1);
write(a2fd, prodos_time(), 4);
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
write(a2fd, &(a2reqlist->type), 1);
{
iopkt[0] = a2reqlist->type;
write(a2fd, iopkt, 1);
printf("vclock: resend request %04X\n", a2reqlist->type);
}
break;
default:
prlog("a2pid: Unknown Event\n");