📄 dicadd1.asm
字号:
; ***************************************************************************
; * Project : Electronic Dictionary *
; * Date : 2003.9 *
; * File Name : DICADD1.ASM *
; ***************************************************************************
pw 128
case off
externs on
include ST2202.def ; Include ST2100 I/O define.
include Data.def ; Data RAM define.
include Bios.h
include Graphics.h
include Keydef.def
include Graph.def
include extract.h
include xyhaddr.h
include 5000lib.ref
;=====================================================
; >>> 变量 public<<
public dicadd1bank
;====================================================
;; >>>>子函数<<<
public MohuMatch
public DrawALineAt15
public StartMoHumatch
public MuhuMatchjieshistatus1
public MoHumatchAlllijustatus1
public MoHumatchlijustatus1
public ClearUp_findbuff
;;;===============常量定义===========================
Inputpoint equ INSL
Wordpoint equ INSH
InputpointBak equ CharL
WordpointBak equ CharH
Icondownpage equ icon_downpage
IconUPpage equ Icon_Uppage
UpPagekey equ pgUp
DownPagekey equ PgDown
;;==================================================
DS0 .SECTION ; Data ROM location
MohuInputtittle:
db 0dh,' 输入完毕请按[输入]键',0
Findnothingtittle:
db 0dh,0dh
db ' 未找到',0
findfinish:
db 0dh,0dh,' 查找完毕',0
findingtittle:
db 0dh,0dh
db ' ','查找中....',0
Heng_line:
db 159,1
db 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
db 0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh,0ffh
;=====================================================
PS9 .SECTION ; Program ROM location
BANKNO equ Dicadd1bank
MohuMatch:
lsetscreen 1
lda <DrrH
sta DRR_RTH
lda <DrrL
sta DRR_RTL
lda #Ds0Help
sta <HelpOffset
lda #<NewenchMoHuinputHelp
sta HelptextpL
lda #>NewenchMoHuinputHelp
sta HelptextpH
stz <DrrH
lda #ds0bank
sta <DrrL
lprint MohuInputtittle
lsetcur 0,0
lprint Ninputbuff
jsr CALL_LUpdateScreen
jsr DrawalineAt15
jmp jmp_LMAINU
NNmainU:
LNewench_help
jmp jmp_LMAINU
StartMoHumatch:
jsr Printfindingtittle
?_Loop
Lstore_Nowlineaddr
lda #>cdict_result
sta <INDH
lda #<cdict_result
sta <INDL
LgetchainLen
Lextract_word
lda #0
sta (<IND)
jsr MatchMain
bne ?_FindOK
lda findbuff
cmp cdict_result
bne ?_FindNOone
Lrestore_nowlineaddr ;恢复当前行地址
jsr Judge_libEnd
beq ?_FindNOone
ldx #1
LGetnextXlineaddr
bra ?_loop
?_FindOK:
cmp #5
beq ?_FindNOone
lda #MuhuMatchjieshistatusNum
sta <NstatusFlag
Lrestore_nowlineaddr ;恢复当前行地址
jsr store_addrInf
jsr MoHuPublicShow
jmp NNmainU
?_FindNOone:
lcls
stz <DrrH
lda #ds0bank
sta <DrrL
lprint Findnothingtittle
jsr CALL_LUpdateScreen
jsr delay
jmp MuhuMatchjieshiEsckey
;;=====================================
;;function:
;;input:
;;output:
;;=====================================
Judge_libEnd:
lda #<Libendformataddr_haveChain
cmp <indxd
bne ?_NotEnd
lda #>Libendformataddr_haveChain
cmp <indxd+1
bne ?_NotEnd
lda #Libendformataddr_haveChain>>16
cmp <indxd+2
bne ?_NotEnd
lda #Libendformataddr_haveChain>>24
cmp <indxd+3
;bne ?_NotEnd
?_NotEnd:
rts
;;=====================================
;;function:
;;input:
;;output:
;;==================================
MoHuPublicShow:
lda #>cdict_result
sta <INDH
lda #<cdict_result
sta <INDL
LgetchainLen
Lextract_word
Lstore_citiao
LsetAttribute_flag
Lextract_yinbiao
LShowcitiaoyinbiao
Lshowinter
lda <AttributeH
and #80h
sta <AttributeH
lda <AttributeL
and #03fh
sta <AttributeL
LLight_AttributeIcon
jsr light_mohujieshiUPDP
jsr CALL_LUpdateScreen
LShow_jieshiyinbiao
rts
;;=================================
;;function:模糊查询的UpDP
;;input:
;;output:
;;=================================
light_mohujieshiUPDP:
lda #IconDownPage&0ffh
tsb IconDownpage>>8
lda Nowlinebuff
cmp firstlinebuff
bne ?_LightUP
lda Nowlinebuff+1
cmp firstlinebuff+1
bne ?_LightUP
lda Nowlinebuff+2
cmp firstlinebuff+2
bne ?_LightUP
lda Nowlinebuff+3
cmp firstlinebuff+3
beq ?_exit
?_LightUP:
lda #IconUpPage&0ffh
tsb IconUppage>>8
?_exit:
rts
MuhuMatchjieshiKeyTab:
db Esckey
db UpKey
db DownKey
db UpPagekey
db DownPagekey
db LiKey
;db LizhengKey
db Enterkey
db spacekey
db talk_key
db Nullkey
MuhuMatchjieshiFuntab:
dw MuhuMatchjieshiEsckey-1
dw MuhuMatchjieshiUKey-1
dw MuhuMatchjieshiDKey-1
dw MuhuMatchjieshiUpKey-1
dw MuhuMatchjieshiDPKey-1
;dw MuhuMatchjieshiLiKey-1 ;04-7-19 15:28
dw MuhuMatchjieshiLizhengKey-1
dw MuhuMatchjieshiEnterkey-1
dw DictTalkWord-1
dw DictTalkWord-1
MuhuMatchjieshistatus1:
Lkeytone
ldy #0ffh
MuhuMatchjieshi_1:
iny
lda MuhuMatchjieshiKeytab,y
bmi ?_ErrorKey
cmp <KeyNo
bne MuhuMatchjieshi_1
tya
asl
tay
lda MuhuMatchjieshiFuntab+1,y
pha
lda MuhuMatchjieshiFuntab,y
pha
rts
?_ErrorKey:
jmp NNmainU
MuhuMatchjieshiEsckey:
LNewenchLoad
MuhuMatchjieshiUKey:
LJieshiUkey
MuhuMatchjieshiDKey:
LJieshiDkey
MuhuMatchjieshiUpKey:
lda IconUppage>>8
and #IconUppage&0ffh
bne ?_0
jmp NNmainU
?_0:
jsr Printfindingtittle
?_loop:
Lrestore_nowlineaddr ;恢复当前行地址
LRelocateaddr ;从新定位所在的16分区间
LGetUpperwordaddr;找到上一单词的地址
Lstore_Nowlineaddr ;保存当前的信息&地址
lda #>cdict_result
sta <INDH
lda #<cdict_result
sta <INDL
LgetchainLen
Lextract_word
lda #0
sta (<IND)
jsr MatchMain
bne ?_FindOK
bra ?_loop
?_FindOK:
Lrestore_nowlineaddr ;恢复当前行地址
jsr MoHuPublicShow
jmp NNmainU
MuhuMatchjieshiDPKey:
jsr Printfindingtittle
Lrestore_nowlineaddr ;恢复当前行地址
lda <indxd
pha
lda <indxd+1
pha
lda <indxd+2
pha
lda <indxd+3
pha
lda <Bitcount
pha
jsr Judge_libEnd
beq ?_FindFinish
ldx #1
LGetnextXlineaddr
?_loop:
Lstore_Nowlineaddr ;保存当前的信息&地址
lda #>cdict_result
sta <INDH
lda #<cdict_result
sta <INDL
LgetchainLen
Lextract_word
lda #0
sta (<IND)
jsr MatchMain
bne ?_FindOK
lda findbuff
cmp cdict_result
bne ?_FindFinish
Lrestore_nowlineaddr ;恢复当前行地址
jsr Judge_libEnd
beq ?_FindFinish
ldx #1
LGetnextXlineaddr
bra ?_loop
?_FindOK:
cmp #5
beq ?_FindFinish
pla
pla
pla
pla
pla
Lrestore_nowlineaddr ;恢复当前行地址
jsr MoHuPublicShow
jmp NNmainU
?_FindFinish:
lsetscreen 1
stz <DrrH
lda #Ds0bank
sta <DrrL
lprint findfinish
jsr CALL_LUpdateScreen
jsr delay
pla
sta <Bitcount
pla
sta <indxd+3
pla
sta <indxd+2
pla
sta <indxd+1
pla
sta <indxd
Lstore_nowlineaddr ;恢复当前行地址
jsr MoHuPublicShow
jmp NNmainU
MuhuMatchjieshiLizhengKey:
bbs7 <AttributeH,?_haveliju
jmp NNmainU
?_haveliju:
lda #MoHumatchAlllijustatusNum
sta <Nstatusflag
Lstore_secondjieshiinf
stz lijuAllNum
Lextract_displaythisliju
NNmain:
LNewench_help
Lmain
MuhuMatchjieshiLiKey:
Lselectliju
MuhuMatchjieshiEnterkey:
bbs0 <Blackflag,?_0
jmp NNmainU
?_0:
lda #MoHumatchlijustatusNum
sta <Nstatusflag
Lstore_secondjieshiinf
Lviewpublicliju ;查找单个例句并显示
jmp NNmain
MoHumatchlijuKeytab:
db Esckey
db Upkey
db DownKey
db Nullkey
MoHumatchlijuFuntab:
dw MoHumatchAlllijuEsckey-1
dw MoHumatchlijuUKey-1
dw MoHumatchlijuDKey-1
MoHumatchlijustatus1:
Lkeytone
ldy #0ffh
MoHumatchliju_1:
iny
lda MoHumatchlijuKeytab,y
bmi ?_ErrorKey
cmp <KeyNo
bne MoHumatchliju_1
tya
asl
tay
lda MoHumatchlijuFuntab+1,y
pha
lda MoHumatchlijuFuntab,y
pha
rts
?_ErrorKey:
jmp NNmainU
MoHumatchlijuUKey:
LViewlijuUkey
MoHumatchlijuDKey:
LViewlijuDkey
MoHumatchAlllijuKeytab:
db Esckey
db Upkey
db DownKey
db UpPagekey
db DownPagekey
db Nullkey
MoHumatchAlllijuFuntab:
dw MoHumatchAlllijuEsckey-1
dw MoHumatchAlllijuUKey-1
dw MoHumatchAlllijuDKey-1
dw MoHumatchAlllijuUPKey-1
dw MoHumatchAlllijuDPKey-1
MoHumatchAlllijustatus1:
Lkeytone
ldy #0ffh
MoHumatchAllliju_1:
iny
lda MoHumatchAlllijuKeytab,y
bmi ?_ErrorKey
cmp <KeyNo
bne MoHumatchAllliju_1
tya
asl
tay
lda MoHumatchAlllijuFuntab+1,y
pha
lda MoHumatchAlllijuFuntab,y
pha
rts
?_ErrorKey:
jmp NNmainU
MoHumatchAlllijuEsckey:
lda #MuhuMatchjieshistatusNum
sta <NStatusFlag
Lrestore_nowlineaddr ;恢复当前行地址
lda #>cdict_result
sta <INDH
lda #<cdict_result
sta <INDL
LgetchainLen
Lextract_word
Lstore_citiao
LsetAttribute_flag
Lextract_yinbiao
LShowcitiaoyinbiao
Lrestore_secondjieshiinf ;还原进入例句前的信息
Lrestore_pageXaddr
Lshowinter
lda <AttributeH
and #80h
sta <AttributeH
lda <AttributeL
and #03fh
sta <AttributeL
LLight_AttributeIcon
jsr light_mohujieshiUPDP
jsr CALL_LUpdateScreen
Lrestore_secondjieshiinf ;还原进入例句前的信息
bbr0 <Blackflag,?_notinvertword
bbr4 <newflag,?_mode4
LfindXlijuposionmode5
bra ?_0
?_mode4:
LfindXlijuposionmode4
?_0:
Linvertliju
?_notinvertword:
LShow_jieshiyinbiao
jmp NNmainU
MoHumatchAlllijuUKey:
LviewAlllijuUKey
MoHumatchAlllijuDKey:
LviewAlllijuDKey
MoHumatchAlllijuUPKey:
LviewAlllijuUPKey
MoHumatchAlllijuDPKey:
LviewAlllijuDPKey
;;===================================
;;function:打印查找中..的信息
;;input:
;;output:
;;===================================
Printfindingtittle:
lda <DrrH
pha
lda <DrrL
pha
stz <DrrH
lda #Ds0bank
sta <DrrL
lsetscreen 1
lprint findingtittle
jsr CALL_LUpdateScreen
pla
sta <DrrL
pla
sta <DrrH
rts
;;====================================
;;function:匹配程序
;;input:findbuff,cdict_result
;;output:a=0 不匹配 a!=0 匹配
;;====================================
MatchMain:
jsr ClearUp_cdict_result
rmb0 <MatchFlag
rmb1 <MatchFlag
stz <Inputpoint
stz <Wordpoint
stz <INDL
jsr ClearLianXuStarMarK
?_matchmain:
ldy <Inputpoint
ldx <Wordpoint
lda Cdict_result,x
bne ?_continuecomp
lda findbuff,y
beq ?_matchOKJmp
cmp #'*'
bne ?_nextword
iny
lda findbuff,y
bne ?_nextword
?_matchOKJmp:
bra ?_matchOK
?_continuecomp:
lda Findbuff,y
beq ?_LastOne
cmp #'?'
beq ?_MatchquesMark
cmp #'*'
beq ?_MatchStarMark
jmp ?_MatchChar
?_MatchquesMark:
inc <Inputpoint
inc <Wordpoint
bra ?_MatchMain
?_LastOne:
ldy <Wordpoint
lda cdict_result,y
beq ?_MatchOK
?_nextword:
bbr0 <MatchFlag,?_exit
inc <INDL
lda <InputpointBak
sta <Inputpoint
lda <WordpointBak
sta <Wordpoint
clc
adc <INDL
sta <Wordpoint
ldy <Wordpoint
lda cdict_result,y
bne ?_matchmain
rmb0 <MatchFlag
?_exit:
lda #0
rts
?_MatchStarMark:
iny
lda findbuff,y
beq ?_MatchOK
inc <inputpoint
smb0 <MatchFlag
jsr Gudge_LastStarMark
lda <InputPoint
sta <InputpointBak
lda <Wordpoint
sta <WordpointBak
bra ?_Matchmain
?_MatchChar:
ldy <Inputpoint
iny
lda findbuff,y
cmp #' '
beq ?_MatchcontinueChar
cmp #'a'
bcs ?_MatchcontinueChar
dey
lda findbuff,y
ldx <Wordpoint
cmp cdict_result,x
bne ?_nextword
bbs1 <Matchflag,?_lastStarMark
rmb0 <MatchFlag
stz <INDL
?_lastStarMark:
inc <Inputpoint
inc <Wordpoint
jmp ?_MatchMain
?_MatchOK:
lda #0ffh
rts
?_MatchcontinueChar:
jsr MatchcontinueChar
beq ?_nextword;?_exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -