Platform-depend CTK support is modified to minimize size of module.
This commit is contained in:
parent
9e1e31f3bb
commit
4381f4b964
|
@ -7,7 +7,7 @@
|
||||||
;;;
|
;;;
|
||||||
;;; @author Takahide Matsutsuka <markn@markn.org>
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
;;;
|
;;;
|
||||||
;;; $Id: ctk-conio_arch-asm.cS,v 1.1 2007/09/19 12:46:15 matsutsuka Exp $
|
;;; $Id: ctk-conio_arch-asm.cS,v 1.2 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
;; uses preprocessor to enable definitions
|
;; uses preprocessor to enable definitions
|
||||||
|
@ -21,26 +21,26 @@
|
||||||
.globl _ctk_draw_dialog
|
.globl _ctk_draw_dialog
|
||||||
.globl _ctk_draw_widget
|
.globl _ctk_draw_widget
|
||||||
.globl _ctk_draw_windowtitle_height
|
.globl _ctk_draw_windowtitle_height
|
||||||
|
.if CTK_CONF_MENUS
|
||||||
.globl _ctk_draw_menus
|
.globl _ctk_draw_menus
|
||||||
|
.endif
|
||||||
.globl _ctk_draw_width
|
.globl _ctk_draw_width
|
||||||
.globl _ctk_draw_height
|
.globl _ctk_draw_height
|
||||||
|
|
||||||
;; import symbols
|
;; import symbols
|
||||||
.globl _cputc_arch
|
|
||||||
.globl _cputs_arch
|
|
||||||
.globl _cputsn_arch
|
|
||||||
.globl _gotoxy_arch
|
|
||||||
.globl _clip_arch
|
|
||||||
.globl _clearto_arch
|
|
||||||
.globl _wherex_arch
|
.globl _wherex_arch
|
||||||
.globl _clearbox_arch
|
.globl _wherey_arch
|
||||||
.globl _drawbox_arch
|
|
||||||
.if CTK_CONF_ICONS
|
|
||||||
.globl _drawicon_arch
|
|
||||||
.endif ; CTK_CONF_ICONS
|
|
||||||
.globl _revers_arch
|
|
||||||
.globl _chline_arch
|
|
||||||
|
|
||||||
|
.globl _cputc_arch_asm
|
||||||
|
.globl _cputs_arch_asm
|
||||||
|
.globl _cputsn_arch_asm
|
||||||
|
.globl _clip_arch_asm
|
||||||
|
.globl _clearto_arch_asm
|
||||||
|
.globl _revers_arch_asm
|
||||||
|
.globl _chline_arch_asm
|
||||||
|
.globl _cvline_arch_asm
|
||||||
|
.globl _gotoxy_arch_asm
|
||||||
|
|
||||||
;; offsets
|
;; offsets
|
||||||
.globl _off_window_x
|
.globl _off_window_x
|
||||||
.globl _off_window_y
|
.globl _off_window_y
|
||||||
|
@ -63,10 +63,13 @@
|
||||||
.globl _off_widget_textentry_xpos
|
.globl _off_widget_textentry_xpos
|
||||||
.globl _off_widget_textentry_ypos
|
.globl _off_widget_textentry_ypos
|
||||||
.globl _off_widget_textentry_state
|
.globl _off_widget_textentry_state
|
||||||
|
.if CTK_CONF_HYPERLINK
|
||||||
|
.globl _off_widget_hyperlink_text
|
||||||
|
.endif
|
||||||
.if CTK_CONF_ICONS
|
.if CTK_CONF_ICONS
|
||||||
.globl _off_widget_icon_title
|
.globl _off_widget_icon_title
|
||||||
.globl _off_widget_icon_textmap
|
.globl _off_widget_icon_textmap
|
||||||
.endif ; CTK_CONF_ICONS
|
.endif
|
||||||
.if CTK_CONF_MENUS
|
.if CTK_CONF_MENUS
|
||||||
.globl _off_menu_title
|
.globl _off_menu_title
|
||||||
.globl _off_menu_active
|
.globl _off_menu_active
|
||||||
|
@ -78,7 +81,7 @@
|
||||||
.globl _off_menus_open
|
.globl _off_menus_open
|
||||||
.globl _off_menus_menus
|
.globl _off_menus_menus
|
||||||
.globl _off_menus_desktopmenu
|
.globl _off_menus_desktopmenu
|
||||||
.endif ; CTK_CONF_MENUS
|
.endif
|
||||||
|
|
||||||
.area _DATA
|
.area _DATA
|
||||||
|
|
||||||
|
@ -94,8 +97,10 @@ _ctk_conio_arch_asm_start::
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_ctk_draw_init:
|
_ctk_draw_init:
|
||||||
ld d, #SCREEN_HEIGHT
|
xor a
|
||||||
ld e, #0
|
call _revers_arch_asm
|
||||||
|
ld h, #SCREEN_HEIGHT
|
||||||
|
ld l, #0
|
||||||
jr _ctk_draw_clear_asm
|
jr _ctk_draw_clear_asm
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
@ -111,21 +116,16 @@ _ctk_draw_clear:
|
||||||
inc hl
|
inc hl
|
||||||
ld d, (hl) ; clipy2
|
ld d, (hl) ; clipy2
|
||||||
;; E = clip1, D = clip2
|
;; E = clip1, D = clip2
|
||||||
|
ex de, hl
|
||||||
_ctk_draw_clear_asm:
|
_ctk_draw_clear_asm:
|
||||||
push de
|
call _clip_arch_asm
|
||||||
call _clip_arch
|
ld a, h
|
||||||
pop de
|
sub l ; A = clipy2 - clipy1
|
||||||
ld a, d
|
ld b, a ; height
|
||||||
sub e
|
ld c, #SCREEN_WIDTH ; width
|
||||||
ld h, a ; height
|
ld d, l ; y
|
||||||
ld l, #SCREEN_WIDTH ; width
|
ld e, #0 ; x
|
||||||
push hl
|
call _clearbox_arch_asm
|
||||||
ld l, #0 ; x
|
|
||||||
ld h, e ; y
|
|
||||||
push hl
|
|
||||||
call _clearbox_arch
|
|
||||||
pop hl
|
|
||||||
pop hl
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
_get_offset:
|
_get_offset:
|
||||||
|
@ -164,9 +164,8 @@ _ctk_draw_clear_window:
|
||||||
ld e, (hl)
|
ld e, (hl)
|
||||||
inc hl
|
inc hl
|
||||||
ld d, (hl)
|
ld d, (hl)
|
||||||
push de
|
ex de, hl
|
||||||
call _clip_arch
|
call _clip_arch_asm
|
||||||
pop de
|
|
||||||
;; clearbox_arch(window->x + 1, window->y + 2, window->w, window->h);
|
;; clearbox_arch(window->x + 1, window->y + 2, window->w, window->h);
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
|
@ -177,11 +176,10 @@ _ctk_draw_clear_window:
|
||||||
ld l, e ; HL = window
|
ld l, e ; HL = window
|
||||||
|
|
||||||
ld bc, #_off_window_h
|
ld bc, #_off_window_h
|
||||||
call _get_offset ; E = window->h
|
call _get_offset
|
||||||
ld a, e
|
ld d, e ; D = window->h
|
||||||
ld bc, #_off_window_w
|
ld bc, #_off_window_w
|
||||||
call _get_offset ; E = window->w
|
call _get_offset ; E = window->w
|
||||||
ld d, a
|
|
||||||
push de
|
push de
|
||||||
ld bc, #_off_window_y
|
ld bc, #_off_window_y
|
||||||
call _get_offset ; E = window->y
|
call _get_offset ; E = window->y
|
||||||
|
@ -192,10 +190,8 @@ _ctk_draw_clear_window:
|
||||||
call _get_offset ; E = window->x
|
call _get_offset ; E = window->x
|
||||||
inc e
|
inc e
|
||||||
ld d, a ; D = window->y + 2, E = window->x + 1
|
ld d, a ; D = window->y + 2, E = window->x + 1
|
||||||
push de
|
pop bc ; B = h, C = w
|
||||||
call _clearbox_arch
|
call _clearbox_arch_asm
|
||||||
pop de
|
|
||||||
pop de
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
@ -243,9 +239,8 @@ _ctk_draw_window:
|
||||||
ld e, (hl)
|
ld e, (hl)
|
||||||
inc hl
|
inc hl
|
||||||
ld d, (hl)
|
ld d, (hl)
|
||||||
push de
|
ex de, hl
|
||||||
call _clip_arch
|
call _clip_arch_asm
|
||||||
pop de
|
|
||||||
|
|
||||||
;; DE = window
|
;; DE = window
|
||||||
;; A = focus = focus & CTK_FOCUS_WINDOW
|
;; A = focus = focus & CTK_FOCUS_WINDOW
|
||||||
|
@ -270,11 +265,10 @@ _ctk_draw_window:
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_draw_window_asm:
|
_draw_window_asm:
|
||||||
;; drawbox_arch(window->x, window->y + 1, window->w, window->h);
|
;; drawbox_asm(window->x, window->y + 1, window->w, window->h);
|
||||||
push af ; focus
|
push af ; focus
|
||||||
ld h, d
|
ld h, d
|
||||||
ld l, e ; HL = window
|
ld l, e ; HL = window
|
||||||
push hl ; window
|
|
||||||
ld bc, #_off_window_h
|
ld bc, #_off_window_h
|
||||||
call _get_offset
|
call _get_offset
|
||||||
ld a, e
|
ld a, e
|
||||||
|
@ -288,14 +282,11 @@ _draw_window_asm:
|
||||||
inc a
|
inc a
|
||||||
ld bc, #_off_window_x
|
ld bc, #_off_window_x
|
||||||
call _get_offset
|
call _get_offset
|
||||||
ld d, a
|
ld d, a ; D = window->y + 1, E = window->x
|
||||||
push de ; D = window->y + 1, E = window->x
|
pop bc ; B = h, C = w, HL = window
|
||||||
call _drawbox_arch
|
call _drawbox_asm
|
||||||
pop de ; pop yx
|
inc d ; D = y = window->y + 2
|
||||||
pop bc ; pop hw, Stack; window focus
|
inc e ; E = x = window->x + 1
|
||||||
pop hl ; HL = window; Stack; focus
|
|
||||||
inc d ; D = x = window->y + 2
|
|
||||||
inc e ; E = y = window->x + 1
|
|
||||||
push de ; Stack; yx focus
|
push de ; Stack; yx focus
|
||||||
|
|
||||||
;; for(w = window->inactive; w != NULL; w = w->next) {
|
;; for(w = window->inactive; w != NULL; w = w->next) {
|
||||||
|
@ -377,6 +368,7 @@ _draw_window_asm_next2: ; Stack; focused focus
|
||||||
pop af
|
pop af
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; ctk_draw_widget(struct ctk_widget *w,
|
;; ctk_draw_widget(struct ctk_widget *w,
|
||||||
;; unsigned char focus,
|
;; unsigned char focus,
|
||||||
|
@ -399,16 +391,14 @@ _ctk_draw_widget:
|
||||||
inc hl
|
inc hl
|
||||||
ld b, (hl) ; clipy2
|
ld b, (hl) ; clipy2
|
||||||
push af ; focus
|
push af ; focus
|
||||||
push bc
|
ld h, b
|
||||||
call _clip_arch
|
ld l, c
|
||||||
pop bc
|
call _clip_arch_asm
|
||||||
push de ; Stack; widget focus
|
push de ; Stack; widget focus
|
||||||
ld h, d
|
ex de, hl ; HL = widget
|
||||||
ld l, e
|
|
||||||
ld bc, #_off_widget_window
|
ld bc, #_off_widget_window
|
||||||
call _get_offset
|
call _get_offset
|
||||||
ld h, d
|
ex de, hl ; HL = window
|
||||||
ld l, e ; HL = window
|
|
||||||
ld bc, #_off_window_focused
|
ld bc, #_off_window_focused
|
||||||
call _get_offset ; DE = focused
|
call _get_offset ; DE = focused
|
||||||
pop bc ; pop widget, Stack focus
|
pop bc ; pop widget, Stack focus
|
||||||
|
@ -439,11 +429,11 @@ _ctk_draw_widget_nofocus:
|
||||||
;; FALL THROUGH
|
;; FALL THROUGH
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; void draw_widget_asm(struct ctk_widget *w,
|
;; static void draw_widget_asm(struct ctk_widget *w,
|
||||||
;; unsigned char x, unsigned char y,
|
;; unsigned char x, unsigned char y,
|
||||||
;; unsigned char focus)
|
;; unsigned char focus)
|
||||||
;; Stack; retl reth
|
;; Stack; retl reth
|
||||||
;; in; a = focus, bc = yx, de = widget
|
;; in; A = focus, BC = yx, DE = widget
|
||||||
;; ____________
|
;; ____________
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
@ -453,7 +443,7 @@ _draw_widget_asm:
|
||||||
push bc
|
push bc
|
||||||
push af
|
push af
|
||||||
|
|
||||||
push de
|
push de ; Stack; w
|
||||||
ld h, d
|
ld h, d
|
||||||
ld l, e
|
ld l, e
|
||||||
push af
|
push af
|
||||||
|
@ -472,15 +462,12 @@ _draw_widget_asm:
|
||||||
add b
|
add b
|
||||||
ld b, a ; B = ypos, C = xpos
|
ld b, a ; B = ypos, C = xpos
|
||||||
pop af
|
pop af
|
||||||
and #_CTK_FOCUS_WIDGET
|
and a, #_CTK_FOCUS_WIDGET
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
ld h, b
|
||||||
call _revers_arch
|
ld l, c
|
||||||
inc sp ; Stack; w
|
call _gotoxy_arch_asm
|
||||||
push bc ; Stack; yx, w
|
pop hl ; Stack; null, HL = w
|
||||||
call _gotoxy_arch
|
|
||||||
pop bc
|
|
||||||
pop hl ; Stack; null
|
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
ld bc, #_off_widget_type
|
ld bc, #_off_widget_type
|
||||||
|
@ -496,20 +483,19 @@ _draw_widget_asm:
|
||||||
jp z, _draw_widget_label
|
jp z, _draw_widget_label
|
||||||
cp a, #_CTK_WIDGET_BUTTON
|
cp a, #_CTK_WIDGET_BUTTON
|
||||||
jp z, _draw_widget_button
|
jp z, _draw_widget_button
|
||||||
|
.if CTK_CONF_HYPERLINK
|
||||||
cp a, #_CTK_WIDGET_HYPERLINK
|
cp a, #_CTK_WIDGET_HYPERLINK
|
||||||
jp z, _draw_widget_hyperlink
|
jp z, _draw_widget_hyperlink
|
||||||
|
.endif
|
||||||
cp a, #_CTK_WIDGET_TEXTENTRY
|
cp a, #_CTK_WIDGET_TEXTENTRY
|
||||||
jp z, _draw_widget_textentry
|
jp z, _draw_widget_textentry
|
||||||
.if CTK_CONF_ICONS
|
.if CTK_CONF_ICONS
|
||||||
cp a, #_CTK_WIDGET_ICON
|
cp a, #_CTK_WIDGET_ICON
|
||||||
jp z, _draw_widget_icon
|
jp z, _draw_widget_icon
|
||||||
.endif ; CTK_CONF_ICONS
|
.endif
|
||||||
_draw_widget_ret:
|
_draw_widget_ret:
|
||||||
xor a
|
xor a
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
|
|
||||||
pop af
|
pop af
|
||||||
pop bc
|
pop bc
|
||||||
|
@ -518,10 +504,8 @@ _draw_widget_ret:
|
||||||
ret
|
ret
|
||||||
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
||||||
_draw_widget_separator:
|
_draw_widget_separator:
|
||||||
push de
|
ld b, e
|
||||||
inc sp
|
call _chline_arch_asm
|
||||||
call _chline_arch
|
|
||||||
inc sp
|
|
||||||
jr _draw_widget_ret
|
jr _draw_widget_ret
|
||||||
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
||||||
_draw_widget_label:
|
_draw_widget_label:
|
||||||
|
@ -542,36 +526,28 @@ _draw_widget_label_loop:
|
||||||
or a
|
or a
|
||||||
jr z, _draw_widget_ret
|
jr z, _draw_widget_ret
|
||||||
|
|
||||||
push de
|
|
||||||
push hl
|
|
||||||
push bc
|
|
||||||
call _gotoxy_arch
|
|
||||||
pop bc
|
|
||||||
pop hl
|
|
||||||
pop de
|
|
||||||
;; BC = ypos, xpos, H = h, L = w->w, DE = text
|
;; BC = ypos, xpos, H = h, L = w->w, DE = text
|
||||||
|
push hl ; Stack; hw
|
||||||
|
ld h, b
|
||||||
|
ld l, c
|
||||||
|
call _gotoxy_arch_asm
|
||||||
|
pop hl
|
||||||
;; cputsn_arch(text, w->w);
|
;; cputsn_arch(text, w->w);
|
||||||
ld a, l
|
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
push af
|
push de ; Stack; text yx hw
|
||||||
inc sp
|
ld b, l
|
||||||
push de
|
call _cputsn_arch_asm ; DE = text
|
||||||
call _cputsn_arch
|
|
||||||
pop de
|
pop de
|
||||||
inc sp
|
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl ; Stack; null
|
||||||
;; clearto_arch(xpos + w->w);
|
;; clearto_arch(xpos + w->w);
|
||||||
ld a, c
|
ld a, c
|
||||||
add a, l
|
add a, l
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
push af
|
call _clearto_arch_asm
|
||||||
inc sp
|
|
||||||
call _clearto_arch
|
|
||||||
inc sp
|
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
|
@ -593,45 +569,38 @@ _draw_widget_button:
|
||||||
push hl ; w
|
push hl ; w
|
||||||
push de ; w->w
|
push de ; w->w
|
||||||
ld a, #0x5b ; '['
|
ld a, #0x5b ; '['
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
pop de
|
pop de
|
||||||
pop hl
|
pop hl
|
||||||
push de
|
ld a, e
|
||||||
ld bc, #_off_widget_button_text
|
ld bc, #_off_widget_button_text
|
||||||
call _get_offset
|
call _get_offset
|
||||||
push de
|
ld b, a
|
||||||
call _cputsn_arch
|
call _cputsn_arch_asm
|
||||||
pop de
|
|
||||||
pop de
|
|
||||||
ld a, #0x5d ; ']'
|
ld a, #0x5d ; ']'
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
jp _draw_widget_ret
|
jp _draw_widget_ret
|
||||||
|
.if CTK_CONF_HYPERLINK
|
||||||
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
||||||
_draw_widget_hyperlink:
|
_draw_widget_hyperlink:
|
||||||
push de
|
ld a, e
|
||||||
ld bc, #_off_widget_button_text
|
ld bc, #_off_widget_hyperlink_text
|
||||||
call _get_offset
|
call _get_offset
|
||||||
push de
|
ld b, a
|
||||||
call _cputsn_arch
|
call _cputsn_arch_asm
|
||||||
pop de
|
|
||||||
pop de
|
|
||||||
jp _draw_widget_ret
|
jp _draw_widget_ret
|
||||||
|
.endif
|
||||||
|
|
||||||
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
||||||
_draw_widget_textentry: ; 0xc5dc sp=0xf97e
|
_draw_widget_textentry: ; 0xc5dc sp=0xf97e ;widget=e3be
|
||||||
|
;; e3cd;textentry.xpos<-b224
|
||||||
;; stable variables;
|
;; stable variables;
|
||||||
;; w->w, w->h, w->widget.textentry.{state,ypos,xpos), xscroll
|
;; w->w, w->h, w->widget.textentry.{state,ypos,xpos), xscroll
|
||||||
push ix
|
push ix
|
||||||
ld ix, #-6
|
ld ix, #-6
|
||||||
add ix, sp
|
add ix, sp
|
||||||
ld sp, ix
|
ld sp, ix
|
||||||
push bc
|
push bc ; yx
|
||||||
|
|
||||||
ld 0(ix), e ; w->w
|
ld 0(ix), e ; w->w
|
||||||
ld bc, #_off_widget_h
|
ld bc, #_off_widget_h
|
||||||
|
@ -648,16 +617,18 @@ _draw_widget_textentry: ; 0xc5dc sp=0xf97e
|
||||||
ld bc, #_off_widget_textentry_xpos
|
ld bc, #_off_widget_textentry_xpos
|
||||||
call _get_offset
|
call _get_offset
|
||||||
ld 4(ix), e ; w->widget.textentry.xpos
|
ld 4(ix), e ; w->widget.textentry.xpos
|
||||||
|
|
||||||
ld bc, #_off_widget_textentry_xpos
|
;; xscroll = 0;
|
||||||
call _get_offset
|
;; if(w->widget.textentry.xpos >= w->w - 1) {
|
||||||
|
;; xscroll = w->widget.textentry.xpos - w->w + 1;
|
||||||
|
;; }
|
||||||
ld a, e
|
ld a, e
|
||||||
inc a
|
inc a
|
||||||
sub 0(ix) ; w->w
|
sub 0(ix) ; xscroll = w->widget.textentry.xpos - w->w + 1
|
||||||
jr nc, _draw_widget_textentry_next
|
jr nc, _draw_widget_textentry_next
|
||||||
xor a
|
xor a ; if (xscroll < 0) xscroll = 0
|
||||||
_draw_widget_textentry_next: ; A = xscroll, Stack; yx - IX
|
_draw_widget_textentry_next: ; A = xscroll, Stack; yx - IX
|
||||||
ld 5(ix), a ; w->widget.textentry.xscroll
|
ld 5(ix), a ; xscroll
|
||||||
|
|
||||||
ld bc, #_off_widget_textentry_text
|
ld bc, #_off_widget_textentry_text
|
||||||
call _get_offset ; DE = text
|
call _get_offset ; DE = text
|
||||||
|
@ -667,40 +638,32 @@ _draw_widget_textentry_next: ; A = xscroll, Stack; yx - IX
|
||||||
;; L = counter, IX = sp, DE = text, BC = yx, Stack; null
|
;; L = counter, IX = sp, DE = text, BC = yx, Stack; null
|
||||||
_draw_widget_textentry_loop1: ; 0xc629
|
_draw_widget_textentry_loop1: ; 0xc629
|
||||||
;; gotoxy_arch(xpos, ypos);
|
;; gotoxy_arch(xpos, ypos);
|
||||||
push de
|
push hl ; Stack; text
|
||||||
push hl ; Stack; yx count text
|
ld h, b
|
||||||
push bc
|
ld l, c
|
||||||
call _gotoxy_arch
|
call _gotoxy_arch_asm
|
||||||
|
|
||||||
;; if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
|
;; if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
|
||||||
;; w->widget.textentry.ypos == j)
|
;; w->widget.textentry.ypos == j)
|
||||||
pop bc
|
pop hl ; Stack; null, BC = yx, DE = text, L = count
|
||||||
pop hl ; Stack; text
|
|
||||||
pop de ; Stack; null
|
|
||||||
push bc ; Stack; yx
|
push bc ; Stack; yx
|
||||||
ld a, l
|
ld a, l
|
||||||
cp a, 1(ix) ; j - w->h
|
cp a, 1(ix) ; j - w->h
|
||||||
jp nc, _draw_widget_textentry_ret
|
jp nc, _draw_widget_textentry_ret
|
||||||
ld a, 2(ix) ; state
|
ld a, 2(ix) ; state
|
||||||
or a
|
or a ; state == EDIT?
|
||||||
jr nz, _draw_widget_textentry_else
|
jr nz, _draw_widget_textentry_else
|
||||||
ld a, 3(ix) ; ypos
|
ld a, 3(ix) ; ypos
|
||||||
cp a, l
|
cp a, l ; ypos == j?
|
||||||
jr nz, _draw_widget_textentry_else
|
jr nz, _draw_widget_textentry_else
|
||||||
;; revers_arch(0);
|
;; revers_arch(0);
|
||||||
push hl ; Stack count yx
|
push hl ; Stack count yx
|
||||||
push de ; Stack text count yx
|
push de ; Stack text count yx
|
||||||
xor a
|
xor a
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
;; cputc_arch('>');
|
;; cputc_arch('>');
|
||||||
ld a, #0x3e ; '>'
|
ld a, #0x3e ; '>'
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
|
|
||||||
pop de ; Stack count yx
|
pop de ; Stack count yx
|
||||||
push de ; Stack text count yx
|
push de ; Stack text count yx
|
||||||
|
@ -713,7 +676,8 @@ _draw_widget_textentry_loop1: ; 0xc629
|
||||||
|
|
||||||
ld h, #0 ; loop counter
|
ld h, #0 ; loop counter
|
||||||
;; for(i = 0; i < w->w; ++i)
|
;; for(i = 0; i < w->w; ++i)
|
||||||
_draw_widget_textentry_loop2: ; 0xc666 Stack text count yx
|
_draw_widget_textentry_loop2: ; 0xc39d Stack text count yx
|
||||||
|
;; H = count2, DE = text[xscroll + i]
|
||||||
ld a, h
|
ld a, h
|
||||||
cp a, 0(ix) ; i - w->w
|
cp a, 0(ix) ; i - w->w
|
||||||
jr nc, _draw_widget_textentry_loop2exit
|
jr nc, _draw_widget_textentry_loop2exit
|
||||||
|
@ -722,44 +686,30 @@ _draw_widget_textentry_loop2: ; 0xc666 Stack text count yx
|
||||||
ld a, 4(ix) ; w->w.widget.textentry.xpos
|
ld a, 4(ix) ; w->w.widget.textentry.xpos
|
||||||
sub 5(ix) ; xscroll
|
sub 5(ix) ; xscroll
|
||||||
sub h ; textentry.xpos - xscroll- i
|
sub h ; textentry.xpos - xscroll- i
|
||||||
jr z, _draw_widget_textentry_revers1
|
ld a, #00 ; flags don't change
|
||||||
xor a
|
jr nz, _draw_widget_textentry_revers
|
||||||
jr _draw_widget_textentry_revers0
|
|
||||||
_draw_widget_textentry_revers1:
|
|
||||||
ld a, #01
|
ld a, #01
|
||||||
_draw_widget_textentry_revers0:
|
_draw_widget_textentry_revers:
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
;; DE = text, Stack; count2 text count1 yx
|
||||||
call _revers_arch
|
;; cputc((c == 0) ? CH_SPACE : c);
|
||||||
inc sp
|
|
||||||
|
|
||||||
ld a, (de) ; ch
|
ld a, (de) ; ch
|
||||||
or a
|
or a
|
||||||
jr nz, _draw_widget_textentry_nospace
|
jr nz, _draw_widget_textentry_nospace
|
||||||
ld a, #CH_SPACE
|
ld a, #CH_SPACE
|
||||||
_draw_widget_textentry_nospace:
|
_draw_widget_textentry_nospace:
|
||||||
push de
|
push de
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
pop de
|
pop de
|
||||||
pop hl ; Stack text count1 yx
|
pop hl ; Stack text count1 yx, H = count2
|
||||||
inc h
|
inc h
|
||||||
inc de
|
inc de
|
||||||
jr _draw_widget_textentry_loop2
|
jr _draw_widget_textentry_loop2
|
||||||
|
|
||||||
_draw_widget_textentry_loop2exit: ; Stack text count yx
|
_draw_widget_textentry_loop2exit: ; Stack text count yx
|
||||||
xor a
|
xor a
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
ld a, #0x3c ; '<'
|
ld a, #0x3c ; '<'
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
jr _draw_widget_textentry_endif
|
jr _draw_widget_textentry_endif
|
||||||
|
|
||||||
_draw_widget_textentry_else: ; 0xc68a DE = text, L = count1, Stack yx
|
_draw_widget_textentry_else: ; 0xc68a DE = text, L = count1, Stack yx
|
||||||
|
@ -767,19 +717,13 @@ _draw_widget_textentry_else: ; 0xc68a DE = text, L = count1, Stack yx
|
||||||
ld a, #CH_VERTLINE
|
ld a, #CH_VERTLINE
|
||||||
push hl
|
push hl
|
||||||
push de
|
push de
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
pop de
|
pop de
|
||||||
;; cputsn_arch(text, w->w);
|
;; cputsn_arch(text, w->w);
|
||||||
ld a, 0(ix) ; w->w
|
ld b, 0(ix) ; w->w
|
||||||
push af
|
|
||||||
inc sp
|
|
||||||
push de
|
push de
|
||||||
call _cputsn_arch
|
call _cputsn_arch_asm
|
||||||
pop de
|
pop de ; Stack count1 yx
|
||||||
inc sp ; Stack j yx
|
|
||||||
;; clearto_arch(xpos + w->w + 1);
|
;; clearto_arch(xpos + w->w + 1);
|
||||||
pop hl
|
pop hl
|
||||||
pop bc
|
pop bc
|
||||||
|
@ -789,16 +733,10 @@ _draw_widget_textentry_else: ; 0xc68a DE = text, L = count1, Stack yx
|
||||||
ld a, 0(ix) ; w->w
|
ld a, 0(ix) ; w->w
|
||||||
add a, c
|
add a, c
|
||||||
inc a ; xpos + w->w + 1
|
inc a ; xpos + w->w + 1
|
||||||
push af
|
call _clearto_arch_asm
|
||||||
inc sp
|
|
||||||
call _clearto_arch
|
|
||||||
inc sp
|
|
||||||
;; cputc_arch(CH_VERTLINE);
|
;; cputc_arch(CH_VERTLINE);
|
||||||
ld a, #CH_VERTLINE
|
ld a, #CH_VERTLINE
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
_draw_widget_textentry_endif: ; Stack text count yx
|
_draw_widget_textentry_endif: ; Stack text count yx
|
||||||
;; text += w->w
|
;; text += w->w
|
||||||
pop de
|
pop de
|
||||||
|
@ -825,19 +763,86 @@ _draw_widget_textentry_ret:
|
||||||
jp _draw_widget_ret
|
jp _draw_widget_ret
|
||||||
|
|
||||||
.if CTK_CONF_ICONS
|
.if CTK_CONF_ICONS
|
||||||
|
;; BC = ypos, xpos, HL = w, E = w->w, Stack; null
|
||||||
_draw_widget_icon:
|
_draw_widget_icon:
|
||||||
|
push bc ; Stack; yx
|
||||||
ld bc, #_off_widget_icon_title
|
ld bc, #_off_widget_icon_title
|
||||||
call _get_offset
|
call _get_offset
|
||||||
push de
|
push de ; Stack; title yx
|
||||||
ld bc, #_off_widget_icon_textmap
|
ld bc, #_off_widget_icon_textmap
|
||||||
call _get_offset
|
call _get_offset
|
||||||
push de
|
pop hl ; HL = title, DE = textmap
|
||||||
call _drawicon_arch
|
pop bc ; BC = yx
|
||||||
pop de
|
|
||||||
pop de
|
|
||||||
jp _draw_widget_ret
|
|
||||||
.endif ; CTK_CONF_ICONS
|
|
||||||
|
|
||||||
|
;; BC = yx, DE = textmap, HL = title
|
||||||
|
push hl ; Stack; title
|
||||||
|
ld h, b
|
||||||
|
ld l, c ; HL = yx
|
||||||
|
ld a, e
|
||||||
|
or d
|
||||||
|
jr z, _draw_widget_icon_title
|
||||||
|
|
||||||
|
;; push hl
|
||||||
|
;; call _wherex_arch
|
||||||
|
;; ld c, l
|
||||||
|
;; call _wherey_arch
|
||||||
|
;; ld b, l
|
||||||
|
;; pop hl
|
||||||
|
|
||||||
|
ld a, #3 ; loop counter
|
||||||
|
_draw_widget_icon_loop: ; HL = yx, DE = textmap, Stack; title
|
||||||
|
call _gotoxy_arch_asm
|
||||||
|
|
||||||
|
push af ; Stack; loop title
|
||||||
|
push hl ; DE = textmap, Stack; yx loop title
|
||||||
|
|
||||||
|
ld b, #3
|
||||||
|
call _cputsn_arch_asm ; DE = DE + 3
|
||||||
|
|
||||||
|
pop hl
|
||||||
|
pop af ; HL = yx, A = count, Stack; title
|
||||||
|
|
||||||
|
inc h ; y++
|
||||||
|
dec a
|
||||||
|
jr nz, _draw_widget_icon_loop
|
||||||
|
;; Stack; title, HL = yx
|
||||||
|
_draw_widget_icon_title:
|
||||||
|
pop de ; Stack; null, HL = yx, DE = title
|
||||||
|
push de ; Stack; title, HL = yx, DE = title
|
||||||
|
ld b, h
|
||||||
|
ld c, l ; BC = yx
|
||||||
|
ex de, hl ; BC = yx, HL = title
|
||||||
|
ld d, #0
|
||||||
|
_draw_widget_icon_title_strlen:
|
||||||
|
ld a, (hl)
|
||||||
|
or a
|
||||||
|
jr z, _draw_widget_icon_title_setpos
|
||||||
|
inc hl
|
||||||
|
inc d
|
||||||
|
jr _draw_widget_icon_title_strlen
|
||||||
|
;; D = len, BC = yx, Stack; title
|
||||||
|
_draw_widget_icon_title_setpos:
|
||||||
|
ld h, d ; H = len
|
||||||
|
ld a, d
|
||||||
|
add a, c ; x + len
|
||||||
|
cp a, #SCREEN_WIDTH ; x + len - SCREEN_WIDTH
|
||||||
|
jr c, _draw_widget_icon_title_show
|
||||||
|
ld a, #SCREEN_WIDTH
|
||||||
|
sub h
|
||||||
|
ld c, a
|
||||||
|
;; B = y, C = x; H = len, Stack; title
|
||||||
|
_draw_widget_icon_title_show:
|
||||||
|
ld a, h ; A = len
|
||||||
|
ld h, b
|
||||||
|
ld l, c
|
||||||
|
call _gotoxy_arch_asm
|
||||||
|
pop de ; DE = title
|
||||||
|
ld b, a ; B = len
|
||||||
|
call _cputsn_arch_asm
|
||||||
|
jp _draw_widget_ret
|
||||||
|
|
||||||
|
.endif
|
||||||
|
|
||||||
.if CTK_CONF_MENUS
|
.if CTK_CONF_MENUS
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; static void draw_menu(struct ctk_menu *m, struct ctk_menu *open)
|
;; static void draw_menu(struct ctk_menu *m, struct ctk_menu *open)
|
||||||
|
@ -855,16 +860,11 @@ _draw_menu_asm:
|
||||||
push bc
|
push bc
|
||||||
ld bc, #_off_menu_title
|
ld bc, #_off_menu_title
|
||||||
call _get_offset ; DE = m->title
|
call _get_offset ; DE = m->title
|
||||||
push hl
|
push hl ; Stack; menu open x
|
||||||
push de
|
call _cputs_arch_asm
|
||||||
call _cputs_arch
|
|
||||||
pop de ; Stack; menu open x
|
|
||||||
;; cputc_arch(CH_SPACE);
|
;; cputc_arch(CH_SPACE);
|
||||||
ld a, #CH_SPACE
|
ld a, #CH_SPACE
|
||||||
push af
|
call _cputc_arch_asm
|
||||||
inc sp
|
|
||||||
call _cputc_arch
|
|
||||||
inc sp
|
|
||||||
|
|
||||||
pop hl ; menu
|
pop hl ; menu
|
||||||
pop bc ; open, Stack; x
|
pop bc ; open, Stack; x
|
||||||
|
@ -914,22 +914,16 @@ _draw_menu_loop1:
|
||||||
jr nz, _draw_menu_next1
|
jr nz, _draw_menu_next1
|
||||||
xor a
|
xor a
|
||||||
push hl
|
push hl
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
pop hl
|
pop hl
|
||||||
;; B = x, C = x2, D = y, HL = menu
|
;; B = x, C = x2, D = y, HL = menu
|
||||||
_draw_menu_next1: ; c4ae
|
_draw_menu_next1: ; c4ae
|
||||||
;; gotoxy_arch(x, y + 1);
|
;; gotoxy_arch(x, y + 1);
|
||||||
push hl
|
push hl
|
||||||
push de
|
ld h, d
|
||||||
inc d
|
ld l, b
|
||||||
ld e, b
|
inc h
|
||||||
push de
|
call _gotoxy_arch_asm
|
||||||
call _gotoxy_arch
|
|
||||||
pop de
|
|
||||||
pop de ; D = y
|
|
||||||
pop hl ; HL = menu, Stack; null
|
pop hl ; HL = menu, Stack; null
|
||||||
;; if(m->items[y].title[0] == '-')
|
;; if(m->items[y].title[0] == '-')
|
||||||
push de
|
push de
|
||||||
|
@ -963,43 +957,31 @@ _draw_menu_next2:
|
||||||
cp a, #0x2d ; '-'
|
cp a, #0x2d ; '-'
|
||||||
jr nz, _draw_menu_else
|
jr nz, _draw_menu_else
|
||||||
;; chline_arch(CTK_CONF_MENUWIDTH);
|
;; chline_arch(CTK_CONF_MENUWIDTH);
|
||||||
ld a, #CTK_CONF_MENUWIDTH
|
ld b, #CTK_CONF_MENUWIDTH
|
||||||
push af
|
call _chline_arch_asm
|
||||||
inc sp
|
|
||||||
call _chline_arch
|
|
||||||
inc sp
|
|
||||||
jr _draw_menu_next3
|
jr _draw_menu_next3
|
||||||
_draw_menu_else:
|
_draw_menu_else:
|
||||||
;; cputs_arch(m->items[y].title);
|
;; cputs_arch(m->items[y].title);
|
||||||
push de
|
call _cputs_arch_asm
|
||||||
call _cputs_arch
|
|
||||||
pop de
|
|
||||||
_draw_menu_next3:
|
_draw_menu_next3:
|
||||||
;; clearto_arch(x + CTK_CONF_MENUWIDTH);
|
;; clearto_arch(x + CTK_CONF_MENUWIDTH);
|
||||||
pop bc ; B = x, C = x2, Stack; menu y
|
pop bc ; B = x, C = x2, Stack; menu y
|
||||||
push bc
|
push bc
|
||||||
ld a, b
|
ld a, b
|
||||||
add a, #CTK_CONF_MENUWIDTH
|
add a, #CTK_CONF_MENUWIDTH
|
||||||
push af
|
call _clearto_arch_asm
|
||||||
inc sp
|
|
||||||
call _clearto_arch
|
|
||||||
inc sp
|
|
||||||
;; revers_arch(1);
|
;; revers_arch(1);
|
||||||
ld a, #1
|
ld a, #1
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
pop de
|
pop de
|
||||||
inc d
|
inc d
|
||||||
jr _draw_menu_loop1
|
jr _draw_menu_loop1
|
||||||
_draw_menu_ret: ; C = x2
|
_draw_menu_ret: ; C = x2
|
||||||
ld b, #0
|
ld h, #0
|
||||||
push bc
|
ld l, c
|
||||||
call _gotoxy_arch
|
call _gotoxy_arch_asm
|
||||||
pop bc
|
|
||||||
_draw_menu_ret2:
|
_draw_menu_ret2:
|
||||||
pop af
|
pop af
|
||||||
ret
|
ret
|
||||||
|
@ -1014,18 +996,13 @@ _ctk_draw_menus:
|
||||||
;; clip_arch(0, SCREEN_HEIGHT);
|
;; clip_arch(0, SCREEN_HEIGHT);
|
||||||
ld h, #SCREEN_HEIGHT
|
ld h, #SCREEN_HEIGHT
|
||||||
ld l, #0
|
ld l, #0
|
||||||
push hl
|
call _clip_arch_asm
|
||||||
call _clip_arch
|
|
||||||
;; gotoxy_arch(0, 0);
|
;; gotoxy_arch(0, 0);
|
||||||
ld hl, #0
|
ld h, #0
|
||||||
ex (sp), hl
|
call _gotoxy_arch_asm
|
||||||
call _gotoxy_arch
|
|
||||||
;; revers_arch(1);
|
;; revers_arch(1);
|
||||||
ld h, #1
|
ld a, #1
|
||||||
ex (sp), hl
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp ; Stack; null
|
|
||||||
|
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
|
@ -1080,20 +1057,14 @@ _ctk_draw_menus_next2:
|
||||||
sub b ; strlen(menus->desktopmenu->title)
|
sub b ; strlen(menus->desktopmenu->title)
|
||||||
dec a ; SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1
|
dec a ; SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1
|
||||||
push hl
|
push hl
|
||||||
push af
|
call _clearto_arch_asm
|
||||||
inc sp
|
|
||||||
call _clearto_arch
|
|
||||||
inc sp
|
|
||||||
pop hl ; desktopmenu
|
pop hl ; desktopmenu
|
||||||
pop bc ; open, Stack; null
|
pop bc ; open, Stack; null
|
||||||
call _draw_menu_asm
|
call _draw_menu_asm
|
||||||
xor a
|
xor a
|
||||||
push af
|
call _revers_arch_asm
|
||||||
inc sp
|
|
||||||
call _revers_arch
|
|
||||||
inc sp
|
|
||||||
ret
|
ret
|
||||||
.endif ; CTK_CONF_MENUS
|
.endif
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; unsigned char ctk_draw_width(void);
|
;; unsigned char ctk_draw_width(void);
|
||||||
|
@ -1115,4 +1086,90 @@ _ctk_draw_height:
|
||||||
ld l, #SCREEN_HEIGHT
|
ld l, #SCREEN_HEIGHT
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; internal functions
|
||||||
|
;; ---------------------------------
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; static void clearbox_arch_asm(unsigned char x, y, w, h)
|
||||||
|
;; Stack; retl reth
|
||||||
|
;; AFBCDEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
;; DE = yx, B = h, C = w
|
||||||
|
_clearbox_arch_asm:
|
||||||
|
ld a, e
|
||||||
|
add a, c
|
||||||
|
ld c, a ; to_x = x + w
|
||||||
|
ld h, d
|
||||||
|
ld l, e
|
||||||
|
_clearbox_arch_loop::
|
||||||
|
call _gotoxy_arch_asm ; (x, y)
|
||||||
|
push hl
|
||||||
|
push bc ; B = h, HL = yx
|
||||||
|
ld a, c
|
||||||
|
call _clearto_arch_asm
|
||||||
|
pop bc
|
||||||
|
pop hl
|
||||||
|
inc h ; y++
|
||||||
|
djnz _clearbox_arch_loop
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void drawbox_asm(unsigned char x, y, w, h)
|
||||||
|
;; Stack; retl reth
|
||||||
|
;; B = h, C = w, D = y, E = x
|
||||||
|
;; AF__________
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_drawbox_asm:
|
||||||
|
push bc
|
||||||
|
push de
|
||||||
|
push hl
|
||||||
|
|
||||||
|
ld h, d
|
||||||
|
ld l, e
|
||||||
|
inc h
|
||||||
|
call _gotoxy_arch_asm ; (x, y + 1)
|
||||||
|
dec h
|
||||||
|
push hl
|
||||||
|
push bc ; Stack; hw, yx, B = h
|
||||||
|
call _cvline_arch_asm
|
||||||
|
ld a, #CH_LLCORNER
|
||||||
|
call _cputc_arch_asm
|
||||||
|
pop bc
|
||||||
|
push bc ; Stack; hw yx
|
||||||
|
ld b, c ; w
|
||||||
|
call _chline_arch_asm
|
||||||
|
ld a, #CH_LRCORNER
|
||||||
|
call _cputc_arch_asm
|
||||||
|
pop bc
|
||||||
|
pop hl
|
||||||
|
call _gotoxy_arch_asm ; (x, y)
|
||||||
|
push hl
|
||||||
|
push bc ; Stack; hw yx
|
||||||
|
ld a, #CH_ULCORNER
|
||||||
|
call _cputc_arch_asm
|
||||||
|
pop bc
|
||||||
|
push bc ; Stack; hw yx
|
||||||
|
ld b, c ; B = w
|
||||||
|
call _chline_arch_asm
|
||||||
|
ld a, #CH_URCORNER
|
||||||
|
call _cputc_arch_asm
|
||||||
|
pop bc ; B = h
|
||||||
|
pop hl
|
||||||
|
ld a, l
|
||||||
|
inc a
|
||||||
|
add a, c
|
||||||
|
ld l, a ; L = x + 1 + w
|
||||||
|
inc h ; H = y + 1
|
||||||
|
call _gotoxy_arch_asm
|
||||||
|
call _cvline_arch_asm
|
||||||
|
|
||||||
|
pop hl
|
||||||
|
pop de
|
||||||
|
pop bc
|
||||||
|
ret
|
||||||
|
|
||||||
_ctk_conio_arch_asm_end::
|
_ctk_conio_arch_asm_end::
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ctk-conio_arch-source.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
* $Id: ctk-conio_arch-source.c,v 1.2 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
#include "ctk/ctk.h"
|
#include "ctk/ctk.h"
|
||||||
#include "ctk/ctk-draw.h"
|
#include "ctk/ctk-draw.h"
|
||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
#include "ctk/ctk-arch.h"
|
#include "ctk/ctk_arch.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
|
@ -176,7 +176,7 @@ draw_widget(struct ctk_widget *w,
|
||||||
cputsn(w->widget.button.text, w->w);
|
cputsn(w->widget.button.text, w->w);
|
||||||
cputc(']');
|
cputc(']');
|
||||||
} else if (w->type == CTK_WIDGET_HYPERLINK) {
|
} else if (w->type == CTK_WIDGET_HYPERLINK) {
|
||||||
cputsn(w->widget.button.text, w->w);
|
cputsn(w->widget.hyperlink.text, w->w);
|
||||||
} else if (w->type == CTK_WIDGET_TEXTENTRY) {
|
} else if (w->type == CTK_WIDGET_TEXTENTRY) {
|
||||||
text = w->widget.textentry.text;
|
text = w->widget.textentry.text;
|
||||||
xscroll = 0;
|
xscroll = 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ctk-conio_arch.c,v 1.2 2007/09/19 12:46:15 matsutsuka Exp $
|
* $Id: ctk-conio_arch.c,v 1.3 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -68,6 +68,10 @@ const u8_t off_widget_textentry_ypos = offsetof(struct ctk_widget, widget) +
|
||||||
offsetof(struct ctk_widget_textentry, ypos);
|
offsetof(struct ctk_widget_textentry, ypos);
|
||||||
const u8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) +
|
const u8_t off_widget_textentry_state = offsetof(struct ctk_widget, widget) +
|
||||||
offsetof(struct ctk_widget_textentry, state);
|
offsetof(struct ctk_widget_textentry, state);
|
||||||
|
#if CTK_CONF_HYPERLINK
|
||||||
|
const u8_t off_widget_hyperlink_text = offsetof(struct ctk_widget, widget) +
|
||||||
|
offsetof(struct ctk_widget_hyperlink, text);
|
||||||
|
#endif CTK_CONF_HYPERLINK
|
||||||
|
|
||||||
#if CTK_CONF_ICONS
|
#if CTK_CONF_ICONS
|
||||||
const u8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) +
|
const u8_t off_widget_icon_title = offsetof(struct ctk_widget, widget) +
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: ctk_arch-def.h,v 1.2 2007/09/19 12:46:15 matsutsuka Exp $
|
* $Id: ctk_arch-def.h,v 1.3 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
/* Define if text icon is used. */
|
/* Define if text icon is used. */
|
||||||
#define CTK_CONF_ICON_TEXTMAPS 1
|
#define CTK_CONF_ICON_TEXTMAPS 1
|
||||||
/* Define if bitmap icon is used. */
|
/* Define if bitmap icon is used. */
|
||||||
#define CTK_CONF_ICON_BITMAPS 1
|
#define CTK_CONF_ICON_BITMAPS 0
|
||||||
/* Toggles support for closable windows. */
|
/* Toggles support for closable windows. */
|
||||||
#define CTK_CONF_WINDOWCLOSE 1
|
#define CTK_CONF_WINDOWCLOSE 1
|
||||||
/* Toggles support for movable windows. */
|
/* Toggles support for movable windows. */
|
||||||
|
@ -127,6 +127,10 @@
|
||||||
#define CTK_CONF_MENUWIDTH 16
|
#define CTK_CONF_MENUWIDTH 16
|
||||||
/* Defines if screen saver is supported. */
|
/* Defines if screen saver is supported. */
|
||||||
#define CTK_CONF_SCREENSAVER 0
|
#define CTK_CONF_SCREENSAVER 0
|
||||||
|
/* Defines if mouse is supported. */
|
||||||
|
#define CTK_CONF_MOUSE_SUPPORT 0
|
||||||
|
/* Defines if hyperlink is supported. */
|
||||||
|
#define CTK_CONF_HYPERLINK 1
|
||||||
|
|
||||||
/* The maximum number of menu items in each menu. */
|
/* The maximum number of menu items in each menu. */
|
||||||
#define CTK_CONF_MAXMENUITEMS 4
|
#define CTK_CONF_MAXMENUITEMS 4
|
||||||
|
@ -142,6 +146,12 @@
|
||||||
/* Defines which key that is to be used for activating the menus */
|
/* Defines which key that is to be used for activating the menus */
|
||||||
#define CTK_CONF_MENU_KEY CH_F1
|
#define CTK_CONF_MENU_KEY CH_F1
|
||||||
|
|
||||||
|
#ifdef LIBCONIO_CONF_EXPORT
|
||||||
|
#define LIBCONIO_EXPORT LIBCONIO_CONF_EXPORT
|
||||||
|
#else /* LIBCONIO_CONF_EXPORT */
|
||||||
|
#define LIBCONIO_EXPORT 0
|
||||||
|
#endif /* LIBCONIO_CONF_EXPORT */
|
||||||
|
|
||||||
/* Imported symbols from ctk.h */
|
/* Imported symbols from ctk.h */
|
||||||
|
|
||||||
#define _CTK_FOCUS_NONE 0
|
#define _CTK_FOCUS_NONE 0
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
;;;
|
;;;
|
||||||
;;; @author Takahide Matsutsuka <markn@markn.org>
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
;;;
|
;;;
|
||||||
;;; $Id: libconio_arch-asm.cS,v 1.1 2007/09/19 12:46:15 matsutsuka Exp $
|
;;; $Id: libconio_arch-asm.cS,v 1.2 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
;;;
|
;;;
|
||||||
|
|
||||||
;; uses preprocessor to enable definitions
|
;; uses preprocessor to enable definitions
|
||||||
#include "ctk_arch-def.h"
|
#include "ctk_arch-def.h"
|
||||||
|
|
||||||
;; export symbols
|
;; export symbols
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
.globl _cputc_arch
|
.globl _cputc_arch
|
||||||
.globl _cputs_arch
|
.globl _cputs_arch
|
||||||
.globl _cputsn_arch
|
.globl _cputsn_arch
|
||||||
|
@ -23,11 +24,9 @@
|
||||||
.globl _clearto_arch
|
.globl _clearto_arch
|
||||||
.globl _revers_arch
|
.globl _revers_arch
|
||||||
.globl _clip_arch
|
.globl _clip_arch
|
||||||
|
.endif
|
||||||
.globl _wherex_arch
|
.globl _wherex_arch
|
||||||
.globl _drawbox_arch
|
.globl _wherey_arch
|
||||||
.globl _drawicon_arch
|
|
||||||
.globl _clearbox_arch
|
|
||||||
.globl _newline_arch
|
|
||||||
|
|
||||||
.area _DATA
|
.area _DATA
|
||||||
_screen_cursor:
|
_screen_cursor:
|
||||||
|
@ -42,45 +41,23 @@ _screen_reversed:
|
||||||
.area _CODE
|
.area _CODE
|
||||||
|
|
||||||
_libconio_arch_asm_start::
|
_libconio_arch_asm_start::
|
||||||
.if 0
|
|
||||||
;; input: B = y, C = x
|
|
||||||
;; output: HL = offset
|
|
||||||
;; ______HL____
|
|
||||||
_calc_offset:
|
|
||||||
push af
|
|
||||||
push de
|
|
||||||
ld a, b
|
|
||||||
ld hl, #0
|
|
||||||
ld de, #SCREEN_WIDTH
|
|
||||||
_calc_offset_loop:
|
|
||||||
or a
|
|
||||||
jr z, _calc_offset_calcx
|
|
||||||
add hl, de
|
|
||||||
dec a
|
|
||||||
jr _calc_offset_loop
|
|
||||||
_calc_offset_calcx:
|
|
||||||
ld d, #0
|
|
||||||
ld e, c
|
|
||||||
add hl, de
|
|
||||||
pop de
|
|
||||||
pop af
|
|
||||||
ret
|
|
||||||
.endif
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; void cputc(char ch);
|
;; void cputc(char ch);
|
||||||
;; Stack; retl reth ch
|
;; Stack; retl reth ch
|
||||||
;; AFBCDEHL____
|
;; AFBCDEHL____
|
||||||
;; return A=1 if output is succeeded, A=0 if not
|
;; return A=1 if output is succeeded, A=0 if not
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_cputc_arch:
|
_cputc_arch:
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
;; ------------
|
;; ------------
|
||||||
;; A = char
|
;; A = char
|
||||||
;; AFBCDEHL____
|
;; AFBCDEHL____
|
||||||
;; ------------
|
;; ------------
|
||||||
_cputc_arch_asm:
|
_cputc_arch_asm::
|
||||||
push af
|
push af
|
||||||
ld bc, (#_screen_cursor) ;B=y, C=x
|
ld bc, (#_screen_cursor) ;B=y, C=x
|
||||||
ld de, (#_screen_clips) ;D=cy2, E=cy1
|
ld de, (#_screen_clips) ;D=cy2, E=cy1
|
||||||
|
@ -99,9 +76,6 @@ _cputc_arch_next2:
|
||||||
cp a, #SCREEN_WIDTH ; cursx - SCREEN_WIDTH
|
cp a, #SCREEN_WIDTH ; cursx - SCREEN_WIDTH
|
||||||
jr nc, _cputc_arch_ret_false ; if (cursx >= SCREEN_WIDTH)
|
jr nc, _cputc_arch_ret_false ; if (cursx >= SCREEN_WIDTH)
|
||||||
;; calculate offset
|
;; calculate offset
|
||||||
.if 0
|
|
||||||
call _calc_offset
|
|
||||||
.else
|
|
||||||
ld a, b ; A=y
|
ld a, b ; A=y
|
||||||
ld hl, #0
|
ld hl, #0
|
||||||
ld de, #SCREEN_WIDTH
|
ld de, #SCREEN_WIDTH
|
||||||
|
@ -115,7 +89,7 @@ _cputc_arch_calcx:
|
||||||
ld d, #0
|
ld d, #0
|
||||||
ld e, c
|
ld e, c
|
||||||
add hl, de
|
add hl, de
|
||||||
.endif
|
|
||||||
;; putchar
|
;; putchar
|
||||||
pop af
|
pop af
|
||||||
ld de, #VRAM_CHAR
|
ld de, #VRAM_CHAR
|
||||||
|
@ -149,19 +123,46 @@ _cputc_arch_ret_false:
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_cputs_arch:
|
.if 1
|
||||||
|
_cputs_arch::
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld e, (hl)
|
ld e, (hl)
|
||||||
inc hl
|
inc hl
|
||||||
ld d, (hl)
|
ld d, (hl)
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
|
|
||||||
|
;; ------------
|
||||||
|
;; DE = str
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; ------------
|
||||||
|
_cputs_arch_asm::
|
||||||
ld b, #SCREEN_WIDTH ; max length
|
ld b, #SCREEN_WIDTH ; max length
|
||||||
|
jr _cputsn_arch_asm ; take over B and DE
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void cputsn(char *str, unsigned char length);
|
||||||
|
;; Stack; retl reth strl strh length
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
|
_cputsn_arch:
|
||||||
|
ld hl, #2
|
||||||
|
add hl, sp
|
||||||
|
ld e, (hl)
|
||||||
|
inc hl
|
||||||
|
ld d, (hl)
|
||||||
|
inc hl
|
||||||
|
ld b, (hl)
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
|
|
||||||
;; ------------
|
;; ------------
|
||||||
;; B = nchars
|
;; B = nchars
|
||||||
;; DE = str
|
;; DE = str
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; ------------
|
;; ------------
|
||||||
_cputs_arch_loop:
|
_cputsn_arch_asm::
|
||||||
ld a, (de)
|
ld a, (de)
|
||||||
or a
|
or a
|
||||||
ret z
|
ret z
|
||||||
|
@ -171,24 +172,8 @@ _cputs_arch_loop:
|
||||||
pop de
|
pop de
|
||||||
pop bc
|
pop bc
|
||||||
inc de
|
inc de
|
||||||
djnz _cputs_arch_loop
|
djnz _cputsn_arch_asm
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; ---------------------------------
|
|
||||||
;; void cputsn(char *str, unsigned char length);
|
|
||||||
;; Stack; retl reth strl strh length
|
|
||||||
;; AFB_DEHL____
|
|
||||||
;; return void
|
|
||||||
;; ---------------------------------
|
|
||||||
_cputsn_arch:
|
|
||||||
ld hl, #2
|
|
||||||
add hl, sp
|
|
||||||
ld e, (hl)
|
|
||||||
inc hl
|
|
||||||
ld d, (hl)
|
|
||||||
inc hl
|
|
||||||
ld b, (hl)
|
|
||||||
jr _cputs_arch_loop ; take over B and DE
|
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; void chline(unsigned char length);
|
;; void chline(unsigned char length);
|
||||||
|
@ -196,6 +181,7 @@ _cputsn_arch:
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_chline_arch:
|
_chline_arch:
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
|
@ -204,15 +190,13 @@ _chline_arch:
|
||||||
;; B = length
|
;; B = length
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; ------------
|
;; ------------
|
||||||
_chline_arch_asm:
|
.endif
|
||||||
|
_chline_arch_asm::
|
||||||
ld a, #CH_HOLILINE
|
ld a, #CH_HOLILINE
|
||||||
_chline_arch_loop:
|
|
||||||
push bc
|
push bc
|
||||||
push af
|
|
||||||
call _cputc_arch_asm
|
call _cputc_arch_asm
|
||||||
pop af
|
|
||||||
pop bc
|
pop bc
|
||||||
djnz _chline_arch_loop
|
djnz _chline_arch_asm
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
@ -221,23 +205,23 @@ _chline_arch_loop:
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_cvline_arch:
|
_cvline_arch:
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld b, (hl) ; length
|
ld b, (hl) ; length
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
;; ------------
|
;; ------------
|
||||||
;; B = length
|
;; B = length
|
||||||
;; AFB_DEHL____
|
;; AFB_DEHL____
|
||||||
;; ------------
|
;; ------------
|
||||||
_cvline_arch_asm:
|
_cvline_arch_asm::
|
||||||
ld a, #CH_VERTLINE
|
|
||||||
ld hl, (#_screen_cursor) ; H=y, L=x
|
ld hl, (#_screen_cursor) ; H=y, L=x
|
||||||
_cvline_arch_loop:
|
_cvline_arch_loop:
|
||||||
|
ld a, #CH_VERTLINE
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
push af
|
|
||||||
call _cputc_arch_asm
|
call _cputc_arch_asm
|
||||||
pop af
|
|
||||||
pop bc
|
pop bc
|
||||||
pop hl
|
pop hl
|
||||||
inc h
|
inc h
|
||||||
|
@ -251,19 +235,22 @@ _cvline_arch_loop:
|
||||||
;; _F__DEHL____
|
;; _F__DEHL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_gotoxy_arch:
|
.if 1
|
||||||
|
_gotoxy_arch::
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld d, (hl) ; x
|
|
||||||
inc hl
|
|
||||||
ld e, (hl) ; y
|
ld e, (hl) ; y
|
||||||
|
inc hl
|
||||||
|
ld d, (hl) ; x
|
||||||
|
ld l, e ; L=x
|
||||||
|
ld h, d ; H=y
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
|
|
||||||
;; ------------
|
;; ------------
|
||||||
;; D = x, E = y
|
;; H = x, L = y
|
||||||
;; ______HL____
|
;; ____________
|
||||||
;; ------------
|
;; ------------
|
||||||
_gotoxy_arch_asm:
|
_gotoxy_arch_asm::
|
||||||
ld l, d ; L=x
|
|
||||||
ld h, e ; H=y
|
|
||||||
ld (#_screen_cursor), hl
|
ld (#_screen_cursor), hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -273,11 +260,17 @@ _gotoxy_arch_asm:
|
||||||
;; AFBCDEHL____
|
;; AFBCDEHL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_clearto_arch:
|
_clearto_arch:
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
_clearto_arch_loop:
|
.endif ; LIBCONIO_EXPORT
|
||||||
|
;; ------------
|
||||||
|
;; A = to
|
||||||
|
;; AFBCDEHL____
|
||||||
|
;; ------------
|
||||||
|
_clearto_arch_asm::
|
||||||
ld hl, #_screen_cursor
|
ld hl, #_screen_cursor
|
||||||
cp (hl) ; to - cursx
|
cp (hl) ; to - cursx
|
||||||
ret z
|
ret z
|
||||||
|
@ -288,7 +281,7 @@ _clearto_arch_loop:
|
||||||
or a
|
or a
|
||||||
pop af
|
pop af
|
||||||
ret z
|
ret z
|
||||||
jr _clearto_arch_loop
|
jr _clearto_arch_asm
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; void revers_arch(unsigned char reverse)
|
;; void revers_arch(unsigned char reverse)
|
||||||
|
@ -296,10 +289,15 @@ _clearto_arch_loop:
|
||||||
;; A_____HL____
|
;; A_____HL____
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_revers_arch:
|
_revers_arch:
|
||||||
ld hl, #2
|
ld hl, #2
|
||||||
add hl, sp
|
add hl, sp
|
||||||
ld a, (hl)
|
ld a, (hl)
|
||||||
|
.endif ; LIBCONIO_EXPORT
|
||||||
|
;; A = reverse
|
||||||
|
;; ____________
|
||||||
|
_revers_arch_asm::
|
||||||
ld (#_screen_reversed), a
|
ld (#_screen_reversed), a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -309,6 +307,7 @@ _revers_arch:
|
||||||
;; ____________
|
;; ____________
|
||||||
;; return void
|
;; return void
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
|
.if LIBCONIO_EXPORT
|
||||||
_clip_arch:
|
_clip_arch:
|
||||||
push af
|
push af
|
||||||
push hl
|
push hl
|
||||||
|
@ -326,12 +325,20 @@ _clip_arch:
|
||||||
pop hl
|
pop hl
|
||||||
pop af
|
pop af
|
||||||
ret
|
ret
|
||||||
|
.endif
|
||||||
|
;; ---------------------------------
|
||||||
|
;; L = clipy1, H = clipy2
|
||||||
|
;; ____________
|
||||||
|
;; ---------------------------------
|
||||||
|
_clip_arch_asm::
|
||||||
|
ld (#_screen_clips), hl
|
||||||
|
ret
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; unsigned char wherex_arch()
|
;; unsigned char wherex_arch()
|
||||||
;; Stack; retl reth
|
;; Stack; retl reth
|
||||||
;; A_____HL____
|
;; A______L____
|
||||||
;; return void
|
;; return x
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_wherex_arch:
|
_wherex_arch:
|
||||||
ld a, (#_screen_cursor)
|
ld a, (#_screen_cursor)
|
||||||
|
@ -339,168 +346,17 @@ _wherex_arch:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
;; void drawbox_arch(unsigned char x, y, w, h)
|
;; unsigned char wherey_arch()
|
||||||
;; Stack; retl reth x y w h
|
;; Stack; retl reth
|
||||||
;; AFBCDEHL____
|
;; A______L____
|
||||||
;; return void
|
;; return y
|
||||||
;; ---------------------------------
|
;; ---------------------------------
|
||||||
_drawbox_arch:
|
_wherey_arch:
|
||||||
ld hl, #2
|
ld a, (#_screen_cursor + 1)
|
||||||
add hl, sp
|
ld l, a
|
||||||
ld d, (hl) ; x
|
|
||||||
inc hl
|
|
||||||
ld e, (hl) ; y
|
|
||||||
inc hl
|
|
||||||
ld c, (hl) ; w
|
|
||||||
inc hl
|
|
||||||
ld b, (hl) ; h
|
|
||||||
inc e
|
|
||||||
call _gotoxy_arch_asm ; (x, y + 1)
|
|
||||||
dec e
|
|
||||||
push de
|
|
||||||
push bc
|
|
||||||
call _cvline_arch_asm
|
|
||||||
ld a, #CH_LLCORNER
|
|
||||||
call _cputc_arch_asm
|
|
||||||
pop bc
|
|
||||||
push bc ; Stack; BC DE
|
|
||||||
ld b, c ; w
|
|
||||||
call _chline_arch_asm
|
|
||||||
ld a, #CH_LRCORNER
|
|
||||||
call _cputc_arch_asm
|
|
||||||
pop bc
|
|
||||||
pop de
|
|
||||||
call _gotoxy_arch_asm ; (x, y)
|
|
||||||
push de
|
|
||||||
push bc ; Stack; BC DE
|
|
||||||
ld a, #CH_ULCORNER
|
|
||||||
call _cputc_arch_asm
|
|
||||||
pop bc
|
|
||||||
push bc ; Stack; BC DE
|
|
||||||
ld b, c
|
|
||||||
call _chline_arch_asm
|
|
||||||
ld a, #CH_URCORNER
|
|
||||||
call _cputc_arch_asm
|
|
||||||
pop bc ; B = h
|
|
||||||
pop de
|
|
||||||
ld a, d
|
|
||||||
inc a
|
|
||||||
add a, c
|
|
||||||
ld d, a ; D = x + 1 + w
|
|
||||||
inc e ; E = y + 1
|
|
||||||
call _gotoxy_arch_asm
|
|
||||||
call _cvline_arch_asm
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.if CTK_CONF_ICONS
|
.if 0
|
||||||
;; ---------------------------------
|
|
||||||
;; void drawicon_arch(char* textmap, char *title);
|
|
||||||
;; Stack; retl reth textmapl textmaph titlel titleh
|
|
||||||
;; AFBCDEHL____
|
|
||||||
;; return void
|
|
||||||
;; ---------------------------------
|
|
||||||
_drawicon_arch:
|
|
||||||
ld hl, #_screen_cursor
|
|
||||||
ld b, (hl) ; x
|
|
||||||
inc hl
|
|
||||||
ld c, (hl) ; y
|
|
||||||
ld hl, #2
|
|
||||||
add hl, sp
|
|
||||||
ld e, (hl)
|
|
||||||
inc hl
|
|
||||||
ld d, (hl) ; DE = textmap
|
|
||||||
ld a, e
|
|
||||||
or d
|
|
||||||
ret z ; if (textmap == NULL) return;
|
|
||||||
ld a, #3 ; loop counter
|
|
||||||
_drawicon_arch_loop:
|
|
||||||
push af
|
|
||||||
push de
|
|
||||||
ld d, b
|
|
||||||
ld e, c
|
|
||||||
call _gotoxy_arch_asm
|
|
||||||
pop de
|
|
||||||
push bc
|
|
||||||
ld b, #3
|
|
||||||
call _cputs_arch_loop ; DE = DE + 3
|
|
||||||
pop bc
|
|
||||||
pop af
|
|
||||||
inc c ; y++
|
|
||||||
dec a
|
|
||||||
jr z, _drawicon_arch_title
|
|
||||||
jr _drawicon_arch_loop
|
|
||||||
;; B = x, C = y
|
|
||||||
_drawicon_arch_title:
|
|
||||||
ld hl, #4
|
|
||||||
add hl, sp
|
|
||||||
ld e, (hl)
|
|
||||||
inc hl
|
|
||||||
ld d, (hl) ; DE = title
|
|
||||||
ld h, d
|
|
||||||
ld l, e
|
|
||||||
xor a
|
|
||||||
push de
|
|
||||||
ld d, #0
|
|
||||||
_drawicon_arch_title_strlen:
|
|
||||||
ld a, (hl)
|
|
||||||
or a
|
|
||||||
jr z, _drawicon_arch_title_setpos
|
|
||||||
inc hl
|
|
||||||
inc d
|
|
||||||
jr _drawicon_arch_title_strlen
|
|
||||||
_drawicon_arch_title_setpos:
|
|
||||||
ld h, d ; H = len
|
|
||||||
ld a, d
|
|
||||||
pop de
|
|
||||||
add a, b
|
|
||||||
cp a, #SCREEN_WIDTH ; x + len - SCREEN_WIDTH
|
|
||||||
jr c, _drawicon_arch_title_show
|
|
||||||
ld a, #SCREEN_WIDTH
|
|
||||||
sub h
|
|
||||||
ld b, a
|
|
||||||
;; B = x, C = y, DE = title, H = len
|
|
||||||
_drawicon_arch_title_show:
|
|
||||||
push de
|
|
||||||
ld d, b
|
|
||||||
ld e, c
|
|
||||||
call _gotoxy_arch_asm
|
|
||||||
pop de
|
|
||||||
ld b, #SCREEN_WIDTH
|
|
||||||
call _cputs_arch_loop
|
|
||||||
ret
|
|
||||||
.endif
|
|
||||||
|
|
||||||
;; ---------------------------------
|
|
||||||
;; void clearbox_arch(unsigned char x, y, w, h)
|
|
||||||
;; Stack; retl reth x y w h
|
|
||||||
;; AFBCDEHL____
|
|
||||||
;; return void
|
|
||||||
;; ---------------------------------
|
|
||||||
_clearbox_arch:
|
|
||||||
ld hl, #2
|
|
||||||
add hl, sp
|
|
||||||
ld d, (hl) ; x
|
|
||||||
inc hl
|
|
||||||
ld e, (hl) ; y
|
|
||||||
inc hl
|
|
||||||
ld c, (hl) ; w
|
|
||||||
inc hl
|
|
||||||
ld b, (hl) ; h
|
|
||||||
ld a, d
|
|
||||||
add a, c
|
|
||||||
ld c, a ; to_x
|
|
||||||
_clearbox_arch_loop:
|
|
||||||
call _gotoxy_arch_asm ; (x, y + 1)
|
|
||||||
push de
|
|
||||||
push bc
|
|
||||||
ld a, c
|
|
||||||
call _clearto_arch_loop
|
|
||||||
pop bc
|
|
||||||
pop de
|
|
||||||
inc e
|
|
||||||
djnz _clearbox_arch_loop
|
|
||||||
ret
|
|
||||||
|
|
||||||
_newline_arch:
|
_newline_arch:
|
||||||
ld hl, #_screen_cursor
|
ld hl, #_screen_cursor
|
||||||
xor a
|
xor a
|
||||||
|
@ -521,5 +377,6 @@ _newline_arch_scroll:
|
||||||
ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - #SCREEN_WIDTH
|
ld bc, #SCREEN_HEIGHT * #SCREEN_WIDTH - #SCREEN_WIDTH
|
||||||
ldir
|
ldir
|
||||||
ret
|
ret
|
||||||
|
.endif
|
||||||
|
|
||||||
_libconio_arch_asm_end::
|
_libconio_arch_asm_end::
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: libconio_arch.h,v 1.1 2007/09/19 12:46:15 matsutsuka Exp $
|
* $Id: libconio_arch.h,v 1.2 2007/09/29 04:10:00 matsutsuka Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -41,22 +41,19 @@
|
||||||
#ifndef __LIBCONIO_ARCH_H__
|
#ifndef __LIBCONIO_ARCH_H__
|
||||||
#define __LIBCONIO_ARCH_H__
|
#define __LIBCONIO_ARCH_H__
|
||||||
|
|
||||||
|
/* The following functions are used by assembler only */
|
||||||
|
#if LIBCONIO_EXPORT
|
||||||
void cputc_arch(char c);
|
void cputc_arch(char c);
|
||||||
void cputs_arch(char *str);
|
void cputs_arch(char *str);
|
||||||
void cputsn_arch(char *str, unsigned char len);
|
void cputsn_arch(char *str, unsigned char len);
|
||||||
void chline_arch(unsigned char length);
|
void chline_arch(unsigned char length);
|
||||||
void cvline_arch(unsigned char length);
|
void cvline_arch(unsigned char length);
|
||||||
void clip_arch(unsigned char clip1, unsigned char clip2);
|
void clip_arch(unsigned char clip1, unsigned char clip2);
|
||||||
unsigned char wherex_arch();
|
|
||||||
void gotoxy_arch(unsigned char x, unsigned char y);
|
|
||||||
void clearto_arch(unsigned char to);
|
void clearto_arch(unsigned char to);
|
||||||
void revers_arch(unsigned char reversed);
|
void revers_arch(unsigned char reversed);
|
||||||
void drawbox_arch(unsigned char x, unsigned char y,
|
#endif /* LIBCONIO_CONF_EXPORT */
|
||||||
unsigned char w, unsigned char h);
|
unsigned char wherex_arch();
|
||||||
void drawicon_arch(unsigned char x, unsigned char y,
|
unsigned char wherey_arch();
|
||||||
char* textmap, char* title);
|
void gotoxy_arch(unsigned char x, unsigned char y);
|
||||||
void clearbox_arch(unsigned char x, unsigned char y,
|
|
||||||
unsigned char w, unsigned char h);
|
|
||||||
void newline_arch();
|
|
||||||
|
|
||||||
#endif /* __LIBCONIO_ARCH_H__ */
|
#endif /* __LIBCONIO_ARCH_H__ */
|
||||||
|
|
Loading…
Reference in a new issue