f_ansi_attr85.asm
bitfixer_bitfixer/dg/z88dk/libsrc/stdio/ansi/ts2068/f_ansi_attr85.asm
;
; 	ANSI Video handling for the TS2068
;	By Stefano Bodrato - May 2011
;
; 	Text Attributes
;	m - Set Graphic Rendition
;	
;	The most difficult thing to port:
;	Be careful here...
;
;
;	$Id: f_ansi_attr85.asm,v 1.2 2015/01/19 01:33:19 pauloscustodio Exp $
;

	PUBLIC	ansi_attr

	EXTERN	INVRS
	EXTERN	BOLD
	EXTERN	UNDERLINE

.ansi_attr
        and     a
        jr      nz,noreset
        ld	(BOLD),a
        ld	(BOLD+1),a
        ld      (INVRS+1),a      ; inverse 0
        ld      (UNDERLINE+1),a   ; underline 0
        ret
.noreset
        cp      1
        jr      nz,nobold
        ld	a,23
        ld	(BOLD),a
        ld	a,182
        ld	(BOLD+1),a
        ret
.nobold
        cp      2
        jr      z,dim
        cp      8
        jr      nz,nodim
.dim
	xor	a
        ld	(BOLD),a
        ld	(BOLD+1),a
        ret
.nodim
        cp      4
        jr      nz,nounderline
        ld      a,255
        ld      (UNDERLINE+1),a   ; underline 1
        ret
.nounderline
        cp      24
        jr      nz,noCunderline
        xor     a
        ld      (UNDERLINE+1),a   ; underline 0
        ret
.noCunderline
        cp      5
        jr      nz,noblink
        ld      a,255
        ld      (UNDERLINE+1),a   ; underline (blink emulation) 1
        ret
.noblink
        cp      25
        jr      nz,nocblink
        xor     a
        ld      (UNDERLINE+1),a   ; underline (blink emulation) 0
        ret
.nocblink
        cp      7
        jr      nz,noreverse
        ld      a,255
        ld      (INVRS+1),a     ; inverse 1
        ret
.noreverse
        cp      27
        jr      nz,noCreverse
        xor     a
        ld      (INVRS+1),a      ; inverse 0
        ret
.noCreverse
        ret
