📄 graphics.asm
字号:
; ***************************************************************************
; * Project : Electronic Dictionary *
; * Date : 2003.9 *
; * File Name : GRAPHICS.ASM *
; ***************************************************************************
pw 128
case off
externs on
include st2202.def
include Data.def
include Bios.h
include Graphics.h
include Graph.def
include KeyDef.def
include DataBank.def
;===========================
public DrawFont8Phonetic
; public DrawFont8Phonetic_5000
public drawfont8
; public drawfont8_5000
public set_to_ds0bank
; public drawtext8_5000
; public call_drawchar_5000
; public clrnum_5000
; public drawnum_5000
public draw8x16phonetic_test
; public draw8x16phonetic_5000_test
; public draw8x16phonetic_5000
; public drawnums_5000
; public drawchar16_5000
; public drawchar12_5000
; public printimagetolcd_5000
; public drawtext_5000
; public update_all_icon_5000
; public update_all_icon_in_test_5000
; public jgame_clrlcdimage_5000
; public speed_clrlcdimage_5000
; public new_blockinvert_5000
public clear_lcd_all
; public UpdateScreen_5000
public InitialLCDC
public SetScreen_to_ds0
; public game_printimagetolcd_5000
; public jgame_printimagetolcd_5000
public SetScreenu_to_ds0
public TestNum
public DrawNum
public DrawNums
public ClrNum
public ClrNums
public jsr_keytone
public update_all_icon_in_test
public update_all_icon
public Chk13CRLF
;; public fullscreen
public ReadSecretCodeToBuff
;; public full_device
;;=====================================================
RightSym equ 13h ;; '→'
LeftSym equ 14h ;; '←'
RLSym equ 15h ;; '←→'
ChinInBuf equ TextBuffor+2*16+4
public set_lcd_contrast
public set_lcd_contrast_to_default
public SetScreenU_yi
public SetScreen_yi
public SetScreen
public SetScreenU
public Print
public PutChar
public NxCursor
public SetCur
public SetCursorSize
public ScreenUp
public Cls
public A2XY_hex
public A2XY
public ClrLCD
public Draw
public DrawChar
public DrawChar8
public DrawChar16
public DrawChar12
public DrawPhoneticChar
public DrawNxLoc
public DrawText
public DrawText8
public DrawPhoneticText
public OXAd8
public OYAd1
public OYAd2
public UpdateScreen
public Draw8x16Phonetic
public CRLF
public CheckCRLF
public CursorOn
public CursorOff
public CurFlash
public ClearCursor
public BackSpace
public call_drawchar
public DrawChar_to_textbuffor
public A2CFontAddr
;public drawfont_5000
public DrawFont
public jgame_printimagetolcd
public game_printimagetolcd
public clear_device
public new_blockinvert
public jgame_clrlcdimage
public game_clrlcdimage
public speed_clrlcdimage
public printimagetolcd
public clear_all_icon
public speed_print_16_x_16
public speed_print_8_x_8
public speed_print_8_x_16
;;=========================================================
EventNo equ 9 ;; Event numbers.
PS0 .SECTION
BankNo equ graphics_bank
UpdateScreen:
lda <ScreenMode
bne ?234
jsr update_all_icon
jmp UpDate_quit
?234:
lda <OX
pha
lda <OY
pha
lda <DRRl
pha
lda <DRRh
pha
stz <OX ;; OX & OY =0
stz <OY
lda <ScreenMode
asl ;; Screen mode * 2.
tax
lda ScreenUpdateTable+1,x ;; Get high address.
pha
lda ScreenUpdateTable,x ;; Get low address.
pha
ldx #0
rts
PutChar:
cpx #0dh ;; It's CRLF ?
beq CRLF
jsr Chk13CRLF ;; Go CRLF if chinese char and CurX >= 13.
Pch5: jsr PutByte ;; Put one byte(X) to (CurXmCurY)
cmp #0a1h ;;0aeh
bcc NxCursor ;; English char !
jsr NxCursor ;; It's Chinese char.
phy
plx ;; y -> x.
jsr PutByte ;; Put one byte(x) to (CurXmCurY)
NxCursor:
inc <CurX
lda <CurX
cmp #screen_width_num+1 ;; Columm over 14 ?
bcc nxcue
CRLF: stz <CurX
inc <CurY
nxcue: rts
CheckCRLF:
lda <CurX
bne CRLF
rts
Chk13CRLF:
cpx #0a1h
bcc c13end
lda <CurX
cmp #screen_width_num
bcs CRLF
c13end: rts
PutByte:
phx
ldx <CurY
cpx #10
bcc ptb5
ldx #9
ptb5:
clc
lda trowtab,x ;; CurY * 16.
adc <CurX
tax
pla
sta TextBuffor,x
rts
CheckBOL:
lda <CurX
bne ckb1 ;; Branch if Cursor.X <> 0
ckb0: smb0 <ScanFState ;; Set BOL(Begin of line) flag.
clc
rts
ckb1: dec
cmp ScanBuf ;;
bcc ckb0 ;;
rts ;; C=1.
CurFlash:
lda <ScanFF
bpl CurFlash_0 ;;should be test
and #00110011b
beq FlashEnglishIn
CurFlash_0:
ldx <CurY
lda trowtab,x ;; CurY * 16.
clc
adc <CurX
tax
lda TextBuffor,x
tax
lda <CurY
asl
asl
asl
asl
sta <OY
lda <CurX
asl
asl
asl
sta <OX
lda #7
cpx #0a1h
bcc FlashCursor7
lda #15
FlashCursor7:
sta <image_width
bbr0 <CursorSize,FlashCursor7xx
lda #8
bbr1 <CursorSize,FlashCursor7x
lda #16
bra FlashCursor7x
FlashCursor7xx:
clc
lda #16
bbr1 <CursorSize,FlashCursor8xxx
lda #8
FlashCursor8xxx:
adc <oy
sta <oy
lda #1
FlashCursor7x:
sta <image_hight_temp
;; LBlockInvert
jsr bios_call_ext
dw ds0_blockinvert
rts
FlashEnglishIn:
jsr SetChinInBuf
ldy #0
lda (<IND),y
cmp #' '
beq CurFlash_0
lda <CurX
pha
lda <CurY
pha
lda <CursorSize
pha
lda #03h ;;cursor mode = 3
sta <CursorSize
FlashEnglishIn_0:
iny
lda (<IND),y
cmp #' '
bne FlashEnglishIn_0
tya
clc
adc #5
sta <CurX
lda #4
sta <CurY
jsr CurFlash_0
pla
sta <CursorSize
pla
sta <CurY
pla
sta <CurX
rts
CursorOn:
smb5 <SysF ;; Set cursor off.
rts
CursorOff:
rmb5 <SysF ;; Set cursor off.
rts
ScreenUp:
lda <ScreenMode
bne scru2
rts ;; Return if Graphics mode.
scru2: ldx #0
scru3: lda TextBuffor+1*20,x
sta TextBuffor,x
inx
cpx #textbuffer_num-20
bcc scru3
rts
A2XY: txa
jsr A2ASC
tay
txa
lsr
lsr
lsr
lsr
jsr A2ASC
tax
rts
A2XY_hex:
txa
and #0fh
tay
txa
lsr
lsr
lsr
lsr
tax
rts
A2ASC: and #0fh
clc
adc #'0'
cmp #'9'+1
bcc a2asce
adc #'A'-('9'+1)-1
a2asce: rts
DrawText:
lda <ox
pha
lda <oy
pha
lda <drr
pha
lda <drrh
pha
stx <StrInxH
sty <StrInxL
ldy #0
?drtx2:
lda (<StrInx),y
beq ?drtxe
cmp #0dh
bne ?dfdsfds
jsr next_line
bra ?drtx7_bug
?dfdsfds:
tax
bpl ?drtx5
iny
phy
lda (<StrInx),y
tay
bra ?drtx6
?drtx5:
phy
?drtx6:
jsr DrawChar
ply
?drtx7_bug:
iny
bra ?drtx2
?drtxe:
pla
sta <drrh
pla
sta <drr
pla
sta <oy
pla
sta <ox
rts
DrawText8:
stx <StrInxH
sty <StrInxL
ldy #0
drtx82: lda (<StrInx),y
beq drtx8e
phy
tax
jsr DrawChar8
ply
iny
bpl drtx82
drtx8e:
rts
DrawPhoneticText:
stx <StrInxH
sty <StrInxL
ldy #0
drtxp2: lda (<StrInx),y
beq drtxpe
phy
tax
jsr DrawPhoneticChar
ply
iny
bpl drtxp2
drtxpe: rts
call_drawchar:
DrawChar:
lda <DRR
pha
lda <DRRh
pha
jsr DrawFont0 ;; Draw out Font(Chinese or english).
drwche:
pla
sta <DRRh
pla
sta <DRR
rts
DrawChar_to_textbuffor:
lda <DRR
pha
lda <DRRh
pha
jsr DrawFont
pla
sta <DRRh
pla
sta <DRR
rts
DrawChar8:
lda <DRR
pha
lda <DRRh
pha
jsr DrawFont8 ;; Draw out Font(Chinese or english).
bra drwche
DrawPhoneticChar:
lda <DRR
pha
lda <DRRh
pha
jsr DrawFont8Phonetic ;; Draw out Font(Chinese or english).
bra drwche
ScreenUpdateTable:
dw Screen0Update-1
dw Screen1Update-1
dw Screen2Update-1
dw Screen3Update-1
dw Screen4Update-1
dw Screen5Update-1
dw Screen6Update-1
dw Screen7Update-1
dw Screen8Update-1
dw Screen9Update-1
dw Screen10Update-1
dw Screen11Update-1
dw Screen12Update-1
dw Screen13Update-1
dw Screen14Update-1 ;;Screen1Update一样但显示字库有:am,pm
dw Screen15Update-1 ;;新加显示模式
dw Screen16Update-1 ;;新加显示模式
dw Screen17Update-1 ;;新加显示模式
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -