how to get ANSI.INC to work on serial port 2


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default how to get ANSI.INC to work on serial port 2

    HI guys ,

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

    Code:
    '****************************************************************
    '*  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:

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383

    Default Re: how to get ANSI.INC to work on serial port 2

    looking at the code I think a conversion of all the HSEROUT?C macro calls to HSEROUT2?C

    eg
    Code:
    ANSIstart
        HSEROUT2?C	27
        HSEROUT2?C	"["
        return
    might be a good start

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default Re: how to get ANSI.INC to work on serial port 2

    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 ?

    Code:
    
    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:

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383

    Default Re: how to get ANSI.INC to work on serial port 2


    #define use_port2

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





Similar Threads

  1. Can't seem to find DT's Ansi.INC file
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th February 2014, 02:47
  2. serial port program in c
    By naveenupendran in forum Off Topic
    Replies: 0
    Last Post: - 28th February 2009, 12:47
  3. PC serial port funny
    By nicjo in forum Serial
    Replies: 13
    Last Post: - 6th February 2007, 06:34
  4. Serial Port Timeout
    By isaac in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd July 2005, 20:05
  5. 5v From Serial Port
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th November 2004, 13:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts