📄 xmain.asm
字号:
;-----------------------------------------------------------------------
; MODULE XMAIN
;
; Initialization, panning and split screen functions for all MODE X 256
; Color resolutions
;
; Compile with Tasm.
; C callable.
;
;
; ****** XLIB - Mode X graphics library ****************
; ****** ****************
; ****** Written By Themie Gouthas ****************
;
; egg@dstos3.dsto.gov.au
; teg@bart.dsto.gov.au
;
; MODIFICATIONS:
; 26-9-92: Pel panning code added
; Dates forgotten: Numerous ;^)
; 05-10-93: Timer synchronized vsync handling extensions
; and tripple buffering - Tore Jahn Bastiansen
; (toreba@ifi.uio.no) for the
;-----------------------------------------------------------------------
include xlib.inc
include xmain.inc
.data
; Mode X CRTC register tweaks for various resolutions
LABEL X256Y200 word
db 0e3h ; dot clock
db 8 ; Number of CRTC Registers to update
dw 05f00h ; horz total
dw 03f01h ; horz displayed
dw 04202h ; start horz blanking
dw 09f03h ; end horz blanking
dw 04c04h ; start h sync
dw 00005h ; end h sync
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 256
dw 200
LABEL X256Y240 word
db 0e3h ; dot clock
db 16 ; Number of CRTC Registers to update
dw 05f00h ; horz total
dw 03f01h ; horz displayed
dw 04202h ; start horz blanking
dw 09f03h ; end horz blanking
dw 04c04h ; start h sync
dw 00005h ; end h sync
dw 00d06h ; vertical total
dw 03e07h ; overflow (bit 8 of vertical counts)
dw 04109h ; cell height (2 to double-scan)
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 256
dw 240
X320Y200 label word
db 00 ; 0e3h ; dot clock
db 02 ; Number of CRTC Registers to update
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 320 ; width
dw 200 ; height
X320Y240 label word
db 0e3h ; dot clock
db 10 ; Number of CRTC Registers to update
dw 00d06h ; vertical total
dw 03e07h ; overflow (bit 8 of vertical counts)
dw 04109h ; cell height (2 to double-scan)
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 320 ; width
dw 240 ; height
X360Y200 label word
db 0e7h ; dot clock
db 08 ; Number of CRTC Registers to update
dw 06b00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08e03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 360 ; width
dw 200 ; height
X360Y240 label word
db 0e7h ; dot clock
db 17 ; Number of CRTC Registers to update
dw 06b00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08e03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 00d06h ; vertical total
dw 03e07h ; overflow (bit 8 of vertical counts)
dw 04109h ; cell height (2 to double-scan)
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 02d13h ; offset;
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 360
dw 240
X376Y282 label word
db 0e7h
db 18
dw 06e00h ; horz total
dw 05d01h ; horz displayed
dw 05e02h ; start horz blanking
dw 09103h ; end horz blanking
dw 06204h ; start h sync
dw 08f05h ; end h sync
dw 06206h ; vertical total
dw 0f007h ; overflow
dw 06109h ; cell height
dw 0310fh ;
dw 03710h ; v sync start
dw 08911h ; v sync end and protect cr0-cr7
dw 03312h ; vertical displayed
dw 02f13h ; offset
dw 00014h ; turn off dword mode
dw 03c15h ; v blank start
dw 05c16h ; v blank end
dw 0e317h ; turn on byte mode
dw 376
dw 282
LABEL X256Y400 word
db 0e3h ; dot clock
db 8 ; Number of CRTC Registers to update
dw 05f00h ; horz total
dw 03f01h ; horz displayed
dw 04202h ; start horz blanking
dw 09f03h ; end horz blanking
dw 04c04h ; start h sync
dw 00005h ; end h sync
dw 04009h ; cell height
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 256
dw 400
LABEL X256Y480 word
db 0e3h ; dot clock
db 16 ; Number of CRTC Registers to update
dw 05f00h ; horz total
dw 03f01h ; horz displayed
dw 04202h ; start horz blanking
dw 09f03h ; end horz blanking
dw 04c04h ; start h sync
dw 00005h ; end h sync
dw 00d06h ; vertical total
dw 03e07h ; overflow (bit 8 of vertical counts)
dw 04009h ; cell height (2 to double-scan)
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 256
dw 480
X320Y400 label word
db 0e3h ; dot clock
db 03 ; Number of CRTC Registers to update
dw 04009h ; cell height
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 320 ; width
dw 400 ; height
X320Y480 label word
db 0e3h ; dotclock
db 10 ; Number of CRTC Registers to update
dw 00d06h ; vertical total
dw 03e07h ; overflow (bit 8 of vertical counts)
dw 04009h ; cell height (2 to double-scan)
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 320 ; width
dw 480 ; height
X360Y400 label word
db 0e7h ; dot clock
db 09 ; Number of CRTC Registers to update
dw 06b00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08e03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 04009h ; cell height
dw 00014h ; turn off dword mode
dw 0e317h ; turn on byte mode
dw 360 ; width
dw 400 ; height
X360Y480 label word
db 0e7h
db 17
dw 06b00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08e03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 00d06h ; vertical total
dw 03e07h ; overflow
dw 04009h ; cell height
dw 0ea10h ; v sync start
dw 0ac11h ; v sync end and protect cr0-cr7
dw 0df12h ; vertical displayed
dw 02d13h ; offset
dw 00014h ; turn off dword mode
dw 0e715h ; v blank start
dw 00616h ; v blank end
dw 0e317h ; turn on byte mode
dw 360
dw 480
X360Y360 label word
db 0e7h
db 15
dw 06b00h ; horz total
dw 05901h ; horz displayed
dw 05a02h ; start horz blanking
dw 08e03h ; end horz blanking
dw 05e04h ; start h sync
dw 08a05h ; end h sync
dw 04009h ; cell height
dw 08810h ; v sync start
dw 08511h ; v sync end and protect cr0-cr7
dw 06712h ; vertical displayed
dw 02d13h ; offset
dw 00014h ; turn off dword mode
dw 06d15h ; v blank start
dw 0ba16h ; v blank end
dw 0e317h ; turn on byte mode
dw 360
dw 360
X376Y308 label word
db 0e7h
db 18
dw 06e00h ; horz total
dw 05d01h ; horz displayed
dw 05e02h ; start horz blanking
dw 09103h ; end horz blanking
dw 06204h ; start h sync
dw 08f05h ; end h sync
dw 06206h ; vertical total
dw 00f07h ; overflow
dw 04009h ;
dw 0310fh ;
dw 03710h ; v sync start
dw 08911h ; v sync end and protect cr0-cr7
dw 03312h ; vertical displayed
dw 02f13h ; offset
dw 00014h ; turn off dword mode
dw 03c15h ; v blank start
dw 05c16h ; v blank end
dw 0e317h ; turn on byte mode
dw 376
dw 308
X376Y564 label word
db 0e7h
db 18
dw 06e00h ; horz total
dw 05d01h ; horz displayed
dw 05e02h ; start horz blanking
dw 09103h ; end horz blanking
dw 06204h ; start h sync
dw 08f05h ; end h sync
dw 06206h ; vertical total
dw 0f007h ; overflow
dw 06009h ;
dw 0310fh ;
dw 03710h ; v sync start
dw 08911h ; v sync end and protect cr0-cr7
dw 03312h ; vertical displayed
dw 02f13h ; offset
dw 00014h ; turn off dword mode
dw 03c15h ; v blank start
dw 05c16h ; v blank end
dw 0e317h ; turn on byte mode
dw 376
dw 564
LAST_X_MODE equ 13
ModeTable label word ; Mode X tweak table
dw offset X320Y200
dw offset X320Y240
dw offset X360Y200
dw offset X360Y240
dw offset X376Y282
dw offset X320Y400
dw offset X320Y480
dw offset X360Y400
dw offset X360Y480
dw offset X360Y360
dw offset X376Y308
dw offset X376Y564
dw offset X256Y200
dw offset X256Y240
PARAMS label byte
_CurrXMode dw 0 ; Current graphics mode index
_InGraphics db 0 ; Flag indicating graphics activity
_ScrnPhysicalByteWidth dw 0 ; Physical width in bytes of screen
_ScrnPhysicalPixelWidth dw 0 ; Physical width in pixels of screen
_ScrnPhysicalHeight dw 0 ; Physical Height of screen
_ErrorValue db 0 ; Set after function calls
_SplitScrnActive db 0 ; Flag indicating Split scrn activity
_DoubleBufferActive dw 0 ; Flag indicating double buffering
_TrippleBufferActive dw 0 ; Flag indicating tripple buffering
_SplitScrnScanLine dw 0 ; Split Screen's starting scan line
_SplitScrnVisibleHeight dw 0 ; Split Screen's height on screen
_SplitScrnOffs dw 0 ; Offset in video ram of Split Screen
; always = 0
_Page0_Offs dw 0 ; Ofset in video ram of Main virtual
; screen ( = 0 if no split screen
; otherwise = offset of first byte
; after split screen
_Page1_Offs dw 0 ; Ofset in video ram of Second virtual
; screen ( = 0 if no split screen
; otherwise = offset of first byte
; after split screen
; = Page0_Offs if Doubble buffering
; not enabled
_Page2_Offs dw 0
_NonVisual_Offs dw 0 ; Ofset in video ram of first byte
; of non visible ram
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -