Skip to content

Commit

Permalink
Allow SUBMIT.COM to work with CCP, not just CCPZ
Browse files Browse the repository at this point in the history
This pull-request closes #91 by allowing SUBMIT.COM to run correctly
under out default CCP.

I started out by comparing the handling of the BATCH-processing with
the "original CCP".  That lead to using some labels and breaking down
the FCB structure into commented fields.

However pretty quickly I realized the actual issue was related to
testing the console.  In the original z80-playground CCP the code
for testing for pending input read:

```

;   Routine to check the console for a key pressed. The zero
; flag is set is none, else the character is returned in (A).
;
CHKCON:	LD	C,11		;check console.
	CALL	ENTRY
	OR	A
	RET	Z		;return if nothing.
	LD	C,1		;else get character.
	CALL	ENTRY
	OR	A		;clear zero flag and return.
	RET
```

However in my fork, for some unknown reason, it read:

```

CHKCON:	LD      A, FF
	OR	A		;clear zero flag and return.
	RET
```

i.e. It would always decide there was a pending character to
be read on STDIN, and that would _cancel_ the batch-processing.

To resolve the failure it seemed like removing `CHKCON` entirely
was the way to go.  Our BDOS functions fake pending-input anyway,
and nobody would press a key quickly enough to stop the processing
of a SUBMIT-generated `$$$.SUB` file on-boot.

TLDR; we aborted processing because we imagined pending console input
was present, even though it wasn't.
  • Loading branch information
skx committed May 23, 2024
1 parent e45ea68 commit a7b6a63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions ccp/DR.ASM
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ GETINP:
LD DE,BATCHFCB
CALL OPEN ;look for it.
JP Z,GETINP1 ;if not there, use normal input.
LD A,(BATCHFCB+15) ;get last record number+1.
DEC A
LD (BATCHFCB+32),A
LD A,(subrc) ;get last record number+1.
DEC A ;
LD (subcr),A
LD DE,BATCHFCB
CALL RDREC ;read last record.
JP NZ,GETINP1 ;quit on end of file.
Expand All @@ -286,7 +286,7 @@ GETINP:
LD HL,TBUFF ;data was read into buffer here.
LD B,128 ;all 128 characters may be used.
CALL HL2DE ;(HL) to (DE), (B) bytes.
LD HL,BATCHFCB+14
LD HL,submod
LD (HL),0 ;zero out the 's2' byte.
INC HL ;and decrement the record count.
DEC (HL)
Expand All @@ -301,7 +301,6 @@ GETINP:
;
LD HL,INBUFF+2
CALL PLINE2
CALL CHKCON ;check console, quit on a key.
JP Z,GETINP2 ;jump if no key is pressed.
;
; Terminate the submit job on any keyboard input. Delete this
Expand Down Expand Up @@ -339,13 +338,6 @@ GETINP4:LD (HL),A ;add trailing null.
LD (INPOINT),HL ;reset input line pointer.
RET
;
; Routine to check the console for a key pressed. The zero
; flag is set is none, else the character is returned in (A).
;
CHKCON: LD A, FF
OR A ;clear zero flag and return.
RET
;
; Routine to get the currently active drive number.
;
GETDSK: LD C,25
Expand Down Expand Up @@ -879,8 +871,6 @@ DRECT65:
DIRECT7:
POP AF ;get the next file name.
DIRECT8:
;CALL CHKCON ;first check console, quit on anything.
;JP NZ,DIRECT9
CALL SRCHNXT ;get next name.
JP DIRECT3 ;and continue with our list.
DIRECT9:
Expand Down Expand Up @@ -1287,7 +1277,21 @@ CCPSTACK:
; Batch (or SUBMIT) processing information storage.
;
BATCH: DEFB 0 ;batch mode flag (0=not active).
BATCHFCB: DEFB 0,'$$$ SUB',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
BATCHFCB:
DEFB 0 ; drive
DEFB '$$$ SUB' ; name + ext
DEFB 0 ; ex
DEFB 0 ; s1
submod:
DEFB 0 ; s2
subrc:
DEFB 1 ; rc
DEFB 0,0,0,0 ,0,0,0,0, 0,0,0,0, 0,0,0,0 ; Al
subcr:
DEFB 1 ; CR
DEFB 0 ; r0
DEFB 0 ; r1
DEFB 0 ; r2
;
; File control block setup by the CCP.
;
Expand Down
Binary file modified ccp/DR.BIN
Binary file not shown.

0 comments on commit a7b6a63

Please sign in to comment.