CCP accepts upper or lower case input

This commit is contained in:
Bobbi Webber-Manners 2019-10-25 10:43:09 -04:00
parent f2270d2049
commit a6db61fd0f
3 changed files with 21 additions and 3 deletions

View File

@ -1888,15 +1888,12 @@ N2H2 OR 0F0H ;
; - FILENAME.COM - Load and run FILENAME.COM at 0100H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TODO: Only A: drive seems to work properly for now
; TODO: Upper-case all characters from console!!
; TODO: Implement the built-in commands using a table
; TODO: Built-in commands argument handling
; TODO: Parse * wildcard and generate FCB with ?s
; TODO: Command tail -> 080F buffer
; TODO: Build default FCB1 and 2 from args, if present
; TODO: Improve .COM loading (allow drive to be specified)
; TODO: Right now programs do not load from drives other than A:
; Get a line of text from the console & handle it
CCP
@ -1912,6 +1909,10 @@ CCPL1 LD A,(CURDRV) ; Get current drive & user number
LD A,120 ; Max line length
LD (DE),A ; Stored in first char of buffer
CALL C_READSTR ; Get a line from the user
LD H,D ; DE->HL
LD L,E ; ...
INC HL ; Skip over capacity byte
CALL UCASE ; Convert buffer to uppercase
LD A,(FILEBUF+1) ; Number of chars entered
CP 0 ; If none ...
@ -1987,6 +1988,23 @@ CCPS4
JP CCP ; Go again
; Convert input buffer to uppercase
; HL points to Pascal-style string (length byte first)
UCASE LD C,(HL) ; Length of string
UCL1 LD A,C ; See if any chars are left
CP 0 ; ...
RET Z ; If 0, we are done
INC HL ; Advance to next char
DEC C ; Decrement count remaining
LD A,(HL) ; Get char from buffer
CP 'z' ; Compare with ASCII 'z'
JP NC,UCS1 ; If >'z' nothing to do
CP 'a'-1 ; Compare with char before ASCII 'a'
JP C,UCS1 ; If <='a'-1 then nothing to do
SUB 'a'-'A' ; Convert to upper case
UCS1 LD (HL),A ; Put converted char back
JP UCL1 ; Loop
; Load and run a .COM file to 0100H
; DE is the address of the FCB describing the file to run
RUNCOM CALL F_OPEN ;

Binary file not shown.

Binary file not shown.