home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Usage: PSID2DBase <filename>
- **
- ** $VER: PSID2DBase.rexx 1.0 (6.7.94)
- **
- ** Created on Wednesday 06-Jul-94 06:36:11 by Ulf Diabelez Harries
- **
- ** This script extracts Song-info from PlaySID One-Part files and
- ** displays them in SuperBase ASCII Delimited format in your console window.
- ** To be at any use at all, you'll have to re-direct the output and write
- ** a script to handle it; or use a program like Directory Opus.
- **
- ** Example:
- **
- ** You could use it with Directory Opus by configurating a button like
- **
- ** |AmigaDOS| |rx REXX:PSID2DBase.rexx {f} >>SBData:PlaySIDMusic.Asc|
- **
- ** and selecting the flags "Do all files" and "Recursive Directories".
- */
-
- OPTIONS RESULTS
-
- IF ARG() = 0 THEN DO /* If no arguments */
- SAY "Usage: PSID2DBase <filename>" /* display usage */
- EXIT /* and exit */
- END
-
- PARSE ARG in_name
- SourceName = COMPRESS(in_name,'"') /* Remove eventual " in filename */
- NULL = "00"X
-
- IF SourceName = '?' THEN DO /* If argument = ? */
- SAY "Usage: PSID2DBase <filename>" /* display usage */
- EXIT /* and exit */
- END
-
- IF ~EXISTS(SourceName) THEN DO /* Check if file exists */
- SAY 'Unable to locate file: "'SourceName'"'
- EXIT
- END
-
- /************************* Extract PlaySID infos *************************/
-
- CALL OPEN(f,SourceName,R) /* Open file */
-
- line = READCH(f,8) /* Read the first 8 chars in file */
- filetype = C2X(line) /* and convert them to Hex */
-
- IF filetype ~= '5053494400010076' THEN DO /* Check if file is PSID */
- SAY 'File "'SourceName'" is not a PlaySID One-Part file.'
- CALL CLOSE(f)
- EXIT
- END
-
- Playaddress = READCH(f,6) /* Read play-addresses */
- Tunenum = READCH(f,2) /* Read number of Tunes */
- TunenumStart = READCH(f,2) /* Read number of start-tune */
- Speed = READCH(f,4) /* Read speed data */
- Name1 = READCH(f,30) /* Read Name */
- trash1 = READCH(f,2)
- Author1 = READCH(f,30) /* Read Author */
- trash2 = READCH(f,2)
- Copyright1 = READCH(f,30) /* Read Copyright */
-
- CALL CLOSE(f) /* Close file */
-
- Songs = C2D(Tunenum) /* Convert Tunes to Dec */
- SongStart = C2D(TunenumStart) /* Convert Start-Tune to Dec */
-
- Name = COMPRESS(Name1,NULL) /* Remove NULL's */
- Author = COMPRESS(Author1,NULL) /* Remove NULL's */
- Copyright = COMPRESS(Copyright1,NULL) /* Remove NULL's */
-
- DBaseLine = '"'Name'","'Author'","'Copyright'","'Songs'","'SourceName'"' /* Database file output format */
-
- IF SongStart > 1 THEN DO
- DBaseLine = '"'Name'","'Author'","'Copyright'","'Songs','SongStart'","'SourceName'"' /* Database file output format */
- END
-
- SAY DBaseLine /* Write DBase Output */
-
- EXIT
-