📄 graphics.h
字号:
; ***************************************************************************
; * Project : Electronic Dictionary *
; * Date : 2003.9 *
; * File Name : GRAPHICS.H *
; ***************************************************************************
argchk off
GraphicsBank equ 0
LSetScreen macro _screenmode
ifma 1
ldx #_screenmode
endif
if graphics_bank=BankNo
jsr SetScreen ;in graphics.asm row of #1208 zl.
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreen-1
endif
endm
LSetScreen_yi macro _screenmode
ifma 1
ldx #_screenmode
endif
if graphics_bank=BankNo
jsr SetScreen_yi
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreen_yi-1
endif
endm
LSetScreen_to_ds0 macro _screenmode
ifma 1
ldx #_screenmode
endif
if graphics_bank=BankNo
jsr SetScreen_to_ds0
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreen_to_ds0-1
endif
endm
LSetScreenu_to_ds0 macro _screenmode
ifma 1
ldx #_screenmode
endif
if graphics_bank=BankNo
jsr SetScreenu_to_ds0
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreenu_to_ds0-1
endif
endm
;[M]-----------------------------------------------[M]
; Set screen mode.(Do'nt clear screen)
;
; Function : Set screen mode.(不清除萤幕)
; Description : 1. 设定Screen mode , 各screen mode
; 详见 Graphics.asm 中 UpdateScreen
; 中的说明.
; Input argument : x : Mode number.
; Output argument : ScreenMode register.
;
;[M]-----------------------------------------------[M]
LSetScreenU macro _screenmodeu
ifma 1
ldx #_screenmodeu
endif
if graphics_bank=BankNo
jsr SetScreenU
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreenU-1
endif
endm
LSetScreenU_yi macro _screenmodeu
ifma 1
ldx #_screenmodeu
endif
if graphics_bank=BankNo
jsr SetScreenU_yi
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetScreenU_yi-1
endif
endm
;[M]-----------------------------------------------[M]
; Print a string to text screen.
;
; Function : 列印(中文/英文/数字)字串到文字画面.
; Description : 1. 将 x,y 所指定的字串列印到文字画面.
; 2. 字串以0当结尾.
; 3. 字串所在的位置请放置在ROM data区段(8000h~ffffh).
; Input argument : x,y : 字串所在address.
; x : high byte of string address.
; Output argument :
;
;[M]-----------------------------------------------[M]
loff_lcd_icon macro _printsource
lda #_printsource&0ffh
trb _printsource>>8
endm
Llight_lcd_icon macro _printsource
lda #_printsource&0ffh
tsb _printsource>>8
endm
lclear_all_icon macro
if graphics_bank=BankNo
jsr clear_all_icon
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw clear_all_icon-1
endif
endm
LPrint macro _printsource
ifma 1
ldx #>_printsource
ldy #<_printsource
endif
if graphics_bank=BankNo
jsr Print
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw Print-1
endif
endm
LPrint_ins macro _printsource
ifma 1
lda #>_printsource
sta <insh
lda #<_printsource
sta <insl
endif
if graphics_bank=BankNo
jsr Print_ins
else
jsr LJSR
dw graphics_bank
dw Print_ins-1
endif
endm
;[M]-----------------------------------------------[M]
; X -> X,Y.(ASCII)
;
; Function : 将 x 转换为两个 16 进位数字的 ASCII code.
; Description :
; Input argument : x :
; Output argument : x : x's high nibber ASCII code
; y : x's low nibber ASCII code
;
;[M]-----------------------------------------------[M]
LA2XY macro
if graphics_bank=BankNo
jsr A2XY
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw A2XY-1
endif
endm
LA2XY_hex macro
if graphics_bank=BankNo
jsr A2XY_hex
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw A2XY_hex-1
endif
endm
;[M]-----------------------------------------------[M]
; Set cursor on.
;
; Function : 游标 (Cursor) on.
; Description :
; Input argument :
; Output argument :
;[M]-----------------------------------------------[M]
LCursorOn macro
if graphics_bank=BankNo
jsr CursorOn
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw CursorOn-1
endif
endm
;[M]-----------------------------------------------[M]
; Set cursor off.
;
; Function : 游标 (Cursor) off.
; Description :
; Input argument :
; Output argument :
;[M]-----------------------------------------------[M]
LCursorOff macro
if graphics_bank=BankNo
jsr CursorOff
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw CursorOff-1
endif
endm
;[M]-----------------------------------------------[M]
; Set cursor location .
;
; Function : 设定游标位置.
; Description : 将游标设定在x,y所指定的位置.
; Input argument : x : 游标X座标.
; y : 游标Y座标.
; Output argument :
;[M]-----------------------------------------------[M]
LSetCur macro _curx,_cury
ifma 1
ldx #_curx
endif
ifma 2
ldy #_cury
endif
if graphics_bank=BankNo
jsr SetCur
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetCur-1
endif
endm
;[M]-----------------------------------------------[M]
; Set cursor size.
;
; Function : 设定游标大小尺寸.
; Description :
; Input argument : x : 游标大小尺寸.
; Output argument :
;[M]-----------------------------------------------[M]
LSetCursorSize macro _cursizex
ifma 1
ldx #_cursizex
endif
if graphics_bank=BankNo
jsr SetCursorSize
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw SetCursorSize-1
endif
endm
;[M]-----------------------------------------------[M]
; Clear cursor.
;
; Function : 清除游标残像.
; Description : 游标移动的时候因故有时会在
; 原位置留下残像,所以改变游标
; 位置请先执行此Subroution.
; Input argument :
; Output argument :
;[M]-----------------------------------------------[M]
LClearCursor macro
if graphics_bank=BankNo
;jsr ClearCursorze
jsr ClearCursor
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw ClearCursor-1
endif
endm
;[M]-----------------------------------------------[M]
; Back space process.
;
; Function : 删除一个字元.
; Description :
; Input argument :
; Output argument :
;[M]-----------------------------------------------[M]
LBackSpace macro
if graphics_bank=BankNo
jsr BackSpace
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw BackSpace-1
endif
endm
;[M]-----------------------------------------------[M]
; Put one character to text screen.
;
; Function : 输出一个字元(中文/英文/数字)到文字画面.
; Description : 将 x ,(y) 字元码输出到文字画面.
; * 如果 x < 80h 则代表是一个英文或数字,
; 则仅将 x 输出.
; * 如果 x >= 80h 则代表是一个中文,
; 则连代将 y 一起输出.
; Input argument : x , (y) : 字元码.
; Output argument :
;
;[M]-----------------------------------------------[M]
LPutChar macro _putchrh,_putchrl
ifma 1
ldx #_putchrh
endif
ifma 2
ldy #_putchrl
endif
if graphics_bank=BankNo
jsr PutChar
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw PutChar-1
endif
endm
;[M]-----------------------------------------------[M]
; Next cursor location.
;
; Function : 游标移动到下一个位置.
; Description : Corsor.X ++ ,
; if Corsor.X >= 12 then
; Corsor.X=0
; Corsor.Y++
;
; Input argument : x , (y) : 字元码.
; Output argument :
;
;[M]-----------------------------------------------[M]
LNxCursor macro
if graphics_bank=BankNo
jsr NxCursor
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw NxCursor-1
endif
endm
;[M]-----------------------------------------------[M]
; Text screen roll up.
;
; Function : 文字画面向上卷动一行.
; Description :
; Input argument :
; Output argument :
;
;[M]-----------------------------------------------[M]
LScreenUp macro
if graphics_bank=BankNo
jsr ScreenUp
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw ScreenUp-1
endif
endm
;[M]-----------------------------------------------[M]
; Clear text screen .
;
; Function : Clear text screen.
; Description : 清除文字画面
; Input argument :
; Output argument :
;
;[M]-----------------------------------------------[M]
LCls macro
if graphics_bank=BankNo
jsr Cls
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw Cls-1
endif
endm
Lclear_lcd_all macro
if graphics_bank=BankNo
jsr clear_lcd_all
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw clear_lcd_all-1
endif
endm
lfullscreen macro
if graphics_bank=BankNo
jsr fullscreen
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw fullscreen-1
endif
endm
;[M]-----------------------------------------------[M]
; Clear real LCD display.
;
; Function : Clear graphic screen.
; Description : 清除图形画面.
; Input argument :
; Output argument :
;[M]-----------------------------------------------[M]
LClrLCD macro
if graphics_bank=BankNo
jsr ClrLCD
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw ClrLCD-1
endif
endm
;[M]-----------------------------------------------[M]
; OY ++
;
; Function : OY++.
; Description : OY 加一
; Input argument :
; Output argument : OY++
;[M]-----------------------------------------------[M]
LOYAd1 macro
if graphics_bank=BankNo
jsr OYAd1
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw OYAd1-1
endif
endm
;[M]-----------------------------------------------[M]
; OY+=2
;
; Function : OY+=2
; Description : OY 加二
; Input argument :
; Output argument : OY+=2
;[M]-----------------------------------------------[M]
LOYAd2 macro
if graphics_bank=BankNo
jsr OYAd2
else
jsr LJSR
dw graphics_bank ; #Bank No.
dw OYAd2-1
endif
endm
;[M]-----------------------------------------------[M]
; Erase block.
;
;
; Function : Graphic block invert
; Description : 将一块图形区块反向(黑变白,白变黑)
; Input argument : OX : 图形区块开始X座标.
; OY : 图形区块开始Y座标.
; x : 图形区块宽度.
; y : 图形区块高度(/8).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -