📄 display.mac
字号:
$nolist
;*******************************************************************************
;*******************************************************************************
;* *
;* (C)Copyright, CLOVER China Electronics Co.,LTD. *
;* All Rigits Reserved *
;* add:No.58-F Yang Dong Road, LuoFeng Demonstrative Zone Suzhou, China *
;* Tel: 0512-67261886 Fax:0512-67261882 *
;* http://www.clover.co.jp *
;* *
;*******************************************************************************
;*******************************************************************************
;
; OBS CPD3212T source program
; CPU: TOSHIBA TLC-870/C series TMP86CM74A
; RAM: 2Kbytes(0040h - 083Fh)
; ROM: 32Kbytes(8000h - FFFFh)
;
;Sub routines
?trigger(@)
@include "symdef_ram.inc"
@include "macro.inc"
@include "define.inc"
$list
public edit_disp,disp_to_dbr,init_vft;V2.00,init_lcd,lcd_display_exp,lcd_display_symbol,lcd_display_symbol,lcd_display_exp
public vft_disable,vft_enable
extern spc_disp
ROM section code
@define(RTC_SET_ON(label))(
test (FLG_RTC).5
j f,@label
)
;--------------------------------
@define(F_ICDSP_ON(label))(
test (FLG_K).7
j f,@label
)
;------------------------------
@define(F_BLINK_OFF(label))(
test (FLG_MODE+1).7
j t,@label
)
;---------------------
@define(F_BLINK_ON(label))(
test (FLG_MODE+1).7
j f,@label
)
;------------------------
@define(F_DPIN_ON(label))(
test (FLG_1).4
j f,@label
)
;--------------------------
@define(F_TNKEY_OFF(label))(
test (FLG_K).5
j t,@label
)
@define(SW_ADM_ON(label))(
test (MDFLG_0).7
j f,@label
)
;==============================================================================
; Name: init_lcd
; Function: set lcd control resister and initialize DBR
; Input: non
;==============================================================================
;==============================================================================
; Name: disp_to_dbr
; Function: DISP data convert and store to LCD DBR(Data Buffer Register)
; Input: DISP +0~+13 (set character code, DP and commma flag)
; used register: wa, bc, de, hl, ix, iy
;==============================================================================
; Name: init_vft
; Function: set VFT control resister and initialize DBR
; Input: non
;==============================================================================
;
;set 256us refresh interval(under 8MHz clock).....
init_vft:
ld (VFTCR1),0y11000000 ;BLK-blanking, SDT1-10, VSEL-(V31~V0) <--8MHz
ld (VFTCR2),0y00101110 ;DIM-14/16, STA-(T14~T0)
ld (VFTCR3),0y01110000 ;OWSEL-(Grid P60~P76 Seg P80~PD4), HVTR1-0, HVTR0-0, SDT2-0
ld (P6DR),0y00000000
ld (P7DR),0y00000000
ld (P8DR),0y00000000
ld ix,tbl_vft_ini ;set grid pattern to DBR(F80h to F9Eh)
ld iy,DBR_TOP ;0f80
init_vft_00:
ld a,(ix)
ld (iy),a
inc ix
inc iy
cmp ix,tbl_vft_ini_end
j lt,init_vft_00
ld a,0 ;clear other DBR area
init_vft_02:
ld (iy),a
cmp iy,DBR_BOT
j ge,init_vft_09
inc iy
j init_vft_02
init_vft_09:
call spc_disp
vft_enable:
ld (VFTCR1),0y01000000 ;BLK-enable 8M
ret
vft_disable:
ld (VFTCR1),0y11000000 ;BLK-blanking, SDT1-10, VSEL-(V31~V0) 8M
ret
;V2.10-------------------------------------
;V4.13dbr_clear:
;V4.13 ld hl,0x0fa0 ;V2.12
;V4.13 ld c,0 ;V2.12
;V4.13dbr_clear0: ;V2.12
;V4.13 ld (hl+c),0 ;V2.12
;V4.13 inc c ;V2.12
;V4.13 cmp c,0x02f ;V2.12
;V4.13 j le,dbr_clear0 ;V2.12
;V4.13 ret ;V2.12
;==============================================================================
; Name: disp_to_dbr
; Function: DISP data convert and store to DBR
; Input: DISP +0~+13 (set character code, DP and commma flag)
;==============================================================================
disp_to_dbr:
ld ix,DISP_LSD
ld iy,DBR_SEG
ld hl,tbl_vft_seg
;set segment data and DP to DBR(FA0h~FAFh)
disp_to_dbr0:
ld c,(ix) ;DISP data load
and c,0y00111111
ld a,(hl+c) ;convert to segment data
;V4.13 @F_BLINK_OFF (disp_to_dbr1) ;V2.12
;V4.13 and a,0y00000000 ;V2.12
disp_to_dbr1: ;V2.12
ld c,(ix) ;DISP data load
;V3.00 @RTC_SET_ON (disp_to_dbr2) ;V2.07
;V4.13 @F_ICDSP_ON (disp_to_dbr2) ;V2.07
;V3.01 @F_BLINK_ON (disp_to_dbr2) ;V2.12
and c,0y01000000 ;DP bit(bit6) check
j z,disp_to_dbr2 ;no DP yes->
or a,0y10000000 ;set DP segment
disp_to_dbr2:
ld (iy),a ;store to DBR
;set commma to DBR(FB0h~FBFh)
ld a,0y00000000
;V3.00 @RTC_SET_ON (disp_to_dbr4) ;V2.07
;V4.13 @F_BLINK_ON (disp_to_dbr4) ;V2.12
;V4.13 @F_DPIN_ON (disp_to_dbr3) ;V2.13
;V4.13 @F_TNKEY_OFF (disp_to_dbr3) ;V2.13
; @SW_ADM_ON (disp_to_dbr4) ;V2.13
disp_to_dbr3: ;V2.13
ld c,(ix) ;DISP data load
and c,0y10000000 ;Comma bit(bit7) check
j z,disp_to_dbr4 ;no Comma yes->
;V3.00 ld a,0y10000000 ;Comma set to DBR
set (iy-0x10).7
jp disp_to_dbr4_1
disp_to_dbr4:
clr (iy-0x10).7
disp_to_dbr4_1:
;V3.00 ld (iy-0x10),a ;store to DBR(current DBR address + 10h)
dec ix ;DISP address move to MSD <-
inc iy ;+1 DBR address
@IS_D14_ON(disp_to_dbr4_2) ;V4.05
cmp ix,DISP_MSD+2 ;V4.03
jp disp_to_dbr4_3 ;V4.05
;V4.05 @IS_D14_ON(disp_to_dbr4_2) ;V4.03
;V4.05 cmp ix,DISP_MSD+2
disp_to_dbr4_2: ;V4.03
cmp ix,DISP_MSD ;V4.05
disp_to_dbr4_3: ;V4.05
j ge,disp_to_dbr0
disp_symbol: ;V2.10
;set 'E','-','M' sign to symbol digit...........
ld c,0y00000000
@BBC (ICON_E,disp_to_dbr5)
set c.2 ;set 'E'
disp_to_dbr5:
;V3.00 @BBS (RTC_ON,disp_to_dbr9) ;RTC display? yes ->
;V3.00 @BBS (RTC_SET,disp_to_dbr9)
@BBC (ICON_MIN,disp_to_dbr6)
set c.1 ;set '-'
disp_to_dbr6:
@BBC (ICON_M,disp_to_dbr7)
set c.0 ;set 'M'
disp_to_dbr7:
;V3.00 ld (iy),c ;store to DBR(G15)
;V3.00 ld c,0 ;V2.06
;V3.00 @BBC (ICON_GT,disp_to_dbr8) ;V2.06
;V3.00 ld c,0y00000001 ;V2.06 set "GT"
;V3.00disp_to_dbr8:
ld (iy),c ;V2.06
ret
disp_to_dbr9: ;V2.06
ld (iy),c ;V2.06
ld c,0 ;V2.06
ld (iy+0x10),c ;V2.06
ret ;V2.06
tbl_vft_seg:
; PPPPPPPP
; 88888888
; 76543210
; .decgfba
db 0y01110111 ;00h '0'
db 0y00010010 ;01h '1'
db 0y01101011 ;02h '2'
db 0y01011011 ;03h '3'
db 0y00011110 ;04h '4'
db 0y01011101 ;05h '5'
db 0y01111101 ;06h '6'
db 0y00010111 ;07h '7'
db 0y01111111 ;08h '8'
db 0y01011111 ;09h '9'
db 0y00111111 ;0ah 'A'
db 0y01111100 ;0bh 'b'
db 0y01100101 ;0ch 'c'
db 0y01111010 ;0dh 'd'
db 0y01101101 ;0eh 'E'
db 0y00101101 ;0fh 'F'
db 0y00101111 ;10h 'P'
db 0y00111110 ;11h 'H '
db 0y00001000 ;12h '-'
db 0y01100100 ;13h 'L'
db 0y00110111 ;14h 'M'
db 0y00111000 ;15h 'n'
db 0y01001000 ;16h '='
db 0y00101000 ;17h 'r'
db 0y01110110 ;18h 'U'
db 0y01101100 ;19h 't'
db 0y00000000 ;1ah ' '
db 0y00000000 ;1bh ' '
db 0y00000000 ;1ch ' '
db 0y00000000 ;1dh ' '
db 0y00000000 ;1eh ' '
db 0y00000000 ;1fh ' '
; .decgfba
db 0y00000001 ;a 20h
db 0y00000010 ;b 21h
db 0y00010000 ;c 22h
db 0y01000000 ;d 23h
db 0y00100000 ;e 24h
db 0y00000100 ;f 25h
db 0y00001000 ;g 26h
db 0y10000000 ;. 27h
db 0y00000000 ;' 28h
db 0y00001111 ;up"o" 29h
db 0y01111000 ;low'o' 2ah
db 0y00000000 ; 2bh
db 0y00000000 ; 2ch
;V4.01 db 0y00000000 ; 2dh
;V4.01 db 0y00000000 ; 2eh
;V4.01 db 0y00000000 ; 2fh
;V4.01 db 0y00000000 ; 30h
;V4.01 db 0y00000000 ; 31h
;V4.01 db 0y00000000 ; 32h
;V4.01 db 0y00000000 ; 33h
;V4.01 db 0y00000000 ; 34h
;V4.01 db 0y00000000 ; 35h
;V4.01 db 0y00000000 ; 36h
;V4.01 db 0y00000000 ; 37h
;V4.01 db 0y00000000 ; 38h
;V4.01 db 0y00000000 ; 39h
;V4.01 db 0y00000000 ; 3ah
;V4.01 db 0y00000000 ; 3bh
;V4.01 db 0y00000000 ; 3ch
;V4.01 db 0y00000000 ; 3dh
;V4.01 db 0y00000000 ; 3eh
;V4.01 db 0y00000000 ; 3fh
;V4.01 db 0y00000000 ; 40h
tbl_vft_ini:
; V7------V0
db 0y00000001
db 0y00000010
db 0y00000100
db 0y00001000
db 0y00010000
db 0y00100000
db 0y01000000
db 0y10000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
; 15-----V8
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000000
db 0y00000001
db 0y00000010
db 0y00000100
db 0y00001000
db 0y00010000
db 0y00100000
db 0y01000000
db 0y10000000
tbl_vft_ini_end:
;==============================================================================
; Name: edit_disp
; Function: copy work resister data to DISP with zero suppression and
; set commma, DP, minus sign
; Input: hl <- work resister address
; Output: DISP +0~+13,ICON_MIN flag
; Work reg.: ix,iy,c,a,w
;==============================================================================
edit_disp:
@SEB (F_DOFF) ;V2.10
ld ix,hl
add ix,OFF_LSD ;ix..address of work register
ld iy,DISP_LSD ;iy..address of DISP
ld c,0 ;c...digit pointer of DISP(0-13)
edit_disp0:
ld a,(ix)
ld cf,c.0 ;check digit pointer
j cc,edit_disp2 ;c is even number? yes->
swap a ;swap by nibble
dec ix ;odd digit -> move source address to next digit
edit_disp2:
and a,0x0f ;get low nibble data
cmp c,(hl+OFF_DP) ;check DP location
j eq,edit_disp4
ld (iy),a ;store to DISP
dec iy ;move distination address to next digit
inc c ;digit counter +1
cmp c,LENG_WK*2
j lt,edit_disp0 ;transfer end? no->loop
j edit_disp9 ;for make sure
;Found DP...............
edit_disp4:
set a.6 ;set DP flag to DISP
ld (iy),a ;store to DISP
dec iy ;move distination address to next digit
inc c ;digit counter+1
ld w,2 ;for set comma separater
edit_disp5:
ld a,(ix) ;get source data
ld cf,c.0 ;check digit pointer
j cc,edit_disp6 ;even digit? yes->
swap a ;odd digit -> swap by nibble
dec ix ;odd digit -> move source address to next digit
edit_disp6:
and a,0x0f ;get low nibble data
dec w
j f,edit_disp8 ;if no borrow? yes->
;V4.13 @if(@eqs(@UP_COM,@ON))then(
;V4.13 or (iy+1),0y10000000 ;set comma to DISP(current DISP address-1) <- for upper ' display style
;V4.13 )else(
set a.7 ;set comma flag to DISP(current DISP) <- for lower , display style
;V4.13 )fi
ld w,2 ;for set comma separater
edit_disp8:
ld (iy),a ;store to DISP
dec iy ;move distination address to next digit
inc c ;digit counter+1
cmp c,LENG_WK*2 ;transfer end?
j lt,edit_disp5 ;no ->loop
edit_disp9:
;zero suppression...............
inc iy ;DISP address move to MSD
dec c
edit_disp10:
ld a,(iy) ;check DISP data from MSD
and a,0y00111111 ;hide comma,DP flag
j nz,edit_disp11 ;found data yes-> stop zero suppression
;current digit is zero.....
ld a,(iy) ;check current DISP digit
and a,0y01000000 ;check DP
j nz,edit_disp11 ;found DP yes-> stop zero suppression (in case of 0.xxx--- format)
ld (iy),D_SPC ;fill space code
inc iy ;DISP address move to next digit
dec c ;digit counter -1
cmp c,0 ;LSD?
j gt,edit_disp10 ;no-> loop
edit_disp11:
;V4.13 @if(@eqs(@UP_COM,@ON))then(
;V4.13 and (iy),0y01111111 ;clear commma for left most digit <- for upper ' display style (no need this instruction when lower , display)
;V4.13 )else(
;V4.13 )fi
;set minus sign...........
@CLB (ICON_MIN)
ld a,(hl+OFF_S) ;-value?
j z,edit_disp19 ;no ->exit
;V3.00 @BBS (M_JET,edit_disp12) ;V2.07
;V1.21 @if(@eqs(@D14,@ON))then(
;V1.21 cmp c,LENG_WK*2-1 ;MSD? in case of 14digit
;V1.21 )else(
;V1.21 cmp c,(LENG_WK-1)*2-1 ;MSD? in case of 12digit
;V1.21 )fi
;V2.07 push wa ;V1.21
@BBS (M14,edit_disp11x) ;V1.21
@BBC (M10,edit_disp11y) ;V1.21
;V2.07 pop wa ;V1.21
cmp C,(LENG_WK-2)*2-1 ;V1.21
jp edit_disp11z ;V1.21
edit_disp11x: ;V1.21
;V2.07 pop wa ;V1.21
cmp c,LENG_WK*2-1 ;V1.21
jp edit_disp11z ;V1.21
edit_disp11y: ;V1.21
;V2.07 pop wa ;V1.21
cmp c,(LENG_WK-1)*2-1 ;V1.21
edit_disp11z: ;V1.21
j ge,edit_disp12 ;yes -> set extend minus sign
ld (iy-1),D_HYPN ;set minus code
j edit_disp19
edit_disp12:
@SEB (ICON_MIN)
edit_disp19:
ret
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -