From d6ec25e37c5476b207b92323579e511fc86711f9 Mon Sep 17 00:00:00 2001 From: matsutsuka Date: Sun, 30 Sep 2007 12:46:34 +0000 Subject: [PATCH] The libconio_arch-small is architecture-depend implementation of console I/O with minimum size for the server mode. --- platform/pc-6001/ctk/libconio_arch-small.cS | 102 ++++++++++++++++++++ platform/pc-6001/ctk/libconio_arch-small.h | 8 ++ 2 files changed, 110 insertions(+) create mode 100644 platform/pc-6001/ctk/libconio_arch-small.cS create mode 100644 platform/pc-6001/ctk/libconio_arch-small.h diff --git a/platform/pc-6001/ctk/libconio_arch-small.cS b/platform/pc-6001/ctk/libconio_arch-small.cS new file mode 100644 index 000000000..18408ba3f --- /dev/null +++ b/platform/pc-6001/ctk/libconio_arch-small.cS @@ -0,0 +1,102 @@ +;;; +;;; +;;; libconio_arch-small.hS +;;; +;;; Architecture depend libconio implementation. +;;; This assembler source contributes basically saving for speed and memory. +;;; +;;; @author Takahide Matsutsuka +;;; +;;; $Id: libconio_arch-small.cS,v 1.1 2007/09/30 12:46:34 matsutsuka Exp $ +;;; + + ;; uses preprocessor to enable definitions +#include "ctk_arch-def.h" + + ;; export symbols + .globl _clrscr_arch + .globl _libputc_arch + + .area _DATA +_screen_offset:: + .ds 2 + + .area _CODE + +_libconio_arch_small_start:: + +_clrscr_arch: + ld hl, #0 + ld (#_screen_offset), hl + ld hl, #VRAM_CHAR + ld bc, #VRAM_CHAR + #SCREEN_HEIGHT * #SCREEN_WIDTH +_clrscr_arch_loop1: + ld (hl), #CH_SPACE + inc hl + ld a, h + cp b + jr nz, _clrscr_arch_loop1 + ld a, l + cp c + jr nz, _clrscr_arch_loop1 + ld hl, #VRAM_ATTR + ld bc, #VRAM_ATTR + #SCREEN_HEIGHT * #SCREEN_WIDTH +_clrscr_arch_loop2: + ld (hl), #COLOR_NORMAL + inc hl + ld a, h + cp b + jr nz, _clrscr_arch_loop2 + ld a, l + cp c + jr nz, _clrscr_arch_loop2 + ret + +_libputc_arch: + ld hl, #2 + add hl, sp + ld a, (hl) +_libputc_asm:: + push af + ld hl, (#_screen_offset) + ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH + ld a, b + cp h + jr nz, _libputc_arch_putc + ld a, c + cp l + jr z, _libputc_arch_scroll +_libputc_arch_putc: + ld bc, #VRAM_CHAR + add hl, bc + pop af + ld (hl), a + ld hl, #_screen_offset + inc (hl) + ret nz + inc hl + inc (hl) + ret +_libputc_arch_scroll: + push de + ld hl, #VRAM_CHAR + #SCREEN_WIDTH + ld de, #VRAM_CHAR + ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - #SCREEN_WIDTH + push bc + push de + ldir + pop de + pop hl + push hl + ld (#_screen_offset), hl + ld b, #SCREEN_WIDTH + add hl, de +_libputc_arch_scroll_loop: + ld (hl), #CH_SPACE + inc hl + djnz _libputc_arch_scroll_loop + pop hl + pop de + jr _libputc_arch_putc + +_libconio_arch_small_end:: diff --git a/platform/pc-6001/ctk/libconio_arch-small.h b/platform/pc-6001/ctk/libconio_arch-small.h new file mode 100644 index 000000000..4de83ee1c --- /dev/null +++ b/platform/pc-6001/ctk/libconio_arch-small.h @@ -0,0 +1,8 @@ +#ifndef __LIBCONIO_ARCH_MSLL_H__ +#define __LIBCONIO_ARCH_MSLL_H__ +#include "contiki.h" + +void clrscr_arch(); +void libputc_arch(unsigned char ch); + +#endif /* __LIBCONIO_ARCH_MSLL_H__ */