mirror of
https://github.com/dschmenk/apple2pi.git
synced 2024-11-24 12:31:30 +00:00
Improve ROM boot
This commit is contained in:
parent
14b8ff2e11
commit
6cc5e45424
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -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
|
a2pi (0.1.8-4) unstable; urgency=low
|
||||||
|
|
||||||
* Fix FUSE create file function
|
* 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 recursive call request (FUSE mount w/ pidrive active)
|
||||||
* Fix symlinks for A2VDx.PO updating
|
* Fix symlinks for A2VDx.PO updating
|
||||||
* Add UTILS.PO image for comms programs and file manipulation
|
* 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
|
-- David Schmenk <dschmenk@gmail.com> Tue, 13 Feb 2014 15:31:23 -0800
|
||||||
|
|
||||||
|
@ -78,16 +78,47 @@ PDWRPRT EQU $2B
|
|||||||
;*
|
;*
|
||||||
;* INIT ACIA
|
;* INIT ACIA
|
||||||
;*
|
;*
|
||||||
|
STY PAD1 ; CLEAR SYNCED FLAG
|
||||||
STY ACIASR ; RESET STATUS REGISTER
|
STY ACIASR ; RESET STATUS REGISTER
|
||||||
LDY #$0B
|
LDA #$0B
|
||||||
STY ACIACR ; SET CONTROL REGISTER
|
STA ACIACR ; SET CONTROL REGISTER
|
||||||
LDY #$10
|
LDA #$10
|
||||||
STY ACIAMR ; SET COMMAND REGISTER (115K BAUD)
|
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 WITH HOST
|
||||||
;*
|
;*
|
||||||
SYNC: LDA #$80
|
SYNC: LDA #$80
|
||||||
STA ACIADR
|
STA ACIADR
|
||||||
|
LDA INDCTR
|
||||||
|
PHA
|
||||||
INX
|
INX
|
||||||
TXA
|
TXA
|
||||||
AND #$07
|
AND #$07
|
||||||
@ -96,51 +127,27 @@ SYNC: LDA #$80
|
|||||||
STA INDCTR
|
STA INDCTR
|
||||||
LDA #$FF
|
LDA #$FF
|
||||||
JSR WAIT
|
JSR WAIT
|
||||||
LDA #$A0
|
PLA
|
||||||
STA INDCTR
|
STA INDCTR
|
||||||
LDA KEYBD
|
LDA KEYBD
|
||||||
BMI SKIPBOOT
|
BPL CHKRSP
|
||||||
LDA ACIASR
|
STA STROBE
|
||||||
|
BMI IOERR
|
||||||
|
SPIN: DB $A1, $AF, $AD, $DC, $A1, $AF, $AD, $DC
|
||||||
|
CHKRSP: LDA ACIASR
|
||||||
AND #$08
|
AND #$08
|
||||||
BEQ SYNC
|
BEQ SYNC
|
||||||
LDY ACIADR
|
LDA ACIADR
|
||||||
CPY #$81
|
CMP #$81
|
||||||
BNE SYNC
|
BNE SYNC
|
||||||
BEQ BOOT
|
STA PAD1
|
||||||
SPIN: DB $A1, $AF, $AD, $DC, $A1, $AF, $AD, $DC
|
SNDCMD: LDA PDUNIT
|
||||||
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
|
|
||||||
ASL
|
ASL
|
||||||
LDA PDCMD
|
LDA PDCMD
|
||||||
ROL
|
ROL
|
||||||
ASL
|
ASL
|
||||||
ORA #$A0
|
ORA #$A0
|
||||||
PHP
|
|
||||||
STA PAD0
|
STA PAD0
|
||||||
SEI
|
|
||||||
JSR SENDACC
|
JSR SENDACC
|
||||||
LDA PDBLKL
|
LDA PDBLKL
|
||||||
JSR SENDACC
|
JSR SENDACC
|
||||||
@ -207,6 +214,6 @@ ENDCMD:
|
|||||||
.ENDREP
|
.ENDREP
|
||||||
DB "Pi"
|
DB "Pi"
|
||||||
DW 0
|
DW 0
|
||||||
DB $A7
|
DB $97
|
||||||
DB <DOCMD
|
DB <DOCMD
|
||||||
.ASSERT * = $C000+(ROMSLOT+1)*256, error, "Code not page size"
|
.ASSERT * = $C000+(ROMSLOT+1)*256, error, "Code not page size"
|
59
src/a2pid.c
59
src/a2pid.c
@ -589,21 +589,6 @@ void main(int argc, char **argv)
|
|||||||
gpclk(271); /* divisor for ~1.8 MHz => (500/271) MHz */
|
gpclk(271); /* divisor for ~1.8 MHz => (500/271) MHz */
|
||||||
sleep(1); /* give clock chance to settle down */
|
sleep(1); /* give clock chance to settle down */
|
||||||
#endif
|
#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.
|
* Open serial port.
|
||||||
*/
|
*/
|
||||||
@ -645,6 +630,21 @@ void main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
|
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
|
||||||
tcsetattr(a2fd, TCSANOW, &newtio);
|
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.
|
* Come basck here on RESET.
|
||||||
*/
|
*/
|
||||||
@ -791,6 +791,7 @@ reset:
|
|||||||
state = RESET;
|
state = RESET;
|
||||||
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
|
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
|
||||||
tcsetattr(a2fd, TCSANOW, &newtio);
|
tcsetattr(a2fd, TCSANOW, &newtio);
|
||||||
|
a2reqlist->type |= AWAIT_COMPLETE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
state = RESET;
|
state = RESET;
|
||||||
@ -829,7 +830,11 @@ reset:
|
|||||||
iopkt[0] = vdrvstatus((iopkt[0] >> 1) & 0x01);
|
iopkt[0] = vdrvstatus((iopkt[0] >> 1) & 0x01);
|
||||||
write(a2fd, iopkt, 1);
|
write(a2fd, iopkt, 1);
|
||||||
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
|
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;
|
break;
|
||||||
case 0xA4: /* virtual drive 1 READ call */
|
case 0xA4: /* virtual drive 1 READ call */
|
||||||
case 0xA6: /* virtual drive 2 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));
|
iopkt[0] = vdrvread(a2fd, (iopkt[0] >> 1) & 0x01, iopkt[1] | (iopkt[2] << 8));
|
||||||
write(a2fd, iopkt, 1);
|
write(a2fd, iopkt, 1);
|
||||||
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
|
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;
|
break;
|
||||||
case 0xA8: /* virtual drive 1 WRITE call */
|
case 0xA8: /* virtual drive 1 WRITE call */
|
||||||
case 0xAA: /* virtual drive 2 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 */
|
newtio.c_cc[VMIN] = 3; /* blocking read until 3 chars received */
|
||||||
tcsetattr(a2fd, TCSANOW, &newtio);
|
tcsetattr(a2fd, TCSANOW, &newtio);
|
||||||
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
|
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;
|
break;
|
||||||
case 0xAC: /* virtual clock TIME call */
|
case 0xAC: /* virtual clock TIME call */
|
||||||
//printf("vclock: TIME\n");
|
//printf("vclock: TIME\n");
|
||||||
iopkt[3] = 0xAD; /* ack */
|
iopkt[0] = 0xAD; /* ack */
|
||||||
write(a2fd, &iopkt[3], 1);
|
write(a2fd, iopkt, 1);
|
||||||
write(a2fd, prodos_time(), 4);
|
write(a2fd, prodos_time(), 4);
|
||||||
if (a2reqlist && !(a2reqlist->type & AWAIT_COMPLETE)) /* resend last request */
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
prlog("a2pid: Unknown Event\n");
|
prlog("a2pid: Unknown Event\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user