📄 sttest.asm
字号:
;;======== 测试---英译汉 初始化界面 ===========
;;======== 测试---英译汉 初始化界面 ===========
public goe2ctest
public goe2ctest_disp
public goe2ctest_first
public music_8times_off
public music_2times_off
public music_on
goe2ctest_key_table:
db EnterKey,esckey,downkey,upkey,K1Key,K2Key,K3Key,nullkey
goe2ctest_keyin_prog:
dw goe2ctest_enterkey-1
dw goe2c_esckey-1
dw goe2ctest_pgdnkey-1
dw goe2ctest_pgupkey-1
dw goe2ctest_key1-1
dw goe2ctest_key2-1
dw goe2ctest_key3-1
MusicSong:
dw Winsong
dw LostSong
dw GMRONDO
right_string:
db ' '
db ' 本次测试总题数:50 '
db ' '
db ' 正确: ,错误: '
db ' '
;============================================================================================
;============================================================================================
goe2ctest:
;startuart
lda #6 ;#5
sta ItemNo
stz <newflag
lda #<goe2ctest-1
sta HelpRtPrc
lda #>goe2ctest-1
sta HelpRtPrc+1
jsr call_sttest_help
stz word_counter
stz temp_goe2c_flag
stz <textscreenno1
stz right_num
stz wrong_num
jsr get_first_word_address
jsr bak_currentwordaddress
jsr bak_firstwordaddress
goe2ctest_first:
jsr cls_dispbuffor
lda #40
sta dispbuffor_offset
lda #0
sta dispbuffor_offset+1
sta get_e2c_num
sta page_num
sta getword_random0
sta getword_random1
sta getword_random2
sta getword_random3
sta getword_random_num
sta get_dispbuffor_num
sta answer_num
jsr random_getword
jsr cls_textbuffor
jsr page1_dispbuffor2textbuffor
jsr light_icon_up_or_down ;add
jmp go_to_lmain
call_sttest_help:
jsr drr_rt_to_drr
lda #>study_goe2ctest_help
sta helptextph
lda #<study_goe2ctest_help
sta helptextpl
rts
;============================================================================================
goe2ctest_disp:
jsr get_first_word_address_0 ;;查找第0-7个studyrage的首单词地址
lcls
lda #>PageXaddrbuff_study ;;初始化存放屏数的buffer
sta <insh
lda #<PageXaddrbuff_study ;;保存6字节单词地址,长度未知=256?
sta <insl
ldy #255
jsr clearram ;;入口insh,insl,y
stz textpagenum_study ;;初始化存放屏数的变量
jsr unpress_english ;;解压出英文放wordlocation中
jsr extract_and_show_all ;;调用英汉程序解压和显示英文音标
jsr showEnglishandphone ;;显示英文和音标
jsr store_pageXaddr_study ;;function:保存每页的首地址
jsr tiao_chuji_mode4
jsr extract_and_show_all_00 ;;调用英汉程序解压中文
lda getword_random_num
cmp #0ffh
bne ?03
jsr E_textbuffor2dispbuffor
?03: JSR print_selectstring
JSR D_textbuffor2dispbuffor
rts
;;========================== key process ====================================================
;;========================== key process ====================================================
goe2ctest_keyin: ;;学习键控
ldy #0ffh
goe2ctest_keyin_loop:
iny
lda goe2ctest_key_table,y
bmi goe2ctest_keyin_end
cmp <KeyNo
bne goe2ctest_keyin_loop
tya
asl
tay
lda goe2ctest_keyin_prog+1,y
pha
lda goe2ctest_keyin_prog,y
pha
rts
goe2ctest_keyin_end:
jmp go_to_lmainu
goe2ctest_enterkey:
stz <newflag
stz temp_goe2c_flag
clc
lda right_num ;(right_num+wrong_num)-1=word_counter ,then get next word
adc wrong_num
dec
cmp word_counter
beq ?next
jmp go_to_lmainu
?next:
lda word_counter
cmp #max_word
bne goe2ctest_not_finish
goe2ctest_have_finish:
jsr clr_icon
jsr print_rightstring
jsr music_8times_off
lda #88h
sta right_num
lda #0ffh
sta page_num
jmp studyload_0
goe2ctest_not_finish:
inc word_counter
jsr unbak_currentwordaddress
jsr current_addr_addc_4 ;;<indxd++,由此程序决定下一个单词的地址
jsr bak_currentwordaddress
jmp goe2ctest_first
;===============================
goe2ctest_pgdnkey:
lda page_num
cmp #0ffh
bne goe2ctest_pgdnkeya
jmp go_to_lmainu
goe2ctest_pgdnkeya:
lda page_num
cmp page_num_max
bne goe2ctest_pgdnkeynext
jmp go_to_lmainu
goe2ctest_pgdnkeynext:
inc page_num
jsr light_icon_up_or_down ;add
goe2ctest_pgdnkeycomm:
lda page_num
beq goe2ctest_page1
cmp #1
beq goe2ctest_page2
bra goe2ctest_page3
goe2ctest_page1:
jsr page1_dispbuffor2textbuffor
bra goe2ctest_pageend
goe2ctest_page2:
jsr page2_dispbuffor2textbuffor
bra goe2ctest_pageend
goe2ctest_page3:
jsr page3_dispbuffor2textbuffor
goe2ctest_pageend:
jmp go_to_lmain
;;==========================
goe2ctest_pgupkey:
lda page_num
cmp #0ffh
bne goe2ctest_pgupkeya
jmp go_to_lmainu
goe2ctest_pgupkeya:
lda page_num
bne goe2ctest_pgupkeynext
jmp go_to_lmainu
goe2ctest_pgupkeynext:
dec page_num
jsr light_icon_up_or_down ;add
jmp goe2ctest_pgdnkeycomm
;;==========================
goe2ctest_key1:
lda page_num
cmp #0ffh
bne goe2ctest_key1a
jmp go_to_lmainu
goe2ctest_key1a:
lda #1
jmp goe2ctest_key123_comm
;;==========================
goe2ctest_key2:
lda page_num
cmp #0ffh
bne goe2ctest_key2a
jmp go_to_lmainu
goe2ctest_key2a:
lda #2
jmp goe2ctest_key123_comm
;;==========================
goe2ctest_key3:
lda page_num
cmp #0ffh
bne goe2ctest_key3a
jmp go_to_lmainu
goe2ctest_key3a:
lda #3
goe2ctest_key123_comm:
cmp getword_rightvalue
bne goe2ctest_key123_wrong
jmp goe2ctest_key123_right
goe2ctest_key123_wrong:
inc answer_num
lda answer_num
cmp #1
beq xxxx
bra yyyy
xxxx:
jsr lsetbmp_x21y13
LOPrintImage wrong1bmp
lda #1
jsr music_2times_off
stz page_num
jsr light_icon_up_or_down ;add
jmp goe2ctest_pgdnkeycomm
yyyy:
jsr lsetbmp_x21y13
LOPrintImage wrong2bmp
lda #1
jsr music_2times_off
jsr print_rightanswer
lda #0ffh
sta page_num
inc wrong_num
;lupdatescreen
jmp go_to_lmain
goe2ctest_key123_right:
inc right_num
jsr lsetbmp_x21y13
LOPrintImage rightbmp
lda #0
jsr music_2times_off
jmp goe2ctest_enterkey
;;==========================sub prog================================================================
;;==========================sub prog================================================================
cls_dispbuffor:
ldy #0
?00: lda #20h
sta dispbuffor,y
sta dispbuffor+0ffh,y
iny
cpy #0ffh
bne ?00
rts
;;==========================
cls_textbuffor:
ldy #0
?00: lda #20h
sta textbuffor,y
iny
cpy #220
bne ?00
rts
;;==========================
page1_dispbuffor2textbuffor:
ldy #0
?00: lda dispbuffor,y
sta textbuffor,y
iny
cpy #120
bne ?00
lda #4
sta screenmode
jsr tiao_chuji_mode4 ;;从第2行开始显示
rts
;;==========================
page2_dispbuffor2textbuffor:
ldy #0
?00: lda dispbuffor+120,y
sta textbuffor,y
iny
cpy #100
bne ?00
lda #1
sta screenmode
lda #0
sta <curx
sta <cury
rts
;;==========================
page3_dispbuffor2textbuffor:
ldy #0
?00: lda dispbuffor+220,y
bne ?01
lda #20h
?01:
sta textbuffor,y
iny
cpy #100
bne ?00
lda #1
sta screenmode
lda #0
sta <curx
sta <cury
rts
;;==========================
E_textbuffor2dispbuffor:
ldy #0
?00: lda textbuffor,y
sta dispbuffor,y
iny
cpy #40 ;star_textbuffor
bne ?00
rts
;;==========================
get_address1: ;textbuffor+star_textbuffor
;lda #0
;sta star_textbuffor+1
lda #<textbuffor
sta strinxl
lda #>textbuffor
sta strinxl+1
clc
lda strinxl
adc star_textbuffor
sta strinxl
lda strinxl+1
adc #0
sta strinxl+1
rts
;;==========================
get_address2: ;dispbuffor+dispbuffor_offset
;lda #0
;sta dispbuffor_offset+1
lda #<dispbuffor
sta indxd
lda #>dispbuffor
sta indxd+1
clc
lda indxd
adc dispbuffor_offset
sta indxd
lda indxd+1
adc dispbuffor_offset+1
sta indxd+1
rts
;;==========================
;;==========================
D_textbuffor2dispbuffor:
;putsio #88h
;putsio dispbuffor_offset
jsr get_address1
jsr get_address2
ldy #0
?00: lda (strinxl),Y
cmp #20h
beq ?01
?02: sta (indxd),Y
iny
bra ?00
?01: ldx #0
?05: lda (strinxl),Y
cmp #20h
bne ?02
iny
inx
cpx #20
bne ?05
?04: dey
sec
tya
sbc #20
clc
adc dispbuffor_offset
sta dispbuffor_offset
bcc ?22
lda #1
sta dispbuffor_offset+1 ;值大于256的处理
clc
lda #16
adc dispbuffor_offset
?22:
sta strinxl
?11: sec
lda strinxl
sbc #20
bcc ?10
sta strinxl
bra ?11
?10: sec
lda #20
sbc strinxl
clc
adc dispbuffor_offset
sta dispbuffor_offset
lda #0
adc dispbuffor_offset+1 ;值大于256的处理
sta dispbuffor_offset+1
rts
;;==========================
print_selectstring: ;[选项1,2,3]:
jsr get_address2
lda #5BH
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda #B4H
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda #F0H
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda #B0H
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda #B8H
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda get_e2c_num
beq ?00
cmp #1
beq ?01
?02:
lda #33H
bra ?04
?00:
lda #31H
bra ?04
?01:
lda #32H
?04:
sta (indxd)
INC DISPBUFFOR_OFFSET
jsr get_address2
lda #5DH
sta (indxd)
CLC
LDA #14
ADC DISPBUFFOR_OFFSET
STA DISPBUFFOR_OFFSET
lda #0
adc dispbuffor_offset+1 ;值大于256的处理
sta dispbuffor_offset+1
;putsio #77h
;putsio dispbuffor_offset+1
;putsio dispbuffor_offset
RTS
;;==========================
print_rightstring:
ldy #0ffh
?00: iny
lda right_string,y
sta textbuffor,y
cpy #100
bne ?00
lda #1
sta screenmode
lda #0
sta <curx
sta <cury
jsr sub_print_num
lupdatescreen
rts
;;==========================
print_num_tab:
db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h
sub_print_num:
lda right_num
jsr hex2dec
lda print_num
and #0fh
tax
lda print_num_tab,x
sta textbuffor+69
lda print_num
and #f0h
beq ?00
lsr
lsr
lsr
lsr
tax
lda print_num_tab,x
sta textbuffor+68
?00:
lda wrong_num
jsr hex2dec
lda print_num
and #0fh
tax
lda print_num_tab,x
sta textbuffor+77
lda print_num
and #f0h
beq ?01
lsr
lsr
lsr
lsr
tax
lda print_num_tab,x
sta textbuffor+76
?01: rts
;;==========================
hex2dec:
sta print_num
stz temp_0
?00: sec
lda print_num
sbc #0ah
bcc ?01
sta print_num
inc temp_0
bra ?00
?01: lda temp_0
asl
asl
asl
asl
ora print_num
sta print_num
rts
;;==========================
random_tab_a:
db 4,0,8,12,16,20,0
random_tab_b:
db 0ffh,0,0,1 ;0
db 0,0,0ffh,3 ;8
db 0,0ffh,0,2 ;4
db 0,0,0ffh,3 ;8
db 0,0ffh,0,2 ;4
db 0ffh,0,0,1 ;0
db 0ffh,0,0,1 ;0
;;==========================
;get chinese order
random_getword:
jsr random_digit5
stz get_e2c_num ;选项的代号
lda getword_random0
sta getword_random_num ;选项位置所对应的中文解释为第几个单词的
jsr get_random_word
LDA #1
STA get_e2c_num
lda getword_random1
sta getword_random_num ;选项位置所对应的中文解释为第几个单词的
jsr get_random_word
LDA #2
STA get_e2c_num
lda getword_random2
sta getword_random_num ;选项位置所对应的中文解释为第几个单词的
jsr get_random_word
lda dispbuffor_offset+1
bne ?02
lda dispbuffor_offset
cmp #121
bcc ?02
cmp #221
bcc ?01
bra ?02
?01: lda #1
bra ?03
?02: lda #2
?03: sta page_num_max
rts
;;==========================
get_random_word:
lda getword_random_num
cmp #0ffh
beq ?21
?100:
jsr getrandom_49
lda get_e2c_num
beq ?00
cmp #1
beq ?01
?02: lda temp_random
sta random2
cmp random0
beq ?100
cmp random1
beq ?100
bra ?common
?01: lda temp_random
sta random1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -