📄 self_test.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 *
;* *
;*******************************************************************************
;*******************************************************************************
;
; OILIVETTI summa20 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 "symdef_sub.inc"
@include "macro.inc"
@include "define.inc"
$list
public check_slftst,wait_35us
extern key_get,start,wait_100ms,wait_50ms,init_keybuf;,fix_mdflg
; extern write_1w,read_1w,wen_command,wds_command,start_blink,stop_blink
; extern hex_to_dec
extern test_prn,HD_TEMP,VPRN,update_md
ROM section code
V_N equ '123'
;==============================================================================
; check enter self test
;==============================================================================
; select RND off, FDP
; press 2, 6, 7 key and turn on AC
;
wait_35us:
cmp wa,(pc+a) ;7 machine cycle(1.75us under 16MHz clock)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
cmp wa,(pc+a)
ret
check_slftst:
ei
call wait_100ms
call wait_100ms
call update_md
cmp (MDFLG_0),0y01000000
j ne,check_stst9
cmp (MDFLG_1),0y01000010
j ne,check_stst9
cmp (MDFLG_2),0y00100100
j ne,check_stst9
cmp (MDFLG_3),0y00000000
j ne,check_stst9
di
ld (P9DR),0y00100000 ;
call wait_35us
ld a,(P1PRD) ;
and a,0y00111111 ;
cmp a,0y00000100 ;press '7'?
j ne,check_stst9
ld (P9DR),0y00010000 ;
call wait_35us
ld a,(P1PRD) ;
and a,0y00111111 ;
cmp a,0y00000001 ;press '2'
j ne,check_stst9 ;yes -> exit
ld (P9DR),0y00001000 ;
call wait_35us
ld a,(P1PRD) ;load key matrix return0~3 (P17~P14)
and a,0y0011111 ;press any key?
cmp a,0y0000010 ;press '6'
j ne,check_stst9
ei
call self_test
check_stst9:
ei
ret
self_test:
call temp_vprn
call vfd_test
call mode_prn
call key_test
call ee_test
call chara_prn
call spc_prnbuf
call print
call spc_prnbuf
call print
j start
M_TEMP db "TEMPERATURE C"
M_VPRN db "VOLTAGE V"
DISP_FINISH db "DISPLAY FINISH "
MD_OK db "MOD SWITCH OK"
MD_NG db "MOD SWITCH NG"
M_EEOK db "EEPROM OK"
M_EENG db "EEPROM NG"
KEY_OK db "KEY NET OK"
KEY_NG db "KEY NET NG"
;input: HL <- string address
set_1line:
ld c,0
ld ix,PRN_BUF_MSD
set_1ln0:
ld a,(hl)
ld (ix),a
inc hl
inc ix
inc c
cmp c,18
j lt,set_1ln0
ret
;--------------------------------------------------------------------------
;--------------------------------------------------------------------------
slid_position_tbl:
db 2,0y10100100 ;
db 0,0y10000000 ;
db 0,0y00000000 ;
db 0,0y00000001 ;
db 0,0y00000100 ;
db 0,0y00001000 ;
db 0,0y00010000 ;
db 0,0y01000000 ;
slid_position_tbl_mid:
db 1,0y00000010 ;
db 1,0y10000010 ;
db 1,0y01000010 ;
db 2,0y00101000 ;
db 2,0y00100000 ;
db 2,0y00100100 ;
db 3,0y00000100 ;
db 3,0y000000000 ;
slid_position_tbl_end:
mode_prn:
call spc_prnbuf
ld a,0x29
ld c,7
call set_disp_test_1
call disp_to_dbr
ld ix,slid_position_tbl
ld (BLK_CT),0
mode_prn_1:
call wait_100ms
call wait_100ms
push ix
call update_md
pop ix
ld c,(ix)
inc ix
ld b,(ix)
ld hl,MDFLG_0
ld a,(hl+c)
cmp a,b
j ne,mode_prn_2
ld hl,DISP+2
ld c,(BLK_CT)
ld a,0x2a
ld (hl+c),a
inc (BLK_CT)
push ix
call disp_to_dbr
call wait_100ms
call wait_100ms
pop ix
inc ix
cmp ix,slid_position_tbl_mid
j ne,mode_prn_10
ld a,0x29
ld c,7
call set_disp_test_1
call disp_to_dbr
ld ix,slid_position_tbl_mid
ld (BLK_CT),0
jp mode_prn_1
mode_prn_10:
cmp ix,slid_position_tbl_end
j ge,mode_prn_ok
jp mode_prn_1
mode_prn_2:
push ix
ld a,(KEY_CT)
j eq,mode_prn_3
call key_get
cmp (KEYIN),K_CEC
j ne,mode_prn_3
pop ix
jp mode_prn_error
mode_prn_3:
pop ix
dec ix
jp mode_prn_1
mode_prn_error:
ld hl,MD_NG
jp mode_prn_exit
mode_prn_ok:
ld hl,MD_OK
jp mode_prn_exit
mode_prn_exit:
call set_1line
call print
call wait_100ms
call wait_100ms
ret
;----------------------------------------------------------
key_test:
call spc_disp
ld (DISP_LSD-1),D_0
ld (DISP_LSD-0),D_F
call disp_to_dbr
ld ix,key_test_tbl
key_test_0:
ld a,(KEY_CT)
j eq,key_test_0
call key_get
ld a,(ix)
cmp a,(KEYIN)
j eq,key_test_1
cmp (KEYIN),K_CEC
j ne,key_test_0
ld hl,KEY_NG
jp key_test_exit
key_test_1:
inc ix
ld a,(ix)
ld (DISP_LSD-0),a
push ix
call disp_to_dbr
pop ix
inc ix
cmp ix,key_test_tbl_end
j lt,key_test_0
ld hl,KEY_OK
key_test_exit:
call set_1line
call print
call wait_100ms
call wait_100ms
ret
key_test_tbl:
db 0x0d,1
db 0x2b,2
db 0x07,3
db 0x05,4
db 0x03,5
db 0x0c,6
db 0x11,7
db 0x17,8
db 0x16,9
key_test_tbl_end:
;--------------------------------------------------------------------------
chara_prn:
ld b,0
chara_prn0:
ld hl,chara
ld a,b
ld w,18
mul w,a
add hl,wa
push b
call set_1line
call print
@CLB (P_RED)
pop b
test b.0
j f,chara_prn1
@SEB (P_RED)
chara_prn1:
inc b
cmp b,24
j lt,chara_prn0
ret
chara:
db "1234567890+-x!#$%^" ;1
db "&*()" ;2
db 0x40,0x83,0x84,0x85,0x86
db "ABCDEFGHI"
db "JKLMNOPQRSTUVWXYZa" ;3
db "bcdefghijklmnopqrs" ;4
db "tuvwxyz09876543210" ;5
db "111111111111111111" ;6
db "222222222222222222" ;7
db "333333333333333333" ;8
db "444444444444444444" ;9
db "555555555555555555" ;10
db "666666666666666666" ;11
db "777777777777777777" ;12
db "888888888888888888" ;13
db "999999999999999999" ;14
db "000000000000000000" ;15
db "123456789123456789" ;16
db "12345678 12345678" ;17
db "1234567 1234567" ;18
db "123456 123456" ;19
db "12345 12345" ;20
db "1234 1234" ;21
db "123 123" ;22
db "12 12" ;23
db "1 1" ;24
;--------------------------------------------------------------------------
temp_vprn:
call spc_prnbuf
call print
ld hl,M_TEMP
call set_1line
ld a,(HD_TEMP)
add a,0x0
daa a
push a
swap a
and a,0x0f
or a,0x30
ld (PRN_BUF_MSD+15),a
pop a
and a,0x0f
or a,0x30
ld (PRN_BUF_MSD+16),a
call print
ld hl,M_VPRN
call set_1line
ld a,(VPRN)
cmp a,152
j ge,vprn_ad0
ld a,152
j vprn_ad2
vprn_ad0:
cmp a,212
j lt,vprn_ad2
ld a,212
vprn_ad2:
sub a,152
shlc a
shlc a
ld w,0
ld hl,vprn_tbl
add hl,wa
ld a,(hl)
ld (PRN_BUF_MSD+12),a
ld (PRN_BUF_MSD+13),'.'
ld a,(hl+1)
ld (PRN_BUF_MSD+14),a
ld a,(hl+2)
ld (PRN_BUF_MSD+15),a
ld a,(hl+3)
ld (PRN_BUF_MSD+16),a
call print
ret
vprn_tbl:
db "5938"
db "5977"
db "6016"
db "6055"
db "6094"
db "6133"
db "6172"
db "6211"
db "6250"
db "6289"
db "6328"
db "6367"
db "6406"
db "6445"
db "6484"
db "6523"
db "6563"
db "6602"
db "6641"
db "6680"
db "6719"
db "6758"
db "6797"
db "6836"
db "6875"
db "6914"
db "6953"
db "6992"
db "7031"
db "7070"
db "7109"
db "7148"
db "7188"
db "7227"
db "7266"
db "7305"
db "7344"
db "7383"
db "7422"
db "7461"
db "7500"
db "7539"
db "7578"
db "7617"
db "7656"
db "7695"
db "7734"
db "7773"
db "7813"
db "7852"
db "7891"
db "7930"
db "7969"
db "8008"
db "8047"
db "8086"
db "8125"
db "8164"
db "8203"
db "8242"
db "8281"
;--------------------------------------------------------------------------
;==============================================================================
; EEPROM Data port initial
;==============================================================================
@define(EE_PORTINI)(
ld (P1DR),0y00111111 ;P17(CK: out 0), P16(EEIN: out 0)
)
;==============================================================================
; EEPROM Data port release (release P17,P16 for share SIO)
;==============================================================================
ee_test:
@BBS (IO_MT,ee_test) ;if printer moving? yes ->loop
call eeprom_check
@BBS (EP_FAIL,ee_error)
ld hl,M_EEOK
call set_1line
call print
ret
ee_error:
ld hl,M_EENG
call set_1line
call print
ret
vfd_test:
ld a,0x20
vfd_test_1:
push a
call set_disp_test
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
pop a
inc a
cmp a,0x28
j le,vfd_test_1
call spc_disp
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
@SEB (ICON_M)
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
@CLB (ICON_M)
@SEB (ICON_MIN)
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
@CLB (ICON_MIN)
@SEB (ICON_E)
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
@CLB (ICON_E)
call spc_disp
ld hl,DISP_LSD
vfd_test_2:
ld (hl),0y11001000
push hl
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
call spc_disp
pop hl
dec hl
cmp hl,DISP
j ne,vfd_test_2
@SEB (ICON_M)
@SEB (ICON_MIN)
@SEB (ICON_E)
ld a,0y11001000
call set_disp_test
call disp_to_dbr
call wait_100ms
call wait_100ms
call wait_100ms
@CLB (ICON_M)
@CLB (ICON_MIN)
@CLB (ICON_E)
call spc_disp
call disp_to_dbr
ld hl,DISP_FINISH
call set_1line
call print
ret
set_disp_test:
ld c,14-2
set_disp_test_1:
ld hl,DISP+2
ld (hl+c),a
dec c
j f,set_disp_test_1
ret
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -