├── alllang.bat ├── asmlib.cfg ├── asmlib ├── asm.mac ├── bios │ └── area0.def ├── code.def ├── code.mac ├── convert │ ├── count2x.mac │ └── digit.mac ├── dos │ ├── file.mac │ ├── io.mac │ ├── mcb.def │ ├── mem.mac │ └── psp.def ├── hard │ ├── pic8259a.def │ └── uart.def ├── hll.mac ├── lgpl └── macro.mac ├── com2exe.exe ├── copying ├── ctm-br.msg ├── ctm-de.msg ├── ctm-en.msg ├── ctm-es.msg ├── ctm-fr.msg ├── ctm-hu.msg ├── ctm-it.msg ├── ctm-lv.msg ├── ctm-nl.msg ├── ctm-pl.msg ├── ctm-pt.msg ├── ctm-sk.msg ├── ctmouse.asm ├── ctmouse.msg ├── ctmouse.txt ├── extend.txt ├── files.lst ├── history.txt ├── int10.lst ├── int33.lst ├── jwasm.txt ├── makefile ├── mouse.lsm ├── national.bat ├── protocol.txt ├── technote.txt ├── utility ├── comtest.asm ├── display.asm ├── makefile ├── mousetst.asm ├── protocol.asm └── wheeltst.asm └── wheelapi.txt /alllang.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if exist ctm-%1.msg goto makeone 3 | if not "%1"=="" goto syntax 4 | for %%i in (BR DE ES FR HU IT LV NL PL PT SK EN) do call %0 %%i 5 | goto done 6 | 7 | :makeone 8 | echo building ctm-%1.exe... 9 | make clean 10 | copy ctm-%1.msg ctmouse.msg 11 | make ctmouse.exe 12 | del ctm-%1.exe 13 | ren ctmouse.exe ctm-%1.exe 14 | goto done 15 | 16 | :syntax 17 | echo Usage: %0 LANGUAGE builds ctm-LANGUAGE.exe using ctm-LANGUAGE.msg 18 | echo Running %0 without options builds all default language ctm-*.exe 19 | 20 | :done 21 | -------------------------------------------------------------------------------- /asmlib.cfg: -------------------------------------------------------------------------------- 1 | -Iasmlib 2 | -Iasmlib\bios 3 | -Iasmlib\convert 4 | -Iasmlib\dos 5 | -Iasmlib\hard 6 | -I..\asmlib 7 | -I..\asmlib\bios 8 | -I..\asmlib\convert 9 | -I..\asmlib\dos 10 | -I..\asmlib\hard 11 | -------------------------------------------------------------------------------- /asmlib/asm.mac: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | ; Import: MOVREG_ (macro.mac), MOVOFF_ (macro.mac), MOVSEG_ (macro.mac), 20 | ; MOVRR_ (macro.mac), MOVOO_ (macro.mac), MOVROO_ (macro.mac), 21 | ; MOVREG2 (macro.mac), MOVREGax_ (macro.mac) 22 | ; Export: j, saveFAR, MOVSEG, POPSEG, movadd, movsub, memcopy, 23 | ; movidx, out_, outw, inb, inw 24 | 25 | j equ jmp short 26 | 27 | saveFAR macro addr:req,segm:req,offs ; :rest 28 | mov word ptr addr[0],offs 29 | mov word ptr addr[2],segm 30 | endm 31 | 32 | MOVSEG macro segreg:req,val:req,temp,segname ; :rest 33 | MOVSEG_ ,,, 34 | endm 35 | 36 | POPSEG macro segreg:req,segname ; :rest 37 | pop segreg 38 | assume segreg:segname 39 | endm 40 | 41 | ;------------------------------------------------------------------------ 42 | 43 | movadd macro dst:req,base,index ; :vararg 44 | ifb 45 | MOVREG_ , ;; dst=base 46 | exitm 47 | elseifidni , 48 | ifb 49 | shl dst,1 ;; dst+=dst 50 | else 51 | movadd ,, ;; dst=dst+base 52 | endif 53 | exitm 54 | elseif (.type index) eq 00100100b 55 | ;; symbol is defined and expression is a constant value 56 | if index eq 0 57 | MOVREG_ , ;; dst=base+0 58 | exitm 59 | endif 60 | endif 61 | 62 | ifnb 63 | ifdifi , 64 | if (.type base) eq 00100100b 65 | ;; symbol is defined and expression is a constant value 66 | if (.type index) eq 00100100b 67 | ;; symbol is defined and expression is a constant value 68 | MOVREG_ ,<(base)+(index)> ;; dst=const+const 69 | elseif base eq 0 70 | MOVREG_ , ;; dst=0+index 71 | else 72 | movadd ,, ;; dst=index+const 73 | endif 74 | exitm 75 | endif 76 | 77 | ??ASL instr <,ax,cx,dx,bx,sp,bp,si,di,eax,ecx,edx,ebx,esp,ebp,esi,edi,>,<,&dst&,> 78 | if ??ASL 79 | ??ASL instr <,bx,bp,si,di,>,<,&base&,> 80 | if ??ASL 81 | if ??ASL gt 6 82 | ??ASL instr <,bx,bp,>,<,&index&,> 83 | else 84 | ??ASL instr <,si,di,>,<,&index&,> 85 | endif 86 | if (??ASL ne 0) or ((.type index) eq 00100100b) 87 | ;; symbol is defined and expression is a constant value 88 | lea dst,[(base)+(index)] 89 | exitm 90 | endif 91 | endif 92 | endif 93 | 94 | mov dst,base 95 | endif ;; ifdifi , 96 | endif ;; ifnb 97 | 98 | if (.type index) eq 00100100b 99 | ;; symbol is defined and expression is a constant value 100 | if index eq 1 101 | inc dst 102 | exitm 103 | elseif index eq -1 104 | dec dst 105 | exitm 106 | elseif (index eq 2) or (index eq -2) 107 | ??ASL instr <,ax,cx,dx,bx,sp,bp,si,di,>,<,&dst&,> 108 | if ??ASL 109 | if index eq 2 110 | inc dst 111 | inc dst 112 | else 113 | dec dst 114 | dec dst 115 | endif 116 | exitm 117 | endif 118 | endif 119 | endif 120 | add dst,index 121 | endm 122 | 123 | movsub macro dst:req,base,index ; :vararg 124 | ifb 125 | MOVREG_ , ;; dst=base 126 | exitm 127 | elseifidni , 128 | MOVREG_ ,0 ;; dst=base-base 129 | exitm 130 | elseifidni , 131 | ifb 132 | MOVREG_ ,0 ;; dst-=dst 133 | else 134 | movsub ,, ;; dst=base-dst=-(dst-base) 135 | neg dst 136 | endif 137 | exitm 138 | elseif (.type index) eq 00100100b 139 | ;; symbol is defined and expression is a constant value 140 | if index eq 0 141 | MOVREG_ , ;; dst=base-0 142 | exitm 143 | endif 144 | endif 145 | 146 | ifnb 147 | ifdifi , 148 | if (.type base) eq 00100100b 149 | ;; symbol is defined and expression is a constant value 150 | if (.type index) eq 00100100b 151 | ;; symbol is defined and expression is a constant value 152 | MOVREG_ ,<(base)-(index)> ;; dst=const-const 153 | elseif base eq 0 154 | MOVREG_ , 155 | neg dst ;; dst=0-index=-index 156 | elseif base eq -1 157 | MOVREG_ , 158 | not dst ;; dst=-1-index 159 | else 160 | MOVREG_ , 161 | sub dst,index ;; dst=const-index 162 | endif 163 | exitm 164 | endif 165 | 166 | ??ASL instr <,ax,cx,dx,bx,sp,bp,si,di,eax,ecx,edx,ebx,esp,ebp,esi,edi,>,<,&dst&,> 167 | if ??ASL 168 | ??ASL instr <,bx,bp,si,di,>,<,&base&,> 169 | if ??ASL 170 | if (.type index) eq 00100100b 171 | ;; symbol is defined and expression is a constant value 172 | lea dst,[(base)-(index)] 173 | exitm 174 | endif 175 | endif 176 | endif 177 | 178 | mov dst,base 179 | endif ;; ifdifi , 180 | endif ;; ifnb 181 | 182 | if (.type index) eq 00100100b 183 | ;; symbol is defined and expression is a constant value 184 | if index eq 1 185 | dec dst 186 | exitm 187 | elseif index eq -1 188 | inc dst 189 | exitm 190 | elseif (index eq 2) or (index eq -2) 191 | ??ASL instr <,ax,cx,dx,bx,sp,bp,si,di,>,<,&dst&,> 192 | if ??ASL 193 | if index eq 2 194 | dec dst 195 | dec dst 196 | else 197 | inc dst 198 | inc dst 199 | endif 200 | exitm 201 | endif 202 | endif 203 | endif 204 | sub dst,index 205 | endm 206 | 207 | ;------------------------------------------------------------------------ 208 | 209 | memcopy macro cnt:=,dstseg,dstsegname,dstoff,srcseg,srcsegname,srcoff ; :vararg 210 | if (.type cnt) ne 00100100b 211 | ;; symbol not defined or expression not a constant value 212 | MOVROO_ cx,,di,,si, 213 | MOVSEG_ es,,, 214 | MOVSEG_ ds,,, 215 | rep movsb 216 | else 217 | MOVOO_ di,,si, 218 | MOVSEG_ es,,, 219 | MOVSEG_ ds,,, 220 | if (cnt) gt 10 221 | MOVREG_ cx,(cnt)/2 222 | rep movsw 223 | else 224 | rept (cnt)/2 225 | movsw 226 | endm 227 | endif 228 | if (cnt) mod 2 229 | movsb 230 | endif 231 | endif 232 | endm 233 | 234 | ;------------------------------------------------------------------------ 235 | 236 | movidx macro reg:req,index:req,base,oldindex ; :vararg 237 | ifb 238 | movadd ,, 239 | elseifb 240 | movadd ,,<(index)-(oldindex)> 241 | elseif ((index)-(oldindex) lt -2) or \ 242 | ((index)-(oldindex) gt 2) or \ 243 | ((oldindex eq 2) or (oldindex eq -2)) and (index eq 0) 244 | movadd ,, 245 | else 246 | movadd ,,<(index)-(oldindex)> 247 | endif 248 | endm 249 | 250 | ;------------------------------------------------------------------------ 251 | 252 | out_ macro port:=,lo:=,hi ; :vararg 253 | if (.type port) eq 00100100b 254 | ;; symbol is defined and expression is a constant value 255 | if port lt 100h 256 | MOVREG2 ax,ah,al,, 257 | ifb 258 | out port,al 259 | else 260 | out port,ax 261 | endif 262 | exitm 263 | endif 264 | endif 265 | MOVREGax_ dx,dh,dl,,, 266 | ifb 267 | out dx,al 268 | else 269 | out dx,ax 270 | endif 271 | endm 272 | 273 | outw macro port:=,val ; :vararg 274 | if (.type port) eq 00100100b 275 | ;; symbol is defined and expression is a constant value 276 | if port lt 100h 277 | MOVREG_ ax, 278 | out port,ax 279 | exitm 280 | endif 281 | endif 282 | MOVRR_ dx,,ax, 283 | out dx,ax 284 | endm 285 | 286 | inb macro var,port ; :vararg 287 | ifnb 288 | if (.type port) eq 00100100b 289 | ;; symbol is defined and expression is a constant value 290 | if port lt 100h 291 | in al,port 292 | MOVREG_ ,al 293 | exitm 294 | endif 295 | endif 296 | endif 297 | MOVREG_ dx, 298 | in al,dx 299 | MOVREG_ ,al 300 | endm 301 | 302 | inw macro var,port ; :vararg 303 | ifnb 304 | if (.type port) eq 00100100b 305 | ;; symbol is defined and expression is a constant value 306 | if port lt 100h 307 | in ax,port 308 | MOVREG_ ,ax 309 | exitm 310 | endif 311 | endif 312 | endif 313 | MOVREG_ dx, 314 | in ax,dx 315 | MOVREG_ ,ax 316 | endm 317 | -------------------------------------------------------------------------------- /asmlib/bios/area0.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | HWLIST record HW_LPT_cnt :2, \; number of parallel ports 20 | HWLIST_13 :1, \ 21 | HW_gameport:1, \; game port present 22 | HW_COM_cnt :3, \; number of serial ports 23 | HWLIST_8 :1, \ 24 | HW_FDD_cnt :2, \; number of floppy disk drives-1 25 | HW_vidmode :2, \; initial video mode 26 | \; =00 EGA/VGA, =01 40x25 CGA 27 | \; =10 80x25 CGA, =11 80x25 mono 28 | HWLIST_3 :1, \ 29 | HW_PS2 :1, \; PS/2 pointing device present 30 | HW_FPU :1, \; math coprocessor present 31 | HW_FDD :1 ; floppy disk drives present 32 | 33 | ;------------------------------------------------------------------------ 34 | 35 | KBDFLAGS record KBD_INS_press :1, \ 36 | KBD_Caps_press :1, \; Caps Lock pressed 37 | KBD_Num_press :1, \; Num Lock pressed 38 | KBD_Scroll_press :1, \; Scroll Lock pressed 39 | KBD_Pause :1, \; Pause state active 40 | KBD_SysReq_press :1, \ 41 | KBD_LAlt_pressed :1, \; Left Alt pressed 42 | KBD_LCtrl_pressed:1, \; Left Ctrl pressed 43 | KBD_INSERT :1, \ 44 | KBD_CapsLock :1, \ 45 | KBD_NumLock :1, \ 46 | KBD_ScrollLock :1, \ 47 | KBD_Alt_press :1, \; either Alt pressed 48 | KBD_Ctrl_press :1, \; either Ctrl pressed 49 | KBD_LShift_press :1, \; Left Shift pressed 50 | KBD_RShift_press :1 ; Right Shift pressed 51 | 52 | KBDSTATUS record \ 53 | KBD_Caps_LED :1, \; Caps Lock LED 54 | KBD_Num_LED :1, \; Num Lock LED 55 | KBD_Scroll_LED :1, \; Scroll Lock LED 56 | KBDSTATUS_5 :3, \ 57 | KBD_AT :1, \; 101-key enhanced keyboard present 58 | KBD_RAlt_pressed :1, \; Right Alt pressed 59 | KBD_RCtrl_pressed:1, \; Right Ctrl pressed 60 | KBDSTATUS_0 :2 61 | 62 | ;------------------------------------------------------------------------ 63 | 64 | VIDEOCONTROL record \ 65 | VCTRL_clear :1, \; high bit of video mode 66 | \; =1 screen is not cleared 67 | VCTRL_RAM_64K :2, \; RAM on adapter-1 in 64K 68 | VCTRL_4 :1, \ 69 | VCTRL_inactive :1, \; EGA/VGA video system inactive 70 | VCTRL_wait :1, \; wait for display enable 71 | VCTRL_mono :1, \; display is mono 72 | VCTRL_notemulate:1 ; =0 cursor shape treated as CGA ones 73 | 74 | VIDEOSWITCHES record \; EGA/VGA video switches 75 | VIDSW_feature :3, \; power-on state of feature 76 | \; connector bits 3-1 77 | VIDSW_feature0 :1, \; =0 enhanced color display (ECD) 78 | VIDSW_display :4 ; adapters+attached display 79 | ; primary secondary 80 | ; =00h MDA EGA+40x25 color display 81 | ; =01h MDA EGA+80x25 color display 82 | ; =02h MDA EGA+ECD (CGA emulation) 83 | ; =03h MDA EGA+ECD 84 | ; =04h CGA+40x25 color display EGA+mono display 85 | ; =05h CGA+80x25 color display EGA+mono display 86 | ; =06h EGA+40x25 color display MDA 87 | ; =07h EGA+80x25 color display MDA 88 | ; =08h EGA+ECD (CGA emulation) MDA 89 | ; =09h EGA+ECD MDA 90 | ; =0Ah EGA+mono display CGA+40x25 color display 91 | ; =0Ah EGA+mono display CGA+80x25 color display 92 | 93 | VGAOPTIONS record \; MCGA/VGA mode set option control 94 | VGA_scan2 :1, \; =0 350-line mode when VGA_scan=0 95 | \; =1 200-line mode when VGA_scan=0 96 | VGA_DCC_enabled :1, \; DCC display switching enabled 97 | VGAOPTIONS_1 :1, \ 98 | VGA_scan :1, \; =1 400-line mode at next mode set 99 | \; =0 350/200-line mode 100 | VGA_nopalette :1, \; default palette loading disabled 101 | VGA_grayscale :1, \; gray scale summing enabled 102 | VGA_active :1 ; =1 VGA active (MCGA always 0) 103 | 104 | ;------------------------------------------------------------------------ 105 | 106 | VIDEOSAVETBL struc ; Video Save Pointer Table [EGA/VGA/MCGA] 107 | VIDEO_paramtbl@ dd ? ; ptr to Video Parameter Table 108 | VIDEO_dynsavearea dd ? ; ptr to Parameter Dynamic Save Area 109 | VIDEO_text_charset@ dd ? ; ptr to Text Character Set Override 110 | VIDEO_graph_charset@ dd ? ; ptr to Graphics Character Set Override 111 | VIDEO_savetbl2@ dd ? ; [VGA] ptr to Secondary Save Pointer Table 112 | VIDEOSAVETBL ends 113 | 114 | ; Video Parameter Table: 115 | ; VIDEOPARAM 4 dup(?) ; modes 0-3 in 200-line CGA emulation mode 116 | ; VIDEOPARAM 11 dup(?) ; modes 4-0Eh 117 | ; VIDEOPARAM 2 dup(?) ; modes 0Fh-10h when only 64K RAM on adapter 118 | ; VIDEOPARAM 2 dup(?) ; modes 0Fh-10h when >64K RAM on adapter 119 | ; VIDEOPARAM 4 dup(?) ; modes 0-3 in 350-line mode 120 | ; VIDEOPARAM ? ; [VGA] modes 0 or 1 in 400-line mode 121 | ; VIDEOPARAM ? ; [VGA] modes 2 or 3 in 400-line mode 122 | ; VIDEOPARAM ? ; [VGA] modes 7 in 400-line mode 123 | ; VIDEOPARAM 3 dup(?) ; [VGA] modes 11h-13h 124 | 125 | VIDEOPARAM struc 126 | VPARAM_width db ? ; screen width in text columns 127 | VPARAM_height db ? ; screen height in text rows-1 128 | VPARAM_hchar db ? ; character height in scan lines/bytes 129 | VPARAM_pagesize dw ? ; video page (regen buffer) size in bytes 130 | VPARAM_SEQC db ?,?,?,? ; values for Sequencer Registers 1-4 (3C4h) 131 | VPARAM_MISC db ? ; value for Miscellaneous Output Reg (3C2h) 132 | VPARAM_CRTC db 25 dup(?) ; values for CRTC Registers (3x4h) 133 | VPARAM_ATC db 20 dup(?) ; values for Attribute Controller Regs (3C0h) 134 | VPARAM_GRC db 9 dup(?) ; values for Graphics Controller Regs (3CEh) 135 | VIDEOPARAM ends ; sizeof(VIDEOPARAM) == 64 136 | 137 | 138 | ;======================================================================== 139 | 140 | BIOS segment use16 page at 0 141 | IVT dd 256 dup(?) ; Interrupt Vectors Table 142 | 143 | COM_base dw ?,?,?,? ; 400: base IO address of serial ports 144 | LPT_base dw ?,?,? ; 408: base IO address of parallel ports 145 | XBDA_seg dw ? ; 40E: segment of eXtended BIOS data area 146 | HW_list HWLIST ? ; 410: detected hardware/equipment list 147 | db ? 148 | basemem_K dw ? ; 413: base memory size in Kb 149 | dw ? 150 | 151 | KBD_flags KBDFLAGS ? ; 417: keyboard status flags 152 | db ? ; 419: Alt-nnn keypad workspace 153 | KBD_bufhead@ dw ? ; 41A: pointer to next character in buffer 154 | KBD_buftail@ dw ? ; 41C: pointer to free space in buffer 155 | KBD_buffer dw 16 dup(?) ; 41E: keyboard circular buffer 156 | db 11 dup(?) 157 | 158 | VIDEO_mode db ? ; 449: current video mode 159 | VIDEO_width dw ? ; 44A: screen width in text columns 160 | VIDEO_pagesize dw ? ; 44C: video page (regen buffer) size in bytes 161 | VIDEO_pageoff dw ? ; 44E: active page offset in video segment 162 | ; CURSOR_pos db 8 dup(?,?) ; 450: cursor column/row on each video page 163 | CURSOR_pos db (8+8) dup (?) ; JWASM does not understand dup(?,?) 164 | CURSOR_shape db ?,? ; 460: cursor end/start scan lines 165 | VIDEO_pageno db ? ; 462: active page number 166 | CRTC_base dw ? ; 463: base IO address of CRT controller (3x4h) 167 | CRT_MODE db ? ; 465: value of CRT mode select register (3x8h) 168 | CRT_PALETTE db ? ; 466: value of CRT palette register (3x9h) 169 | db 5 dup(?) 170 | 171 | BIOS_timer dd ? ; 46C: timer ticks since midnight 172 | BIOS_overflow db ? ; 470: timer overflow flag (timer has counted 173 | ; past midnight) 174 | 175 | BIOS_ctrlbreak db ? ; 471: bit 7 set when Ctrl-Break has been pressed 176 | BIOS_POSTreset dw ? ; 472: specifies the action at POST when reboot 177 | db ? 178 | BIOS_HD_cnt db ? ; 475: number of fixed disk drives 179 | db ?,? 180 | LPT_timeout db ?,?,? ; 478: parallel device timeout counters 181 | BIOS_4B_flags db ? ; 47B: INT 4B flags 182 | COM_timeout db ?,?,?,? ; 47C: serial device timeout counters 183 | 184 | KBD_buffer@ dw ?,? ; 480: keyboard buffer start/end+1 offsets in 40:0 185 | 186 | VIDEO_lastrow db ? ; 484: last text row on screen (count from 0) 187 | VIDEO_hchar dw ? ; 485: character height in scan lines/bytes 188 | VIDEO_control VIDEOCONTROL ? ; 487: EGA/VGA control 189 | VIDEO_switches VIDEOSWITCHES ? ; 488: EGA/VGA switches 190 | VGA_options VGAOPTIONS ? ; 489: MCGA/VGA mode set option control 191 | VGA_DCC_index db ? ; 48A: index into display combination code table 192 | db 11 dup(?) 193 | 194 | KBD_status KBDSTATUS ? ; 496: keyboard status flags 195 | 196 | TIMER_waitflag@ dd ? ; 498: pointer to user wait flag 197 | TIMER_waitmks dd ? ; 49C: wait counter in mks 198 | TIMER_active db ? ; 4A0: =0 acknowledged, =1 busy, =80h elapsed 199 | db 7 dup(?) 200 | 201 | VIDEO_ptrtable@ dd ? ; 4A8: pointer to video save pointer table 202 | 203 | org 04F0h 204 | IAC db 16 dup(?) ; Inter-Application Communication Area 205 | BIOS ends ; sizeof(BIOS) == 1024+256 206 | -------------------------------------------------------------------------------- /asmlib/code.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | OPCODE_MOV_AL equ 20 | OPCODE_MOV_CL equ 21 | OPCODE_MOV_DL equ 22 | OPCODE_MOV_BL equ 23 | OPCODE_MOV_AH equ 24 | OPCODE_MOV_CH equ 25 | OPCODE_MOV_DH equ 26 | OPCODE_MOV_BH equ 27 | OPCODE_MOV_AX equ 28 | OPCODE_MOV_CX equ 29 | OPCODE_MOV_DX equ 30 | OPCODE_MOV_BX equ 31 | 32 | OPCODE_ADD_AX equ 33 | OPCODE_AND_AX equ 34 | OPCODE_XOR_AX equ 35 | OPCODE_OR_AL equ 36 | OPCODE_AND_AL equ 37 | OPCODE_XOR_AL equ 38 | OPCODE_CMP_AL equ 39 | 40 | OPCODE_CMP_DI equ 41 | -------------------------------------------------------------------------------- /asmlib/code.mac: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | CODE_ macro op:req,name,def ; :vararg 20 | OPCODE_&op 21 | name def 22 | endm 23 | 24 | ;------------------------------------------------------------------------ 25 | 26 | call_ macro name:req,value ; :vararg 27 | db 0E8h ; CALL NEAR word 28 | name dw value-$-2 29 | endm 30 | 31 | jmp_ macro name:req,value ; :vararg 32 | db 0E9h ; JMP NEAR word 33 | name dw value-$-2 34 | endm 35 | 36 | call_far macro name ; :vararg 37 | db 09Ah ; CALL FAR dword 38 | name dd ? 39 | endm 40 | 41 | jmp_far macro name ; :vararg 42 | db 0EAh ; JMP FAR dword 43 | name dd ? 44 | endm 45 | 46 | ;------------------------------------------------------------------------ 47 | 48 | fixnear macro name:req,value ; :vararg 49 | mov [name],value-name-2 50 | endm 51 | 52 | fixcode macro offs:req,op,arg ; :vararg 53 | ifb 54 | mov [offs],op 55 | elseifb 56 | mov byte ptr offs[1],arg 57 | else 58 | mov word ptr [offs],((arg) shl 8)+op 59 | endif 60 | endm 61 | -------------------------------------------------------------------------------- /asmlib/convert/count2x.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/asmlib/convert/count2x.mac -------------------------------------------------------------------------------- /asmlib/convert/digit.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/asmlib/convert/digit.mac -------------------------------------------------------------------------------- /asmlib/dos/file.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/asmlib/dos/file.mac -------------------------------------------------------------------------------- /asmlib/dos/io.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/asmlib/dos/io.mac -------------------------------------------------------------------------------- /asmlib/dos/mcb.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | MCB segment use16 para at 0 20 | MCB_ID db ? ; 0: 'M'=valid, 'Z'=last block in list 21 | ownerID dw ? ; 1: PSP seg of owner (0=free) or special flag 22 | ; (6=DR-DOS XMS UMB, 7=DR-DOS excluded upper memory, 23 | ; 8=belongs to DOS, 0xfffx=386MAX) 24 | MCB_size dw ? ; 3: size in paragraphs (without MCB itself) 25 | db 3 dup(?) 26 | ownername db 8 dup(?) 27 | MCB ends ; sizeof(MCB) == 16 28 | -------------------------------------------------------------------------------- /asmlib/dos/mem.mac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/asmlib/dos/mem.mac -------------------------------------------------------------------------------- /asmlib/dos/psp.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | PSP segment use16 page at 0 20 | DOS_exit dw ? ; 00: =INT 20 instruction (20CDh) 21 | next_seg dw ? ; 02: seg beyond program memory 22 | db 6 dup(?) 23 | terminate dd ? ; 0A: terminate routine (see INT 22) 24 | ctrlBreak dd ? ; 0E: Ctrl-Break handler (see INT 23) 25 | critErr dd ? ; 12: Critical Error handler (see INT 24) 26 | parent dw ? ; 16: parent's PSP seg 27 | JFT db 20 dup(?) ; 18: Job File Table, one byte per file handle 28 | env_seg dw ? ; 2C: process environment seg 29 | dd ? 30 | JFT_size dw ? ; 32: number of entries in JFT (default 20) 31 | JFT@ dd ? ; 34: pointer to JFT (default PSP:JFT) 32 | prev dd ? ; 38: pointer to previous PSP (default FFFF:FFFFh) 33 | db 18 dup(?) 34 | PSP_TSR equ $-DOS_exit ; 4E: memory below available to reuse in TSR 35 | db 2 dup(?) 36 | DOS_call db 3 dup(?) ; 50: =INT 21/RETF instructions 37 | db 2 dup(?) 38 | extFCB1 db 7 dup(?) ; 55: can be used to make extended FCB 39 | FCB1 db 16 dup(?) ; 5C: unopened FCB for 1st cmd argument 40 | FCB2 db 16 dup(?) ; 6C: unopened FCB for 2nd cmd argument 41 | db 4 dup(?) 42 | defaultDTA label byte 43 | cmdline_len db ? ; 80 44 | cmdline db 127 dup(?) 45 | PSP ends ; sizeof(PSP) == 256 46 | -------------------------------------------------------------------------------- /asmlib/hard/pic8259a.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | ; PIC (Programmable Interrupt Controller) 20 | ; - IBM PC contains Intel 8259A PIC chipset. 21 | ; - IBM PC AT contains two 8259A cascaded through IRQ2 and original IRQ2 22 | ; line on the ISA bus attached to IRQ9 (second IRQ line on slave PIC). 23 | 24 | ;------------------------------------------------------------------------- 25 | 26 | ; 8259A contains: 27 | ; - IRR (Interrupt Request Register): reflects active IRQ lines; R/O 28 | ; - ISR (In Service Register): reflects IRQ accepted by CPU, which are not 29 | ; yet acknowledged by EOI command; R/O 30 | ; - IMR (Interrupt Mask Register): disables selected IRQ lines; R/W 31 | 32 | ; IRQ processing in 8086 mode: 33 | ; 1. IRR sets bit for IRQ line, at which signal front is detected. 34 | ; 2. 8259A sends INT signal to CPU if IRR bit is not masked by IMR and its 35 | ; priority is greater, than highest in ISR (i.e. same IRQ also will not 36 | ; be processed until its ISR bit is cleared). 37 | ; 3. CPU answers by INTA impulse. 38 | ; 4. ISR sets bit with highest priority from IRR and clears it in IRR. 39 | ; 5. CPU sends second INTA impulse, at which 8259A sends 8-bit address. 40 | ; 6. ISR bits cleared by EOI command later or at the end of second INTA 41 | ; impulse in AutoEOI mode. 42 | ; In cascade mode INT signal sent and first INTA impulse accepted by master 43 | ; PIC, then it allows the slave PIC to accept (and answer) second INTA impulse. 44 | 45 | ; Bounds: 46 | ; - IRR bit is cleared if consequent IRQ line goes down; if IRQ line goes down 47 | ; before second INTA impulse, then 8259A sends IRQ7 address (but not sets 48 | ; ISR7 bit). 49 | ; - it is undocumented what happens after EOI if new front(s) come in at IRQ 50 | ; line or IRQ line goes down after new front(s) before EOI for this IRQ. 51 | 52 | ; 8259A accepts commands of two types: sequence of 2-4 ICW (initialization 53 | ; command words) or 3 different OCW (output control words). After ICW1 IRR 54 | ; and IMR are cleared, IRQ7 gets priority 7, slave gets address 7, special 55 | ; mask mode is cleared and read mode is set for IRR. 56 | 57 | 58 | ;========================================================================= 59 | 60 | ; I/O ports addresses 61 | 62 | PIC1_ICW1 equ 20h ; All ICW W/O 63 | PIC1_ICW2 equ 21h ; ICW2/ICW3/ICW4 goes to 21h/0A1h 64 | PIC1_ICW3 equ 21h ; immediately after ICW1 65 | PIC1_ICW4 equ 21h 66 | 67 | PIC1_OCW2 equ 20h ; W/O 68 | PIC1_OCW3 equ 20h ; W/O; also set IRR or ISR read mode 69 | 70 | PIC1_IRR equ 20h ; R/O; selected by OCW3_read 71 | PIC1_ISR equ 20h ; R/O; selected by OCW3_read 72 | PIC1_IRQ equ 20h ; R/O; returned in polling mode 73 | ; (OCW3_POLL), valid if high bit set 74 | PIC1_IMR equ 21h ; R/O for IMR, W/O for OCW1 75 | 76 | PIC2_ICW1 equ 0A0h 77 | PIC2_ICW2 equ 0A1h 78 | PIC2_ICW3 equ 0A1h 79 | PIC2_ICW4 equ 0A1h 80 | 81 | PIC2_OCW2 equ 0A0h 82 | PIC2_OCW3 equ 0A0h 83 | 84 | PIC2_IRR equ 0A0h 85 | PIC2_ISR equ 0A0h 86 | PIC2_IRQ equ 0A0h 87 | PIC2_IMR equ 0A1h 88 | 89 | 90 | ;------------------------------------------------------------------------- 91 | 92 | ; ICW defenitions 93 | 94 | ICW1 record ICW1_ADDR:3, \; for 8080/8085 CPUs only 95 | \; value of A5-A7 address lines 96 | ICW1_ID :1=1, \; should be set for ICW1 97 | ICW1_LTIM:1, \ 98 | ICW1_ADI :1, \; for 8080/8085 CPUs only 99 | \; =0 intr vectors use 8 bytes 100 | \; =1 intr vectors use 4 bytes 101 | ICW1_SNGL:1, \; =0 cascade mode 102 | \; =1 single 8259A mode (and no ICW3) 103 | ICW1_ICW4:1 ; =1 ICW4 will be sent 104 | 105 | ; ICW1_LTIM values: 106 | ICW1_edge equ 0 ; edge triggered mode 107 | ICW1_level equ 1 ; level triggered mode 108 | 109 | ICW2_8080 record ICW2_8080_ADDR:8 ; A8-A15 address lines 110 | ICW2_8086 record ICW2_8086_ADDR:5, \; T3-T7 address lines 111 | ICW2_reserved:3 112 | 113 | ; - ICW3 for master PIC contains bit mask with 1 for each IRQ line at which 114 | ; slave PIC is attached; 115 | ; - ICW3 for slave PIC contains IRQ line # (in three lowest bits), at which 116 | ; it is connected. 117 | 118 | ICW4 record ICW4_special:1, \; =1 special fully nested mode 119 | ICW4_BUF :2, \ 120 | ICW4_autoEOI:1, \ 121 | ICW4_CPU :1 122 | 123 | ; ICW4_CPU values: 124 | ICW4_8080 equ 0 125 | ICW4_8086 equ 1 126 | 127 | ; ICW4_BUF values: 128 | ICW4_nonbuf equ 00b 129 | ICW4_SLAVE equ 10b ; PIC is slave 130 | ICW4_MASTER equ 11b ; PIC is master 131 | 132 | 133 | ;------------------------------------------------------------------------- 134 | 135 | ; OCW defenitions 136 | 137 | ; OCW1 inits IMR value 138 | 139 | OCW2 record OCW2_CMD :3, \ 140 | OCW2_ID :2=0, \; should be set for OCW2 141 | OCW2_level:3=0 142 | 143 | ; OCW2_CMD values: 144 | OCW2_EOI equ 001b ; nonspecific EOI 145 | OCW2_specEOI equ 011b ; specific EOI + level 146 | OCW2_ROTEOI equ 101b ; rotate on nonspecific EOI 147 | OCW2_ROTspecEOI equ 111b ; rotate on specific EOI + level 148 | OCW2_ROTAEOI equ 100b ; rotate in auto EOI mode (set) 149 | OCW2_noROTAEOI equ 000b ; rotate in auto EOI mode (clear) 150 | OCW2_priority equ 110b ; set lowest priority + level 151 | OCW2_NOP equ 010b 152 | 153 | OCW3 record OCW3_mask:2=0, \ 154 | OCW3_ID :2=1, \; should be set for OCW3 155 | OCW3_POLL:1=0, \; =1 polling mode 156 | OCW3_read:2 157 | 158 | ; OCW3_read values: 159 | OCW3_IRR equ 10b ; IRR read mode 160 | OCW3_ISR equ 11b ; ISR read mode 161 | 162 | ; OCW3_mask values: 163 | OCW3_mask_clear equ 10b ; reset special mask mode 164 | OCW3_mask_set equ 11b ; set special mask mode 165 | -------------------------------------------------------------------------------- /asmlib/hard/uart.def: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | ; UART (Universal Asynchronous Receiver/Transmitter) 20 | ; - IBM PC contains one of 8250, 16450, 16550, 16550A, 16550AFN or 21 | ; compatible chipsets, which implements RS-232C interface. 22 | ; - IBM PC usually contains up to four UART at next addresses and IRQ: 23 | ; 3F8h/IRQ4, 2F8h/IRQ3, 3E8h/IRQ4, 2E8h/IRQ3. Founded UART addresses 24 | ; recorded in BIOS data area. 25 | 26 | 27 | ;========================================================================= 28 | 29 | ; I/O port address indexes 30 | 31 | RBR_index equ 0 ; [R/O] [DLAB=0] Receive Buffer Register 32 | THR_index equ 0 ; [W/O] [DLAB=0] Transmitter Holding Register 33 | IER_index equ 1 ; [DLAB=0] Interrupt Enable Register 34 | DL_index equ 0 ; [DLAB=1] Divisor Latch, 16-bit 35 | IIR_index equ 2 ; [R/O] Interrupt Identification Register 36 | FCR_index equ 2 ; [W/O] FIFO Control Register (16550+ only) 37 | LCR_index equ 3 ; Line Control Register 38 | MCR_index equ 4 ; Modem Control Register 39 | LSR_index equ 5 ; Line Status Register 40 | MSR_index equ 6 ; Modem Status Register 41 | SCR_index equ 7 ; Scratch Register (16450+) 42 | 43 | ;------------------------------------------------------------------------- 44 | 45 | ; Registers definitions 46 | 47 | ; RBR returns received bytes. 48 | 49 | ; THR accepts bytes to send. 50 | 51 | ; DL used to program the bps rate as follows: 52 | ; 1843200 Hz / 16 / desired rate = divisor 53 | ; 1843200 Hz / 16 / divisor = obtained rate 54 | ; For example, to get 1200 bps 1843200/16/1200=96 value should be used. 55 | ; Max speed is a 1843200/16/1=115200 bps. 56 | 57 | IER record IER_reserved:4, \ 58 | IER_MSR :1, \; Enable Delta Status Signals Interrupt 59 | \; =1 interrupt when one of delta (MSR) is set 60 | IER_LSR :1, \; Enable Line Status Interrupt 61 | \; =1 interrupt when transmission errors 62 | IER_THRE :1, \; Enable Transmitter Buffer Empty Interrupt 63 | \; =1 THRE (THR empty) interrupt enabled 64 | IER_DR :1 ; Enable Receiver Buffer Full Interrupt 65 | ; =1 DR (data ready) interrupt enabled 66 | 67 | IIR record IIR_FIFO :2, \; FIFO enable 68 | \; =11b if FCR_enable=1 for 16550A 69 | \; =10b if FCR_enable=1 for 16550 70 | \; =0 in other cases 71 | IIR_reserved:2, \ 72 | IIR_IID :3, \; Interrupt IDentification 73 | IIR_pending :1 ; =0 interrupt is pending 74 | 75 | ; IIR allows to detect the cause of an interrupt. Only one interrupt is 76 | ; reported at a time; they are priorized. IIR_pending tells if the UART 77 | ; triggered interrupt. After parsing IIR_IID IIR_pending should be tested 78 | ; again - if it is still =0, there is another interrupt to be serviced. 79 | 80 | ; IIR_IID values: 81 | 82 | IID_LSR equ 011b ; priority=1,source=status 83 | ; OE/PE/FE/break in LSR set. Serviced by reading LSR. 84 | IID_DR equ 010b ; priority=2,source=receiver 85 | ; DR (data ready) or trigger level reached. Serviced by 86 | ; reading RBR until under level. 87 | IID_FIFO equ 110b ; priority=2,source=FIFO 88 | ; No Receiver FIFO action since 4 words time (neither IN 89 | ; nor OUT) but data in RX FIFO. Serviced by reading RBR. 90 | IID_THRE equ 001b ; priority=3,source=transmitter 91 | ; THRE. Serviced by reading IIR or writing to THR. 92 | IID_MSR equ 000b ; priority=4,source=modem 93 | ; One of the delta in MSR set. Serviced by reading MSR. 94 | 95 | FCR record FCR_trigger :2, \; RX FIFO trigger level select (1,4,8,14) 96 | FCR_reserved:2, \ 97 | FCR_DMA :1, \; DMA mode select 98 | FCR_TXreset :1, \; Transmitter FIFO reset 99 | FCR_RXreset :1, \; Receiver FIFO reset 100 | FCR_enable :1 ; FIFO enable 101 | 102 | LCR record LCR_DLAB :1, \; Divisor Latch Access Bit 103 | LCR_SBR :1, \; Set BReak 104 | \; =1 forces TxD +12V (break) 105 | LCR_parity :3, \; parity type 106 | LCR_stop :1, \; stop bits (1-1.5/2, 1.5 if word length=5) 107 | LCR_wordlen :2 ; word length (5-8 bits) 108 | 109 | ; LCR_parity values: 110 | 111 | LCR_noparity equ 0 112 | LCR_oddparity equ 000b+1 113 | LCR_evenparity equ 010b+1 114 | LCR_markparity equ 100b+1 ; parity bit always 1 115 | LCR_spaceparity equ 110b+1 ; parity bit always 0 116 | 117 | MCR record MCR_reserved:2, \ 118 | MCR_AFE :1, \; Automatic Flow control Enable 119 | MCR_loop :1, \; =1 local loopback, all outputs disabled 120 | MCR_OUT2 :1, \; =1 transfer UART interrupts to PIC 121 | MCR_OUT1 :1, \; programs -OUT1 (normally not used; best 122 | \; is to set this bit) 123 | MCR_RTS :1, \; programs -RTS 124 | MCR_DTR :1 ; programs -DTR 125 | 126 | LSR record LSR_FIFOerr :1, \; =1 errors is pending in the RX FIFO chain 127 | LSR_TEMT :1, \; Transmitter Empty (last word has been sent) 128 | LSR_THRE :1, \; THR Empty (new data can be written to THR) 129 | LSR_break :1, \; =1 broken line detected (set if RxD is 130 | \; 'space' for more than 1 word) 131 | LSR_FE :1, \; =1 framing error (stop bit missing) 132 | LSR_PE :1, \; =1 parity error (transmission error) 133 | LSR_OE :1, \; =1 overrun error (loss of data) 134 | LSR_RBF :1 ; Receiver Buffer Full, Data Ready (DR) 135 | 136 | ; - LSR_FIFOerr, LSR_TEMT, LSR_break, LSR_FE, LSR_PE and LSR_OE reset by 137 | ; reading LSR. 138 | ; - LSR_THRE reset by writing THR; when FIFO enabled LSR_THRE cleared 139 | ; whenever any data in TX FIFO (not when FIFO is full). 140 | ; - LSR_RBF reset by reading RBR (but only if the RX FIFO is empty). 141 | 142 | MSR record MSR_DCD :1, \; Data Carrier Detect 143 | MSR_RI :1, \; Ring Indicator 144 | MSR_DSR :1, \; Data Set Ready 145 | MSR_CTS :1, \; Clear To Send 146 | MSR_DDCD :1, \; Delta DCD 147 | MSR_TERI :1, \; Trailing Edge Ring Indicator 148 | MSR_DDSR :1, \; Delta DSR 149 | MSR_DCTS :1 ; Delta CTS 150 | 151 | ; MSR allows to check modem status lines. The delta bits are set if the 152 | ; corresponding signals have changed since the last reading (except for 153 | ; TERI which is only set if MSR_RI cleared and the phone stopped ringing). 154 | 155 | ; In loopback mode (when MCR_loop=1) MSR_DCD=MCR_OUT2, MSR_RI=MCR_OUT1 156 | ; MSR_DSR=MCR_DTR and MSR_CTS=MCR_RTS. The delta bits act accordingly to 157 | ; the level transition of the data written to MCR. 158 | -------------------------------------------------------------------------------- /asmlib/hll.mac: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | ; Import: MOVREG_ (macro.mac), TESTREG_ (macro.mac) 20 | ; Export: block_, break_, breakif_, 21 | ; if_, elif_, else_, 22 | ; loop_, while_, until_, 23 | ; countloop_, countloop?, end_ 24 | 25 | ;------------------------------------------------------------------------ 26 | 27 | ; Additional mnemonics for conditional jumps 28 | 29 | jnnae equ jae 30 | jnnb equ jb 31 | jnnc equ jc 32 | jnna equ ja 33 | jnnbe equ jbe 34 | jnne equ je 35 | jnnz equ jz 36 | jnng equ jg 37 | jnnle equ jle 38 | jnns equ js 39 | jnnge equ jge 40 | jnnl equ jl 41 | jnno equ jo 42 | jnnp equ jp 43 | jnpo equ jpe 44 | jnnpo equ jpo 45 | jnpe equ jpo 46 | jnnpe equ jpe 47 | jnncxz equ jcxz 48 | jnnecxz equ jecxz 49 | jeq equ je 50 | jneq equ jne 51 | jgt equ jg 52 | jngt equ jng 53 | jlt equ jl 54 | jnlt equ jnl 55 | jzf equ jz 56 | jnzf equ jnz 57 | jsf equ js 58 | jnsf equ jns 59 | jcf equ jc 60 | jncf equ jnc 61 | jof equ jo 62 | jnof equ jno 63 | jzero equ jz 64 | jnzero equ jnz 65 | jsign equ js 66 | jnsign equ jns 67 | jcarry equ jc 68 | jncarry equ jnc 69 | joverflow equ jo 70 | jnoverflow equ jno 71 | jabove equ ja 72 | jnabove equ jna 73 | jbelow equ jb 74 | jnbelow equ jnb 75 | jodd equ jpo 76 | jnodd equ jpe 77 | jeven equ jpe 78 | jneven equ jpo 79 | 80 | 81 | ;======================================================================== 82 | 83 | ; High level language (HLL)-like statements: 84 | ; 85 | ; block_ ... end_ [block] 86 | ; 87 | ; if_ {... andif_ } ... 88 | ; {elif_ {... andif_ } ...} 89 | ; {else_ {... andif_ } ...} 90 | ; [else_ ...] end_ [if] 91 | ; 92 | ; loop_ {... while_ } ... end_ [loop] 93 | ; 94 | ; loop_ {... while_ } ... until_ 95 | ; 96 | ; countloop_ [],[] {... while_ } ... end_ [countloop] 97 | ; 98 | ; countloop? [],[] {... while_ } ... end_ [countloop] 99 | ; 100 | ; break_ 101 | ; breakif_ 102 | 103 | ; Notes: 104 | ; - most statements accepts as additional argument distance for jumps 105 | ; ( or ). 106 | ; - break_ terminates block_ execution like for loops. 107 | ; - while_ similar to , but can't be nested in other statements. 108 | ; - until_ terminates loop when is true. 109 | ; 110 | ; - if for countloop_/countloop? is empty, then CX is assumed. 111 | ; - or for countloop_/countloop? should be a register. 112 | ; - countloop? checks if or is nonzero before loop (for zero 113 | ; value, loop skipped and not necessarily will be zeroed); for 114 | ; countloop_ =0 means 65536 iterations. 115 | ; - if for countloop_/countloop? is equal to 1, then will not 116 | ; be initialized and end_ generates no jumps. 117 | 118 | ??HLLlevel = 0 119 | ??HLLlabel equ <0> 120 | 121 | ??HLLrestore equ <> 122 | ??HLLname equ <> 123 | ??HLLbreak equ <> 124 | ??HLLifend equ <> 125 | ??HLLelse equ <> 126 | ??HLLtop equ <> 127 | ??HLLloopi equ <> 128 | 129 | ??HLLpush macro level:req,namelist:vararg 130 | ideal ;;!!! TASM bugfix for EQU substitution 131 | irp n, 132 | ??HLL&&n&&level equ ??HLL&&n 133 | endm 134 | masm 135 | ??HLLrestore equ 136 | ??HLLlevel = ??HLLlevel + 1 137 | endm 138 | 139 | ??HLLpop macro level:req,namelist:vararg 140 | ??HLLlevel = level 141 | ideal ;;!!! TASM bugfix for EQU substitution 142 | irp n, 143 | ??HLL&&n equ ??HLL&&n&&level 144 | endm 145 | masm 146 | endm 147 | 148 | ??HLLjump macro n,cond,dist,label:vararg 149 | local next 150 | ifb 151 | jmp dist ??HLL&label 152 | elseifdifi , 153 | j&n&cond dist ??HLL&label 154 | else 155 | ifb 156 | jn&cond next 157 | else 158 | j&cond next 159 | endif 160 | jmp ??HLL&label 161 | next: 162 | endif 163 | endm 164 | 165 | ;------------------------------------------------------------------------ 166 | 167 | block_ macro 168 | ??HLLpush %??HLLlevel,break 169 | ??HLLname equ 170 | ??HLLbreak equ <*> 171 | endm 172 | 173 | break_ macro dist:vararg 174 | % ifb 175 | err "No matching BLOCK or LOOP for BREAK" 176 | exitm 177 | endif 178 | % ifidni ,<*> 179 | ??HLLlabel equ % ??HLLlabel+1 180 | ??HLLbreak equ % ??HLLlabel 181 | endif 182 | % jmp dist ??HLL&&??HLLbreak 183 | endm 184 | 185 | breakif_ macro cond:req,dist:vararg 186 | % ifb 187 | err "No matching BLOCK or LOOP for BREAK" 188 | exitm 189 | endif 190 | % ifidni ,<*> 191 | ??HLLlabel equ % ??HLLlabel+1 192 | ??HLLbreak equ % ??HLLlabel 193 | endif 194 | ??HLLjump ,,,%??HLLbreak 195 | endm 196 | 197 | ;------------------------------------------------------------------------ 198 | 199 | if_ macro cond:req,dist:vararg 200 | ??HLLpush %??HLLlevel,ifend,else 201 | ??HLLname equ 202 | ??HLLifend equ <> 203 | ??HLLlabel equ % ??HLLlabel+1 204 | ??HLLelse equ % ??HLLlabel 205 | ??HLLjump n,,,%??HLLelse 206 | endm 207 | 208 | andif_ macro cond:req,dist:vararg 209 | % ifdifi , 210 | err "No matching IF/ELIF/ELSE for ANDIF" 211 | exitm 212 | endif 213 | % ifb 214 | ??HLLlabel equ % ??HLLlabel+1 215 | ??HLLelse equ % ??HLLlabel 216 | endif 217 | ??HLLjump n,,,%??HLLelse 218 | endm 219 | 220 | elif_ macro cond:req,dist:vararg 221 | else_ 222 | ??HLLlabel equ % ??HLLlabel+1 223 | ??HLLelse equ % ??HLLlabel 224 | ??HLLjump n,,,%??HLLelse 225 | endm 226 | 227 | else_ macro dist:vararg 228 | % ifidni , 229 | % ifnb 230 | % ifb 231 | ??HLLlabel equ % ??HLLlabel+1 232 | ??HLLifend equ % ??HLLlabel 233 | endif 234 | % jmp dist ??HLL&&??HLLifend 235 | % ??HLL&&??HLLelse: 236 | ??HLLelse equ <> 237 | exitm 238 | endif 239 | endif 240 | err "No matching IF/ELIF for ELSE" 241 | endm 242 | 243 | ;------------------------------------------------------------------------ 244 | 245 | loop_ macro 246 | ??HLLpush %??HLLlevel,top,break 247 | ??HLLname equ 248 | ??HLLbreak equ <*> 249 | ??HLLlabel equ % ??HLLlabel+1 250 | ??HLLtop equ % ??HLLlabel 251 | % ??HLL&&??HLLtop: 252 | endm 253 | 254 | while_ macro cond:req,dist:vararg 255 | % ifdifi , 256 | % ifdifi , 257 | err "No matching LOOP for WHILE" 258 | exitm 259 | endif 260 | endif 261 | % ifidni ,<*> 262 | ??HLLlabel equ % ??HLLlabel+1 263 | ??HLLbreak equ % ??HLLlabel 264 | endif 265 | ??HLLjump n,,,%??HLLbreak 266 | endm 267 | 268 | until_ macro cond:req,dist:vararg 269 | % ifdifi , 270 | err "No matching LOOP for UNTIL" 271 | exitm 272 | endif 273 | ??HLLjump n,,,%??HLLtop 274 | % ifdifi ,<*> 275 | % ??HLL&&??HLLbreak: 276 | endif 277 | ??HLLpop %??HLLlevel-1,%??HLLrestore 278 | endm 279 | 280 | ;------------------------------------------------------------------------ 281 | 282 | countloop_ macro val,var:=,misc:vararg 283 | ??HLLpush %??HLLlevel,top,break,loopi 284 | ??HLLname equ 285 | ??HLLbreak equ <*> 286 | ifnb 287 | if ((.type val) and 00100100b) eq 00100100b 288 | ;; symbol is defined and expression is a constant value 289 | if val eq 1 290 | ??HLLtop equ <> 291 | ??HLLloopi equ <> 292 | exitm 293 | endif 294 | endif 295 | endif 296 | ??HLLlabel equ % ??HLLlabel+1 297 | ??HLLtop equ % ??HLLlabel 298 | ??HLLloopi equ 299 | MOVREG_ , 300 | % ??HLL&&??HLLtop: 301 | endm 302 | 303 | countloop? macro val,var:=,dist:vararg 304 | ??HLLpush %??HLLlevel,top,break,loopi 305 | ??HLLname equ 306 | ??HLLbreak equ <*> 307 | ??HLLtop equ <> 308 | ??HLLloopi equ 309 | ifidni , 310 | breakif_ cxz, 311 | ??HLLloopi equ <> 312 | elseifnb 313 | if ((.type val) and 00100100b) eq 00100100b 314 | ;; symbol is defined and expression is a constant value 315 | if val eq 0 316 | break_ 317 | endif 318 | if val le 1 319 | exitm 320 | endif 321 | ??HLLloopi equ <> 322 | elseifdifi , 323 | irp r, 324 | ifidni , 325 | TESTREG_ 326 | breakif_ zero, 327 | ??HLLloopi equ <> 328 | exitm 329 | endif 330 | endm 331 | endif 332 | endif 333 | ??HLLlabel equ % ??HLLlabel+1 334 | ??HLLtop equ % ??HLLlabel 335 | MOVREG_ , 336 | % ifidni , 337 | breakif_ cxz, 338 | % elseifnb 339 | TESTREG_ 340 | breakif_ zero, 341 | endif 342 | ??HLLloopi equ 343 | % ??HLL&&??HLLtop: 344 | endm 345 | 346 | ;------------------------------------------------------------------------ 347 | 348 | end_ macro name,dist:vararg 349 | if ??HLLlevel eq 0 350 | err "No matching HLL statement for END" 351 | exitm 352 | endif 353 | ifnb 354 | % ifdifi , 355 | err "Unmatched END type" 356 | endif 357 | endif 358 | % ifidni , 359 | % ifnb 360 | % ??HLL&&??HLLelse: 361 | endif 362 | % ifnb 363 | % ??HLL&&??HLLifend: 364 | endif 365 | % elseifidni , 366 | % jmp dist ??HLL&&??HLLtop 367 | % elseifidni , 368 | % ifnb 369 | % ifidni , 370 | % loop dist ??HLL&&??HLLtop 371 | else 372 | % dec ??HLLloopi 373 | % jnz dist ??HLL&&??HLLtop 374 | endif 375 | endif 376 | endif 377 | % ifdifi , 378 | % ifdifi ,<*> 379 | % ??HLL&&??HLLbreak: 380 | endif 381 | endif 382 | ??HLLpop %??HLLlevel-1,%??HLLrestore 383 | endm 384 | -------------------------------------------------------------------------------- /asmlib/lgpl: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 489 | 490 | Also add information on how to contact you by electronic and paper mail. 491 | 492 | You should also get your employer (if you work as a programmer) or your 493 | school, if any, to sign a "copyright disclaimer" for the library, if 494 | necessary. Here is a sample; alter the names: 495 | 496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 | 499 | , 1 April 1990 500 | Ty Coon, President of Vice 501 | 502 | That's all there is to it! 503 | -------------------------------------------------------------------------------- /asmlib/macro.mac: -------------------------------------------------------------------------------- 1 | ; Assembler source library 2 | ; Copyright (c) 2002 Arkady Belousov 3 | ; 4 | ; This library is free software; you can redistribute it and/or modify it 5 | ; under the terms of the GNU Lesser General Public License as published by 6 | ; the Free Software Foundation; either version 2.1 of the License, or (at 7 | ; your option) any later version. 8 | ; 9 | ; This library is distributed in the hope that it will be useful, 10 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | ; GNU Lesser General Public License for more details. 13 | ; 14 | ; You should have received a copy of the GNU Lesser General Public 15 | ; License along with this library; if not, write to the Free Software 16 | ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | ; 18 | 19 | ; Export: MOVREG_, MOVOFF_, MOVSEG_, 20 | ; MOVRR_, MOVRO_, MOVOO_, MOVRRR_, MOVRRO_, MOVROO_, 21 | ; MOVREG2, MOVREGax_, MOVOFFax_, 22 | ; TESTREG_ 23 | 24 | MOVREG_ macro reg,val ; :vararg 25 | ifnb 26 | ifnb 27 | ifdifi , 28 | ??ASL instr <,ax,cx,dx,bx,sp,bp,si,di,eax,ecx,edx,ebx,esp,ebp,esi,edi,>,<,®&,> 29 | if ??ASL 30 | if (.type val) eq 00100100b 31 | ;; symbol is defined and expression is a constant value 32 | if val eq 0 33 | xor reg,reg 34 | exitm 35 | endif 36 | endif 37 | endif 38 | mov reg,val 39 | endif 40 | endif 41 | endif 42 | endm 43 | 44 | MOVOFF_ macro reg,offs ; :vararg 45 | ifnb 46 | ifnb 47 | ifdifi , 48 | mov reg,offset offs 49 | endif 50 | endif 51 | endif 52 | endm 53 | 54 | MOVSEG_ macro segreg,val,temp,segname ; :vararg 55 | ifb 56 | exitm 57 | endif 58 | ifnb 59 | ifdifi , 60 | ??ASL instr <,cs,ss,ds,es,fs,gs,>,<,&val&,> 61 | if ??ASL 62 | ifb 63 | push val 64 | pop segreg 65 | else ;; is a segment register and present 66 | mov temp,val 67 | mov segreg,temp 68 | endif 69 | elseif ((.type val) eq 00100100b) or ((.type val) eq 0) 70 | ;; symbol is defined and expression is a constant value 71 | ; errifb "Temporary register should be present!" 72 | MOVREG_ , 73 | mov segreg,temp 74 | else 75 | mov segreg,val 76 | endif 77 | endif 78 | endif 79 | ifnb 80 | assume segreg:segname 81 | endif 82 | endm 83 | 84 | ;------------------------------------------------------------------------ 85 | 86 | MOVRR_ macro r1,v1,r2,v2 ; :vararg 87 | ifdifi , 88 | MOVREG_ , 89 | ifnb 90 | ifidni , 91 | MOVREG_ , 92 | else 93 | MOVREG_ , 94 | endif 95 | endif 96 | elseifdifi , 97 | MOVREG_ , 98 | MOVREG_ , 99 | else 100 | xchg r1,r2 101 | endif 102 | endm 103 | 104 | MOVRO_ macro r1,v,r2,off ; :vararg 105 | ifdifi , 106 | MOVREG_ , 107 | ifnb 108 | ifidni , 109 | MOVREG_ , 110 | else 111 | MOVOFF_ , 112 | endif 113 | endif 114 | elseifdifi , 115 | MOVOFF_ , 116 | MOVREG_ , 117 | else 118 | xchg r1,r2 119 | endif 120 | endm 121 | 122 | MOVOO_ macro r1,off1,r2,off2 ; :vararg 123 | ifdifi , 124 | MOVOFF_ , 125 | ifnb 126 | ifidni , 127 | MOVREG_ , 128 | else 129 | MOVOFF_ , 130 | endif 131 | endif 132 | elseifdifi , 133 | MOVOFF_ , 134 | MOVOFF_ , 135 | else 136 | xchg r1,r2 137 | endif 138 | endm 139 | 140 | ;------------------------------------------------------------------------ 141 | 142 | MOVRRR_ macro r1,v1,r2,v2,r3,v3 ; :vararg 143 | ifidni , 144 | ifdifi , 145 | MOVREG_ , 146 | MOVRR_ ,,, 147 | elseifdifi , 148 | MOVREG_ , 149 | MOVRR_ ,,, 150 | else 151 | xchg r1,r2 152 | xchg r2,r3 153 | endif 154 | elseifidni , 155 | ifdifi , 156 | MOVREG_ , 157 | MOVRR_ ,,, 158 | elseifdifi , 159 | MOVREG_ , 160 | MOVRR_ ,,, 161 | else 162 | xchg r1,r3 163 | xchg r3,r2 164 | endif 165 | else 166 | MOVRR_ ,,, 167 | MOVREG_ , 168 | endif 169 | endm 170 | 171 | MOVRRO_ macro r1,v1,r2,v2,r3,off ; :vararg 172 | ifidni , 173 | MOVRRR_ ,,,,, 174 | elseifidni , 175 | MOVRRR_ ,,,,, 176 | else 177 | MOVRR_ ,,, 178 | MOVOFF_ , 179 | endif 180 | endm 181 | 182 | MOVROO_ macro r1,v1,r2,off2,r3,off3 ; :vararg 183 | ifidni , 184 | MOVRRO_ ,,,,, 185 | elseifidni , 186 | MOVRRO_ ,,,,, 187 | else 188 | MOVRO_ ,,, 189 | MOVOFF_ , 190 | endif 191 | endm 192 | 193 | ;------------------------------------------------------------------------ 194 | 195 | MOVREG2 macro r,rhi,rlo,hi,lo ; :vararg 196 | ifidni , 197 | MOVREG_ ,ax 198 | elseifidni , 199 | MOVREG_ ,cx 200 | elseifidni , 201 | MOVREG_ ,dx 202 | elseifidni , 203 | MOVREG_ ,bx 204 | elseif ((.type hi) eq 00100100b) and ((.type lo) eq 00100100b) 205 | ;; symbol is defined and expression is a constant value 206 | MOVREG_ ,<(hi shl 8)+(low lo)> 207 | else 208 | MOVRR_ ,,, 209 | endif 210 | endm 211 | 212 | MOVREGax_ macro r:req,rhi:req,rlo:req,val,ahi:=,alo ; :vararg 213 | ??ASLflag = 0 214 | ifb 215 | ??ASLflag = 00001b 216 | elseifidni , 217 | ??ASLflag = 00001b 218 | elseifidni , 219 | ??ASLflag = 00010b 220 | endif 221 | ifidni , 222 | ??ASLflag = ??ASLflag or 01000b 223 | elseifidni , 224 | ??ASLflag = ??ASLflag or 01000b 225 | endif 226 | ??ASL instr <,&rlo&,&rhi&,>,<,&alo&,> 227 | if ??ASL 228 | ??ASLflag = ??ASLflag or 00100b 229 | endif 230 | ??ASL instr <,&rlo&,&rhi&,>,<,&ahi&,> 231 | if ??ASL 232 | ??ASLflag = ??ASLflag or 10000b 233 | endif 234 | ifidni , 235 | if ((??ASLflag and 00110b) ne 0) or ((??ASLflag and 10001b) eq 10001b) 236 | ;; alo=ah or alo=rlo/rhi or (alo=al and ahi=rlo/rhi) 237 | MOVREG2 ,,,, 238 | xchg ax,r 239 | elseif ??ASLflag and 01001b ;; alo=al or ahi=al/ah 240 | mov r,ax 241 | MOVREG2 ax,ah,al,, 242 | else 243 | xchg r,ax 244 | ifidni , 245 | mov al,alo 246 | elseifidni , 247 | MOVREG2 ax,ah,al,al, 248 | else 249 | MOVREG2 ax,ah,al,, 250 | endif 251 | endif 252 | elseifb 253 | MOVREG2 ax,ah,al,, 254 | elseifidni , 255 | MOVREG2 ax,ah,al,, 256 | elseifidni , 257 | MOVREG_ , 258 | xchg ax,r ; OPTIMIZE: instead MOV AX,r 259 | MOVREG_ , 260 | elseif ??ASLflag and 10100b ;; alo=rlo/rhi or ahi=rlo/rhi 261 | MOVREG2 ax,ah,al,, 262 | MOVREG_ , 263 | else 264 | MOVREG_ , 265 | MOVREG2 ax,ah,al,, 266 | endif 267 | endm 268 | 269 | MOVOFFax_ macro r:req,rhi:req,rlo:req,off,ahi:=,alo ; :vararg 270 | ??ASLflag = 0 271 | ifb 272 | ??ASLflag = 00001b 273 | elseifidni , 274 | ??ASLflag = 00001b 275 | elseifidni , 276 | ??ASLflag = 00010b 277 | endif 278 | ifidni , 279 | ??ASLflag = ??ASLflag or 01000b 280 | elseifidni , 281 | ??ASLflag = ??ASLflag or 01000b 282 | endif 283 | ??ASL instr <,&rlo&,&rhi&,>,<,&alo&,> 284 | if ??ASL 285 | ??ASLflag = ??ASLflag or 00100b 286 | endif 287 | ??ASL instr <,&rlo&,&rhi&,>,<,&ahi&,> 288 | if ??ASL 289 | ??ASLflag = ??ASLflag or 10000b 290 | endif 291 | ifidni , 292 | if ((??ASLflag and 00110b) ne 0) or ((??ASLflag and 10001b) eq 10001b) 293 | ;; alo=ah or alo=rlo/rhi or (alo=al and ahi=rlo/rhi) 294 | MOVREG2 ,,,, 295 | xchg ax,r 296 | elseif ??ASLflag and 01001b ;; alo=al or ahi=al/ah 297 | mov r,ax 298 | MOVREG2 ax,ah,al,, 299 | else 300 | xchg r,ax 301 | ifidni , 302 | mov al,alo 303 | elseifidni , 304 | MOVREG2 ax,ah,al,al, 305 | else 306 | MOVREG2 ax,ah,al,, 307 | endif 308 | endif 309 | elseifb 310 | MOVREG2 ax,ah,al,, 311 | elseifidni , 312 | MOVREG2 ax,ah,al,, 313 | elseifidni , 314 | MOVREG_ , 315 | xchg ax,r ; OPTIMIZE: instead MOV AX,r 316 | MOVOFF_ , 317 | elseif ??ASLflag and 10100b ;; alo=rlo/rhi or ahi=rlo/rhi 318 | MOVREG2 ax,ah,al,, 319 | MOVOFF_ , 320 | else 321 | MOVOFF_ , 322 | MOVREG2 ax,ah,al,, 323 | endif 324 | endm 325 | 326 | ;------------------------------------------------------------------------ 327 | 328 | TESTREG_ macro reg ; :vararg 329 | ifnb 330 | ??ASL instr <,ah,cl,ch,dl,dh,bl,bh,ax,cx,dx,bx,sp,bp,si,di,eax,ecx,edx,ebx,esp,ebp,esi,edi,>,<,®&,> 331 | if ??ASL 332 | test reg,reg 333 | else 334 | cmp reg,0 335 | endif 336 | endif 337 | endm 338 | -------------------------------------------------------------------------------- /com2exe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/com2exe.exe -------------------------------------------------------------------------------- /copying: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /ctm-br.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-br.msg -------------------------------------------------------------------------------- /ctm-de.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-de.msg -------------------------------------------------------------------------------- /ctm-en.msg: -------------------------------------------------------------------------------- 1 | ; This file is a part of CuteMouse source 2 | ; Here are messages in English 3 | 4 | E_needvga db 'No VGA? Use older CTMOUSE if you need EGA RIL support',nl,eos 5 | E_error db nl,'Error: Invalid option' 6 | E_option db eos 7 | E_argument db ' argument',eos 8 | E_help db 5,nl,'Enter /? on command line for help',eos 9 | 10 | E_mousepresent db 5,'Mouse services already present',eos 11 | E_notfound db 5,'Error: device not found',eos 12 | ;;+E_noIRQ db 5,'Error: IRQ line not detected',eos 13 | 14 | E_nocute db 1,'CuteMouse driver is not installed!',eos 15 | E_notunload db 2,'Driver unload failed: some interrupts intercepted...',eos 16 | S_unloaded db 0,'Driver successfully unloaded...',eos 17 | 18 | S_reset db 'Resident part reset to ',eos 19 | S_installed db 'Installed at ',eos 20 | S_atPS2 db 'PS/2 port',eos 21 | S_atCOM db 'COM' 22 | com_port db ?,' (' 23 | S_atIO db '0000h/IRQ' 24 | IRQno db ? 25 | S_in db ') in ',eos 26 | S_inMSYS db 'Mouse Systems mode',eos 27 | S_inMS db 'Microsoft mode',eos 28 | S_inLT db 'Logitech mode',eos 29 | S_wheel db ' (wheel present)' 30 | S_CRLF db nl,eos 31 | 32 | Copyright db nl,'CuteMouse v',CTMRELEASE,' [FreeDOS]',nl,eos 33 | Syntax label byte 34 | db 0,nl,'Options:',nl 35 | db ' /V - reverse search: find PS/2 after serial mouse',nl 36 | db ' /P - force PS/2 mouse mode, do not probe serial ports',nl 37 | db ' /S[c[i]] - force serial mouse mode at COM port c (1-4) with IRQ i (1-7)',nl 38 | db ' /3 - force 3-button mode if Microsoft or PS/2 mouse found',nl 39 | ; Note: /O now acts inverse compared to 2.1 beta 3 40 | db ' /O - enable PS2 and BIOS USB wheel detection (might hang)',nl 41 | ; 2008: made /Y (ignore MSys) the default and introduced /M (enable MSys) 42 | ; db ' /Y - do not try Mouse Systems mode for non-PnP devices',nl,nl 43 | db ' /M - try *old* Mouse Systems / Genius for non-PnP mice',nl,nl 44 | db ' /R[h[v]] - horizontal / vertical resolution: h,v = 1-9, or 0 for auto',nl 45 | db ' (no value = use default: auto for h, or "as h" for v)',nl 46 | db ' /L - swap left and right button',nl,nl 47 | ; 48 | db ' /B - cancel run if mouse services are already present',nl 49 | db ' /N - load CuteMouse as new TSR, even if CuteMouse is already loaded',nl 50 | db ' (useful for batch files which unload CuteMouse at end)',nl 51 | db ' /W - do not allow CuteMouse to move itself into UMB',nl 52 | db ' /U - uninstall driver, remove TSR from memory',nl 53 | db ' /? - show this help',eos 54 | -------------------------------------------------------------------------------- /ctm-es.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-es.msg -------------------------------------------------------------------------------- /ctm-fr.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-fr.msg -------------------------------------------------------------------------------- /ctm-hu.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-hu.msg -------------------------------------------------------------------------------- /ctm-it.msg: -------------------------------------------------------------------------------- 1 | ; This file is a part of CuteMouse source 2 | ; Here are messages in Italian 3 | ; Translated by Massimo Giussani 4 | ; updated 25/8/08 from Roberto Perotti Iw2evk 5 | ; Please note that suespammers domain is located in California, 6 | ; so DON'T spam that account or you'll be sued!! 7 | 8 | E_needvga db 'No VGA? Use older CTMOUSE if you need EGA RIL support',nl,eos 9 | E_error db nl,'Errore: Opzione invalida' 10 | E_option db eos 11 | E_argument db ' (argomento errato)',eos 12 | E_help db 5,nl,"Per l'aiuto aggiungere /? alla linea di comando",eos 13 | 14 | E_mousepresent db 5,"Servizi Mouse gia' presenti",eos 15 | E_notfound db 5,'Errore: mouse non trovato',eos 16 | ;;+E_noIRQ db 5,'Errore: nessun IRQ trovato',eos 17 | 18 | E_nocute db 1,"Il driver CuteMouse non e' stato installato!",eos 19 | E_notunload db 2,'Disinstallazione fallita: alcuni interrupts sono stati intercettati!',eos 20 | S_unloaded db 0,'Driver disinstallato',eos 21 | 22 | S_reset db "Parte residente impostata su ",eos 23 | S_installed db 'Installato su ',eos 24 | S_atPS2 db 'Porta PS/2',eos 25 | S_atCOM db 'COM' 26 | com_port db ?,' (' 27 | S_atIO db '0000h/IRQ' 28 | IRQno db ? 29 | S_in db ") tipo ",eos 30 | S_inMSYS db 'Mouse Systems',eos 31 | S_inMS db 'Microsoft',eos 32 | S_inLT db 'Logitech',eos 33 | S_wheel db ' (con rotellina)' 34 | S_CRLF db nl,eos 35 | 36 | Copyright db nl,'CuteMouse v',CTMRELEASE,' [FreeDOS]',nl,eos 37 | Syntax label byte 38 | db 0,'Opzioni:',nl 39 | db " /P - forza modalita' PS/2",nl 40 | db " /S[c[i]] - forza modalita' seriale sulla porta COM c (1-4) ed IRQ i (1-7)",nl 41 | ;;+ db " /S$a[,i] - forza modalita' seriale all'indirizzo I/O a (in esadecimale)",nl 42 | ;;+ db ' con IRQ i (1-7)',nl 43 | db " /O - abilita PS2 e il BIOS USB per riconoscere la ruota",nl 44 | ; 2008: made /Y (ignora MSys) come default e introducede /M (abilita MSys) 45 | ; db ' /Y - non prova il modo Mouse Systems per non-PnP devices',nl,nl 46 | db ' /M - prova il "vecchio" Mouse Systems / Genius per non-PnP mouse',nl,nl 47 | db ' /V - inverte la ricerca: cerca il mouse PS/2 dopo quello seriale',nl 48 | db " /3 - forza l'uso dei 3 pulsanti (solo per mouse Microsoft e PS/2)",nl 49 | db " /R[h[v]] - risoluzione orizzontale/verticale (h,v=0-9; senza l'opzione R, o",nl 50 | db ' senza h e v oppure con /R0, significa risoluzione automatica; se',nl 51 | db " v e' mancante allora assume per esso lo stesso valore dato ad h)",nl 52 | db " /L - imposta la modalita' per utenti mancini",nl 53 | db " /B - non installa se i servizi mouse sono gia' presenti",nl 54 | db ' /N - forza un ulteriore caricamento di CuteMouse come TSR (utile',nl 55 | db ' per quei files batch che alla fine disinstallano CuteMouse)',nl 56 | db ' /W - impedisce il caricamento TSR negli UMB',nl 57 | db ' /U - disinstalla il driver',nl 58 | db ' /? - mostra questo aiuto',eos 59 | -------------------------------------------------------------------------------- /ctm-lv.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-lv.msg -------------------------------------------------------------------------------- /ctm-nl.msg: -------------------------------------------------------------------------------- 1 | ; This file is a part of CuteMouse source 2 | ; Here are messages in Dutch 3 | ; Translated by Bernd Blaauw 4 | 5 | E_needvga db 'Geen VGA? Gebruik oudere CTMOUSE voor EGA RIL ondersteuning',nl,eos 6 | E_error db nl,'Fout: Ongeldige optie' 7 | E_option db eos 8 | E_argument db ' argument',eos 9 | E_help db 5,nl,'Voer /? in op opdrachtregel voor hulp',eos 10 | 11 | E_mousepresent db 5,'Muis service reeds aanwezig',eos 12 | E_notfound db 5,'Fout: apparaat niet gevonden',eos 13 | ;;+E_noIRQ db 5,'Fout: IRQ lijn niet gevonden',eos 14 | 15 | E_nocute db 1,'CuteMouse stuurprogramma is niet geladen!',eos 16 | E_notunload db 2,'ontladen stuurprogramma mislukt: interrupts onderbroken',eos 17 | S_unloaded db 0,'Stuurprogramma is succesvol ontladen...',eos 18 | 19 | S_reset db 'Residente gedeelte gereset naar ',eos 20 | S_installed db 'Geinstalleerd op ',eos 21 | S_atPS2 db 'PS/2 poort',eos 22 | S_atCOM db 'COM' 23 | com_port db ?,' (' 24 | S_atIO db '0000h/IRQ' 25 | IRQno db ? 26 | S_in db ') in ',eos 27 | S_inMSYS db 'Mouse Systems mode',eos 28 | S_inMS db 'Microsoft mode',eos 29 | S_inLT db 'Logitech mode',eos 30 | S_wheel db ' (muiswiel aanwezig)' 31 | S_CRLF db nl,eos 32 | 33 | Copyright db nl,'CuteMouse v',CTMRELEASE,' [FreeDOS]',nl,eos 34 | Syntax label byte 35 | db 0,'Opties:',nl 36 | db ' /P - dwing PS/2 muis-modus af',nl 37 | db ' /S[c[i]] - forceer seriele muismodus op COM poort c=1-4 met IRQ lijn i=1-7',nl 38 | ;;+ db ' /S$a[,i] - dwing seriele muis-modus af op I/O adres a (hexadecimaal getal)',nl 39 | ;;+ db ' met IRQ lijn i=1-7',nl 40 | db ' /O - probeer PS/2 of USB BIOS wiel herkenning (experimenteel)',nl 41 | ; 2008: made /Y (ignore MSys) the default and introduced /M (enable MSys) 42 | ; db ' /Y - do not try Mouse Systems mode for non-PnP devices',nl,nl 43 | db ' /M - gebruik *oud* Mouse Systems / Genius protocol als geen PnP muis',nl,nl 44 | db ' /V - omgekeerd zoeken: PS/2 na seriele muis vinden',nl 45 | db ' /3 - dwing 3-knops modus af (alleen voor Microsoft en PS/2 muizen)',nl 46 | db ' /R[h[v]] - horizontale/verticale resolutie (h,v=0-9; geen optie R, geen',nl 47 | db ' h en v of 0 als argument na R betekent auto-resolutie, ontbrekend',nl 48 | db ' tweede argument houdt dezelfde waarde als voor het 1e argument in',nl 49 | db ' /L - linkshandige modus (standaard ingesteld op rechtshandig)',nl 50 | db ' /B - niet laden als een muis-stuurprogramma al geladen is',nl 51 | db ' /N - CuteMouse laden als een nieuwe TSR, zelfs als het al geladen is',nl 52 | db ' (handig voor batchbestanden die op het einde CuteMouse ontladen)',nl 53 | db ' /W - voorkomt het laden van deze TSR in UMBs',nl 54 | db ' /U - stuurprogramma deactiveren',nl 55 | db ' /? - toont dit helpscherm',eos 56 | -------------------------------------------------------------------------------- /ctm-pl.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-pl.msg -------------------------------------------------------------------------------- /ctm-pt.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-pt.msg -------------------------------------------------------------------------------- /ctm-sk.msg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctm-sk.msg -------------------------------------------------------------------------------- /ctmouse.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/ctmouse.asm -------------------------------------------------------------------------------- /ctmouse.msg: -------------------------------------------------------------------------------- 1 | ; This file is a part of CuteMouse source 2 | ; Here are messages in English 3 | 4 | E_needvga db 'No VGA? Use older CTMOUSE if you need EGA RIL support',nl,eos 5 | E_error db nl,'Error: Invalid option' 6 | E_option db eos 7 | E_argument db ' argument',eos 8 | E_help db 5,nl,'Enter /? on command line for help',eos 9 | 10 | E_mousepresent db 5,'Mouse services already present',eos 11 | E_notfound db 5,'Error: device not found',eos 12 | ;;+E_noIRQ db 5,'Error: IRQ line not detected',eos 13 | 14 | E_nocute db 1,'CuteMouse driver is not installed!',eos 15 | E_notunload db 2,'Driver unload failed: some interrupts intercepted...',eos 16 | S_unloaded db 0,'Driver successfully unloaded...',eos 17 | 18 | S_reset db 'Resident part reset to ',eos 19 | S_installed db 'Installed at ',eos 20 | S_atPS2 db 'PS/2 port',eos 21 | S_atCOM db 'COM' 22 | com_port db ?,' (' 23 | S_atIO db '0000h/IRQ' 24 | IRQno db ? 25 | S_in db ') in ',eos 26 | S_inMSYS db 'Mouse Systems mode',eos 27 | S_inMS db 'Microsoft mode',eos 28 | S_inLT db 'Logitech mode',eos 29 | S_wheel db ' (wheel present)' 30 | S_CRLF db nl,eos 31 | 32 | Copyright db nl,'CuteMouse v',CTMRELEASE,' [FreeDOS]',nl,eos 33 | Syntax label byte 34 | db 0,nl,'Options:',nl 35 | db ' /V - reverse search: find PS/2 after serial mouse',nl 36 | db ' /P - force PS/2 mouse mode, do not probe serial ports',nl 37 | db ' /S[c[i]] - force serial mouse mode at COM port c (1-4) with IRQ i (1-7)',nl 38 | db ' /3 - force 3-button mode if Microsoft or PS/2 mouse found',nl 39 | ; Note: /O now acts inverse compared to 2.1 beta 3 40 | db ' /O - enable PS2 and BIOS USB wheel detection (might hang)',nl 41 | ; 2008: made /Y (ignore MSys) the default and introduced /M (enable MSys) 42 | ; db ' /Y - do not try Mouse Systems mode for non-PnP devices',nl,nl 43 | db ' /M - try *old* Mouse Systems / Genius for non-PnP mice',nl,nl 44 | db ' /R[h[v]] - horizontal / vertical resolution: h,v = 1-9, or 0 for auto',nl 45 | db ' (no value = use default: auto for h, or "as h" for v)',nl 46 | db ' /L - swap left and right button',nl,nl 47 | ; 48 | db ' /B - cancel run if mouse services are already present',nl 49 | db ' /N - load CuteMouse as new TSR, even if CuteMouse is already loaded',nl 50 | db ' (useful for batch files which unload CuteMouse at end)',nl 51 | db ' /W - do not allow CuteMouse to move itself into UMB',nl 52 | db ' /U - uninstall driver, remove TSR from memory',nl 53 | db ' /? - show this help',eos 54 | -------------------------------------------------------------------------------- /ctmouse.txt: -------------------------------------------------------------------------------- 1 | CuteMouse driver v2.0. Copyright (c) 1997-2002 Nagy Daniel 2 | Release date: 2002/10/01 3 | 4 | 5 | License: 6 | -------- 7 | 8 | CuteMouse is released under the terms of the GNU General Public License 9 | (GPL). For further information please read the file COPYING. 10 | 11 | 12 | Description: 13 | ------------ 14 | 15 | CuteMouse is a mouse driver which supports many protocols of serial and 16 | PS/2 mice. It can search for a serial mouse at all COM ports or only at 17 | a specified port. 18 | 19 | CuteMouse supports a new Wheel API. This means that you can write your 20 | applications which use the mouse wheel. For programming details see 21 | WHEELAPI.TXT. 22 | 23 | An important CuteMouse feature is its small memory footprint: the resident 24 | part (TSR) occupies less than 3.5K. CuteMouse can also install itself in 25 | upper memory, when available, without requiring external utilities such 26 | as the DOS 'lh' (loadhigh) command. 27 | 28 | CuteMouse supports cursor drawing in all standard graphics and text modes 29 | with any screen size. These are automatically detected whenever the video 30 | mode or the screen size is changed or reset functions are called. 31 | 32 | You can subscribe to the CuteMouse discussion group at the official 33 | homepage http://cutemouse.sourceforge.net or by sending an empty 34 | email to . 35 | 36 | CuteMouse is part of the FreeDOS project at http://www.freedos.org 37 | 38 | 39 | Details: 40 | -------- 41 | 42 | CTMOUSE supports standard Mouse Systems, Microsoft and Logitech serial 43 | and PS/2 protocols. Also supported are mice with wheel. By default, when 44 | searching for a connected mouse, the PS/2 port is checked first, then all 45 | COM ports are scanned. 46 | 47 | Option /S, whose syntax is described in the help screen, disables PS/2 48 | support and can specify the COM port to be checked for a mouse connection 49 | and its IRQ line; option /P disables serial protocols. If option /S is 50 | present in the command line, but PS/2 support is also required, then 51 | option /P must also be present. 52 | 53 | If a COM port number is not specified with the /S option, then CTMOUSE 54 | searches all COM ports. If an IRQ line is not specified with the /S 55 | option, then the default IRQ line value is IRQ4 for COM1/3 and IRQ3 56 | for COM2/4. In the future IRQ autodetection will be added. 57 | 58 | Option /V reverses default search order, causing CTMOUSE to look for a 59 | serial mouse before checking for the PS/2 device. This can be useful, for 60 | example, on notebooks which have a built-in PS/2 pointing device to enable 61 | use of a serial mouse, when attached. Using option /Y (see below) may also 62 | be required along with /V. Note: option /V enables both serial and PS/2 63 | protocols, so using options /P and /S without arguments along with /V 64 | in the command line is meaningless. 65 | 66 | For serial mice, CTMOUSE searches all COM ports (or at the port specified 67 | by option /S) for an attached mouse with Microsoft or Logitech protocol. 68 | If no such mouse is found then CTMOUSE installs at the first existing 69 | (or specified) COM port in Mouse Systems mode, whether a mouse is there 70 | or not. (This is because the Mouse Systems protocol defines no detection 71 | sequence). Option /Y in the command line disables Mouse Systems protocol 72 | support and prevents driver installation if no mouse with Microsoft or 73 | Logitech protocol is found. Note: option /Y forces serial mouse search, 74 | but, unlike option /S, doesn't disable PS/2 support. 75 | 76 | Both PS/2 and plain Microsoft protocols assume a two button mouse but 77 | option /3 in the command line can be used to enable the middle button 78 | if one is present. 79 | 80 | WARNING: when the middle button of a plain Microsoft mouse is enabled, 81 | pressing left or right button along with the middle button can cause 82 | "middle button state triggering" - i.e. when the middle button is pressed 83 | the driver thinks it is released and vice-versa. This is a peculiarity of 84 | the Microsoft protocol and can't be changed. If button triggering occurs 85 | simply press the left or right button along with the middle button once 86 | again to clear the problem. 87 | 88 | Option /R, whose syntax is described in the help screen, allows the 89 | preferred sensitivity to be specified for each axis of mouse movements. 90 | These define the relationship between cursor and mouse movement - the 91 | higher the sensitivity, the further the cursor moves for a given mouse 92 | movement. For sensitivity 0 coefficient 1/3 is used, for sensitivity 9 93 | coefficient 3.0 is used. 94 | 95 | If installing from low memory, CTMOUSE attempts to move itself into upper 96 | memory (UMB) if there is a suitable free UMB block and option /W is not 97 | used. With option /W any external utility can be used to install CTMOUSE 98 | at a specific location. Subsequent CTMOUSE runs simply reset the resident 99 | part to the new command line options, unless the mouse is not found or 100 | option /B or /N is used. 101 | 102 | When installing, CTMOUSE ignores and hides any present mouse services 103 | unless option /B is used. Option /U in command line can be used to 104 | unload the resident part of CTMOUSE unless driver interrupts have been 105 | intercepted by another program. After successful unloading, CTMOUSE 106 | restores mouse services that were present at installation time. 107 | 108 | Option /B in the command line cancels CTMOUSE execution if any (including 109 | CTMOUSE itself) mouse services are already present. With option /B CTMOUSE 110 | will not install itself above loaded mouse drivers and will not reset the 111 | resident part to new command line options. 112 | 113 | In contrast, option /N forces the loading of a new TSR even if CTMOUSE is 114 | already loaded - without this option CTMOUSE will only reset the loaded 115 | resident part. In cases where mouse services are provided by any other 116 | driver or are not present at all, CTMOUSE loads a new TSR even without 117 | option /N - see table below: 118 | 119 | options no services other driver CTMOUSE loaded 120 | ------- ----------- ------------ -------------- 121 | /B load CTMOUSE do nothing do nothing 122 | load CTMOUSE load CTMOUSE update resident part 123 | /N load CTMOUSE load CTMOUSE load new CTMOUSE 124 | 125 | Option /N is useful for batch files, which load CTMOUSE before some 126 | actions and unload it after. 127 | 128 | For each event CTMOUSE returns an appropriate exit code which can be used 129 | in "if errorlevel" statements in batch files: 130 | 131 | 0 PS/2, Microsoft or Logitech mouse found and CTMOUSE installed; 132 | Unload successful; 133 | /? option used. 134 | 1 CTMOUSE installed in Mouse Systems mode; 135 | Unload failed because CTMOUSE was not loaded. 136 | 2 Resident part switched to PS/2, Microsoft or Logitech mode; 137 | Unload failed because driver interrupts were intercepted. 138 | 3 Resident part switched to Mouse Systems mode. 139 | 4 Mouse services already present (returned for option /B only). 140 | 5 Mouse not found; 141 | Invalid option used. 142 | 143 | Together with options /B and /N, this enables creation of complex and 144 | intelligent batch files. For example, the following batch file can be 145 | used to run a program that requires mouse services to be present: 146 | 147 | ctmouse/n/y>nul 148 | if errorlevel 5 echo Mouse not found! 149 | if errorlevel 5 goto end 150 | %1 %2 %3 %4 %5 %6 %7 %8 %9 151 | ctmouse/u>nul 152 | :end 153 | 154 | In the previous example, CTMOUSE is loaded before and unloaded 155 | afterwards regardless of whether or not mouse services are already present 156 | (e.g., another mouse driver was loaded). This may not be suitable if every 157 | free byte of memory is important or if CTMOUSE does not support a mouse 158 | that is currently in use. In the following example, CTMOUSE will be 159 | loaded and unloaded only if no mouse services are present: 160 | 161 | if "%1"=="@" goto driverloaded 162 | ctmouse/b/y>nul 163 | if errorlevel 5 echo Mouse not found! 164 | if errorlevel 5 goto end 165 | if errorlevel 2 goto run 166 | 167 | call %0 @ %1 %2 %3 %4 %5 %6 %7 %8 %9 168 | ctmouse/u>nul 169 | goto end 170 | 171 | :driverloaded 172 | shift 173 | :run 174 | %1 %2 %3 %4 %5 %6 %7 %8 %9 175 | :end 176 | 177 | Option /B can also be used to manually specify a mouse search sequence. 178 | In the following example, CTMOUSE is installed by the first command that 179 | finds a mouse and the following commands won't affect the resident part: 180 | 181 | ctmouse/b/s4/y>nul 182 | ctmouse/b/p/y>nul 183 | ctmouse/b/s2/y>nul 184 | 185 | Use the /? command line option to obtain a help screen with all option 186 | descriptions. 187 | 188 | The CuteMouse package also includes a utility to detect COM ports 189 | (COMTEST) and a serial protocol analyzer (PROTOCOL). PROTOCOL shows how 190 | mice work and what they send to the computer for each action. PROTOCOL can 191 | even decipher information sent by PnP mice. All output goes through DOS 192 | functions and can be redirected to a file for subsequent analysis or 193 | sending to someone else. 194 | 195 | 196 | Compiling: 197 | ---------- 198 | 199 | To assemble the English version of the driver use TASM (or any compatible 200 | assembler) and any linker that can produce a COM file from OBJ files: 201 | 202 | copy ctm-en.msg ctmouse.msg 203 | tasm /m @asmlib.cfg ctmouse.asm 204 | tlink /t /x ctmouse.obj,ctmouse.exe 205 | com2exe -s512 ctmouse.exe ctmouse.exe 206 | 207 | To assemble the serial protocol analyzer: 208 | 209 | tasm /m @..\asmlib.cfg protocol.asm 210 | tlink /t /x protocol.obj 211 | 212 | To compile or delete temporary files, the MAKE utility also can be used 213 | (see makefile). 214 | 215 | 216 | Known problems: 217 | --------------- 218 | 219 | Symptom: if the mouse is moved when Works 2.0 for DOS or Word 5.5 for DOS 220 | are redrawing a screen in graphics mode then some parts of screen 221 | are corrupted. 222 | Cause: these programs don't hide the mouse cursor while drawing on the 223 | screen and/or don't use the EGA RIL API when changing video 224 | adapter registers. 225 | Solution: correct the code of these programs; don't move the mouse while 226 | the screen is being redrawn; future versions of CTMOUSE will 227 | probably read the VGA adapter registers directly. 228 | 229 | Symptom: under Windows 3.1 after a mouse reset (INT 33/0000), the graphics 230 | mouse cursor is shifted by one pixel right/down. 231 | Cause: Windows traps INT 33 calls and for the reset function additionally 232 | calls the text and graphics cursor define functions with [-1,-1] 233 | hot spot. 234 | Solution: use 'PUSHF/CALL FAR' sequence instead of 'INT' instruction to 235 | call INT 33 handler; there probably are some Windows APIs, which 236 | can be used in CTMOUSE to interact with Windows directly. 237 | 238 | Symptom: sometimes, under Windows 3.1, the graphics cursor has a black box 239 | shape. This may also happen after switching between windows. 240 | Cause: probably due to a Windows bug when Windows incorrectly redefines 241 | the cursor after video mode changes or switching between windows. 242 | Solution: restart the graphics application or switch back and forth 243 | between windows again; there probably are some Windows APIs, 244 | which can be used in CTMOUSE to interact with Windows directly. 245 | 246 | Symptom: unlike Microsoft Mouse driver 8.2, the mouse doesn't work in 247 | a windowed DOS box of Windows 3.1 with CTMOUSE installed. 248 | Cause: the Microsoft Mouse driver most probably uses an unpublished API to 249 | interact with Windows. 250 | Solution: currently unknown. 251 | 252 | Symptom: CTMOUSE fails to detect PS/2 mice under Windows 9x/ME. 253 | Cause: Windows seems unwilling to let a DOS application have access to the 254 | PS/2 device services. 255 | Solution: currently unknown. 256 | 257 | 258 | Credits: 259 | -------- 260 | 261 | (Some names are mentioned in HISTORY). 262 | 263 | Ralf Brown : author of Interrupt List (a great collection 264 | of system specific information). 265 | Joergen Ibsen / Jibz : author of aPACK (an excellent 266 | executable packing program); advice about managing executables. 267 | 268 | Arkady V.Belousov : bugfixes, optimizations and features. 269 | Matthias Paul : many ideas and 270 | advice about interfacing with OS. 271 | Jason Burgon : bugfixes, features, advice 272 | about interrupts handling consistency. 273 | NetDave : wheel support idea. 274 | Alain Mouette : many ideas and message files. 275 | Robert Riebisch : mode 13h bugfix. 276 | Fernando Papa Budzyn: automatic loadhigh capability. 277 | Martin : optimizations. 278 | Paul Schubert: much faster PS/2 code. 279 | All who helped with ideas and code. 280 | 281 | 282 | Contacts: 283 | --------- 284 | 285 | mailto:nagyd@users.sourceforge.net 286 | http://cutemouse.sourceforge.net 287 | -------------------------------------------------------------------------------- /extend.txt: -------------------------------------------------------------------------------- 1 | Extension list 2 | -------------- 3 | 4 | Below are listed possible extensions and additional features for CuteMouse 5 | in different categories. Not all of them will be implemented, but they may 6 | give hints for other ideas. Please, express your opinion about this list - 7 | this may help in CuteMouse's further development and enhancement. 8 | 9 | 10 | Mice support: 11 | ------------- 12 | 13 | - Support for Bus, InPort and other mouse types. Currently there is not 14 | enough information and no available hardware/mice for testing. 15 | - Mouse reset and/or switching between serial mouse modes on the fly if 16 | the received mouse data flow has errors. 17 | [proposed by Alain Mouette] 18 | - API to access wheel rotation information. 19 | - API to send mouse-like information to driver. Useful for emulating a 20 | mouse for nonstandard hardware. 21 | [proposed by Matthias Paul] 22 | 23 | 24 | Video support: 25 | -------------- 26 | 27 | - Support of all possible text modes, including VESA. Currently only 28 | standard modes 0-3 and 7 are supported, although with any screen size. 29 | - Direct video adapter register reading in the EGA RIL API for VGA and 30 | newer adapters. 31 | - Scaling cursor movement according to current screen resolution (mouse 32 | movement should move the cursor the same distance on the screen rather 33 | than the same distance in pixels regardless of the current resolution). 34 | [proposed by Jason Burgon] 35 | 36 | 37 | Hardware handling: 38 | ------------------ 39 | 40 | - IRQ8-15 support. Currently only IRQ1-7 are supported. 41 | - Auto detect IRQ assigned to a COM port. Currently IRQ is determined by 42 | COM port number only. 43 | 44 | 45 | Command line: 46 | ------------- 47 | 48 | - Hyphen as the switch char in the command line. Currently only the slash 49 | is accepted for this. 50 | - Option to specify UART base address. 51 | - Option to reorder all mouse buttons. 52 | - Option to specify movement orientation (with 90 or 180 degrees step). 53 | - Option to reverse wheel orientation. 54 | [proposed by Matthias Paul] 55 | 56 | 57 | Miscellaneous: 58 | -------------- 59 | 60 | - Remove code for all unused handlers from resident part. 61 | - Completely reuse the PSP area in resident memory block. 62 | - Use DPMS and HMA to further reduce conventional memory footprint. 63 | [proposed by Matthias Paul] 64 | - COUNTRY settings may determine displayed messages coding. 65 | 66 | 67 | Utilities: 68 | ---------- 69 | 70 | - Utility to install a handler for secondary mouse. This would be 71 | especially useful for notebooks with both built-in and external mice. 72 | -------------------------------------------------------------------------------- /files.lst: -------------------------------------------------------------------------------- 1 | 2 | Note: for regular work only ctmouse.exe (or the other appropriate ctm-*.exe) 3 | is required. For legal purposes file COPYING also may be preserved. 4 | All other files are documentation, utilities and sources and may be 5 | safely removed. 6 | 7 | Contents 8 | -------- 9 | 10 | BIN\ 11 | ctmouse.exe - CuteMouse driver executable with English messages 12 | ctmdebug.exe - CuteMouse driver which shows PS/2 debug messages 13 | ctm-*.exe - CuteMouse driver executables in other languages 14 | comtest.com - utility to detect COM ports, executable 15 | mousetst.com - mouse test example executable 16 | protocol.com - protocol analyzer executable 17 | 18 | doc\ctmouse\ 19 | ctmouse.txt - main documentation for CuteMouse 20 | history.txt - detailed version history 21 | extend.txt - list of possible extensions for CuteMouse 22 | technote.txt - technical notes for advanced users 23 | wheelapi.txt - wheel API documentation and list of wheel using DOS apps 24 | protocol.txt - description of some low level mouse protocols 25 | int10.lst - excerpt from RBIL 61 for INT 10/04 and INT 10/Fx functions 26 | int33.lst - excerpt from RBIL 61 for INT 33 mouse functions 27 | files.lst - this file 28 | jwasm.txt - information about the port from TASM to MASM / JWASM 29 | uartnote.txt - short overview of UART I/O port access in ctmouse 2.1 30 | 31 | source\ctmouse\ 32 | makefile - MAKE's script file for rebuilding CTMOUSE.EXE 33 | alllang.bat - batch file to compile all language versions of CuteMouse 34 | asmlib.cfg - configuration file for makefile and batch files 35 | ctmouse.asm - CuteMouse source code 36 | ctm-en.msg - CuteMouse source file with messages in English 37 | ctm-*.msg - messages in other languages 38 | ctmouse.msg - copy of the message file which is used as default 39 | com2exe.exe - .COM to .EXE file converter executable 40 | copying - GNU license file 41 | ctmouse.map - information about code / data segment sizes (optional) 42 | 43 | source\ctmouse\tasmmasm\ 44 | jw-tasm.dif - udiff between TASM and MASM/JWASM version of 2.1beta4 45 | jw-tasm.txt - only the 800 old / 1550 new code lines from jw-tasm.dif 46 | *.com - utility binaries made with TASM, for comparison 47 | ctmouse.exe - CuteMouse ctmdebug binary made with TASM, for comparison 48 | 49 | source\ctmouse\ASMLIB\ 50 | *.def - assembler source library files 51 | *.mac - assembler source library files 52 | lgpl - GNU license file 53 | 54 | source\ctmouse\UTILITY\ 55 | makefile - MAKE's script file for rebuilding utilities 56 | comtest.asm - utility to detect COM ports, source 57 | mousetst.asm - mouse test example source (now NASM, wheel supported) 58 | display.asm - text output helpers include file for mousetst.asm 59 | protocol.asm - protocol analyzer source 60 | 61 | -------------------------------------------------------------------------------- /history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/history.txt -------------------------------------------------------------------------------- /int10.lst: -------------------------------------------------------------------------------- 1 | --------V-1004------------------------------- 2 | INT 10 - VIDEO - READ LIGHT PEN POSITION (except VGA) 3 | AH = 04h 4 | Return: AH = light pen trigger flag 5 | 00h not down/triggered 6 | 01h down/triggered 7 | DH,DL = row,column of character light pen is on 8 | CH = pixel row (graphics modes 04h-06h) 9 | CX = pixel row (graphics modes with >200 rows) 10 | BX = pixel column 11 | Desc: determine the current position and status of the light pen (if 12 | present) 13 | Notes: on a CGA, returned column numbers are always multiples of 2 (320- 14 | column modes) or 4 (640-column modes) 15 | returned row numbers are only accurate to two lines 16 | --------V-10F0------------------------------- 17 | INT 10 - EGA Register Interface Library - READ ONE REGISTER 18 | AH = F0h 19 | BL = register number 20 | BH = 00h 21 | DX = group index (see #00223) 22 | Return: BL = data 23 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 24 | compatibility box, and others; it is used for software virtualization 25 | of write-only registers on an EGA video adapter, so that multiple 26 | programs may peacefully coexist without clobbering each other's 27 | display settings 28 | SeeAlso: AH=F1h"EGA",AH=F2h"EGA",AH=FAh"EGA",INT 2F/AX=BC00h 29 | 30 | (Table 00223) 31 | Values for group index: 32 | Pointer/data chips 33 | 00h CRT Controller (25 reg) 3B4h mono modes, 3D4h color modes 34 | 08h Sequencer (5 registers) 3C4h 35 | 10h Graphics Controller (9 registers) 3CEh 36 | 18h Attribute Controller (20 registers) 3C0h 37 | Single registers 38 | 20h Miscellaneous Output register 3C2h 39 | 28h Feature Control register (3BAh mono modes, 3DAh color modes) 40 | 30h Graphics 1 Position register 3CCh 41 | 38h Graphics 2 Position register 3CAh 42 | --------V-10F1------------------------------- 43 | INT 10 - EGA Register Interface Library - WRITE ONE REGISTER 44 | AH = F1h 45 | DX = group index (see #00223) 46 | if single register: 47 | BL = value to write 48 | otherwise 49 | BL = register number 50 | BH = value to write 51 | Return: BL = data 52 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 53 | compatibility box, and others 54 | SeeAlso: AX=7F05h,AH=F0h"EGA",AH=F3h"EGA",AH=FAh"EGA" 55 | --------V-10F2------------------------------- 56 | INT 10 - EGA Register Interface Library - READ REGISTER RANGE 57 | AH = F2h 58 | CH = starting register number 59 | CL = number of registers (>1) 60 | DX = group index (00h,08h,10h,18h) (see #00223) 61 | ES:BX -> buffer, CL bytes 62 | Return: nothing 63 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 64 | compatibility box, and others 65 | SeeAlso: AH=F0h"EGA",AH=F3h"EGA",AH=FAh"EGA" 66 | --------V-10F3------------------------------- 67 | INT 10 - EGA Register Interface Library - WRITE REGISTER RANGE 68 | AH = F3h 69 | CH = starting register 70 | CL = number of registers (>1) 71 | DX = group index (00h,08h,10h,18h) (see #00223) 72 | ES:BX -> buffer, CL bytes 73 | Return: nothing 74 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 75 | compatibility box, and others 76 | SeeAlso: AX=7F05h,AH=F1h"EGA",AH=F2h"EGA",AH=F4h"EGA" 77 | --------V-10F4------------------------------- 78 | INT 10 - EGA Register Interface Library - READ REGISTER SET 79 | AH = F4h 80 | CX = number of registers to read (>1) 81 | ES:BX -> table of register records (see #00224) 82 | Return: register values in table filled in 83 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 84 | compatibility box, and others 85 | SeeAlso: AH=F0h"EGA",AH=F2h"EGA",AH=F5h"EGA" 86 | 87 | Format of EGA RIL entries in table of register records: 88 | Offset Size Description (Table 00224) 89 | 00h WORD group index 90 | Pointer/data chips 91 | 00h CRTC (3B4h mono modes, 3D4h color modes) 92 | 08h Sequencer 3C4h 93 | 10h Graphics Controller 3CEh 94 | 18h Attribute Controller 3C0h 95 | Single registers 96 | 20h Miscellaneous Output register 3C2h 97 | 28h Feature Control register (3BAh mono modes, 3DAh color) 98 | 30h Graphics 1 Position register 3CCh 99 | 38h Graphics 2 Position register 3CAh 100 | 02h BYTE register number (0 for single registers) 101 | 03h BYTE register value 102 | --------V-10F5------------------------------- 103 | INT 10 - EGA Register Interface Library - WRITE REGISTER SET 104 | AH = F5h 105 | CX = number of registers to write (>1) 106 | ES:BX -> table of records (see #00224) 107 | Return: nothing 108 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 109 | compatibility box, and others 110 | SeeAlso: AX=7F05h,AH=F1h"EGA",AH=F3h"EGA",AH=F4h"EGA" 111 | --------V-10F6------------------------------- 112 | INT 10 - EGA Register Interface Library - REVERT TO DEFAULT REGISTERS 113 | AH = F6h 114 | Return: nothing 115 | Note: provided by the Microsoft Mouse driver, OS/2 compatibility box, and 116 | others 117 | SeeAlso: AH=F5h"EGA",AH=F7h"EGA" 118 | --------V-10F7------------------------------- 119 | INT 10 - EGA Register Interface Library - DEFINE DEFAULT REGISTER TABLE 120 | AH = F7h 121 | DX = port number 122 | Pointer/data chips 123 | 00h CRTC (3B4h mono modes, 3D4h color modes) 124 | 08h Sequencer 3C4h 125 | 10h Graphics Controller 3CEh 126 | 18h Attribute Controller 3C0h 127 | Single registers 128 | 20h Miscellaneous Output register 3C2h 129 | 28h Feature Control register (3BAh mono modes, 3DAh color modes) 130 | 30h Graphics 1 Position register 3CCh 131 | 38h Graphics 2 Position register 3CAh 132 | ES:BX -> table of one-byte entries, one byte to be written to each 133 | register 134 | Return: nothing 135 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 136 | compatibility box, and others 137 | SeeAlso: AH=F0h"EGA",AH=F6h"EGA" 138 | --------V-10FA--BX0000----------------------- 139 | INT 10 - EGA Register Interface Library - INTERROGATE DRIVER 140 | AH = FAh 141 | BX = 0000h 142 | Return: BX = 0000h if RIL driver not present 143 | ES:BX -> EGA Register Interface version number, if present: 144 | byte 0 = major release number 145 | byte 1 = minor release number 146 | Note: the RIL is provided by EGA.SYS, the Microsoft Mouse driver, the OS/2 147 | compatibility box, and others 148 | SeeAlso: AH=F0h"EGA",AH=F6h"EGA",INT 2F/AX=BC00h 149 | -------------------------------------------------------------------------------- /int33.lst: -------------------------------------------------------------------------------- 1 | --------M-330000----------------------------- 2 | INT 33 - MS MOUSE - RESET DRIVER AND READ STATUS 3 | AX = 0000h 4 | Return: AX = status 5 | 0000h hardware/driver not installed 6 | FFFFh hardware/driver installed 7 | BX = number of buttons 8 | 0000h other than two 9 | 0002h two buttons (many drivers) 10 | 0003h Mouse Systems/Logitech three-button mouse 11 | FFFFh two buttons 12 | Notes: since INT 33 might be uninitialized on old machines, the caller 13 | should first check that INT 33 is neither 0000h:0000h nor points at 14 | an IRET instruction (BYTE CFh) before calling this API 15 | to use mouse on a Hercules-compatible monographics card in graphics 16 | mode, you must first set 0040h:0049h to 6 for page 0 or 5 for page 1, 17 | and then call this function. Logitech drivers v5.01 and v6.00 18 | reportedly do not correctly use Hercules graphics in dual-monitor 19 | systems, while version 4.10 does. 20 | the Logitech mouse driver contains the signature string "LOGITECH" 21 | three bytes past the interrupt handler; many of the Logitech mouse 22 | utilities check for this signature. 23 | Logitech MouseWare v6.30 reportedly does not support CGA video modes 24 | if no CGA is present when it is started and the video board is 25 | later switched into CGA emulation 26 | SeeAlso: AX=0011h,AX=0021h,AX=002Fh,INT 62/AX=007Ah,INT 74 27 | --------M-330001----------------------------- 28 | INT 33 - MS MOUSE v1.0+ - SHOW MOUSE CURSOR 29 | AX = 0001h 30 | SeeAlso: AX=0002h,INT 16/AX=FFFEh,INT 62/AX=007Bh,INT 6F/AH=06h"F_TRACK_ON" 31 | --------M-330002----------------------------- 32 | INT 33 - MS MOUSE v1.0+ - HIDE MOUSE CURSOR 33 | AX = 0002h 34 | Note: multiple calls to hide the cursor will require multiple calls to 35 | function 01h to unhide it. 36 | SeeAlso: AX=0001h,AX=0010h,INT 16/AX=FFFFh,INT 62/AX=007Bh 37 | SeeAlso: INT 6F/AH=08h"F_TRACK_OFF" 38 | --------M-330003----------------------------- 39 | INT 33 - MS MOUSE v1.0+ - RETURN POSITION AND BUTTON STATUS 40 | AX = 0003h 41 | Return: BX = button status (see #03168) 42 | CX = column 43 | DX = row 44 | Note: in text modes, all coordinates are specified as multiples of the cell 45 | size, typically 8x8 pixels 46 | SeeAlso: AX=0004h,AX=000Bh,INT 2F/AX=D000h"ZWmous" 47 | 48 | Bitfields for mouse button status: 49 | Bit(s) Description (Table 03168) 50 | 0 left button pressed if 1 51 | 1 right button pressed if 1 52 | 2 middle button pressed if 1 (Mouse Systems/Logitech/Genius) 53 | --------M-330004----------------------------- 54 | INT 33 - MS MOUSE v1.0+ - POSITION MOUSE CURSOR 55 | AX = 0004h 56 | CX = column 57 | DX = row 58 | Note: the row and column are truncated to the next lower multiple of the cell 59 | size (typically 8x8 in text modes); however, some versions of the 60 | Microsoft documentation incorrectly state that the coordinates are 61 | rounded 62 | SeeAlso: AX=0003h,INT 62/AX=0081h,INT 6F/AH=10h"F_PUT_SPRITE" 63 | --------M-330005----------------------------- 64 | INT 33 - MS MOUSE v1.0+ - RETURN BUTTON PRESS DATA 65 | AX = 0005h 66 | BX = button number (see #03169) 67 | Return: AX = button states (see #03168) 68 | BX = number of times specified button has been pressed since last call 69 | CX = column at time specified button was last pressed 70 | DX = row at time specified button was last pressed 71 | Note: at least for the Genius mouse driver, the number of button presses 72 | returned is limited to 7FFFh 73 | SeeAlso: AX=0006h,INT 62/AX=007Ch 74 | 75 | (Table 03169) 76 | Values for mouse button number: 77 | 0000h left 78 | 0001h right 79 | 0002h middle (Mouse Systems/Logitech/Genius mouse) 80 | --------M-330006----------------------------- 81 | INT 33 - MS MOUSE v1.0+ - RETURN BUTTON RELEASE DATA 82 | AX = 0006h 83 | BX = button number (see #03169) 84 | Return: AX = button states (see #03168) 85 | BX = number of times specified button has been released since last call 86 | CX = column at time specified button was last released 87 | DX = row at time specified button was last released 88 | Note: at least for the Genius mouse driver, the number of button releases 89 | returned is limited to 7FFFh 90 | SeeAlso: AX=0005h,INT 62/AX=007Ch 91 | --------M-330007----------------------------- 92 | INT 33 - MS MOUSE v1.0+ - DEFINE HORIZONTAL CURSOR RANGE 93 | AX = 0007h 94 | CX = minimum column 95 | DX = maximum column 96 | Note: in text modes, the minimum and maximum columns are truncated to the 97 | next lower multiple of the cell size, typically 8x8 pixels 98 | SeeAlso: AX=0008h,AX=0010h,AX=0031h,INT 62/AX=0080h 99 | SeeAlso: INT 6F/AH=0Ch"F_SET_LIMITS_X" 100 | --------M-330008----------------------------- 101 | INT 33 - MS MOUSE v1.0+ - DEFINE VERTICAL CURSOR RANGE 102 | AX = 0008h 103 | CX = minimum row 104 | DX = maximum row 105 | Note: in text modes, the minimum and maximum rows are truncated to the 106 | next lower multiple of the cell size, typically 8x8 pixels 107 | SeeAlso: AX=0007h,AX=0010h,AX=0031h,INT 62/AX=0080h 108 | SeeAlso: INT 6F/AH=0Eh"F_SET_LIMITS_Y" 109 | --------M-330009----------------------------- 110 | INT 33 - MS MOUSE v3.0+ - DEFINE GRAPHICS CURSOR 111 | AX = 0009h 112 | BX = column of cursor hot spot in bitmap (-16 to 16) 113 | CX = row of cursor hot spot (-16 to 16) 114 | ES:DX -> mask bitmap (see #03170) 115 | Notes: in graphics modes, the screen contents around the current mouse cursor 116 | position are ANDed with the screen mask and then XORed with the 117 | cursor mask 118 | the Microsoft mouse driver v7.04 and v8.20 uses only BL and CL, so the 119 | hot spot row/column should be limited to -128..127 120 | Microsoft KnowledgeBase article Q19850 states that the high bit is 121 | right-most, but that statement is contradicted by all other available 122 | documentation 123 | SeeAlso: AX=000Ah,AX=0012h,AX=002Ah,INT 62/AX=007Fh,INT 6F/AH=0Ah"F_DEF_MASKS" 124 | 125 | Format of mouse mask bitmap: 126 | Offset Size Description (Table 03170) 127 | 00h 16 WORDs screen mask 128 | 10h 16 WORDs cursor mask 129 | Note: each word defines the sixteen pixels of a row, low bit rightmost 130 | --------M-33000A----------------------------- 131 | INT 33 - MS MOUSE v3.0+ - DEFINE TEXT CURSOR 132 | AX = 000Ah 133 | BX = hardware/software text cursor 134 | 0000h software 135 | CX = screen mask 136 | DX = cursor mask 137 | 0001h hardware 138 | CX = start scan line 139 | DX = end scan line 140 | Note: when the software cursor is selected, the character/attribute data at 141 | the current screen position is ANDed with the screen mask and then 142 | XORed with the cursor mask 143 | SeeAlso: AX=0009h,INT 62/AX=007Eh 144 | --------M-33000B----------------------------- 145 | INT 33 - MS MOUSE v1.0+ - READ MOTION COUNTERS 146 | AX = 000Bh 147 | Return: CX = number of mickeys mouse moved horizontally since last call 148 | DX = number of mickeys mouse moved vertically 149 | Notes: a mickey is the smallest increment the mouse can sense 150 | positive values indicate down/right 151 | SeeAlso: AX=0003h,AX=001Bh,AX=0027h 152 | --------M-33000C----------------------------- 153 | INT 33 - MS MOUSE v1.0+ - DEFINE INTERRUPT SUBROUTINE PARAMETERS 154 | AX = 000Ch 155 | CX = call mask (see #03171) 156 | ES:DX -> FAR routine (see #03172) 157 | SeeAlso: AX=0018h 158 | 159 | Bitfields for mouse call mask: 160 | Bit(s) Description (Table 03171) 161 | 0 call if mouse moves 162 | 1 call if left button pressed 163 | 2 call if left button released 164 | 3 call if right button pressed 165 | 4 call if right button released 166 | 5 call if middle button pressed (Mouse Systems/Logitech/Genius mouse) 167 | 6 call if middle button released (Mouse Systems/Logitech/Genius mouse) 168 | 7-15 unused 169 | Note: some versions of the Microsoft documentation incorrectly state that CX 170 | bit 0 means call if mouse cursor moves 171 | 172 | (Table 03172) 173 | Values interrupt routine is called with: 174 | AX = condition mask (same bit assignments as call mask) 175 | BX = button state 176 | CX = cursor column 177 | DX = cursor row 178 | SI = horizontal mickey count 179 | DI = vertical mickey count 180 | Notes: some versions of the Microsoft documentation erroneously swap the 181 | meanings of SI and DI 182 | in text modes, the row and column will be reported as a multiple of 183 | the character cell size, typically 8x8 pixels 184 | --------M-33000D----------------------------- 185 | INT 33 - MS MOUSE v1.0+ - LIGHT PEN EMULATION ON 186 | AX = 000Dh 187 | SeeAlso: AX=000Eh,INT 10/AH=04h 188 | --------M-33000E----------------------------- 189 | INT 33 - MS MOUSE v1.0+ - LIGHT PEN EMULATION OFF 190 | AX = 000Eh 191 | SeeAlso: AX=000Dh 192 | --------M-33000F----------------------------- 193 | INT 33 - MS MOUSE v1.0+ - DEFINE MICKEY/PIXEL RATIO 194 | AX = 000Fh 195 | CX = number of mickeys per 8 pixels horizontally (default 8) 196 | DX = number of mickeys per 8 pixels vertically (default 16) 197 | SeeAlso: AX=0013h,AX=001Ah,INT 62/AX=0082h 198 | --------M-330010----------------------------- 199 | INT 33 - MS MOUSE v1.0+ - DEFINE SCREEN REGION FOR UPDATING 200 | AX = 0010h 201 | CX,DX = X,Y coordinates of upper left corner 202 | SI,DI = X,Y coordinates of lower right corner 203 | Note: mouse cursor is hidden in the specified region, and needs to be 204 | explicitly turned on again 205 | SeeAlso: AX=0001h,AX=0002h,AX=0007h,AX=0010h"Genius MOUSE",AX=0031h 206 | --------M-330012----------------------------- 207 | INT 33 - MS MOUSE - SET LARGE GRAPHICS CURSOR BLOCK 208 | AX = 0012h 209 | BH = cursor width in words 210 | CH = rows in cursor 211 | BL = horizontal hot spot (-16 to 16) 212 | CL = vertical hot spot (-16 to 16) 213 | ES:DX -> bit map of screen and cursor maps 214 | Return: AX = FFFFh if successful 215 | SeeAlso: AX=0009h,AX=002Ah,AX=0035h 216 | --------M-330013----------------------------- 217 | INT 33 - MS MOUSE v5.0+ - DEFINE DOUBLE-SPEED THRESHOLD 218 | AX = 0013h 219 | DX = threshold speed in mickeys/second, 0000h = default of 64/second 220 | Note: if speed exceeds threshold, the cursor's on-screen motion is doubled 221 | SeeAlso: AX=000Fh,AX=001Bh,AX=002Ch 222 | --------M-330014----------------------------- 223 | INT 33 - MS MOUSE v3.0+ - EXCHANGE INTERRUPT SUBROUTINES 224 | AX = 0014h 225 | CX = call mask (see #03171) 226 | ES:DX -> FAR routine 227 | Return: CX = call mask of previous interrupt routine 228 | ES:DX = FAR address of previous interrupt routine 229 | SeeAlso: AX=000Ch,AX=0018h 230 | --------M-330015----------------------------- 231 | INT 33 - MS MOUSE v6.0+ - RETURN DRIVER STORAGE REQUIREMENTS 232 | AX = 0015h 233 | Return: BX = size of buffer needed to store driver state 234 | SeeAlso: AX=0016h,AX=0017h,AX=0042h 235 | --------M-330016----------------------------- 236 | INT 33 - MS MOUSE v6.0+ - SAVE DRIVER STATE 237 | AX = 0016h 238 | BX = size of buffer (see AX=0015h) 239 | ES:DX -> buffer for driver state 240 | Note: although not documented (since the Microsoft driver does not use it), 241 | many drivers appear to require BX on input 242 | SeeAlso: AX=0015h,AX=0017h 243 | --------M-330017----------------------------- 244 | INT 33 - MS MOUSE v6.0+ - RESTORE DRIVER STATE 245 | AX = 0017h 246 | BX = size of buffer (see AX=0015h) 247 | ES:DX -> buffer containing saved state 248 | Notes: although not documented (since the Microsoft driver does not use it), 249 | many drivers appear to require BX on input 250 | some mouse drivers range-check the values in the saved state based on 251 | the current video mode; thus, the video mode should be restored 252 | before the mouse driver's state is restored 253 | SeeAlso: AX=0015h,AX=0016h 254 | --------M-330018----------------------------- 255 | INT 33 - MS MOUSE v6.0+ - SET ALTERNATE MOUSE USER HANDLER 256 | AX = 0018h 257 | CX = call mask (see #03174) 258 | ES:DX -> FAR routine to be invoked on mouse events (see #03175) 259 | Return: AX = status 260 | 0018h if successful 261 | FFFFh on error 262 | Notes: up to three handlers can be defined by separate calls to this function, 263 | each with a different combination of shift states in the call mask; 264 | calling this function again with a call mask of 0000h undefines the 265 | specified handler (official documentation); specifying the same 266 | call mask and an address of 0000h:0000h undefines the handler (real 267 | life) 268 | some versions of the documentation erroneously reverse the order of 269 | the bits in the call mask 270 | SeeAlso: AX=000Ch,AX=0014h,AX=0019h 271 | 272 | Bitfields for mouse call mask: 273 | Bit(s) Description (Table 03174) 274 | 0 call if mouse moves 275 | 1 call if left button pressed 276 | 2 call if left button released 277 | 3 call if right button pressed 278 | 4 call if right button released 279 | 5 call if shift button pressed during event 280 | 6 call if ctrl key pressed during event 281 | 7 call if alt key pressed during event 282 | Note: at least one of 5-7 must be set 283 | 284 | (Table 03175) 285 | Values user handler is called with: 286 | AX = condition mask (same bit assignments as call mask) 287 | BX = button state 288 | CX = cursor column 289 | DX = cursor row 290 | SI = horizontal mickey count 291 | DI = vertical mickey count 292 | Return: registers preserved 293 | Note: in text modes, the row and column will be reported as a multiple of 294 | the cell size, typically 8x8 pixels 295 | --------M-330019----------------------------- 296 | INT 33 - MS MOUSE v6.0+ - RETURN USER ALTERNATE INTERRUPT VECTOR 297 | AX = 0019h 298 | CX = call mask (see #03174) 299 | Return: BX:DX = user interrupt vector 300 | CX = call mask (0000h if not found) 301 | Note: attempts to find a user event handler (defined by function 18h) 302 | whose call mask matches CX 303 | SeeAlso: AX=0018h 304 | --------M-33001A----------------------------- 305 | INT 33 - MS MOUSE v6.0+ - SET MOUSE SENSITIVITY 306 | AX = 001Ah 307 | BX = horizontal speed \ 308 | CX = vertical speed / (see AX=000Fh) 309 | DX = double speed threshold (see AX=0013h) 310 | SeeAlso: AX=0013h,AX=001Bh,INT 62/AX=0082h 311 | --------M-33001B----------------------------- 312 | INT 33 - MS MOUSE v6.0+ - RETURN MOUSE SENSITIVITY 313 | AX = 001Bh 314 | Return: BX = horizontal speed 315 | CX = vertical speed 316 | DX = double speed threshold 317 | SeeAlso: AX=000Bh,AX=001Ah 318 | --------M-33001C----------------------------- 319 | INT 33 - MS MOUSE v6.0+ - SET INTERRUPT RATE 320 | AX = 001Ch 321 | BX = rate (see #03176) 322 | Notes: only available on InPort mouse 323 | values greater than 4 may cause unpredictable driver behavior 324 | 325 | (Table 03176) 326 | Values for mouse interrupt rate: 327 | 00h no interrupts allowed 328 | 01h 30 per second 329 | 02h 50 per second 330 | 03h 100 per second 331 | 04h 200 per second 332 | --------M-33001D----------------------------- 333 | INT 33 - MS MOUSE v6.0+ - DEFINE DISPLAY PAGE NUMBER 334 | AX = 001Dh 335 | BX = display page number 336 | Note: the cursor will be displayed on the specified page 337 | SeeAlso: AX=001Eh 338 | --------M-33001E----------------------------- 339 | INT 33 - MS MOUSE v6.0+ - RETURN DISPLAY PAGE NUMBER 340 | AX = 001Eh 341 | Return: BX = display page number 342 | SeeAlso: AX=001Dh 343 | --------M-33001F----------------------------- 344 | INT 33 - MS MOUSE v6.0+ - DISABLE MOUSE DRIVER 345 | AX = 001Fh 346 | Return: AX = status 347 | 001Fh successful 348 | ES:BX = INT 33 vector before mouse driver was first installed 349 | FFFFh unsuccessful 350 | Notes: restores vectors for INT 10 and INT 71 (8086) or INT 74 (286/386) 351 | if you restore INT 33 to ES:BX, driver will be completely disabled 352 | many drivers return AX=001Fh even though the driver has been disabled 353 | SeeAlso: AX=0020h 354 | --------M-330020----------------------------- 355 | INT 33 - MS MOUSE v6.0+ - ENABLE MOUSE DRIVER 356 | AX = 0020h 357 | Return: AX = status 358 | 0020h successful 359 | FFFFh unsuccessful 360 | Notes: restores vectors for INT 10h and INT 71h (8086) or INT 74h (286/386) 361 | which were removed by function 1Fh 362 | Microsoft's documentation states that no value is returned 363 | SeeAlso: AX=001Fh 364 | --------M-330021----------------------------- 365 | INT 33 - MS MOUSE v6.0+ - SOFTWARE RESET 366 | AX = 0021h 367 | Return: AX = status 368 | FFFFh if mouse driver installed 369 | BX = number of buttons (FFFFh = two buttons) 370 | 0021h if mouse driver not installed 371 | Note: this call is identical to funtion 00h, but does not reset the mouse 372 | SeeAlso: AX=0000h 373 | --------M-330022----------------------------- 374 | INT 33 - MS MOUSE v6.0+ - SET LANGUAGE FOR MESSAGES 375 | AX = 0022h 376 | BX = language (see #03177) 377 | Note: only available on international versions of the driver; US versions 378 | ignore this call 379 | SeeAlso: AX=0023h 380 | 381 | (Table 03177) 382 | Values for mouse driver language: 383 | 00h English 384 | 01h French 385 | 02h Dutch 386 | 03h German 387 | 04h Swedish 388 | 05h Finnish 389 | 06h Spanish 390 | 07h Portugese 391 | 08h Italian 392 | --------M-330023----------------------------- 393 | INT 33 - MS MOUSE v6.0+ - GET LANGUAGE FOR MESSAGES 394 | AX = 0023h 395 | Return: BX = language (see #03177) 396 | Note: the US version of the driver always returns zero 397 | SeeAlso: AX=0022h 398 | --------M-330024BX0000----------------------- 399 | INT 33 - MS MOUSE v6.26+ - GET SOFTWARE VERSION, MOUSE TYPE, AND IRQ NUMBER 400 | AX = 0024h 401 | BX = 0000h to check for function's existence 402 | Return: AX = FFFFh on error 403 | otherwise, 404 | BH = major version 405 | BL = minor version 406 | CH = type (1=bus, 2=serial, 3=InPort, 4=PS/2, 5=HP) 407 | CL = interrupt (0=PS/2, 2=IRQ2, 3=IRQ3,...,7=IRQ7,...,0Fh=IRQ15) 408 | Note: although current Microsoft documentation states that this function was 409 | introduced in v6.26, it appears to have been present as early as 410 | v6.02 (for earlier versions, use INT 33/AX=006Dh) 411 | SeeAlso: AX=004Dh,AX=006Dh 412 | --------M-330025----------------------------- 413 | INT 33 - MS MOUSE v6.26+ - GET GENERAL DRIVER INFORMATION 414 | AX = 0025h 415 | Return: AX = general information (see #03178) 416 | BX = cursor lock flag for OS/2 to prevent reentrancy problems 417 | CX = mouse code active flag (for OS/2) 418 | DX = mouse driver busy flag (for OS/2) 419 | 420 | Bitfields for general mouse driver information: 421 | Bit(s) Description (Table 03178) 422 | 15 driver loaded as device driver rather than TSR 423 | 14 driver is newer integrated type 424 | 13,12 current cursor type 425 | 00 software text cursor 426 | 01 hardware text cursor (CRT Controller's cursor) 427 | 1X graphics cursor 428 | 11-8 interrupt rate (see #03176) 429 | 7-0 count of currently-active Mouse Display Drivers (MDD), the newer 430 | integrated driver type 431 | --------M-330026----------------------------- 432 | INT 33 - MS MOUSE v6.26+ - GET MAXIMUM VIRTUAL COORDINATES 433 | AX = 0026h 434 | Return: BX = mouse-disabled flag (0000h mouse enabled, nonzero disabled) 435 | CX = maximum virtual X (for current video mode) 436 | DX = maximum virtual Y 437 | Note: for driver versions before 7.05, this call returns the currently-set 438 | maximum coordinates; v7.05+ returns the absolute maximum coordinates 439 | SeeAlso: AX=0031h 440 | --------M-330027----------------------------- 441 | INT 33 - MS MOUSE v7.01+ - GET SCREEN/CURSOR MASKS AND MICKEY COUNTS 442 | AX = 0027h 443 | Return: AX = screen-mask value (or hardware cursor scan-line start for v7.02+) 444 | BX = cursor-mask value (or hardware cursor scan-line stop for v7.02+) 445 | CX = horizontal mickeys moved since last call 446 | DX = vertical mickeys moved since last call 447 | SeeAlso: AX=000Bh 448 | --------M-330028----------------------------- 449 | INT 33 - MS MOUSE v7.0+ - SET VIDEO MODE 450 | AX = 0028h 451 | CX = new video mode (call is NOP if 0000h) 452 | DH = Y font size (00h = default) 453 | DL = X font size (00h = default) 454 | Return: CL = status (00h = successful) 455 | Notes: DX is ignored unless the selected video mode supports font size control 456 | when CX=0000h, an internal flag that had been set by a previous call 457 | is cleared; this is required before a mouse reset 458 | SeeAlso: AX=0029h,INT 10/AH=00h 459 | --------M-330029----------------------------- 460 | INT 33 - MS MOUSE v7.0+ - ENUMERATE VIDEO MODES 461 | AX = 0029h 462 | CX = previous video mode 463 | 0000h get first supported video mode 464 | other get next supported mode after mode CX 465 | Return: CX = first/next video mode (0000h = no more video modes) 466 | DS:DX -> description of video mode or 0000h:0000h if none 467 | Notes: the enumerated video modes may be in any order and may repeat 468 | the description string (if available) is terminated by '$' followed by 469 | a NUL byte 470 | SeeAlso: AX=0028h 471 | --------M-33002A----------------------------- 472 | INT 33 - MS MOUSE v7.02+ - GET CURSOR HOT SPOT 473 | AX = 002Ah 474 | Return: AX = internal counter controlling cursor visibility 475 | BX = cursor hot spot column 476 | CX = cursor hot spot row 477 | DX = mouse type (see #03179) 478 | Note: the hot spot location is relative to the upper left corner of the 479 | cursor block and may range from -128 to +127 both horizontally and 480 | vertically 481 | SeeAlso: AX=0009h,AX=0012h,AX=0035h 482 | 483 | (Table 03179) 484 | Values for mouse type: 485 | 00h none 486 | 01h bus 487 | 02h serial 488 | 03h InPort 489 | 04h IBM 490 | 05h Hewlett-Packard 491 | --------M-33002B----------------------------- 492 | INT 33 - MS MOUSE v7.0+ - LOAD ACCELERATION PROFILES 493 | AX = 002Bh 494 | BX = active acceleration profile 495 | 0001h-0004h or FFFFh to restore default curves 496 | ES:SI -> buffer containing acceleration profile data (see #03180) 497 | Return: AX = success flag 498 | SeeAlso: AX=002Ch,AX=002Dh,AX=0033h 499 | 500 | Format of acceleration profile data: 501 | Offset Size Description (Table 03180) 502 | 00h BYTE length of acceleration profile 1 503 | 01h BYTE length of acceleration profile 2 504 | 02h BYTE length of acceleration profile 3 505 | 03h BYTE length of acceleration profile 4 506 | 04h 32 BYTEs threshold speeds for acceleration profile 1 507 | 24h 32 BYTEs threshold speeds for acceleration profile 2 508 | 44h 32 BYTEs threshold speeds for acceleration profile 3 509 | 64h 32 BYTEs threshold speeds for acceleration profile 4 510 | 84h 32 BYTEs speedup factor for acceleration profile 1 511 | (10h = 1.0, 14h = 1.25, 20h = 2.0, etc) 512 | A4h 32 BYTEs speedup factor for acceleration profile 2 513 | (10h = 1.0, 14h = 1.25, 20h = 2.0, etc) 514 | C4h 32 BYTEs speedup factor for acceleration profile 3 515 | (10h = 1.0, 14h = 1.25, 20h = 2.0, etc) 516 | E4h 32 BYTEs speedup factor for acceleration profile 4 517 | (10h = 1.0, 14h = 1.25, 20h = 2.0, etc) 518 | 104h 16 BYTEs name of acceleration profile 1 (blank-padded) 519 | 114h 16 BYTEs name of acceleration profile 2 (blank-padded) 520 | 124h 16 BYTEs name of acceleration profile 3 (blank-padded) 521 | 134h 16 BYTEs name of acceleration profile 4 (blank-padded) 522 | Note: unused bytes in the threshold speed fields are filled with 7Fh and 523 | unused bytes in the speedup factor fields are filled with 10h 524 | --------M-33002C----------------------------- 525 | INT 33 - MS MOUSE v7.0+ - GET ACCELERATION PROFILES 526 | AX = 002Ch 527 | Return: AX = status (0000h success) 528 | BX = currently-active acceleration profile 529 | ES:SI -> acceleration profile data (see #03180) 530 | SeeAlso: AX=002Bh,AX=002Dh,AX=0033h 531 | --------M-33002D----------------------------- 532 | INT 33 - MS MOUSE v7.0+ - SELECT ACCELERATION PROFILE 533 | AX = 002Dh 534 | BX = acceleration level 535 | 0001h-0004h to set profile, or FFFFh to get current profile 536 | Return: AX = status 537 | 0000h successful 538 | ES:SI -> 16-byte blank-padded name of acceleration profile 539 | FFFEh invalid acceleration curve number 540 | ES:SI destroyed 541 | BX = active acceleration curve number 542 | SeeAlso: AX=0013h,AX=002Bh,AX=002Ch,AX=002Eh 543 | --------M-33002E----------------------------- 544 | INT 33 - MS MOUSE v8.10+ - SET ACCELERATION PROFILE NAMES 545 | AX = 002Eh 546 | BL = flag (if nonzero, fill ES:SI buffer with default names on return) 547 | ES:SI -> 64-byte buffer containing profile names (16 bytes per name) 548 | Return: AX = status (0000h success) 549 | FFFEh error for ATI Mouse driver 550 | ES:SI buffer filled with default names if BL nonzero on entry 551 | Notes: not supported by Logitech driver v6.10 552 | supported by ATI Mouse driver v7.04 553 | SeeAlso: AX=002Ch,AX=002Dh,AX=012Eh,AX=022Eh 554 | --------M-33002F----------------------------- 555 | INT 33 - MS MOUSE v7.02+ - MOUSE HARDWARE RESET 556 | AX = 002Fh 557 | Return: AX = status 558 | Note: invoked by mouse driver v8.20 on being called with INT 2F/AX=530Bh 559 | SeeAlso: INT 2F/AH=53h 560 | --------M-330030----------------------------- 561 | INT 33 - MS MOUSE v7.04+ - GET/SET BallPoint INFORMATION 562 | AX = 0030h 563 | CX = command 564 | 0000h get status of BallPoint device 565 | other set rotation angle and masks 566 | BX = rotation angle (-32768 to 32767 degrees) 567 | CH = primary button mask 568 | CL = secondary button mask 569 | Return: AX = button status (FFFFh if no BallPoint) (see #03181) 570 | BX = rotation angle (0-360 degrees) 571 | CH = primary button mask 572 | CL = secondary button mask 573 | Note: not supported by the ATI Mouse driver which calls itself v7.04 574 | 575 | Bitfields for BallPoint mouse button status: 576 | Bit(s) Description (Table 03181) 577 | 5 button 1 578 | 4 button 2 579 | 3 button 3 580 | 2 button 4 581 | other zero 582 | --------M-330031----------------------------- 583 | INT 33 - MS MOUSE v7.05+ - GET CURRENT MINIMUM/MAXIMUM VIRTUAL COORDINATES 584 | AX = 0031h 585 | Return: AX = virtual X minimum 586 | BX = virtual Y minimum 587 | CX = virtual X maximum 588 | DX = virtual Y maximum 589 | Note: the minimum and maximum values are those set by AX=0007h and AX=0008h; 590 | the default is minimum = 0 and maximum = absolute maximum 591 | (see AX=0026h) 592 | SeeAlso: AX=0007h,AX=0008h,AX=0010h,AX=0026h 593 | --------M-330032----------------------------- 594 | INT 33 - MS MOUSE v7.05+ - GET ACTIVE ADVANCED FUNCTIONS 595 | AX = 0032h 596 | Return: AX = active function flags (FFFFh for v8.10) 597 | bit 15: function 0025h supported 598 | bit 14: function 0026h supported 599 | ... 600 | bit 0: function 0034h supported 601 | BX = ??? (0000h) officially unused 602 | CX = ??? (E000h) officially unused 603 | DX = ??? (0000h) officially unused 604 | Note: the Italian version of MS MOUSE v8.20 reportedly indicates that 605 | functions 0033h and 0034h are not supported even though they are 606 | --------M-330033----------------------------- 607 | INT 33 - MS MOUSE v7.05+ - GET SWITCH SETTINGS AND ACCELERATION PROFILE DATA 608 | AX = 0033h 609 | CX = size of buffer 610 | 0000h get required buffer size 611 | Return: AX = 0000h 612 | CX = required size (0154h for Logitech v6.10, 0159h 613 | for MS v8.10-8.20) 614 | other 615 | ES:DX -> buffer of CX bytes for mouse settings 616 | Return: AX = 0000h 617 | CX = number of bytes returned 618 | ES:DX buffer filled (see #03182) 619 | SeeAlso: AX=002Bh 620 | 621 | Format of mouse settings data buffer: 622 | Offset Size Description (Table 03182) 623 | 00h BYTE mouse type 624 | 01h BYTE current language 625 | 02h BYTE horizontal sensitivity (00h-64h) 626 | 03h BYTE vertical sensitivity (00h-64h) 627 | 04h BYTE double-speed threshold (00h-64h) 628 | 05h BYTE ballistic curve (01h-04h) 629 | 06h BYTE interrupt rate (01h-04h) 630 | 07h BYTE cursor override mask 631 | 08h BYTE laptop adjustment 632 | 09h BYTE memory type (00h-02h) 633 | 0Ah BYTE SuperVGA support (00h,01h) 634 | 0Bh BYTE rotation angle 635 | 0Ch BYTE ??? 636 | 0Dh BYTE primary button (01h-04h) 637 | 0Eh BYTE secondary button (01h-04h) 638 | 0Fh BYTE click lock enabled (00h,01h) 639 | 10h 324 BYTEs acceleration profile data (see #03180) 640 | 154h 5 BYTEs ??? (Microsoft driver, but not Logitech) 641 | --------M-330034----------------------------- 642 | INT 33 - MS MOUSE v8.0+ - GET INITIALIZATION FILE 643 | AX = 0034h 644 | Return: AX = status (0000h successful) 645 | ES:DX -> ASCIZ initialization (.INI) file name 646 | --------M-330035----------------------------- 647 | INT 33 - MS MOUSE v8.10+ - LCD SCREEN LARGE POINTER SUPPORT 648 | AX = 0035h 649 | BX = function 650 | FFFFh get current settings 651 | Return: AX = 0000h 652 | BH = style (see #03183) 653 | BL = size (see #03184) 654 | CH = threshold (00h-64h) 655 | CL = active flag (00h disabled, 01h enabled) 656 | DX = delay 657 | other 658 | BH = pointer style (see #03183) 659 | BL = size (see #03184) 660 | CH = threshold (00h-64h) 661 | CL = active flag (00h disable size change, 01h enable) 662 | DX = delay (0000h-0064h) 663 | Return: AX = 0000h 664 | Note: not supported by Logitech driver v6.10 665 | SeeAlso: AX=0012h,AX=002Ah 666 | 667 | (Table 03183) 668 | Values for pointer style: 669 | 00h normal 670 | 01h reverse 671 | 02h transparent 672 | SeeAlso: #03184 673 | 674 | (Table 03184) 675 | Values for pointer size: 676 | 00h small ("1") 677 | 01h medium ("1.5") 678 | 02h large ("2") 679 | SeeAlso: #03183 680 | --------M-33004D----------------------------- 681 | INT 33 - MS MOUSE - RETURN POINTER TO COPYRIGHT STRING 682 | AX = 004Dh 683 | Return: ES:DI -> copyright message "*** This is Copyright 1983 Microsoft" or 684 | "Copyright 19XX...." 685 | Notes: also supported by Logitech, Kraft, Genius Mouse, and Mouse Systems 686 | mouse drivers 687 | in the Genius Mouse 9.06 driver, the ASCIZ signature "KYE" immediately 688 | follows the above copyright message (KYE Corp. manufactures the 689 | driver) 690 | SeeAlso: AX=0024h,AX=006Dh,AX=0666h 691 | --------M-33006D----------------------------- 692 | INT 33 - MS MOUSE - GET VERSION STRING 693 | AX = 006Dh 'm' 694 | Return: ES:DI -> Microsoft version number of resident driver (see #03187) 695 | Notes: also supported by Logitech, Mouse Systems, Kraft, and Genius mouse 696 | drivers 697 | the Mouse Systems 7.01 and Genius Mouse 9.06 drivers report their 698 | Microsoft version as 7.00 even though they do not support any of the 699 | functions from 0025h through 002Dh supported by the MS 7.00 driver 700 | (the Genius Mouse driver supports function 0026h, but it differs 701 | from the Microsoft function) 702 | the TRUEDOX 4.01 driver reports its version as 6.26 through this call, 703 | but as 6.24 through AX=0024h 704 | There seems to be no reliable method to distinguish MS MOUSE before 705 | 3.00 from mouse drivers of other vendors. 706 | Some releases of the MS MOUSE 6.00 erroneously return 6.01 instead of 707 | their true version number. In this case, a DI value of 01ABh can 708 | be used to still detect a 6.00 driver. 709 | For returned versions 6.02+, INT 33/AX=0024h should be used to retrieve 710 | more accurate version data. 711 | True MS MOUSE drivers can also be identified by magic numbers in 712 | their copyright message, stored in the driver's segment (ES). 713 | These can be found by scanning the first 2 Kb of the mouse 714 | driver's segment for a string like: [new since 7.00+] 715 | "** This is Copyright 1983[-19xx] Microsoft ***" with the 716 | magic number stored one byte after the signature string. 717 | SeeAlso: AX=0024h,AX=004Dh,AX=006Ah,AX=266Ch 718 | 719 | Format of Microsoft version number: 720 | Offset Size Description (Table 03187) 721 | 00h BYTE major version 722 | 01h BYTE minor version (BCD) 723 | 724 | (Table 04087) 725 | Values for Microsoft MOUSE copyright string magic numbers: 726 | 5564h version 3.00..6.00 (for reported versions up to 5.03, and 6.00) 727 | 557Ch version 6.01Z..6.24 (for reported versions 6.01..6.24) 728 | E806h version 6.25 (for reported version 6.25) 729 | EB02h version 6.26..7.04 (for reported version 6.26..7.04) 730 | 0800h Integrated driver 1.0+ (for reported version 9.x+) 731 | Note: Versions above 7.04 (except for integrated mouse drivers) have a magic 732 | number representing their version number, e.g. 0507h for version 7.05 733 | -------------------------------------------------------------------------------- /jwasm.txt: -------------------------------------------------------------------------------- 1 | 2 | Notes on conversion of CTMOUSE 2.1beta4 from TASM to JWASM / MASM: 3 | 4 | - TASM evendata pads with 0, JWASM even pads with 0fch 5 | I do not know how to change this, I just used "db 0". 6 | 7 | - sbb ch,ch xchg dx,si xchg cl,bh xchg si,di sbb al,al 8 | xchg dh,bl xchg cx,si xchg cx,bx xchg dl,al xchg dl,ah 9 | xchg dx,si xchg ah,al (but not ALL "xchg" instructions) 10 | all swap the arguments when compiled with JWASM as 11 | compared to compiled with TASM - I used "db ..." here. 12 | 13 | - cmp ax, valuebelow128 uses "cmp ax,word" in TASM but 14 | I cannot make JWASM do that - it uses "cmp ax,byte" 15 | 16 | - adc ax,0 has the same problem as cmp ax,4 ... 17 | 18 | - JWASM does not support testflag / setflag / maskflag 19 | which compile into test / or / and in an "intelligent" 20 | way. For example "testflag [bx],400h" would create a 21 | "test [bx+1],4" in a TASM made binary... 22 | 23 | Differences between TASM and MASM: 24 | 25 | - MASM needs double "::" after labels to make them globally 26 | visible, TASM has keyword "locals" to make all labels global 27 | ... however I had to use "::" at ONLY 28 places and having 28 | the global-hints explicit makes the code more readable ... 29 | 30 | - MASM uses "even" where TASM uses "evendata" 31 | 32 | - MASM uses "STRUCNAME ends" where TASM uses "ends" 33 | 34 | - the size info in "MYLABEL label byte" can be optional in TASM 35 | 36 | - JWASM / TASM do not understand "warn" and various "%settings" 37 | 38 | - macro options can be of type "rest" and "vararg" only in TASM 39 | 40 | - TASM allows push and pop with multiple arguments... Dunno about 41 | MASM but JWASM does not support this. I think NASM does...? 42 | 43 | Other JWASM specifics I had to work around: 44 | 45 | - JWASM seems to have pretty bad support for "record" bitfields, 46 | I had to remove most references to them to avoid broken code 47 | (later JWASM versions are a bit better with this) 48 | 49 | - JWASM uses only 8 instead of 16 bytes for "foo db 8 dup (?,?)" 50 | before version 1.8 - this bug is fixed in later JWASM versions 51 | 52 | - JWASM does not allow structures to be named OPTION ;-) It also 53 | can do less magic with macros compared to TASM... You can find 54 | all sorts of related simplifications I had to use in jw-tasm.* 55 | 56 | - in TASM you can say "offset X" instead of "offset PAIR.X" 57 | in cases where this is not ambiguous (PAIR is a struct). 58 | You cannot say [si].foo either, only [si+offset WHAT.foo]. 59 | You can also say "ends" instead of "STRUCTNAME ends" in 60 | TASM and "LABNAME label byte" does not need the "byte" in 61 | TASM if it can be inferred. Instead of ".model use16 tiny" 62 | I had to use the JWASM -mt command line option. 63 | 64 | - to make a COM file with JWASM, several changes were needed: 65 | Instead of .startup I had to say: org 100h assume ds:DGROUP 66 | and start:: (and at the end: end start). Using tlink /x /t 67 | does not work, I have to use tlink /x and call exe2bin after 68 | that (Watcom exe2bin) for ctmouse. However, tlink /x /t did 69 | work for the utilities! Maybe related to the map info? The 70 | ctmouse binary had 14e4 bytes _text, 2 _data, 5b9h const in 71 | the version before I run exe2bin and com2exe. While exe to 72 | com via exe sounds odd, it has use - gives smaller headers. 73 | 74 | - you cannot say ERRIF in JWASM and I could not get the "hll" 75 | (if_ loop_ etc) macros by Arkady nor the CODE_ or out_ ones 76 | to work in a syntax suitable for JWASM... 77 | 78 | - instead of PS2WHEELCODE[1] I had to say byte ptr [PS2WHEELCODE+1] 79 | 80 | Change stats: 15 files edited, 2 files removed (file.mac, hll.mac), 81 | 787 lines removed, 1538 lines added (this often means "replaced a 82 | line by a comment and added a new line"). Sum of lines of makefiles, 83 | include files and source files: 9317. Unified diff: 4981 lines. 84 | 85 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | # Macros for building, deleting ######################################## 2 | 3 | # AS=tasm -m @asmlib.cfg 4 | # the following would require that you run SET ASMLIB=... first in a .bat: 5 | # AS=jwasmd -mt @asmlib ... so we just hardcode the asmlib/ for includes 6 | AS=jwasmd -mt 7 | LINKEXE=tlink /x 8 | # using tlink /x /t would create COM but fails on jwasm made OBJ: 9 | # it says that there would be data defined below initial CS:IP... 10 | # *** LINKCOM=tlink /x /t 11 | 12 | RM=del 13 | 14 | 15 | # Rules to build files ################################################# 16 | 17 | .asm.obj: 18 | $(AS) $* 19 | .obj.exe: 20 | $(LINKEXE) $* 21 | 22 | 23 | # Targets ############################################################## 24 | 25 | all: ctmouse.exe 26 | 27 | ctmouse.exe: ctmouse.obj com2exe.exe 28 | $(LINKEXE) $*,$*.exe 29 | exe2bin $*.exe $*.bin 30 | com2exe -s512 $*.bin $*.exe 31 | 32 | ctmouse.obj: ctmouse.asm ctmouse.msg asmlib\*.* asmlib\bios\*.* \ 33 | asmlib\convert\*.* asmlib\dos\*.* asmlib\hard\*.* 34 | 35 | # ctmouse.msg: ctm-en.msg 36 | # copy ctm-en.msg ctmouse.msg 37 | 38 | 39 | # Clean up ############################################################# 40 | 41 | clean: 42 | -$(RM) ctmouse.msg 43 | -$(RM) *.obj 44 | -$(RM) ctmouse.bin 45 | # -$(RM) ctmouse.com 46 | 47 | -------------------------------------------------------------------------------- /mouse.lsm: -------------------------------------------------------------------------------- 1 | Begin3 2 | Title: CTMouse 3 | Version: 2.1b4 4 | Entered-date: 22/07/2008 5 | Description: The FreeDOS mouse driver 6 | Keywords: Mouse, mice, wheel 7 | Author: 8 | Maintained-by: Eric Auer 9 | Primary-site: 10 | Alternate-site: http://www.freedos.org 11 | Original-site: 12 | Platforms: FreeDOS 13 | Copying-policy: GPL 14 | End -------------------------------------------------------------------------------- /national.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if "%1"=="" goto syntax 3 | if "%1"=="@" goto compile 4 | if not "%2"=="" goto syntax 5 | if exist ctm-%1.msg %0 @ %1 ctm-%1 6 | 7 | echo Invalid language code! 8 | echo. 9 | 10 | :syntax 11 | echo Syntax: national "lang code" 12 | echo. 13 | echo Where "lang code" is an "EN" for English edition or suffix 14 | echo of one of other CTM-*.MSG file. Example: 15 | echo. 16 | echo %0 DE 17 | goto end 18 | 19 | :compile 20 | if not exist %2\nul md %2 21 | cd %2 22 | 23 | copy ..\%3.msg ctmouse.msg>nul 24 | call tasm -m @..\asmlib.cfg ..\ctmouse.asm 25 | if not errorlevel 1 call tlink /t /x ctmouse.obj,ctmouse.exe 26 | if not errorlevel 1 ..\com2exe -s512 ctmouse.exe ctmouse.exe 27 | if exist ctmouse.msg del ctmouse.msg>nul 28 | if exist ctmouse.obj del ctmouse.obj>nul 29 | 30 | cd .. 31 | 32 | :end 33 | -------------------------------------------------------------------------------- /protocol.txt: -------------------------------------------------------------------------------- 1 | Serial mouse reset 2 | ------------------ 3 | 4 | 1: Set UART to 'break line' state (set bit 6 in the LCR). 5 | 2: Clear the RTS and DTR (bits 0-1) in the MCR, wait a while. 6 | 3: Set the RTS and DTR bits again. 7 | 8 | 9 | Serial mouse detection (identification bytes before optional PnP data) 10 | ---------------------------------------------------------------------- 11 | 12 | In Mouse Systems mode, mouse sends nothing. 13 | In Microsoft mode, mouse sends 'M' after dropping and raising RTS. 14 | In Logitech mode, mouse sends 'M3' after dropping and raising RTS. 15 | In wheel mode, mouse sends 'MZ@',0,0,0 after dropping and raising RTS. 16 | 17 | 18 | PS/2 pointing device ID (reported after 0F2h command) 19 | ----------------------------------------------------- 20 | 21 | In standard mode, the device reports 0. 22 | In wheel mode, the device reports 3. This mode is enabled by sending a 23 | Select Report Rate 200, a Rate 100 and finally a Rate 80 command sequence. 24 | In extended mode, the device reports 4. This mode is enabled by sending a 25 | Select Report Rate 200, a Rate 200 and finally a Rate 80 command sequence. 26 | 27 | 28 | =========================================================================== 29 | Serial Mouse Systems mode: 1200 bps, 8 data bits, 1 stop bit, no parity 30 | 31 | 1st byte 2nd byte 3rd byte 32 | +---------------+ +---------------+ +---------------+ 33 | |1|0|0|0|0|L|M|R| |X|X|X|X|X|X|X|X| |Y|Y|Y|Y|Y|Y|Y|Y| 34 | +---------------+ +---------------+ +---------------+ 35 | | | | Xa movement Ya movement 36 | | | | 37 | | | | 4th byte 5th byte 38 | Left Button ------+ | | +---------------+ +---------------+ 39 | Middle Button --------+ | |X|X|X|X|X|X|X|X| |Y|Y|Y|Y|Y|Y|Y|Y| 40 | Right Button ----------+ +---------------+ +---------------+ 41 | (0 if pressed) Xb movement Yb movement 42 | 43 | 44 | Xa/Ya - movement of the mouse since last packet. 45 | Xb/Yb - movement of the mouse since Xa/Ya. 46 | Movement values are 8-bit signed twos complement integers. 47 | Positive movement value indicates motion to the right/upward. 48 | 49 | 50 | =========================================================================== 51 | Serial Microsoft mode: 1200 bps, 7 data bits, 1 stop bit, no parity 52 | 53 | 1st byte 2nd byte 3rd byte 54 | +---------------+ +---------------+ +---------------+ 55 | |0|1|L|R|Y|Y|X|X| |0|0|X|X|X|X|X|X| |0|0|Y|Y|Y|Y|Y|Y| 56 | +---------------+ +---------------+ +---------------+ 57 | | | \ / \ / \----+----/ \----+----/ 58 | | | | | | | 59 | | | +---|-------------|---------+ | 60 | | | +-----+ | | | 61 | | | / \ /----+----\ / \ /----+----\ 62 | | | +---------------+ +---------------+ 63 | Left Button -+ | | | | | | | | | | | | | | | | | | | 64 | Right Button ---+ +---------------+ +---------------+ 65 | (1 if pressed) X movement Y movement 66 | 67 | 68 | Movement values are 8-bit signed twos complement integers. 69 | Positive movement value indicates motion to the right/downward. 70 | 71 | 72 | =========================================================================== 73 | Serial Logitech mode: 1200 bps, 7 data bits, 1 stop bit, no parity 74 | 75 | 1st byte 2nd byte 3rd byte 76 | +---------------+ +---------------+ +---------------+ 77 | |0|1|L|R|Y|Y|X|X| |0|0|X|X|X|X|X|X| |0|0|Y|Y|Y|Y|Y|Y| 78 | +---------------+ +---------------+ +---------------+ 79 | | | \ / \ / \----+----/ \----+----/ 80 | | | | | | | 81 | | | +---|-------------|---------+ | 82 | | | +-----+ | | | 83 | | | / \ /----+----\ / \ /----+----\ 84 | | | +---------------+ +---------------+ 85 | Left Button -+ | | | | | | | | | | | | | | | | | | | 86 | Right Button ---+ +---------------+ +---------------+ 87 | (1 if pressed) X movement Y movement 88 | 89 | 90 | The extra byte (only when middle button is pressed) 91 | --------------------------------------------------- 92 | 93 | 4th byte 94 | +---------------+ 95 | |0|0|M|0|0|0|0|0| 96 | +---------------+ 97 | | 98 | Middle Button (1 if pressed) 99 | 100 | 101 | First three bytes are equal to Mouse mode packet. 102 | Movement values are 8-bit signed twos complement integers. 103 | Positive movement value indicates motion to the right/downward. 104 | 105 | 106 | =========================================================================== 107 | Serial Microsoft wheel mode: 1200 bps, 7 data bits, 1 stop bit, no parity 108 | 109 | 1st byte 2nd byte 3rd byte 4th byte 110 | +---------------+ +---------------+ +---------------+ +---------------+ 111 | |0|1|L|R|Y|Y|X|X| |0|0|X|X|X|X|X|X| |0|0|Y|Y|Y|Y|Y|Y| |0|0|0|M|w|w|w|w| 112 | +---------------+ +---------------+ +---------------+ +---------------+ 113 | | | \ / \ / \----+----/ \----+----/ | \--+--/ 114 | | | | | | | | | 115 | | | +---|-------------|---------+ | | | 116 | | | +-----+ | | | | Wheel 117 | | | / \ /----+----\ / \ /----+----\ | Movement 118 | | | +---------------+ +---------------+ | 119 | Left Button -+ | | | | | | | | | | | | | | | | | | | | 120 | Right Button ---+ +---------------+ +---------------+ Middle Button 121 | (1 if pressed) X movement Y movement (1 if pressed) 122 | 123 | 124 | First three bytes are equal to Mouse mode packet. 125 | Movement values are 8-bit signed twos complement integers. 126 | Positive movement value indicates motion to the right/downward. 127 | Wheel movement is a 4-bit signed twos complement integer. 128 | Positive wheel movement value indicates rotation downward. 129 | 130 | 131 | =========================================================================== 132 | PS/2 standard mode protocol: 133 | 134 | 1st byte 2nd byte 3rd byte 135 | +---------------+ +---------------+ +---------------+ 136 | |?|?|Y|X|1|M|R|L| |X|X|X|X|X|X|X|X| |Y|Y|Y|Y|Y|Y|Y|Y| 137 | +---------------+ +---------------+ +---------------+ 138 | | | | | | \------+------/ \------+------/ 139 | | | | | | | | 140 | +-|---|-|-|----------|-----------+ | 141 | +---|-|-|--+ | | | 142 | | | | | /-----+-------\ | /---+---------\ 143 | Middle Button ------+ | | +-----------------+ +-----------------+ 144 | Right Button --------+ | | | | | | | | | | | | | | | | | | | | | 145 | Left Button ----------+ +-----------------+ +-----------------+ 146 | (1 if pressed) X movement Y movement 147 | 148 | 149 | Two most significant bits in first byte indicate overflow (more than 9 bits 150 | of movement) in each direction. Usually ignored. 151 | Movement values are 9-bit signed twos complement integers. 152 | Positive movement value indicates motion to the right/upward. 153 | 154 | 155 | =========================================================================== 156 | PS/2 wheel mode protocol: 157 | 158 | 1st byte 2nd byte 3rd byte 4th byte 159 | +---------------+ +---------------+ +---------------+ +---------------+ 160 | |?|?|Y|X|1|M|R|L| |X|X|X|X|X|X|X|X| |Y|Y|Y|Y|Y|Y|Y|Y| |w|w|w|w|W|W|W|W| 161 | +---------------+ +---------------+ +---------------+ +---------------+ 162 | | | | | | \------+------/ \------+------/ \-------+-----/ 163 | | | | | | | | | 164 | +-|---|-|-|----------|-----------+ | | 165 | +---|-|-|--+ | | | | 166 | | | | | /-----+-------\ | /---+---------\ | 167 | Middle Button ------+ | | +-----------------+ +-----------------+ | 168 | Right Button --------+ | | | | | | | | | | | | | | | | | | | | | | 169 | Left Button ----------+ +-----------------+ +-----------------+ Wheel 170 | (1 if pressed) X movement Y movement Movement 171 | 172 | 173 | First three bytes are equal to PS/2 standard mode packet. 174 | Two most significant bits in first byte indicate overflow (more than 9 bits 175 | of movement) in each direction. Usually ignored. 176 | Movement values are 9-bit signed twos complement integers. 177 | Positive movement value indicates motion to the right/upward. 178 | Wheel movement is a 8-bit signed twos complement integer and usually 179 | limited by -8..+7 range (4-bit value). 180 | Positive wheel movement value indicates rotation downward. 181 | 182 | 183 | =========================================================================== 184 | PS/2 extended mode protocol: 185 | 186 | 1st byte 2nd byte 3rd byte 4th byte 187 | +---------------+ +---------------+ +---------------+ +---------------+ 188 | |?|?|Y|X|1|M|R|L| |X|X|X|X|X|X|X|X| |Y|Y|Y|Y|Y|Y|Y|Y| |0|0|B|F|W|W|W|W| 189 | +---------------+ +---------------+ +---------------+ +---------------+ 190 | | | | | | \------+------/ \------+------/ | | \--+--/ 191 | | | | | | | | | | | 192 | +-|---|-|-|----------|-----------+ | | | | 193 | +---|-|-|--+ | | | | | Wheel 194 | | | | | /-----+-------\ | /---+---------\ | | Movement 195 | Middle Button ------+ | | +-----------------+ +-----------------+ | | 196 | Right Button --------+ | | | | | | | | | | | | | | | | | | | | | | +- Forward Button 197 | Left Button ----------+ +-----------------+ +-----------------+ +--- Back Button 198 | (1 if pressed) X movement Y movement (1 if pressed) 199 | 200 | 201 | First three bytes are equal to PS/2 standard mode packet. 202 | Two most significant bits in first byte indicate overflow (more than 9 bits 203 | of movement) in each direction. Usually ignored. 204 | Movement values are 9-bit signed twos complement integers. 205 | Positive movement value indicates motion to the right/upward. 206 | Wheel movement is a 4-bit signed twos complement integer. 207 | Positive wheel movement value indicates rotation downward. 208 | -------------------------------------------------------------------------------- /technote.txt: -------------------------------------------------------------------------------- 1 | Mouse driver services 2 | --------------------- 3 | 4 | Functions implemented in CTMOUSE: 5 | 6 | INT 33/0000 - MS MOUSE - Reset driver and read status 7 | INT 33/0001 - MS MOUSE v1.0+ - Show mouse cursor 8 | INT 33/0002 - MS MOUSE v1.0+ - Hide mouse cursor 9 | INT 33/0003 - WheelAPI v1.0+ - Get cursor position, buttons status and wheel counter 10 | INT 33/0004 - MS MOUSE v1.0+ - Position mouse cursor 11 | INT 33/0005 - WheelAPI v1.0+ - Get button press or wheel movement data 12 | INT 33/0006 - WheelAPI v1.0+ - Get button release or wheel movement data 13 | INT 33/0007 - MS MOUSE v1.0+ - Set horizontal cursor range 14 | INT 33/0008 - MS MOUSE v1.0+ - Set vertical cursor range 15 | INT 33/0009 - MS MOUSE v3.0+ - Define graphics cursor 16 | INT 33/000A - MS MOUSE v3.0+ - Define text cursor 17 | INT 33/000B - MS MOUSE v1.0+ - Get motion counters 18 | INT 33/000C - MS MOUSE v1.0+ - Define User Interrupt Routine 19 | INT 33/000F - MS MOUSE v1.0+ - Set mickeys/pixels ratios 20 | INT 33/0010 - MS MOUSE v1.0+ - Define screen region for updating 21 | INT 33/0011 - WheelAPI v1.0+ - Check wheel support and get capabilities flags 22 | INT 33/0014 - MS MOUSE v3.0+ - Exchange User Interrupt Routines 23 | INT 33/0015 - MS MOUSE v6.0+ - Get driver storage requirements 24 | INT 33/0016 - MS MOUSE v6.0+ - Save driver state 25 | INT 33/0017 - MS MOUSE v6.0+ - Restore driver state 26 | INT 33/001A - MS MOUSE v6.0+ - Set mouse sensitivity 27 | INT 33/001B - MS MOUSE v6.0+ - Get mouse sensitivity 28 | INT 33/001E - MS MOUSE v6.0+ - Get display page 29 | INT 33/001F - MS MOUSE v6.0+ - Disable mouse driver 30 | INT 33/0020 - MS MOUSE v6.0+ - Enable mouse driver 31 | INT 33/0021 - MS MOUSE v6.0+ - Software reset 32 | INT 33/0023 - MS MOUSE v6.0+ - Get language for messages 33 | INT 33/0024 - MS MOUSE v6.26+ - Get software version, mouse type and IRQ 34 | INT 33/0026 - MS MOUSE v6.26+ - Get maximum virtual screen coordinates 35 | INT 33/0027 - MS MOUSE v7.01+ - Get screen/cursor masks and mickey counters 36 | INT 33/0028 - MS MOUSE v7.0+ - Set video mode 37 | INT 33/002A - MS MOUSE v7.02+ - Get cursor hot spot 38 | INT 33/0031 - MS MOUSE v7.05+ - Get current virtual cursor coordinates 39 | INT 33/0032 - MS MOUSE v7.05+ - Get supported advanced functions flag 40 | INT 33/004D - MS MOUSE - Get pointer to copyright string 41 | INT 33/006D - MS MOUSE - Get pointer to version 42 | 43 | Video functions implemented in CTMOUSE: 44 | 45 | INT 10/F0 - EGA Register Interface Library - Read one register 46 | INT 10/F1 - EGA Register Interface Library - Write one register 47 | INT 10/F2 - EGA Register Interface Library - Read register range 48 | INT 10/F3 - EGA Register Interface Library - Write register range 49 | INT 10/F4 - EGA Register Interface Library - Read register set 50 | INT 10/F5 - EGA Register Interface Library - Write register set 51 | INT 10/F6 - EGA Register Interface Library - Revert registers to default 52 | INT 10/F7 - EGA Register Interface Library - Define registers default 53 | INT 10/FA - EGA Register Interface Library - Interrogate driver 54 | 55 | The following functions are not implemented but they don't return 56 | anything and can be counted as implemented: 57 | 58 | INT 33/000D - MS MOUSE v1.0+ - Light pen emulation ON 59 | INT 33/000E - MS MOUSE v1.0+ - Light pen emulation OFF 60 | INT 33/0013 - MS MOUSE v5.0+ - Define double-speed threshold 61 | INT 33/001C - MS MOUSE v6.0+ - Set interrupt rate 62 | INT 33/001D - MS MOUSE v6.0+ - Set display page 63 | INT 33/0022 - MS MOUSE v6.0+ - Set language for messages 64 | 65 | The following functions are not implemented: 66 | 67 | INT 10/04 - VIDEO - Get light pen position (except VGA) 68 | INT 33/0012 - MS MOUSE - Set large graphics cursor block 69 | INT 33/0018 - MS MOUSE v6.0+ - Set alternate User Interrupt Routine 70 | INT 33/0019 - MS MOUSE v6.0+ - Get alternate User Interrupt Routine 71 | INT 33/0025 - MS MOUSE v6.26+ - Get general driver information 72 | INT 33/0029 - MS MOUSE v7.0+ - Enumerate video modes 73 | INT 33/002B - MS MOUSE v7.0+ - Load acceleration profiles 74 | INT 33/002C - MS MOUSE v7.0+ - Get acceleration profiles 75 | INT 33/002D - MS MOUSE v7.0+ - Select acceleration profile 76 | INT 33/002E - MS MOUSE v8.10+ - Set acceleration profile names 77 | INT 33/002F - MS MOUSE v7.02+ - Mouse hardware reset 78 | INT 33/0030 - MS MOUSE v7.04+ - Get/Set BallPoint information 79 | INT 33/0033 - MS MOUSE v7.05+ - Get switch settings and acceleration profile data 80 | INT 33/0034 - MS MOUSE v8.0+ - Get initialization file 81 | INT 33/0035 - MS MOUSE v8.10+ - LCD screen large pointer support 82 | 83 | 84 | Details of driver operation 85 | --------------------------- 86 | 87 | CTMOUSE displays the cursor only in standard video modes of CGA, EGA and 88 | VGA; Hercules Graphics/InColor Card or SVGA/VESA extended video modes 89 | are not supported but an application can display the cursor by itself in 90 | a user interrupt routine (may be installed by INT 33/000C function) or 91 | when idle. Remember to remove calls to INT 33/0001 (Show cursor) and 92 | define cursor movement limits (INT 33/0007 and INT 33/0008). 93 | 94 | Some applications call INT 33/0001 (Show cursor), INT 33/0009 (Define 95 | graphics cursor) and INT 33/000A (Define text cursor) in loops. To 96 | prevent cursor flickering INT 33/0001 function redraws cursor only if it 97 | was hidden before and INT 33/0004 (Position cursor), INT 33/0009 and 98 | INT 33/000A functions redraw cursor only if its position or pattern 99 | has changed. 100 | 101 | Unlike many other mouse drivers, CTMOUSE doesn't require call INT 33/0002 102 | (Hide cursor) or INT 33/0010 (Define region for updating) before writing 103 | to the screen in text mode because screen under cursor isn't restored if 104 | cursor is overwritten. However CTMOUSE can't correct all cases of cursor 105 | overwriting: when a character is written at the cursor position without 106 | an attribute, (through INT 10/0E (Teletype output) or INT 21), then it 107 | gets the cursor's attribute. Also, if cursor is overwritten by character 108 | with attribute which is equal to cursor's character/attribute then 109 | CTMOUSE restores the old character/attribute. 110 | 111 | Unlike Microsoft's specification, CTMOUSE always displays cursor on the 112 | active video page and doesn't require call INT 33/001D (Set display 113 | page) at all; this function is, anyway, a dummy. 114 | 115 | Below is a table of virtual screen size, cursor movement granularity and 116 | minimum/maximum size of region on the screen, occupied by cursor (actual 117 | for INT 33/0010) for each video mode: 118 | min max 119 | mode screen cell shape shape 120 | *0 640x200 16x8 16x8 16x8 121 | *1 640x200 16x8 16x8 16x8 122 | *2 640x200 8x8 8x8 8x8 123 | *3 640x200 8x8 8x8 8x8 124 | 4 640x200 2x1 16x16 24x16 125 | 5 640x200 2x1 16x16 24x16 126 | 6 640x200 1x1 16x16 24x16 127 | *7 640x200 8x8 8x8 8x8 128 | 0Dh 640x200 2x1 32x16 48x16 129 | 0Eh 640x200 1x1 16x16 24x16 130 | 0Fh 640x350 1x1 16x16 24x16 131 | 10h 640x350 1x1 16x16 24x16 132 | 11h 640x480 1x1 16x16 24x16 133 | 12h 640x480 1x1 16x16 24x16 134 | 13h 640x200 2x1 32x16 32x16 135 | other 640x200 1x1 - - 136 | 137 | * for text modes, the virtual screen size is given for standard screen 138 | sizes 40x25 and 80x25; for other screen sizes the corresponding virtual 139 | screen size is changed accordingly. 140 | 141 | In standard text modes, CTMOUSE supports any screen size beside 40x25 and 142 | 80x25. It sets virtual screen size as [screen width in characters]*8 by 143 | [screen height in characters]*8 (except video modes 0-1, where width is 144 | multiplied by 16) each time when the video mode or the screen size is 145 | changed or INT 33/0000 (Reset driver), INT 33/0020 (Enable driver) or 146 | INT 33/0021 (Software reset) are called. 147 | 148 | CTMOUSE intercepts only INT 10/0 (Set video mode), INT 10/111x (Load and 149 | activate font) and INT 10/4F02 (Set VESA/SVGA video mode) functions. If 150 | screen size in text mode changed by other functions like INT 10/1Ch (VGA 151 | state save/restore) or by direct hardware programming, then INT 33/0000 152 | (Reset driver), INT 33/0020 (Enable driver) or INT 33/0021 (Software 153 | reset) must be called to renew virtual screen size. If INT 33/0020 only 154 | is called then INT 33/0007 (Set horizontal range) and INT 33/0008 (Set 155 | vertical range) also should be called with min=0 and max=[8*screen 156 | width-1,8*screen height-1] to enable the complete screen for cursor 157 | movement. 158 | 159 | INT 33/0007 (Set horizontal range) and INT 33/0008 (Set vertical range) 160 | functions setup cursor movement area but cursor will be seen on the 161 | screen only in standard video modes and when cursor shape intersects 162 | with virtual screen coordinates. 163 | 164 | All driver's coordinates (ranges, cursor positions, regions) interpreted 165 | as signed values, also as cursor hot spot or mickey counts. 166 | 167 | 168 | Notes for mouse driver services 169 | ------------------------------- 170 | 171 | For bitmapped graphics modes 4-6 and 0Dh-12h a peculiarity of INT 33/0010 172 | (Define region for updating) function should be noted: horizontal cursor 173 | position is always aligned by modulo 8 or 16 and cursor occupies 24 or 174 | 48 positions, unlike mode 13h, where start position is unchanged and 175 | cursor occupies 32 positions; i.e. for left limit L and right limit R in 176 | modes 4-6, 0Eh-12h cursor will be hidden between (L-L%8)-16 and 177 | [R/8+1]*8-1 positions, in mode 0Dh cursor will be hidden between 178 | (L-L%16)-32 and [R/16+1]*16-1 positions and in mode 13h cursor will be 179 | hidden between L-32 and R positions. 180 | 181 | To set update region via INT 33/0010 in terms of character positions you 182 | must compute arguments as CX=left*W, DX=top*8, SI=(right+1)*W-1 and 183 | DI=(bottom+1)*W-1, where W=16 for modes 0-1, 4-5, 0Dh and 13h and W=8 184 | for all other modes. 185 | 186 | Size of buffer, required to save driver state by INT 33/0016, in CTMOUSE 187 | is less than 180 bytes; exact buffer size is returned by INT 33/0015 188 | (Get driver storage requirements). 189 | 190 | INT 33/0016 (Save driver state) and INT 33/0017 (Restore driver state) 191 | functions save and restore user defined variables (mickeys per 8 pixels, 192 | user interrupt routine call mask and address), cursor definition (cursor 193 | type, text and graphics shape, visibility, position, ranges and update 194 | region) and mouse access state (mickeys mouse moved, buttons press and 195 | release status since last access). These functions don't affect driver 196 | state (disabled flag, resolution level), mouse definition (mouse type, 197 | buttons count, IO address and interrupt), video mode definition (maximum 198 | virtual screen coordinates, EGA RIL register values) and dummy variables 199 | (lightpen emulation status and double speed threshold). 200 | 201 | When the video mode after INT 10/0 or INT 10/4F02 or screen size after 202 | INT 10/111x is changed, CTMOUSE hides cursor so that it can be shown by 203 | next INT 33/0001, recalculates screen sizes, sets cursor ranges to 204 | virtual screen sizes and centers cursor. 205 | 206 | INT 33/0000 (Reset driver) and INT 33/0021 (Software reset) functions hide 207 | cursor (so that it can be shown by next INT 33/0001), recalculate screen 208 | sizes, set cursor ranges to screen sizes, center cursor and clear mickey 209 | counts, user interrupt routine call mask, button press/release and wheel 210 | data. In addition, horizontal mickeys per 8 pixels ratio is set to 8, 211 | vertical mickeys per 8 pixels ratio is set to 16, software text mode 212 | cursor is set with reverse video shape (screen mask 77FFh, cursor mask 213 | 7700h) and graphics mode cursor shape is set to arrow with zero hot spot. 214 | 215 | INT 33/001F (Disable driver) function hides cursor so that it can be shown 216 | by next INT 33/0001, disables mouse, restores IRQ interrupt (for serial 217 | mouse) and returns in ES:BX the old INT 33 interrupt handler address. If 218 | INT 33 or INT 10 interrupt was intercepted by another program then on 219 | exit AX will contain -1, else if INT 10 interrupt handler was not 220 | restored yet then it will be restored. 221 | 222 | INT 33/0020 (Enable driver) function installs IRQ handler (if serial mouse 223 | is active) and INT 10 handler (if it is not yet installed), enables 224 | mouse interrupts, recalculates screen sizes, sets cursor ranges to 225 | screen sizes and centers cursor. 226 | 227 | CTMOUSE supports INT 33/0022 and 0023 (Set/get language for messages) 228 | functions, but only for English. 229 | 230 | When you have to deal with RIL, keep in mind that RIL is unprotected from 231 | wrong user input - RIL functions should be called only in standard video 232 | modes and on EGA or later video adapters, and RIL doesn't check if group 233 | index, register number or count of registers are valid. 234 | 235 | 236 | Asynchronous execution and User Interrupt Routine (UIR) 237 | ------------------------------------------------------ 238 | 239 | UIR installed via INT 33/000C (Define UIR) or INT 33/0014 (Exchange UIRs) 240 | must use far RET (not IRET) for return and it is not required to keep 241 | any register value except SS:SP. 242 | 243 | Mouse interrupt handler (IH) redraws cursor on the screen only when the 244 | called UIR returns to IH. If new mouse events occur before UIR returns 245 | to IH, then IH will not redraw cursor and call UIR again (i.e. UIR is 246 | not required to be re-enterable). However, mouse events themselves 247 | will be parsed and reflected in driver state, so driver state (cursor 248 | position, buttons state) may be changed before UIR returns. Therefore, 249 | UIR should be aware of a possible difference between initial arguments 250 | and values returned by driver functions. 251 | 252 | Driver functions will not hide or redraw cursor if they are called while 253 | cursor hidding or drawing routines in the driver are already working. 254 | This means that cursor will not be redrawn by requests from UIR or any 255 | other general purpose hardware interrupt handler, if they are executed 256 | while cursor redrawing was in progress (this will look like cursor on 257 | the screen freezes). But hidding or drawing routines will be called 258 | again when they finish their first request if new request comes in 259 | from interrupt handlers while they are working. 260 | 261 | When bit 0 ("call if mouse moves") is set in the UIR call mask then UIR 262 | will be called when any mickey count is changed. Note: cursor position 263 | usually changes less often than mickey counts because mickeys per 8 264 | pixels ratios can reduce mickeys change to zero and cursor position 265 | change can be hidden by granulation (in text modes cursor positions are 266 | always factor of 8 or 16; in some graphics modes X cursor positions are 267 | always factor of two). 268 | 269 | 270 | Used BIOS variables 271 | ------------------- 272 | 273 | 0:449h bits 0-6 used to determine the current video mode (when driver 274 | enabled by INT 33/0020 or video mode changed) 275 | 0:44Ah screen width in text columns (used to compute offset in video 276 | memory in text video modes) 277 | 0:44Eh offset in video segment of active video memory page 278 | 0:462h current video page (returned by INT 33/001E) 279 | 0:463h used to compute CRTC base and Feature Control video ports addresses 280 | (when driver enabled by INT 33/0020 or video mode changed) 281 | 0:46Ch timer used in mouse detection routine to make timing 282 | 0:487h bits 5-6 used to determine RAM size on video adapter (when driver 283 | enabled by INT 33/0020 or video mode changed) 284 | 0:488h bits 0-3 used to get video configuration switches (when driver 285 | enabled by INT 33/0020 or video mode changed) 286 | 0:4A8h used to get default video registers values for RIL (when driver 287 | enabled by INT 33/0020 or video mode changed) 288 | 289 | 290 | Used interrupts 291 | --------------- 292 | 293 | INT 10/01 setup text-mode hardware cursor shape, when hardware 294 | cursor selected 295 | INT 10/1A00 get DCC to check VGA presence 296 | INT 15/C200 enable/disable PS/2 pointing device 297 | INT 15/C203 set resolution of PS/2 pointing device [when PS/2 checking] 298 | INT 15/C205 initialize PS/2 pointing device [when PS/2 checking] 299 | INT 15/C207 set handler for PS/2 pointing device 300 | INT 21/09 output all strings to standard output 301 | INT 21/25 install interrupt handlers for INT 33, INT 10 and IRQ 302 | handler, also restore those interrupts 303 | INT 21/26 create new PSP for driver image in the UMB [when trying to 304 | install driver high] 305 | INT 21/31 remain TSR when driver not copied to other UMB segment 306 | INT 21/35 save old INT 33, INT 10 and IRQ handlers addresses 307 | INT 21/48 allocate UMB memory [when trying to install driver high] 308 | INT 21/49 free memory used by environment and by unloaded TSR 309 | INT 21/4C terminate program with nonzero errorlevel if some error 310 | found or with zero errorlevel when no errors 311 | INT 21/58 modify memory allocation strategy [when trying to install 312 | driver high] 313 | INT 2F/4310 get XMS driver entry [when trying to install driver high] 314 | INT 33/001F disable previous mouse driver, if one is present 315 | INT 33/0020 enable previous mouse driver after unloading CuteMouse 316 | INT 33/004D check if installed driver is CuteMouse 317 | 318 | 319 | Techniques used 320 | --------------- 321 | 322 | 1. Two writes to adjacent I/O ports are combined into one write "out dx,ax" 323 | (used for most video registers, divisor latch of COM port, etc). 324 | 325 | 2. For interrupt handler's address comparision only segment of address is 326 | used, because usually different programs reside in different segments 327 | and no one program is pointed to by zero segment. 328 | 329 | 3. CuteMouse uses a lot of self-modifying code and many variables are 330 | placed in the code instructions; most of code modification is grouped 331 | in the setupdriver and softreset_21 procedures. 332 | 333 | 4. To use free part of PSP and thus minimize memory footprint, CuteMouse 334 | source includes corresponding "ORG" statement before uninitialized 335 | variables, for which only offsets are computed and no data is generated. 336 | Note: in TASM 3.1, a structure instance with "DUP(?)" generates data 337 | (fixed in TASM 4.1), so buttpress and buttrelease arrays are defined 338 | without "DUP" as series of BUTTLASTSTATE structure insertions instead. 339 | 340 | 5. CuteMouse is written using TASM and makes use some of TASM features: 341 | for example, multiple "push" and "pop" in one line ("push ax bx") and 342 | shifts with an immediate value >1 ("shl ax,2"), which are converted 343 | into several opcodes valid for 8086/8088 CPUs (i.e. for shifts, TASM 344 | simply duplicates them - "shl ax,1/shl ax,1"), because there is no 345 | ".186" or higher statement. 346 | 347 | 6. Often instructions with shorter opcode but slightly different behavior 348 | than assumed instruction are used to minimize code; each such use is 349 | marked by "OPTIMIZE" comment. In addition, instructions for which 350 | functions are performed by previous code remain in the source as 351 | comments; this is done for greater readability and to ease code 352 | carrying. 353 | 354 | 7. To ease code pipelining in CPU, instructions which manipulate common 355 | registers or other resources are interspersed with other kinds of 356 | instructions whenever possible. For example: 357 | 358 | mov ax,cx mov ax,cx 359 | add ax,bx neg dx 360 | neg dx add ax,bx 361 | 362 | here second variant is preferred. 363 | -------------------------------------------------------------------------------- /utility/comtest.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/utility/comtest.asm -------------------------------------------------------------------------------- /utility/display.asm: -------------------------------------------------------------------------------- 1 | ; ### This file is taken from FDAPM, by Eric Auer. Uses NASM Syntax. 2 | ; FDAPM is free software; you can redistribute it and/or modify it 3 | ; under the terms of the GNU General Public License as published 4 | ; by the Free Software Foundation; either version 2 of the License, 5 | ; or (at your option) any later version. See http://www.gnu.org/ 6 | ; ### FDAPM does not come with ANY warranty...! 7 | ; hex2dec convert AX to bcd, with saturation to 9999h 8 | ; showal/showax write hex AL / AX to stdout, strip leading 0s 9 | ; showalFull/showaxFull write AL / AX ... do not strip leading 0s 10 | ; showtty write AL to stdout, as char 11 | 12 | hex2dec: ; take a value AX and convert to packed BCD 13 | push bx ; modified, taken from LBAcache. 14 | push cx 15 | push dx 16 | push di 17 | xor dx,dx 18 | xor cx,cx ; shift counter 19 | xor di,di ; result 20 | mov bx,10 21 | h2dlp: div bx ; remainder in dx, 0..9 22 | shl dx,cl ; move to position 23 | or di,dx ; store digit 24 | xor dx,dx ; make dx:ax a proper value again 25 | or ax,ax ; done? 26 | jz h2dend 27 | add cl,4 ; next digit 28 | cmp cl,16 ; digit possible? 29 | jb h2dlp ; otherwise overflow 30 | h2doverflow: 31 | mov di,9999h ; overflow 32 | h2dend: mov ax,di ; return packed BCD 33 | pop di 34 | pop dx 35 | pop cx 36 | pop bx 37 | ret 38 | 39 | showax: ; show AX in HEX, strip at most 3 leading 0s 40 | xchg al,ah 41 | or al,al 42 | jz showaxshort ; skip leading zeroes 43 | call showal ; DO strip here 44 | xchg al,ah 45 | call showalFull ; do NOT strip here 46 | ret 47 | 48 | showaxFull: ; show AX in HEX, do not strip leading 0s 49 | xchg al,ah 50 | call showalFull ; do NOT strip here 51 | xchg al,ah 52 | call showalFull ; do NOT strip here 53 | ret 54 | 55 | showaxshort: 56 | xchg al,ah 57 | call showal ; DO strip here 58 | ret 59 | 60 | showalFull: ; show AL in HEX, do NOT strip leading 0s 61 | push ax 62 | push cx 63 | xor cx,cx ; strip nothing 64 | jmp short showal2 65 | 66 | showal: ; show AL in HEX, strip at most 1 leading 0 67 | push ax 68 | push cx 69 | mov ch,'0' ; strip if '0' 70 | showal2: 71 | push dx 72 | mov dl,al 73 | mov cl,4 74 | shr dl,cl 75 | add dl,'0' 76 | cmp dl,'9' 77 | jbe showAL1 78 | add dl,7 ; 'A'-('0'+10) ; ... which is 7 79 | showAL1: 80 | push ax 81 | cmp dl,ch ; strip this? 82 | jz showshortAL ; strip leading zero / leading "impossible" 83 | mov ah,2 ; char DL to stdout 84 | int 21h 85 | showshortAL: 86 | pop ax 87 | and al,15 88 | mov dl,al 89 | add dl,'0' 90 | cmp dl,'9' 91 | jbe showAL2 92 | add dl,7 ; 'A'-('0'+10) ; ... which is 7 93 | showAL2: 94 | mov ah,2 ; char DL to stdout 95 | int 21h 96 | pop dx 97 | pop cx 98 | pop ax 99 | ret 100 | 101 | showtty: ; char AL to TTY (stdout would be dl=al ah=2 int 21h) 102 | push ax 103 | push bx 104 | mov bx,000fh ; page, color 105 | mov ah,0eh ; char AL to TTY 106 | int 10h 107 | pop bx 108 | pop ax 109 | ret 110 | 111 | -------------------------------------------------------------------------------- /utility/makefile: -------------------------------------------------------------------------------- 1 | # Macros for building, deleting ######################################## 2 | 3 | # AS=tasm -m @..\asmlib.cfg 4 | # AS=jwasmd -mt @asmlib ... so we just hardcode the asmlib/ for includes 5 | AS=jwasmd -mt 6 | # CC=tcc 7 | # CFLAGS = -IC:\TC\INCLUDE -LC:\TC\LIB -f -c -w -ms -a- -k- -N- -d -O -O2 8 | # CFLAGS=-IC:\TC\INCLUDE -LC:\TC\LIB -N -w -a- -f- -f87- -ms -r- 9 | LINKEXE=tlink /x 10 | LINKCOM=tlink /x /t 11 | 12 | RM=del 13 | 14 | 15 | # Rules to build files ################################################# 16 | 17 | # .c.obj: 18 | # $(CC) $(CFLAGS) $* 19 | .asm.obj: 20 | $(AS) $* 21 | .obj.com: 22 | $(LINKCOM) $* 23 | .obj.exe: 24 | $(LINKEXE) $* 25 | 26 | 27 | # Targets ############################################################## 28 | 29 | all: comtest.com protocol.com mousetst.com 30 | 31 | # com does not link... 32 | comtest.com: comtest.obj 33 | 34 | # com does not link... 35 | protocol.com: protocol.obj 36 | 37 | # mousetst.exe: mousetst.obj prf.obj 38 | # for com use -mt -lt 39 | # mousetst.exe: mousetst.c prf.c 40 | # tcc -N -w -a- -f- -f87- -ms -r- \ 41 | # -IC:\TC\INCLUDE -LC:\TC\LIB mousetst prf 42 | # *** mousetst.exe: mousetst.c 43 | # *** tcc -N -w -a- -f- -f87- -ms -r- \ 44 | # *** -IC:\TC\INCLUDE -LC:\TC\LIB mousetst 45 | 46 | mousetst.com: mousetst.asm display.asm 47 | nasm -o mousetst.com mousetst.asm 48 | 49 | comtest.obj: comtest.asm ..\asmlib\asm.mac ..\asmlib\bios\area0.def \ 50 | ..\asmlib\macro.mac \ 51 | ..\asmlib\convert\digit.mac ..\asmlib\convert\count2x.mac \ 52 | ..\asmlib\dos\io.mac ..\asmlib\dos\mem.mac \ 53 | ..\asmlib\hard\pic8259a.def ..\asmlib\hard\uart.def 54 | 55 | protocol.obj: protocol.asm ..\asmlib\asm.mac ..\asmlib\bios\area0.def \ 56 | ..\asmlib\macro.mac ..\asmlib\code.def ..\asmlib\code.mac \ 57 | ..\asmlib\convert\digit.mac ..\asmlib\convert\count2x.mac \ 58 | ..\asmlib\dos\io.mac ..\asmlib\dos\mem.mac \ 59 | ..\asmlib\hard\pic8259a.def ..\asmlib\hard\uart.def 60 | 61 | # mousetst.obj: mousetst.c 62 | # prf.obj: prf.c 63 | 64 | 65 | # Clean up ############################################################# 66 | 67 | clean: 68 | -$(RM) *.obj 69 | 70 | 71 | -------------------------------------------------------------------------------- /utility/mousetst.asm: -------------------------------------------------------------------------------- 1 | ; ### This file is part of MOUSETST, by Eric Auer. Uses NASM Syntax. 2 | ; MOUSETST is free software; you can redistribute it and/or modify it 3 | ; under the terms of the GNU General Public License as published 4 | ; by the Free Software Foundation; either version 2 of the License, 5 | ; or (at your option) any later version. See http://www.gnu.org/ 6 | ; ### MOUSETST does not come with ANY warranty...! 7 | 8 | org 100h ; a com file 9 | 10 | ; one could check if the int 33 vector is 0:0 first 11 | 12 | xor bp,bp 13 | mov ax,11h ; test for wheel support 14 | int 33h 15 | cmp ax,574dh ; "WM" 16 | jnz nowheelsupport 17 | or bp,1 ; "have wheel support in driver" 18 | test cx,1 19 | jz nowheelpresent 20 | or bp,2 ; "this mouse has a wheel" 21 | nowheelpresent: 22 | nowheelsupport: 23 | mov [cs:wheels],bp 24 | 25 | call fillscreen 26 | call hookmouse 27 | 28 | key_loop: 29 | mov ax,[cs:buttons] 30 | or ax,ax 31 | jns no_update_screen 32 | and ax,7fffh 33 | mov [cs:buttons],ax 34 | update_screen: 35 | call showstatus 36 | no_update_screen: 37 | mov ah,1 ; check for keystroke 38 | int 16h 39 | jz key_loop ; no key pressed 40 | mov ah,0 ; fetch key 41 | int 16h 42 | ; hotkeys: ESCape, mode 0..9, Show +/s, Hide -/h, Reset, Window, 43 | ; fonts x..z, 44 | cmp ah,1 ; ESC? 45 | jz exit 46 | cmp al,27 ; ESC? 47 | jnz no_exit 48 | exit: 49 | mov dx, handler ; bogus, no longer called 50 | ; ES already is segment handler 51 | xor cx,cx ; event mask: no events 52 | mov ax,0ch ; install handler 53 | int 33h 54 | mov ax,3 ; text mode, clear screen 55 | int 10h 56 | mov ah,9 ; show string 57 | mov dx,version ; offset 58 | int 21h 59 | mov ax,4c00h ; exit, errorlevel 0 60 | int 21h 61 | no_exit: 62 | cmp al,'s' 63 | jnz no_show 64 | m_show: mov ax,1 ; show mouse cursor 65 | int 33h 66 | jmp key_loop 67 | no_show: 68 | cmp al,'h' 69 | jnz no_hide 70 | m_hide: mov ax,2 ; hide mouse cursor 71 | int 33h 72 | jmp key_loop 73 | no_hide: 74 | cmp al,30h ; digit? 75 | jb no_digit 76 | cmp al,37h ; at most 7 (modes 0..7 supported) 77 | ja no_digit 78 | sub al,30h ; convert to hex 79 | mode_common: 80 | mov ah,0 ; set mode 81 | int 10h 82 | call fillscreen 83 | jmp update_screen 84 | no_digit: 85 | cmp al,'r' 86 | jnz no_r 87 | mov ax,0 ; reset driver, install check 88 | int 33h 89 | cmp ax,-1 90 | jz have_mouse 91 | jmp exit ; no driver present! 92 | have_mouse: 93 | ; also returns BX button count, 0 or -1 can mean "2" 94 | call hookmouse ; activate handler again 95 | ; cursor is invisible after reset, so you want to hit + next 96 | jmp key_loop 97 | no_r: 98 | cmp al,'w' 99 | jnz no_w 100 | mov cx,-40 101 | mov dx,640+40 102 | mov ax,7 ; set window limits / X range 103 | int 33h 104 | mov cx,-20 105 | mov dx,480+20 106 | mov ax,8 ; set window limits / Y range 107 | int 33h 108 | ; you may want to enable the cursor again next 109 | jmp key_loop 110 | no_w: 111 | cmp al,'x' 112 | jnz no_x 113 | mov ax,1112h ; select font 8x8 114 | font_common: 115 | mov bl,0 116 | int 10h 117 | call fillscreen 118 | mov ax,21h ; software reset 119 | int 33h 120 | call hookmouse 121 | mov ax,1 ; show cursor 122 | int 33h 123 | jmp key_loop 124 | no_x: 125 | cmp al,'y' 126 | jnz no_y 127 | mov ax,1111h ; select font 8x14 128 | jmp short font_common 129 | no_y: 130 | cmp al,'z' 131 | jnz no_z 132 | mov ax,1114h ; select font 8x16 133 | jmp short font_common 134 | no_z: 135 | cmp al,'a' 136 | jb no_xmode 137 | cmp al,'g' 138 | ja no_xmode 139 | sub al,'a' 140 | add al,13 ; a..g -> modes 13..19 (0d..13 hex) 141 | jmp mode_common 142 | no_xmode: 143 | jmp key_loop 144 | 145 | 146 | 147 | 148 | hookmouse: ; activate handler. destroys regs! 149 | mov dx, handler ; offset 150 | ; ES already is segment handler 151 | mov cx,-1 ; event mask: all events 152 | mov ax,0ch ; install handler 153 | int 33h 154 | ret 155 | 156 | 157 | handler: ; store registers for later use and return 158 | ; mov [cs:hand_ax],ax ; event bits 159 | mov [cs:buttons],bx ; buttons - high byte is wheel info 160 | mov [cs:column],cx ; column 161 | mov [cs:row],dx ; row 162 | ; mov [cs:hand_si],si ; delta X 163 | ; mov [cs:hand_di],di ; delta Y 164 | or word [cs:buttons],8000h ; flag event 165 | retf 166 | 167 | 168 | showstatus: 169 | mov dx,200h ; 3rd row, 1st column 170 | call setcursor 171 | mov ax,[cs:wheels] 172 | mov bx,wheel1n 173 | test ax,1 ; wheel driver support 174 | jz nobit1 175 | mov bx,wheel1y 176 | nobit1: call showstring 177 | mov ax,[cs:wheels] 178 | test ax,1 ; wheel driver support? 179 | jz nowheelmsg ; if not, do not show wheel presence bit 180 | mov bx,wheel2n 181 | test ax,2 ; wheel presence 182 | jz nobit2 183 | mov bx,wheel2y 184 | nobit2: call showstring 185 | nowheelmsg: 186 | mov ax,[cs:buttons] 187 | mov bx,btnLn 188 | test ax,1 ; left button 189 | jz nobit3 190 | mov bx,btnLy 191 | nobit3: call showstring 192 | mov ax,[cs:buttons] 193 | mov bx,btnMn 194 | test ax,4 ; middle button 195 | jz nobit4 196 | mov bx,btnMy 197 | nobit4: call showstring 198 | mov ax,[cs:buttons] 199 | mov bx,btnRn 200 | test ax,2 ; right button 201 | jz nobit5 202 | mov bx,btnRy 203 | nobit5: call showstring 204 | ; 205 | mov ax,[cs:column] 206 | or ax,ax 207 | mov al,'-' 208 | js negcol 209 | mov al,' ' 210 | negcol: call showtty 211 | mov ax,[cs:column] 212 | or ax,ax 213 | jns poscol 214 | neg ax 215 | poscol: call hex2dec 216 | call showax 217 | mov al,'/' 218 | call showtty 219 | mov ax,[cs:row] 220 | or ax,ax 221 | mov al,'-' 222 | js negrow 223 | mov al,' ' 224 | negrow: call showtty 225 | mov ax,[cs:row] 226 | or ax,ax 227 | jns posrow 228 | neg ax 229 | posrow: call hex2dec 230 | call showax 231 | mov al,'/' 232 | call showtty 233 | mov ax,[cs:buttons] ; buttons, wheel 234 | mov al,ah ; wheel movement 235 | cbw 236 | or ax,ax 237 | mov al,'-' 238 | js negwh 239 | mov al,' ' 240 | negwh: call showtty 241 | mov ax,[cs:buttons] ; buttons, wheel 242 | mov al,ah ; wheel movement 243 | cbw 244 | or ax,ax 245 | jns poswh 246 | neg ax 247 | poswh: call hex2dec 248 | call showax 249 | mov bx,filler 250 | call showstring 251 | ret 252 | 253 | 254 | fillscreen: ; fill screen with a pattern. destroys regs! 255 | xor si,si ; row 256 | xor di,di ; column 257 | xor bp,bp ; high: color, low: char 258 | fill_loop: 259 | mov ax,di 260 | add ax,si 261 | mov bh,10 262 | div bh ; ah = (row+column) modulo 10 263 | add ah,'0' 264 | mov bl,ah 265 | mov ax,bp 266 | mov al,bl ; set char 267 | inc ah ; color 268 | cmp ah,16 ; wrap 269 | jnz nocolorwrap 270 | mov ah,1 271 | nocolorwrap: 272 | mov bp,ax ; update color, char 273 | ; 274 | mov cx,si ; row 275 | mov dx,di ; column, to DL 276 | mov dh,cl ; row, to DH 277 | call setcursor 278 | mov ax,bp ; al char, ah color 279 | mov bl,ah ; color (AL already is correct) 280 | cmp si,2 ; row 0 1 or 2? 281 | ja no_upper 282 | mov bl,7 ; fix color (nicer status / menu background) 283 | no_upper: 284 | mov bh,0 ; page 285 | mov ah,9 ; write char in color 286 | mov cx,1 ; one copy 287 | int 10h 288 | inc di ; next column 289 | call getwidth 290 | cmp di,ax 291 | jnz fill_loop 292 | xor di,di 293 | inc si ; next row 294 | call getheight 295 | cmp si,ax 296 | jnz fill_loop 297 | ; 298 | xor dx,dx ; 1st row, 1st column: home 299 | call setcursor 300 | mov bx, help1 ; offset 301 | call showstring 302 | mov dx,100h ; 2nd row, 1st column 303 | call setcursor 304 | mov bx, help2 ; offset 305 | call showstring 306 | ret 307 | 308 | 309 | setcursor: ; move cursor to DX. destroys AX BX 310 | mov bh,0 ; page 311 | mov ah,2 ; move cursor 312 | int 10h 313 | ret 314 | 315 | 316 | showstring: ; show string at cs:bx. destroys AX BX 317 | xor ax,ax 318 | mov al,[cs:bx] 319 | inc bx 320 | cmp al,10 321 | jb eof 322 | call showtty 323 | jmp short showstring 324 | eof: xchg ax,bx ; shorter than mov bx,ax 325 | inc bx 326 | eof2: dec bx 327 | jz eof3 328 | mov al,' ' 329 | call showtty 330 | jmp short eof2 331 | eof3: ret 332 | 333 | 334 | getwidth: ; return number of text screen columns in AX 335 | push ds 336 | mov ax,40h 337 | mov ds,ax 338 | mov ax,[ds:4ah] 339 | pop ds 340 | ret 341 | 342 | 343 | getheight: ; return number of text screen rows in AX 344 | push ds 345 | mov ax,40h 346 | mov ds,ax 347 | xor ax,ax 348 | mov al,[ds:84h] 349 | pop ds 350 | or ax,ax 351 | jnz vgaheight 352 | mov al,25-1 353 | vgaheight: 354 | inc ax 355 | ret 356 | 357 | 358 | %include "display.asm" ; ax=hex2dec(ax), showax(ax), showtty(al) ... 359 | 360 | 361 | wheels dw 0 ; 1 driver, 2 mouse 362 | buttons dw 0 ; high byte: wheel delta, low byte: 1 L 2 R 4 M 363 | column dw 0 364 | row dw 0 365 | 366 | version db "Mousetst 2007 by Eric Auer, License GPL2",13,10,"$" 367 | ; showstring strings: bytes < 10 mean "add N spaces and stop" 368 | help1 db "s show, h hide, r reset, w window,",6 369 | help2 db "x/y/z fonts, ESC exit, 0..7/a..g modes",2 370 | filler db 9 ; for 000 <-> 64048099 length difference 371 | 372 | wheel1n db "Wheel n/a",1 ; driver has no wheel support 373 | wheel1y db "Wheel:",1 ; wheel supported 374 | wheel2n db "off",1 ; no wheel mouse 375 | wheel2y db "YES",1 ; wheel mouse present 376 | btnLn db "-l-",2 377 | btnLy db "LEFT",1 378 | btnMn db "-m-",1 379 | btnMy db "MID",1 380 | btnRn db " -r-",2 381 | btnRy db "RIGHT",1 382 | 383 | -------------------------------------------------------------------------------- /utility/protocol.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/utility/protocol.asm -------------------------------------------------------------------------------- /utility/wheeltst.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FDOS/mouse/dd268521dc76d323d0597d1b21f58be5b82c6c25/utility/wheeltst.asm -------------------------------------------------------------------------------- /wheelapi.txt: -------------------------------------------------------------------------------- 1 | 2 | Wheel support in DOS real-mode mouse drivers 3 | 4 | List of DOS applications which use the wheel API: 5 | 6 | Thanks to Rugxulo and others for collecting this list :-) 7 | 8 | - GVFM (graphical file manager) 9 | - Mpxplay (.MP3, .OGG, etc. audio player) 10 | - Arachne/GPL (graphical web browser / email suite) 11 | - Star Commander (file manager) 12 | - PDCurses 3.x (console library) 13 | - Necromancer's DOS Navigator (file manager) 14 | - Fred (text editor using graphics mode) 15 | - Blocek (graphical Unicode text editor, image viewer) 16 | - Hammer of Thyrion (DOS port of Hexen II game) 17 | - 4DOS (COMMAND.COM shell replacement) 18 | - Deskwork (graphical user interface, StarTrek style) 19 | 20 | --------------------------------------------------------------------- 21 | 22 | API version 1.0 23 | 24 | Summary: 25 | 26 | This document describes an extension to the commonly used INT 33h Mouse 27 | API to add wheel (Z axis) support. This draft introduces extra functions 28 | and additions to the standard INT 33 API. These new and changed functions 29 | are mentioned in the technote.txt as the WheelAPI. 30 | 31 | --------------------------------------------------------------------- 32 | New functions: 33 | 34 | INT 33/0011 - Check wheel support and get capabilities flags 35 | AX = 0011h 36 | Return: AX = 574Dh ('WM' in assembly) if Wheel API is supported by driver 37 | BX = Capabilities flag (all bits reserved) 38 | CX = Capabilities flag 39 | Bit(s) Description 40 | ------ ----------- 41 | 0 1=Pointing device supports wheel 42 | 1-15 Reserved 43 | Note: this function should be examined before accessing wheel features 44 | 45 | --------------------------------------------------------------------- 46 | Changes in the original INT 33h functions: 47 | 48 | INT 33/0000 - Reset driver and read status 49 | Note: this call clears the wheel movement counter 50 | 51 | INT 33/0003 - Get cursor position, buttons status and wheel counter 52 | AX = 0003h 53 | Return: BL = buttons status 54 | BH = 8-bit signed counter of wheel movement since last call 55 | CX = column 56 | DX = row 57 | Notes: returned wheel counter contains all wheel movements accumulated since 58 | the last call to INT 33/AX=0003h, INT 33/AX=0005h/BX=-1 or 59 | INT 33/AX=0006h/BX=-1 60 | positive value of wheel counter means downward wheel movement 61 | this call clears the wheel movement counter 62 | 63 | INT 33/0005 - Get button press or wheel movement data 64 | AX = 0005h 65 | BX = button number or -1 for wheel 66 | Return: AL = state of buttons 67 | AH = 8-bit signed counter of wheel movement 68 | ---button info--- 69 | BX = number of times specified button has been pressed since last call 70 | CX = column where specified button was last pressed 71 | DX = row where specified button was last pressed 72 | ---wheel info--- 73 | BX = 16-bit signed counter of wheel movement since last call 74 | CX = column where wheel was last moved 75 | DX = row where wheel was last moved 76 | Notes: returned wheel counters contain all wheel movements accumulated since 77 | the last call to INT 33/AX=0003h, INT 33/AX=0005h/BX=-1 or 78 | INT 33/AX=0006h/BX=-1 79 | positive value of wheel counter means downward wheel movement 80 | this call clears the wheel movement counter for BX=-1 81 | 82 | INT 33/0006 - Get button release or wheel movement data 83 | AX = 0006h 84 | BX = button number or -1 for wheel 85 | Return: AL = state of buttons 86 | AH = 8-bit signed counter of wheel movement 87 | ---button info--- 88 | BX = number of times specified button has been released since last call 89 | CX = column where specified button was last released 90 | DX = row where specified button was last released 91 | ---wheel info--- 92 | BX = 16-bit signed counter of wheel movement since last call 93 | CX = column where wheel was last moved 94 | DX = row where wheel was last moved 95 | Notes: returned wheel counters contain all wheel movements accumulated since 96 | the last call to INT 33/AX=0003h, INT 33/AX=0005h/BX=-1 or 97 | INT 33/AX=0006h/BX=-1 98 | positive value of wheel counter means downward wheel movement 99 | this call clears the wheel movement counter for BX=-1 100 | 101 | INT 33/000C - Define User Interrupt Routine 102 | INT 33/0014 - Exchange User Interrupt Routines 103 | Notes: on entry, bit 7 of CX (call mask) indicates that the user routine 104 | will be called on a wheel movement 105 | the user routine will be called with BH holding the 8-bit signed 106 | counter of wheel movement since the last call to the routine 107 | 108 | INT 33/0021 - Software reset 109 | Note: this call clears the wheel movement counter 110 | --------------------------------------------------------------------------------