Fixed ASCII code for comma

This commit is contained in:
Bill Chatfield 2017-09-07 15:24:17 -04:00
parent 8a4d621aa9
commit c9c749d393
4 changed files with 403 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Vim swap files
.*.swp
# Vim backup files
.*~
# Compiled Java
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Packaged Java components
*.jar
*.war
*.ear
# JVM crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# C development
*.exe
*.o
Debug/
Release/
# Mac
.DS_Store

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
# Compiles with https://www.brutaldeluxe.fr/products/crossdevtools/merlin/
#
ifeq ($(OS),Windows_NT)
MERLIN_DIR=C:/opt/Merlin32_v1.0
MERLIN_LIB=$(MERLIN_DIR)/Library
MERLIN=$(MERLIN_DIR)/Windows/Merlin32
RM=del /s
else
MERLIN_DIR=/opt/Merlin32_v1.0
MERLIN_LIB=$(MERLIN_DIR)/Library
MERLIN=$(MERLIN_DIR)/Windows/Merlin32
RM=rm -f
endif
AC=java -jar AppleCommander-1.3.5.14.jar
SRC=online.s
PGM=ONLINE
VOL=$(PGM)
DSK=$(PGM).dsk
$(DSK): $(PGM)
$(AC) -pro140 $(DSK) $(VOL)
$(AC) -p $(DSK) $(PGM) SYS < $(PGM)
$(PGM): $(SRC)
$(MERLIN) $(MERLIN_LIB) $(SRC)
clean:
$(RM) $(DSK) $(PGM)

1
_FileInformation.txt Normal file
View File

@ -0,0 +1 @@
ONLINE=Type(00),AuxType(0000),VersionCreate(70),MinVersion(BE),Access(E3),FolderInfo1(000000000000000000000000000000000000),FolderInfo2(000000000000000000000000000000000000)

344
online.s Normal file
View File

@ -0,0 +1,344 @@
********************************
* *
* ONLINE - LISTS ALL VOLUMES *
* *
* AUTHOR: BILL CHATFIELD *
* LICENSE: GPL2 *
* *
********************************
ORG $2000
DSK ONLINE
TYP $FF ;SYSTEM TYPE
********************************
* *
* CONSTANTS *
* *
********************************
DEBUG EQU 0
ONLCMD EQU $C5 ;ID FOR ON_LINE MLI SYSTEM CALL
RDKEY EQU $FD0C ;READS 1 CHAR
CROUT EQU $FD8E ;SUB TO OUTPUT CARRIAGE RETURN
COUT EQU $FDED ;SUB TO OUTPUT A CHARACTER
PRBYTE EQU $FDDA ;SUB TO PRINT ERROR MESSAGE
MLI EQU $BF00 ;ADDRESS OF MLI ENTRY POINT
BELL EQU $FF3A ;SUBROUTINE TO BEEP
MAXREC EQU 16 ;MAX RECS RETURNED BY ON_LINE
BUFPTR EQU 6 ;WILL USE ZERO PAGE 6 & 7
MSGADR EQU 8
RECLEN EQU $10 ;THAT'S 16 IN DECIMAL
********************************
* *
* MACROS *
* *
********************************
DO 0 ;TURN OFF ASSEMBLY FOR MACROS
********************************
* *
* PUTS *
* *
********************************
PUTS MAC
TYA ;PRESERVE Y
PHA
LDY #0 ;PREPARE LOOP INDEX
]NEXTCHR LDA ]1,Y ;LOAD A CHARACTER
CMP #0 ;CHECK FOR END OF STRING
BEQ FINISH
JSR COUT
INY
JMP ]NEXTCHR
FINISH PLA ;RESTORE Y
TAY
EOM
********************************
* *
* PAUSE *
* *
********************************
PAUSE MAC
PUTS DPAUSE
JSR RDKEY
JSR CROUT
EOM
ADD2ADDR MAC
LDA ]1
CLC
ADC ]2
STA ]1
BCC DONE
INC ]1+1
DONE EOM
FIN ;END OF MACROS
********************************
* *
* MAIN *
* *
********************************
MAIN
JSR MLI ;CALL MACHINE LANGUAGE INTERFACE
DB ONLCMD ;SPECIFY THE ON_LINE SYSTEM CALL
DA ONLARGS ;SPECIFY ADDRESS OF ARGUMENTS
BEQ CONTINUE ;ON_LINE RETURNS 0 ON SUCCESS
JMP ERROR
*
* COPY THE ADDRESS OF THE OUTPUT BUFFER INTO BUFPTR
*
CONTINUE LDA #<BUFFER ;PUT LOW BYTE INTO ACCUMULATOR
STA BUFPTR ;ASSIGN LOW BYTE TO BUFPTR
LDA #>BUFFER ;PUT HIGH BYTE INTO ACCUMULATOR
STA BUFPTR+1 ;ASSIGN HIGH BYTE TO BUFPTR
*
* LOOP TO PROCESS 16 RECORDS
*
RECLOOP LDA RECNUM
CMP #MAXREC
BNE :CHKLAST
JMP ENDPROG
:CHKLAST LDY #0
LDA (BUFPTR),Y
CMP #0 ;LAST REC IF FIRST BYTE IS 0
BNE FINDDRV
JMP ENDPROG
* FIND DRIVE NUMBER. IT IS SPECIFIED BY THE HIGH BIT OF
* THE FIRST BYTE IN THE RECORD. A ZERO SPECIFIES DRIVE 1.
* A ONE SPECIFIES DRIVE 2.
FINDDRV LDY #0 ;SETUP FOR LDA INDIRECT INDEXED
LDA (BUFPTR),Y ;LOAD FIRST BYTE INTO ACCUM
AND #%10000000 ;FOCUS ON THE HIGH BIT
CLC ;DON'T LET THE CARRY BIT WRAP
LSR ;SHIFT BITS TO THE RIGHT
LSR ;AGAIN
LSR ;AGAIN
LSR ;...
LSR
LSR
LSR ;BIT ZERO NOW SPECIFIES DRIVE
ADC #1 ;CONVERT BIT TO DRIVE NUMBER
STA DRIVENUM ;STORE THE RESULT
*
* FIND SLOT NUMBER
*
LDY #0 ;SETUP FOR NEXT OP
LDA (BUFPTR),Y ;LOAD FIRST BYTE INTO ACCUM
AND #%01110000 ;FOCUS ON BITS 4,5, AND 6
LSR ;SHIFT BITS TO THE RIGHT
LSR ;DO IT AGAIN
LSR ;DO IT AGAIN
LSR ;DO IT AGAIN
STA SLOTNUM ;BITS 0,1,2 NOW SPECIFY SLOT NUM
*
* FIND VOLUME NAME LENGTH
*
LDY #0 ;SETUP FOR NEXT OP
LDA (BUFPTR),Y ;LOAD FIRST BYTE OF REC INTO A
AND #%00001111 ;FOCUS ON LOWER 4 BITS
STA NAMELEN ;STORE THE RESULT
DO DEBUG
PUTS DNAMELEN
LDA NAMELEN
JSR PRBYTE
JSR CROUT
FIN
*
* PRINT SLOT AND DRIVE
*
PRTSLOT
LDA #"S" ;AN 'S' WITH HIGH BIT SET
JSR COUT ;WRITE 'S'
LDA SLOTNUM ;PUT SLOT NUM IN ACCUMULATOR
CLC ;CLEAR CARRY FLAG FOR ADDITION
ADC #$B0 ;CONVERT TO ASCII & SET HI BIT
JSR COUT ;PRINT SLOTNUM
LDA #$AC ;COMMA WITH HIGH BIT SET
JSR COUT ;WRITE COMMA
LDA #"D" ;A 'D' WITH HIGH BIT SET
JSR COUT ;WRITE 'D'
LDA DRIVENUM ;PUT DRIVE NUM IN ACCUMULATOR
CLC ;CLEAR CARRY FLAG FOR ADDITION
ADC #$B0 ;CONVERT TO ASCII & SET HI BIT
JSR COUT ;WRITE DRIVENUM CHARACTER
LDA #" " ;SPACE WITH HIGH BIT SET
JSR COUT ;WRITE SPACE CHARACTER
*
* CHECK FOR EMPTY VOLUME NAME
*
LDY #0
CPY NAMELEN ;CHECK FOR EMPTY NAME
BNE WRITEVOL ;CONTINUE IF IT IS NOT EMPTY
INY ;MOVE INDEX TO LOC OF ERROR CODE
LDA (BUFPTR),Y ;LOAD THE ERROR CODE
JSR WRITEERR
JSR CROUT
JMP INCREC
*
* PRINT THE VOLUME NAME
*
WRITEVOL LDA #"/" ;SLASH WITH HIGH BIT SET
JSR COUT ;WRITE SLASH CHARACTER
LDY #1 ;SET INDEX TO FIRST CHAR OF NAME
:NEXTCHR LDA (BUFPTR),Y ;LOAD CHAR INTO ACCUMULATOR
ORA #%10000000 ;TURN ON THE HIGH BIT FOR PRINT
JSR COUT ;WRITE A CHARACTER OF VOL NAME
CPY NAMELEN ;CHECK IF LAST CHARACTER
BEQ :DONEVOL ;EXIT LOOP IF DONE
INY ;INCREMENT Y REGISTER
JMP :NEXTCHR ;LOOP TO NEXT CHARACTER
:DONEVOL JSR CROUT ;WRITE A CARRIAGE RETURN
*
* BOTTOM OF RECLOOP
*
INCREC INC RECNUM ;INCREMENT CURRENT RECORD NUM
*
* ADD 16 TO THE ADDRESS IN BUFPTR
*
LDA BUFPTR ;LOAD THE LOW BYTE OF BUFPTR
CLC ;CLEAR CARRY BIT IN PREP FOR ADD
ADC #RECLEN ;ADD RECLEN TO LOW BYTE
STA BUFPTR ;STORE CALCULATED LOW BYTE
BCC :NOCARRY ;IF CARRY NOT SET THEN NEXT REC
INC BUFPTR+1 ;INC HIGH BYTE IF CARRY WAS SET
:NOCARRY
DO DEBUG
PAUSE
FIN
JMP RECLOOP ;LOOP TO NEXT RECORD
ENDPROG
RTS ;RETURN TO WHATEVER CALLED PROG
*
* ERROR HANDLER
*
ERROR
JSR WRITEERR
JSR BELL ;BEEP
JSR CROUT ;WRITE CARRIAGE RETURN
RTS ;RETURN TO WHATEVER CALL PROGRAM
********************************
* *
* SUB WRITEERR *
* ERROR CODE MUST BE IN ACCUM *
* *
********************************
WRITEERR
STA ERRCODE
LDX #0
LDY #0
:NEXTERR
DO DEBUG
PUTS DERRCODE
LDA ERRCODE
JSR PRBYTE
JSR CROUT
FIN
LDA ERRCODE
CMP ERRCODES,X
BEQ :FOUND
INX
INY
INY
CPX ERRCOUNT
BMI :NEXTERR
* UNKNOWN ERROR CODE
LDA #"("
JSR COUT
PUTS UNKECODE
LDA ERRCODE
JSR PRBYTE
LDA #")"
JSR COUT
JMP :ENDSUB
:FOUND LDA ERRMSGS,Y ;LOAD A WITH LOW BYTE OF MSG
STA MSGADR ;STORE LOW BYTE INTO LOCAL
INY ;ADVANCE TO HIGH BYTE
LDA ERRMSGS,Y ;LOAD A WITH HIGH BYTE OF MSG
STA MSGADR+1 ;STORE HIGH BYTE INTO LOCAL
DO DEBUG
PUTS DMSGADR
LDA MSGADR
JSR PRBYTE
JSR CROUT
FIN
LDA #"("
JSR COUT
PUTS (MSGADR) ;WRITE THE ERROR MESSAGE
LDA #")"
JSR COUT
:ENDSUB RTS
********************************
* *
* VARIABLES *
* *
********************************
BUFFER DS 256 ;SPACE FOR 16 DISK VOL RECORDS
ONLARGS DB 2 ;PARAMETER COUNT
DB 0 ;UNIT NUMBER, 0=ALL
DA BUFFER ;ADDRESS OF OUTPUT BUFFER
DRIVENUM DB 0 ;BYTE TO STORE DRIVENUM
SLOTNUM DB 0 ;BYTE TO STORE SLOTNUM
NAMELEN DB 0 ;LENGTH OF A VOLUME NAME
RECNUM DB 0 ;CURRENT RECORD NUMBER
ERRCODE DB 0
DNAMELEN ASC "NAMELEN=",00
DERRCODE ASC "ERRCODE=",00
DMSGADR ASC "MSGADR=",00
DPAUSE ASC "PRESS ANY KEY TO CONTINUE",00
UNKECODE ASC "UNKNOWN ERROR CODE: ",00
*
* ERROR MESSAGES
*
ERRCOUNT DB 8
ERR27 ASC "I/O ERROR",00
ERR28 ASC "DEVICE NOT CONNECTED",00
ERR2E ASC "DISK SWITCHED: FILE STILL OPEN ON OTHER DISK",00
ERR45 ASC "VOLUME DIRECTORY NOT FOUND",00
ERR52 ASC "NOT A PRODOS DISK",00
ERR55 ASC "VOLUME CONTROL BLOCK FULL",00
ERR56 ASC "BAD BUFFER ADDRESS",00
ERR57 ASC "DUPLICATE VOLUME",00
*
* ERROR CODE TO MESSAGE TRANSLATION TABLE
*
ERRCODES DB $27
DB $28
DB $2E
DB $45
DB $52
DB $55
DB $56
DB $57
ERRMSGS DA ERR27
DA ERR28
DA ERR2E
DA ERR45
DA ERR52
DA ERR55
DA ERR56
DA ERR57