Implemented *BUILD.

This commit is contained in:
Bobbi Webber-Manners 2022-11-02 23:56:29 -04:00
parent 3da7e82cc7
commit 634841df6d
4 changed files with 59 additions and 1 deletions

Binary file not shown.

View File

@ -209,7 +209,7 @@ BYTE00 BEQ BYTE00A ; OSBYTE 0,0 - generate error
RTS ; %000x1xxx host type, 'A'pple
BYTE00A BRK
DB $F7
HELLO ASC 'Applecorn MOS 2022-10-31-BOO!'
HELLO ASC 'Applecorn MOS 2022-11-02'
DB $00 ; Unify MOS messages
* TO DO: Move into RAM
GSSPEED DB $00 ; $80 if GS is fast, $00 for slow

View File

@ -28,6 +28,9 @@ CMDTABLE
CMDFILE ASC 'CAT' ; Must be first command so matches '*.'
DB $85
DW STARFSC-1 ; CAT -> FSC 5, XY=>params
ASC 'BUILD'
DB $81 ; TO DO
DW CMDBUILD-1 ; BUILD -> XY=>params
ASC 'CDIR'
DB $88
DW STARFILE-1 ; CDIR -> OSFILE 08, CBLK=>filename
@ -683,6 +686,60 @@ CMDDUMP BEQ ERRDUMP ; No filename
BCC :LOOP1
JMP TYPCLOSE ; Close and finish
* *BUILD (<afsp>)
* ---------------
* XY=>parameters string
*
CMDBUILD LDA #$80 ; A=OPENOUT, for writing
JSR OPENAFILE ; Try to open file
STA :FILENUM ; Stash file number
LDA #<:LINEBUF ; Pointer to line buffer
STA OSTEXT+0
LDA #>:LINEBUF
STA OSTEXT+1
LDA #80 ; Maximum line length
STA MAXLEN
LDA #32 ; Minimum allowable char
STA MINCHAR
LDA #126 ; Maximum allowable char
STA MAXCHAR
:RDLINE LDX #<:TEXT ; Display prompt
LDY #>:TEXT
JSR OSPRSTR
LDA #$00 ; OSWORD &00 input line from console
LDX #<OSTEXT ; XY -> control block
LDY #>OSTEXT
JSR OSWORD ; Read line from console
BCS :CLOSE ; Escape pressed
INY ; Include the carriage return
STY :LINELEN ; Number of chars read
JSR :BUILDLN ; Write one line to disk
BRA :RDLINE
:CLOSE
* JSR :BUILDLN ; Write one line to disk
JSR OSNEWL
LDA #$00 ; A=CLOSE
LDY :FILENUM ; Recover file number
JSR OSFIND ; Close build file
RTS
* Helper function for CMDBUILD
* Writes a single line from LINEBUF -> disk
:BUILDLN LDX #$00
:L1 CPX :LINELEN
BEQ :DONELN
LDA :LINEBUF+1,X
LDY :FILENUM ; Recover file number
JSR OSBPUT ; Write char to file
INX
BRA :L1
:DONELN RTS
:TEXT ASC 'Build> '
:LINEBUF DS 81 ; 80 char line plus CR
:LINELEN DB $00 ; Line length excluding CR
:FILENUM DB $00 ; File handle
* *SPOOL (<afsp>)
* ---------------
* XY=>parameters string, EQ=no parameters

View File

@ -440,6 +440,7 @@ ENSQISR INC SYSCLOCK+0 ; Increment system clock
PHY ; Frequency
JSR REMAUDIO ; Remove dur byte from queue
TYA ; Duration
DEC A ; EXPERIMENT
STA CHANTIMES,X
PLA ; Recover frequency
STA CURRPITCH,X ; Store for pitch envelope