Dec 132017
 
Filter v. 3.0 - A TPU that filters ANSI codes passed to it, includes ANSI music as well. Full source is included.
File FILTER30.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Filter v. 3.0 – A TPU that filters ANSI codes passed to it, includes ANSI music as well. Full source is included.
File Name File Size Zip Size Zip Type
ANSILIST.DOC 8081 2292 deflated
ANSITYPE.EXE 15840 8203 deflated
ANSITYPE.PAS 1499 537 deflated
FILTER.DOC 2580 1153 deflated
FILTER.PAS 20095 4495 deflated
FILTER.TPU 20528 8441 deflated

Download File FILTER30.ZIP Here

Contents of the ANSILIST.DOC file


The following is a list of Ansi Code sequences that I used in my program.
I only included the Ansi codes useful to me. If you find others of use to
you, please include them in this doc, with a little note of revision. If you
revise this document of new Ansi codes, please include them into filter.pas.

Created by : William Russell

Revised by : No one yet!


'*' is the Escape sequence used for each Ansi Code. CHR(27) or 1b hex is
the Escape sequence.

A normal Ansi code looks similar to the following:

*[ + coding + Marker.

Marker Description and other notes
============================================================================
J Clears all or part of the screen, it has three possible codes:
*[0J or *[J - Clears from cursor to end of screen
*[1J - Clears from beginning of screen to cursor
*[2J - Completely clears the screen
K Clears all or part of the line, it has three possible codes:
*[0K or *[K - Clears from cursor to end of screen
*[1K - Clears from beginning of screen to cursor
*[2K - Completely clears the screen
m Contains all of the color sequences listed below:

No. Color <- Intensified -> Color (Fore/Back)
-----------------------------------------------------------
30 Black +1 Grey Fore
31 Red +1 Bright Red Fore
32 Green +1 Bright Green Fore
33 Brown +1 Yellow Fore
34 Blue +1 Bright Blue Fore
35 Purple +1 Bright Purple Fore
36 Cyan +1 Bright Cyan Fore
37 Light grey +1 Bright white Fore
40 Black Back
41 Red Back
42 Green Back
43 Brown Back
44 Blue Back
45 Purple Back
46 Cyan Back
47 Light grey Back

0 - Sets everything back to normal
1 - Intensifies the color
5 - Makes the color blink
7 - reverses the background/foreground colors
8 - Makes the current Foreground match the back

To change it to color blue it would look like
*[34m

To change it to a bright blue it would look like
*[1;34m

To change it to a bright, blinking blue
*[1;5;34m

To change it to a bright, blinking blue on a black back
*[1;5;34;40m

H,f They are goto statements. H is the most common one used, r is
used for a location report, however some bbs programs use it as
as a goto statement. It is used like the following:
*[ < row >; + marker

to move to the top left hand corner of the screen, you would have
*[1;1H

and to move to the bottom right-hand corner you would have
*[25;80H

r Set the active window. It can have 1 of three forms:
*[r - row to start window
*[,r - row to start, row to end
*[,,,r - begin r,c & end r,c
This command is similar to the window command in Basic
View Print, and Pascals Window. However this doesnt change any
X,Y coordinats. If the boundry is from line 5 to line 24, and
a goto statement is sent to line 3, the window is temp. out of
commesion, however when a goto statement in within the active
screen again, the window is restores
( This one is used by alot of fancy editors, DOS doesn't
Recgonize this command, however BBS's do )


A moves the cursor up. The following is used for moving the cursor
up 2 spaces
*[2A
the correct format is *[ n A
where 'n' is the spaces to move


B moves the cursor down. The following is used for moving the
cursor down 2 spaces
*[2B
the correct format is *[ n B
where 'n' is the spaces to move


C moves the cursor right. The following is used for moving the
cursor right 2 spaces
*[2C
the correct format is *[ n C
where 'n' is the spaces to move


D moves the cursor left. The following is used for moving the
cursor left 2 spaces
*[2D
the correct format is *[ n D
where 'n' is the spaces to move

M deletes lines. *[ n M is the proper format.
*[1M would delete one line

L inserts one line. *[ n L is the proper format
*[1L would insert one line

s saves the XY location. *[s.

u restores the last saved XY location from *[s. Looks like *[u



Thats the end of the basic ansi list. However, Filter.pas continues to
filter out Music. The music is a little harder to filter out. Most ansi
codes start off with *[, but it starts off with *[M and the current
location of sound. 'B' would be the background and 'F' would be the
foreground. That is a reason for not allowing defaults for the marker 'M'
above. When filtering out music, you search for *[ and the beginning
marker.

A music ansi code would look like the following

*[M beginning marker + Music lines + end marker.

the end marker for music is a music symbol, chr(14) or E hex.

here is a list of all the music statements:

A - G plays notes A through G of 1 musical scale. You may include
an optional number sign (#) or plus sign (+) to indicate a
sharp note or a minus sign (-) to indicate a flat note.

Ln Sets the duration of the notes that follow. n may be a value
in the range 1 to 64 where:
1 indicates a whole note
2 indicates a half note
4 indicates a quarter note
8 indicates an eighth note
16 indicates a sixteenth note

On sets the current octave. There are 7 octaves, 0 through 6.
Octave 3 starts with middle C. Default = Octave 4.

Nn plays a note. N may be in the range 0 to 64.

Tn sets the number of quarter notes in one minute. N may be in
the range of 32 to 255. Default = 120 quarter notes in 1
minute

. plays as a dotted note. It plays 1/2 its normal note length
longer.

MF plays the music in the foreground

MB plays the music in the background

MN sets "music normal"; each note plays 7/8 of the duration set
by the L option

ML sets "music legato"; each note plays full duration as set by
the L option

MS sets "music staccato"; each note plays 3/4 of the duration
as set by the L option


Thats all folks!


 December 13, 2017  Add comments

Leave a Reply