Log in

View Full Version : how to get ANSI.INC to work on serial port 2



longpole001
- 29th January 2015, 02:54
HI guys ,

wondering how to get DT's ANSI.INC to work with serial port 2 , it works so far for port 1 only



'************************************************* ***************
'* Name : ANSI.INC *
'* Author : Darrel Taylor *
'* Date : 5/2/2003 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
' TermColor ForegroundLightDark, ForegroundColor, BackgroundColor
' ForColor ForegroundColor
' BackColor BackgroundColor
' Normal
' Bold
' Dim
' Italic
' UnderScore
' Blink
' Negative
' CurUp


black con "0" system ' ALL color names ARE case sensitive
red con "1" system
green con "2" system
yellow con "3" system
blue con "4" system
magenta con "5" system
cyan con "6" system
white con "7" system

dark con "0" system
light con "1" system

tch var byte system ' Temporary Character

goto OverANSI


asm

ANSIstart
HSEROUT?C 27
HSEROUT?C "["
return

TermColor macro FGLD, FGCL, BGCL
L?CALL ANSIstart
HSEROUT?C FGLD
HSEROUT?C ";"
HSEROUT?C "3"
HSEROUT?C FGCL
HSEROUT?C ";"
HSEROUT?C "4"
HSEROUT?C BGCL
HSEROUT?C "m"
endm

ForColor macro FGColor
L?CALL ANSIstart
HSEROUT?C "3"
HSEROUT?C FGColor
HSEROUT?C "m"
endm

BackColor macro BGColor
L?CALL ANSIstart
HSEROUT?C "4"
HSEROUT?C BGColor
HSEROUT?C "m"
endm

DHSEROUT?B macro Bin
MOVE?BA Bin
L?CALL HSEROUT
endm

SendFormat
L?CALL ANSIstart
DHSEROUT?B tch
HSEROUT?C "m"
return

Normal macro
MOVE?CB "0",tch
L?CALL SendFormat
endm

Bold macro
MOVE?CB "1",tch
L?CALL SendFormat
endm

Dim macro
MOVE?CB "2",tch
L?CALL SendFormat
endm

Italic macro
MOVE?CB "3",tch
L?CALL SendFormat
endm

UnderScore macro
MOVE?CB "4",tch
L?CALL SendFormat
endm

Blink macro
MOVE?CB "5",tch
L?CALL SendFormat
endm

Negative macro
MOVE?CB "7",tch
L?CALL SendFormat
endm

CurUp macro
L?CALL ANSIstart
HSEROUT?C "A"
endm

CurDown macro
L?CALL ANSIstart
HSEROUT?C "B"
endm

CurRight macro
L?CALL ANSIstart
HSEROUT?C "C"
endm

CurLeft macro
L?CALL ANSIstart
HSEROUT?C "D"
endm

CurHome macro
L?CALL ANSIstart
HSEROUT?C "H"
endm

CurMove macro Row, Col ;[H = Home, [24;80H = Row 24, Column 80
L?CALL ANSIstart
HSEROUTCOUNT?C 2
HSEROUTNUM?C Row
HSEROUTDEC?
HSEROUT?C ";"
HSEROUTCOUNT?C 2
HSEROUTNUM?C Col
HSEROUTDEC?
HSEROUT?C "H"
endm

ClearScr macro
L?CALL ANSIstart
HSEROUT?C "2"
HSEROUT?C "J"
endm

ClearLine macro
HSEROUT?C 13
L?CALL ANSIstart
HSEROUT?C "K"
endm

ClearUp macro
L?CALL ANSIstart
HSEROUT?C "1"
HSEROUT?C "J"
endm

ClearDown macro
L?CALL ANSIstart
HSEROUT?C "0"
HSEROUT?C "J"
endm

RequestCurPos macro
L?CALL ANSIstart
HSEROUT?C "6"
HSEROUT?C "n"
endm

endasm


OverANSI:

richard
- 29th January 2015, 04:03
looking at the code I think a conversion of all the HSEROUT?C macro calls to HSEROUT2?C

eg

ANSIstart
HSEROUT2?C 27
HSEROUT2?C "["
return


might be a good start

longpole001
- 29th January 2015, 05:26
yep that seems to work , but how would i rewrite the macro to allow for the port to be a variable parameter , so both port 1, 2 etc would be supported ?





black con "0" system ' ALL color names ARE case sensitive
red con "1" system
green con "2" system
yellow con "3" system
blue con "4" system
magenta con "5" system
cyan con "6" system
white con "7" system

dark con "0" system
light con "1" system

tch var byte system ' Temporary Character

goto OverANSI


asm

ANSIstart
HSEROUT2?C 27
HSEROUT2?C "["
return

TermColor macro FGLD, FGCL, BGCL
L?CALL ANSIstart
HSEROUT2?C FGLD
HSEROUT2?C ";"
HSEROUT2?C "3"
HSEROUT2?C FGCL
HSEROUT2?C ";"
HSEROUT2?C "4"
HSEROUT2?C BGCL
HSEROUT2?C "m"
endm

ForColor macro FGColor
L?CALL ANSIstart
HSEROUT2?C "3"
HSEROUT2?C FGColor
HSEROUT2?C "m"
endm

BackColor macro BGColor
L?CALL ANSIstart
HSEROUT2?C "4"
HSEROUT2?C BGColor
HSEROUT2?C "m"
endm

DHSEROUT?B macro Bin
MOVE?BA Bin
L?CALL HSEROUT
endm

SendFormat
L?CALL ANSIstart
DHSEROUT?B tch
HSEROUT2?C "m"
return

Normal macro
MOVE?CB "0",tch
L?CALL SendFormat
endm

Bold macro
MOVE?CB "1",tch
L?CALL SendFormat
endm

Dim macro
MOVE?CB "2",tch
L?CALL SendFormat
endm

Italic macro
MOVE?CB "3",tch
L?CALL SendFormat
endm

UnderScore macro
MOVE?CB "4",tch
L?CALL SendFormat
endm

Blink macro
MOVE?CB "5",tch
L?CALL SendFormat
endm

Negative macro
MOVE?CB "7",tch
L?CALL SendFormat
endm

CurUp macro
L?CALL ANSIstart
HSEROUT2?C "A"
endm

CurDown macro
L?CALL ANSIstart
HSEROUT2?C "B"
endm

CurRight macro
L?CALL ANSIstart
HSEROUT2?C "C"
endm

CurLeft macro
L?CALL ANSIstart
HSEROUT2?C "D"
endm

CurHome macro
L?CALL ANSIstart
HSEROUT2?C "H"
endm

CurMove macro Row, Col ;[H = Home, [24;80H = Row 24, Column 80
L?CALL ANSIstart
HSEROUT2COUNT?C 2
HSEROUT2NUM?C Row
HSEROUT2DEC?
HSEROUT2?C ";"
HSEROUT2COUNT?C 2
HSEROUT2NUM?C Col
HSEROUT2DEC?
HSEROUT2?C "H"
endm

ClearScr macro
L?CALL ANSIstart
HSEROUT2?C "2"
HSEROUT2?C "J"
endm

ClearLine macro
HSEROUT2?C 13
L?CALL ANSIstart
HSEROUT2?C "K"
endm

ClearUp macro
L?CALL ANSIstart
HSEROUT2?C "1"
HSEROUT2?C "J"
endm

ClearDown macro
L?CALL ANSIstart
HSEROUT2?C "0"
HSEROUT2?C "J"
endm

RequestCurPos macro
L?CALL ANSIstart
HSEROUT2?C "6"
HSEROUT2?C "n"
endm

endasm


OverANSI:

richard
- 29th January 2015, 05:43
#define use_port2

#IFDEF use_port2
HSEROUT2?C 27
#else
HSEROUT?C 27
#endif