skx / cpmulator

Golang CP/M emulator for zork, Microsoft BASIC, Turbo Pascal, Wordstar, lighthouse-of-doom, etc
MIT License
98 stars 3 forks source link

Allow SUBMIT.COM to work with CCP, not just CCPZ #92

Closed skx closed 5 months ago

skx commented 5 months ago

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.