24桁x2行LCD使用表示ライブラリーサンプル
/*======================================================================*/
/* */
/* 24桁x2行LCD使用表示ライブラリー */
/* ("lcd_drv.h"を必ずインクルードする事) */
/* */
/* stdio.h Vr1.00 */
/* */
/* */
/* void put_lcd(int data) */
/* void crlf_lcd( ) */
/* */
/* */
/*======================================================================*/
void put_lcd(int data)
{
#asm
call __cursor_adr_r
ld a,l
cp 17h
jr z,put_lcd_1
cp 57h
jr z,put_lcd_2
ld hl,2
add hl,sp
ld a,(hl)
ld l,a
ld h,0
push hl
call __lcd_data_dsp
pop hl
ld l,0
ret
put_lcd_1:
ld hl,2
add hl,sp
ld a,(hl)
ld l,a
ld h,0
push hl
call __lcd_data_dsp
call lcd_crlf
pop hl
ld l,0
ret
put_lcd_2:
ld hl,2
add hl,sp
ld a,(hl)
ld l,a
ld h,0
push hl
call __lcd_data_dsp
ld a,40h
ld l,a
ld h,0
push hl
call __cursor_adr_w
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
ld hl,0
add hl,sp
ld b,24
put_lcd_3:
call lcd_busy
in a,(io_lcd_dt)
ld (hl),a
inc hl
djnz put_lcd_3
call __lcd_clear
call __cursor_home
ld hl,0
add hl,sp
ld b,24
put_lcd_4:
ld a,(hl)
call lcd_busy
out (io_lcd_dt),a
inc hl
djnz put_lcd_4
call lcd_crlf
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
#endasm
}
void crlf_lcd( )
{
#asm
call __cursor_adr_r
ld a,l
cp 40h
jr nc,crlf_lcd_1
call lcd_crlf
ret
crlf_lcd_1:
ld a,40h
ld l,a
ld h,0
push hl
call __cursor_adr_w
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
push bc
ld hl,0
add hl,sp
ld b,24
crlf_lcd_2:
call lcd_busy
in a,(io_lcd_dt)
ld (hl),a
inc hl
djnz crlf_lcd_2
call __lcd_clear
call __cursor_home
ld hl,0
add hl,sp
ld b,24
crlf_lcd_3:
ld a,(hl)
call lcd_busy
out (io_lcd_dt),a
inc hl
djnz crlf_lcd_3
call lcd_crlf
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
pop bc
#endasm
}