*---------------------------* * Coder Documentation * *---------------------------* * Video system * * of * * CENTScreen * * DOLMEN Compatible * *---------------------------* Author: Sacha Hnatiuk ASM: Sacha Hnatiuk C: David Ren‚-Loiseau Hotline from 21h to 23h form mardi to samedi at 344-746-330 or e-mail centek@graphity.fr Introduction ------------ It will come later... *--------start of the functions----------* Getrez ($04) ------------ Return the current resolution It's the old call to know the current resolution. 0 for Low ST 1 for Med ST 2 for High ST In the other case, it return 3, the default value for Falcon modes. Parameters: Nothing Answer: D0 (word): resolution ASM 1: move.w #4,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Getrez C: #include int Getrez( void ) Setscreen ($05) --------------- Change the resolution: Use this function in priority for all changement of resolution because it realloc the screen an initialise the VDI. Whatever the screen adress composed of 0, the reallocation of the screen is doing. Parameters: Log (long): Pointeur to the logical screen or 0 to realloc the screen Phys (long): Pointeur to the physical screen or 0 to realloc the screen Rez (word): 3 for Falcon mode Mode (word): video mode Answer: D0 (word): the old video mode ASM 1: move #mode_video,-(sp) move #3,-(sp) move.l #log_base,-(sp) move.l #phys_base,-(sp) move.w #5,-(sp) trap #14 addq.l #14,sp ASM 2: include XBIOS.EQU move #mode_video,-(sp) move #3,-(sp) move.l #log_base,-(sp) move.l #phys_base,-(sp) XBIOS Setscreen C: #include void Setscreen( void *laddr, void *paddr, int rez ); Vread ($41) ----------- Inquire on the actual video mode: In one call, you can know all the informations on the video mode installed. Parameters: Long: pointeur to an array: word: handle word: video mode like on Falcon word: width of the physical screen word: height of the physical screen word: number of plane word: width of the virtual screen word: height of the virtual screen word: delay in seconds before shut down word: delay in seconds between the shut down and the Energy Star mode bytes: name of the video mode (32 bytes maxi) terminated by a 0. Answer: the array is full. ASM 1: move.l #Result,-(sp) move.w #$41,-(sp) trap #14 addq.l #6,sp ASM 2: include XBIOS.EQU move.l #Result,-(sp) XBIOS Vread C: #include void Vread(VDO_PARAM *Result); Vwrite ($42) ------------ Change the screen resolution It is possible to initialized the VDI to use its functions directly. It make an realloc at the same time. With the in-array (see the desciptor in the last function), you can send the new desire resolution: - handle <>-1: it's the handle of a known video mode (like the start resolution). You can give the virtual size with a value different of -1, else it take the original virtual size. - handle = -1: the resolution must be given and could be adjust by virtual size like before. The search of your resolution take the resolution smaller or equal and add virtual screen if needed. After the call, the out-array contains the real resolution made. If an error occur, the actual resolution is return with -1 for d0. parameters: word: reset the VDI if different of 0 Long: in parameters Long: out parameters Answer: the out-arry is full. D0=0 : no error D0=-1: error ASM 1: move.l #OutParam,-(sp) move.l #InParam,-(sp) move.w #$42,-(sp) trap #14 lea 10(sp),sp ASM 2: include XBIOS.EQU move.l #OutParam,-(sp) move.l #InParam,-(sp) XBIOS Vwrite C: #include int Vwrite(int InitVDI, VDO_PARAM *InParam, VDO_PARAM *OutParam); Vattrib ($43) ------------- Change the attributs of a video mode You can change the original mode with this function. ... parameters: Long: in parameters Long: out parameters Answer: the out-array is full. ASM 1: move.l #OutParam,-(sp) move.l #InParam,-(sp) move.w #$43,-(sp) trap #14 lea 10(sp),sp ASM 2: include XBIOS.EQU move.l #OutParam,-(sp) move.l #InParam,-(sp) XBIOS Vattrib C: #include void Vattrib (VDO_PARAM *InParam, VDO_PARAM *OutParam); Vcreate ($44) ------------- Add a video mode It take directly the videl parameters and affect a new handle on it with your parameters. It use by CENTvidel. ... parameters: Long: in parameters Long: out parameters Answer: The out array is full. ASM 1: move.l #OutParam,-(sp) move.l #InParam,-(sp) move.w #$44,-(sp) trap #14 lea 10(sp),sp ASM 2: include XBIOS.EQU move.l #OutParam,-(sp) move.l #InParam,-(sp) XBIOS Vcreate C: #include void Vcreate (VDO_PARAM *InParam, VDO_PARAM *OutParam); Vdelete ($45) ------------- Delete a video mode Don't move the handles but compress the internal data. After a save-load sequence, the handles may be change. parameters: word: handle to delete. Answer: D0=0 : no error. D0=-1 : bad handle. ASM 1: move.w #Handle,-(sp) move.w #$45,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #Handle,-(sp) XBIOS Vdelete C: #include int Vdelete(int Handle); Vfirst ($46) ------------ Search the first video mode ... parameters: long: in-mask long: out-array Answer: D0=0 : the out-array is full. D0=-1 : no mode match ASM 1: move.l #Mode,-(sp) move.l #Mask,-(sp) move.w #$46,-(sp) trap #14 lea 10(sp),sp ASM 2: include XBIOS.EQU move.l #Mode,-(sp) move.l #Mask,-(sp) XBIOS Vfirst C: #include int Vfirst(VDO_PARAM *Mask, VDO_PARAM *Mode); Vnext ($47) ----------- Next video mode ... parameters: long: in-mask with the last handle found long: out-array Answer: D0=0: the array is full D0=-1: no mode match. ASM 1: move.l #Mode,-(sp) move.l #Mask,-(sp) move.w #$47,-(sp) trap #14 lea 10(sp),sp ASM 2: include XBIOS.EQU move.l #Mode,-(sp) move.l #Mask,-(sp) XBIOS Vnext C: #include int Vnext(VDO_PARAM *Mask, VDO_PARAM *Mode); Vvalid ($48) ------------ Valid a video mode ... parameters: word: handle to be tested. Answer: D0=0 If the mode exist. D0=-1 no mode for this hanlde. ASM 1: move.w #Handle,-(sp) move.w #$48,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #Handle,-(sp) XBIOS Vvalid C: #include int Vvalid(int Handle); Vload ($49) ----------- Load VIDEO.DAT ... parameters: Nothing Answer: D0=0 : no error. D0=-1 : file not found. ASM 1: move.w #$49,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Vload C: #include int Vload(void); Vsave ($4a) ----------- Save VIDEO.DAT ... parameters: Nothing Answer: D0=0 : no error. D0=-1 : save impossible. ASM 1: move.w #$4a,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Vsave C: #include int Vsave(void); Vopen ($4b) ----------- Wake up the screen ... parameters: Nothing Answer: D0=0 : no error. D0=-1 : improbable. ASM 1: move.w #$4b,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Vopen C: #include int Vopen(void); Vclose ($4c) ------------ Shut down ... parameters: Nothing Answer: D0=0 : no error. D0=-1 : improbable. ASM 1: move.w #$4c,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Vclose C: #include int Vclose(void); Vscroll ($4d) ------------- Choose the method of scrolling ... parameters: word: new methode to use 0: edge scrolling (default methode) 1: proportionnal scrolling 2: focus scrolling Answer: D0: the old methode ASM 1: move.w #ScrollMode,-(sp) move.w #$4d,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #ScrollMode,-(sp) XBIOS Vscroll C: #include int Vscroll(int ScrollMode); Voffset ($4e) ------------- Locating of the virtual screen It return the position in relation to the top left corner of the physical screen in the virtual screen. parameters: Nothing Answer: D0 hold the actual position with x in the high word and y in the low word. ASM 1: move.w #$4e,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Voffset C: #include int Voffset(void); Vseek ($4f) ----------- Locate the virtual screen ... parameters: word: x word: y Answer: D0 hold the old position with x in the high word and y in the low word. ASM 1: move.w #$4f,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS Vseek C: #include VPOS result; *(long *)&result = Vseek(10, 10); VPOS Voffset(void); Vlock ($50) ----------- Lock the virtual screen ... parameters: word: command 0: the mouse can move the virtual screen 1: the mouse can not mode the virtual screen Answer: D0 the old configuration. ASM 1: move.w #Cmd,-(sp) move.w #$50,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #Cmd,-(sp) XBIOS Vlock C: #include int Vlock(int Cmd); SetMon ($51) ------------ Set the monitor's kind ... parameters: word: new kind of monitor 0: SM124 ( prehistorical screen of the ST ) 1: RGB ( TV's like screen, ideal to make blind... ) 2: VGA ( a real monitor to work! ) 3: TV ( worst RGB, all user are blind... ) Answer: D0: the kind of screen. ASM 1: move.w #MonType,-(sp) move.w #$51,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #MonType,-(sp) XBIOS SetMon C: #include int SetMon(int MontType); MultiMon ($52) -------------- Multisynchro mode You can authorise the switch between RGB and VGA. parameters: word: 0 : forbidden the switchs. >0 : authorise the switchs. -1: the actual mode. Answer: D0: the old mode. ASM 1: move.w #Cmd,-(sp) move.w #$52,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #Cmd,-(sp) XBIOS MultiMon C: #include int MultiMon(int Cmd); SizeComp ($53) -------------- Vgetsize compatibility ... parameters: word: 0 : return the real size of the original screen. Put the hight bit to 1 to return the extended size of the video mode. >0 : return the extended size. -1: the actual mode. Answer: D0: the old mode. ASM 1: move.w #$53,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS VSizeComp C: #include int VSizeComp(void); Vsize ($54) ----------- Return the size of the screen This functions allow you to know the size of a screen with input parameters. If you put -1 for handle, the current handle is take by default and reference. The function read only the logical parameter (no if -1) and the virtual flag (no if -1). Parameters: Long: in-array Answer: D0 hold the size in bytes. 0 for error (bad parameters ?!) ASM 1: move.l #Mode,-(sp) move.w #$53,-(sp) trap #14 addq.l #6,sp ASM 2: include XBIOS.EQU pea Mode XBIOS Vsize C: To do ... Vsetmode ($58) -------------- Set a new resolution if the high bit of the video mode is put to 1, it run an extended screen like Setscreen. parameters: Mode (word): the new mode Answer: D0 (word): the old mode ASM 1: move.w #ModeVideo,-(sp) move.w #$58,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #ModeVideo,-(sp) XBIOS Vsetmode C: #include Montype ($59) ------------- What kind of monitor is connected parameters: Nothing Answer: D0 (word): 0 -> SM124 1 -> RGB screen 2 -> VGA screen 3 -> TV screen ASM 1: move.w #$59,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS MonType C: #include VsetSync ($5a) -------------- Set the video synchronisation ... parameters: External (word): xxxx xxxx xxxx xHVC x r‚serv‚ (… 0) H: external horizontal synchronisation V: idem in vertical C: external clock Answer: D0=0 : no error. D0=-1 : improbable. ASM 1: move.w #Sync,-(sp) move.w #$5a,-(sp) trap #14 addq.l #4,sp ASM 2: include XBIOS.EQU move.w #Sync,-(sp) XBIOS VsetSync C: #include VgetSize ($5b) -------------- Return the size of the actual screen ... parameters: word: video mode Answer: D0 (long): the size in bytes ASM 1: move.w #$5b,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS VgetSize C: #include VmodeValid ($5f) ---------------- Valid a video mode It's an hidden call of the TOS. ... parameters: word: video mode. Answer: D0: the goog video mode. ASM 1: move.w #$5f,-(sp) trap #14 addq.l #2,sp ASM 2: include XBIOS.EQU XBIOS VmodeValid C: #include *--------End of the functions----------* *-------------------------------------------------------------------------* * STRUCTURE OF VIDEO XBIOS *-------------------------------------------------------------------------* *----------* * Structure of parameters for cookie "_VID" * the start is made for Dolmen RSRESET sys_id rs.l 1 ;name of the librairy or number ; ex: "_VID" sys_ver rs.l 1 ;version of the librairy ; ex: 1.0.1 ($101) sys_date rs.l 1 ;date of the librairy ; ex: $01061997(01/06/1997) sys_version rs.l 1 ;pointeur to a text... sys_install rs.l 1 ;install rout of the driver sys_open rs.l 1 ;call at the start sys_close rs.l 1 ;...a the end sys_extend rs.l 1 ;Local vars of the librairy *----------* RSSET sys_extend vid_maj_vars rs.l 1 ;pointeur of the main vars vid_cur_vars rs.l 1 ;pointeur of the cur vars vid_shut_down rs.l 1 ;shut down rout vid_wake_up rs.l 1 ;wake up rout *----------* *-------------------------------------------------------------------------* *----------* * Structure of parameters for cookie "CNTS" RSRESET cnts_name rs.l 1 ;name of the cookie cnts_version rs.l 1 ;number of the version ; ex: 1.0.1 ($101) cnts_kbd_on rs.b 1 ;flag for keyboard wake up cnts_midi_on rs.b 1 ;idem for midi cnts_mouse_on rs.b 1 ;idem for mouse cnts_joy_on rs.b 1 ;idem for joysticks cnts_tst_eco rs.b 1 ;hotkeys to shut down cnts_turbo_on rs.b 1 ;turbo mouse *-------------------------------------------------------------------------* *-------------* * CURENTS VARS *-------------* RSRESET vid_BUG_DAT rs.b 1 ;error during load VIDEO.DAT vid_new_dat rs.b 1 ;... vid_OK_VBL rs.b 1 ;VBL flag vid_OK_TIMERC rs.b 1 ;TIMERC flag vid_monitor rs.w 1 ;... vid_pal rs.w 1 ;flag pal/ntsc vid_xbios_mode rs.w 1 ;video mode system vid_cur_mode rs.w 1 ;current video mode vid_multisync rs.b 1 ;... vid_size_comp rs.b 1 ;... vid_vdi_chg rs.b 1 ;Initialise the VDI vid_col_chg rs.b 1 ;... vid_palst rs.b 1 ;... vid_BIG_FLAG rs.b 1 ;Virtual mode vid_SCROLL rs.b 1 ;scoll... vid_newpos rs.b 1 ;new coordinate vid_freeze rs.b 1 ;no scrolling rs.b 1 ;reserved vid_scroll_mth rs.w 1 ;methode of scrolling from 0 to 2 vid_ECO_FLAG rs.b 1 ;ECO mode run rs.b 1 vid_NIGHT_FLAG rs.b 1 ;... vid_ENERGY_FLAG rs.b 1 ;... vid_eco2_extinction rs.b 1 ;... vid_eco2_night_flag rs.b 1 ;... vid_eco_delay rs.l 1 ;... vid_eco2_delay rs.l 1 ;... vid_eco_counter rs.l 1 ;... *-------------------------------------------------------------------------* *-------------* * VARIABLES PRINCIPALES *-------------* RSRESET vid_dat_adr rs.l 1 ;... vid_dat_len rs.l 1 ;... vid_dat_len_MAX rs.l 1 ;... vid_cfg_adr rs.l 1 ;... max_handle rs.w 1 ;... *-------------* vid_cfg_param rs.l 1 ;... vid_screen_param rs.l 1 ;... vid_videl_param rs.l 1 ;... vid_phys_adr rs.l 1 ;... vid_log_adr rs.l 1 :... *-------------* vid_handle rs.w 1 ;... vid_phys_w rs.w 1 ;... vid_phys_h rs.w 1 ;... vid_plan rs.w 1 ;... vid_log_w rs.w 1 ;... vid_log_h rs.w 1 ;... vid_scrn_size rs.l 1 ;... *-------------* * for virtual screen ... vid_newx rs.w 1 ;... vid_newy rs.w 1 ;... *-------------* *-------------------------------------------------------------------------* *-------------* * Structure of .DAT file *-------------* * Hardware address _HHT EQU $FFFF8282 _HBB EQU $FFFF8284 _HBE EQU $FFFF8286 _HDB EQU $FFFF8288 _HDE EQU $FFFF828A _HSS EQU $FFFF828C _HFS EQU $FFFF828E _HEE EQU $FFFF8290 _VFT EQU $FFFF82A2 _VBB EQU $FFFF82A4 _VBE EQU $FFFF82A6 _VDB EQU $FFFF82A8 _VDE EQU $FFFF82AA _VSS EQU $FFFF82AC _VCO EQU $FFFF82C0 _VMODE EQU $FFFF82C2 _SYNC EQU $FFFF820A _OFFSET EQU $FFFF820E _VWRAP EQU $FFFF8210 _SHIFT EQU $FFFF8260 _SPSHIFT EQU $ffff8266 * bits position flag_80c EQU 3 flag_vga EQU 4 flag_pal EQU 5 flag_over EQU 6 flag_st EQU 7 flag_vert EQU 8 flag_eco2 EQU 9 flag_eco EQU 10 flag_virt EQU 11 flag_extclk EQU 12 flag_ext EQU 13 flag_std EQU 14 flag_set EQU 15 * masks ;FSOPV8NNN _cols equ %000000111 _80c equ %000001000 _vga equ %000010000 _pal equ %000100000 _over equ %001000000 _st equ %010000000 _vert equ %100000000 _eco2 equ %1000000000 _eco equ %10000000000 _virt equ %100000000000 _extclk equ %1000000000000 _ext equ %10000000000000 _std equ %100000000000000 _set equ %1000000000000000 ;FSOPV8NNN _setmod equ %110111111 _setvga equ %110011111 _setrgb equ %110101111 _setext equ $fe00 _setopt equ _set+_eco+_eco2+_virt *-------------* * struture of DAT *-------------* * header 1.00 RSRESET dat_id rs.l 1 ;name: "VDAT" dat_ver rs.w 1 ;version of the file dat_head rs.w 1 ;offset to the first mode dat_multisync rs.b 1 ;... dat_size_comp rs.b 1 ;... dat_scroll rs.b 1 ;... dat_kbd_on rs.b 1 ;... dat_midi_on rs.b 1 ;... dat_mouse_on rs.b 1 ;... dat_joy_on rs.b 1 ;... dat_tst_eco rs.b 1 ;... dat_turbo_on rs.b 1 ;... rs.b 1 ;reserved dat_modes rs.l 0 ;the first mode RSRESET dat_offset rs.w 1 ;offset to the next mode dat_datas rs.l 0 ;datas of the mode *-------------* * video mode 1.00 *-------------* RSRESET dat_mode rs.w 1 ;mode code xxxx xxxF SOPV 8NNN ; STANDARD: ; bit 0 … 2: NNN (nombre de plan) ; 0-> monochrome ; 1-> 2 planes ; 2-> 4 planes ; 3-> 8 planes ; 4-> 16 planes (Near True Color) ; bit 3: Flag 80 colums (8) ; bit 4: Flag VGA (V) ; bit 5: Flag Pal (P) ; bit 6: Flag overscan (O) ; bit 7: Flag ST compatible (S) ; bit 8: Flag Vertical (F) ; ETENDU: ; bit 9: energy star on/off ; bit 10: screen saver on/off ; bit 11: virtual screen on/off ; bit 12: external clock 32/36MHz (CT2) ; bit 13: external clock on/off ; bit 14: standard resolution (not deletable) ; bit 15: default video mode for old functions dat_physx rs.w 1 ;physical x dat_physy rs.w 1 ;physical y dat_plan rs.w 1 ;number of plane dat_logx rs.w 1 ;virtual x dat_logy rs.w 1 ;virtual y dat_eco_delay rs.w 1 ;delay in seconds dat_eco2_delay rs.w 1 ;delay in seconds * VIDEL registers dat_videl rs.l 0 dat_SPSHIFT rs.w 1 ;... dat_shift_write rs.b 1 ;... dat_SHIFT rs.b 1 ;... dat_VCO rs.w 1 ;... dat_VMODE rs.w 1 ;... dat_Hxx rs.w 8 ;... dat_Vxx rs.w 6 ;... dat_name rs.b 33 ;comments rs.b 1 ;reserved (0) dat_maxlength rs.l 0 ;maximum lenght of a video mode *-------------* *-------------------------------------------------------------------------* *-------------------* * Structure of an array for Vxxxx functions *-------------------* RSRESET V_Hdl rs.w 1 ;handle of video mode V_mode rs.w 1 ;Falcon video mode V_physx rs.w 1 ;physical width V_physy rs.w 1 ;physical height V_plan rs.w 1 ;planes number V_logx rs.w 1 ;virtual width V_logy rs.w 1 ;virtual height v_eco rs.w 1 ;eco delay v_eco2 rs.w 1 ;Energy Star delay V_name rs.b 33 ;name of the mode (32 bytes)+0 for the end rs.b 1 ;reserved (0) V_length rs.l 0 ;len of the array *-------------------------------------------------------------------------* *----------END----------*