eris2010

Documentation: http://frombelow.net/projects/eris2010/
Clone: git clone https://git.frombelow.net/eris2010.git
Log | Files | Refs | README | LICENSE

ansi_test.asm (2819B)


      1 ;;; Copyright 2021 Gerd Beuster (gerd@frombelow.net). This is free
      2 ;;; software under the GNU GPL v3 license or any later version. See
      3 ;;; COPYING in the root directory for details.
      4 
      5 	.include "os.inc"
      6 
      7 .dsection code
      8 .section code
      9 	start_of_stack = end_of_code ; Stack starts right after code
     10 init:
     11 	cld
     12 	#ds.INIT_STACK start_of_stack
     13 	#io.SETUP
     14         jsr ansi_test
     15 	jsr io.getc
     16 	jsr print_all_colors
     17 	jsr io.getc
     18 	jmp ($fffc)		; Reset
     19 
     20 ansi_test:
     21 	.block
     22 	jsr ds.create_stack_frame
     23 	jsr term.clear_screen
     24 	#term.SET_CURSOR #$01, #$01
     25         #io.PRINTSNL "ANSI Terminal"
     26 	#term.SET_CURSOR #$03, #$02
     27         #io.PRINTS "Text starting at position 3, 2"
     28 	#term.SET_CURSOR #$02, #$03
     29         #io.PRINTSNL "Text starting at position 2, 3"
     30 	#io.PRINTS "Cursor position: "
     31 	jsr term.get_cursor
     32 	pha
     33 	txa
     34 	jsr io.putd
     35 	#io.PRINTS ", "
     36 	pla
     37 	jsr io.putd
     38 	#term.SET_CURSOR #$01, #$05
     39 	#io.PRINTS "Screen size: "
     40 	jsr term.get_screen_size
     41 	pha
     42 	txa
     43 	jsr io.putd
     44 	#io.PRINTS ", "
     45 	pla
     46 	jsr io.putd
     47 	jsr io.putnl
     48 	#term.SET_TEXT term.bold
     49 	#io.PRINTSNL "Bold text"
     50 	#term.SET_TEXT term.plain
     51 	#term.SET_TEXT term.blink
     52 	#io.PRINTSNL "Blinking text"
     53 	#term.SET_TEXT term.plain
     54 	#term.SET_TEXT term.reverse
     55 	#io.PRINTSNL "Reverse text"
     56 	#term.SET_TEXT term.plain
     57 	lda #"*"
     58 	jsr io.putc
     59 	#term.CURSOR_DOWN 1
     60 	#term.CURSOR_BACK 1
     61 	lda #"*"
     62 	jsr io.putc
     63 	#term.CURSOR_DOWN 1
     64 	#term.CURSOR_BACK 1
     65 	lda #"*"
     66 	jsr io.putc
     67 	#term.CURSOR_FORWARD 1
     68 	lda #"*"
     69 	jsr io.putc
     70 	#term.CURSOR_BACK 1
     71 	#term.CURSOR_UP 1
     72 	lda #"*"
     73 	jsr io.putc
     74 	#term.CURSOR_BACK 1
     75 	#term.CURSOR_UP 1
     76 	lda #"*"
     77 	jsr io.putc
     78 	lda #$03
     79 	jsr term.cursor_down
     80 	lda #$03
     81 	jsr term.cursor_back
     82 	#io.PRINTSNL "ANSI test completed."
     83 	jsr ds.delete_stack_frame
     84 	rts
     85 	.bend
     86 
     87 print_all_colors:
     88 	.block
     89 	jsr ds.create_stack_frame
     90 	jsr term.clear_screen
     91 	#term.SET_CURSOR #$01, #$01
     92 	.for color in (term.black, term.red, term.green, term.yellow,
     93 		       term.blue, term.magenta, term.cyan, term.white)
     94 		#term.SET_COLOR color
     95 		#io.PRINTSNL "Foreground color"
     96 	.next
     97 	#term.SET_TEXT term.plain
     98 	.for color in (term.black, term.red, term.green, term.yellow,
     99 		       term.blue, term.magenta, term.cyan, term.white)
    100 		#term.SET_BACKGROUND_COLOR color
    101 		#io.PRINTS "Background color"
    102 		#term.SET_TEXT term.plain
    103 		jsr io.putnl
    104 	.next
    105 	.for color in (term.bright_black, term.bright_red,
    106 	               term.bright_green, term.bright_yellow,
    107 	               term.bright_blue, term.bright_magenta,
    108 	               term.bright_cyan, term.bright_white)
    109 		#term.SET_COLOR color
    110 		#io.PRINTSNL "Foreground color"
    111 	.next
    112 	lda #$00
    113 loop:	
    114 	pha
    115 	jsr term.set_color
    116 	pla
    117 	pha
    118 	jsr io.putd
    119 	lda #" "
    120 	jsr io.putc
    121 	pla
    122 	inc a
    123 	cmp #$00
    124 	bne loop
    125 	jsr io.putnl
    126 	jsr ds.delete_stack_frame
    127 	#term.SET_TEXT term.plain
    128 	#io.PRINTSNL "Color test completed."
    129 	rts
    130 	.bend
    131 
    132 end_of_code:	
    133 .send code