├── .gitignore ├── src ├── cwDPMI │ └── MAKE.BAT ├── cwc │ ├── cwc.asm │ ├── Makefile │ ├── decstub.inc │ └── copystub.asm ├── cwd │ ├── win.inc │ ├── cwd-ovl.asm │ ├── History.txt │ ├── print.inc │ ├── isfpu.asm │ ├── getkeys.inc │ ├── cwd.doc │ ├── cwd.cfg │ ├── Makefile │ └── macros.inc ├── cwl │ ├── cwl.asm │ └── make.bat ├── .gitignore ├── cwlib │ ├── cw.lib │ └── cw.asm │ │ ├── make.bat │ │ ├── null.asm │ │ ├── closef.asm │ │ ├── waitkey.asm │ │ ├── _waitkey.asm │ │ ├── getdrv.asm │ │ ├── _getdrv.asm │ │ ├── _beep.asm │ │ ├── _upprstr.asm │ │ ├── deletef.asm │ │ ├── setdrv.asm │ │ ├── _delay.asm │ │ ├── beep.asm │ │ ├── _free.asm │ │ ├── _prntstr.asm │ │ ├── _closef.asm │ │ ├── renfile.asm │ │ ├── free.asm │ │ ├── prntstr.asm │ │ ├── sys2hrd.asm │ │ ├── _getkey.asm │ │ ├── messw.asm │ │ ├── _setdrv.asm │ │ ├── _getpath.asm │ │ ├── dlggtw.asm │ │ ├── _setpath.asm │ │ ├── dlggtd.asm │ │ ├── arrow.gsc │ │ ├── _openf.asm │ │ ├── upchr.asm │ │ ├── _bord.asm │ │ ├── _rmsbits.asm │ │ ├── openf.asm │ │ ├── delay.asm │ │ ├── _apndstr.asm │ │ ├── _setmode.asm │ │ ├── _copystr.asm │ │ ├── _sys2hrd.asm │ │ ├── createf.asm │ │ ├── _createf.asm │ │ ├── relsbit.asm │ │ ├── _lnstr.asm │ │ ├── _upchr.asm │ │ ├── bord.asm │ │ ├── _dlggtw.asm │ │ ├── upprstr.asm │ │ ├── _dlggtd.asm │ │ ├── lnstr.asm │ │ ├── _deletef.asm │ │ ├── dlggtst.asm │ │ ├── _malloc.asm │ │ ├── _closew.asm │ │ ├── dlgstst.asm │ │ ├── _renfile.asm │ │ ├── _bin2dec.asm │ │ ├── _remsbit.asm │ │ ├── _srchrgb.asm │ │ ├── apndstr.asm │ │ ├── malloc.asm │ │ ├── setdacs.asm │ │ ├── _messw.asm │ │ ├── _msetype.asm │ │ ├── copystr.asm │ │ ├── _mgetpos.asm │ │ ├── _readf.asm │ │ ├── dlggtbw.asm │ │ ├── dlggtby.asm │ │ ├── _remallo.asm │ │ ├── dlggtbd.asm │ │ ├── setpix.asm │ │ ├── dlggtbx.asm │ │ ├── setpath.asm │ │ ├── _writef.asm │ │ ├── _dlggtst.asm │ │ ├── _srtflst.asm │ │ ├── _strlnpx.asm │ │ ├── _dlggtbw.asm │ │ ├── _dlggtby.asm │ │ ├── remallo.asm │ │ ├── _dlggtbd.asm │ │ ├── _dlggtbx.asm │ │ ├── strlnpx.asm │ │ ├── wsetpix.asm │ │ ├── bsetpix.asm │ │ ├── getkey.asm │ │ ├── _regsbit.asm │ │ ├── _setdacs.asm │ │ ├── _ldfont.asm │ │ ├── _relsbit.asm │ │ ├── _bin2hex.asm │ │ ├── getpath.asm │ │ ├── _dlgdraw.asm │ │ ├── _dlgstst.asm │ │ ├── _getdrvs.asm │ │ ├── setposf.asm │ │ ├── _crbtmp.asm │ │ ├── remsbit.asm │ │ ├── _regupw.asm │ │ ├── bin2hex.asm │ │ ├── _ldimage.asm │ │ ├── _setpal.asm │ │ ├── _ldiff.asm │ │ ├── _ldgif.asm │ │ ├── _ldtga.asm │ │ ├── _svgif.asm │ │ ├── _setpix.asm │ │ ├── _svtga.asm │ │ ├── _whichw.asm │ │ ├── _ulflist.asm │ │ ├── _sviff.asm │ │ ├── _setposf.asm │ │ ├── _dlgbtwn.asm │ │ ├── _svimage.asm │ │ ├── writef.asm │ │ ├── _dlgwhch.asm │ │ ├── bin2dec.asm │ │ ├── readf.asm │ │ ├── _flmknm.asm │ │ ├── bmyflp.asm │ │ ├── getdrvs.asm │ │ ├── flmknm.asm │ │ ├── _vesa.asm │ │ ├── _video.asm │ │ ├── _command.asm │ │ ├── ulflist.asm │ │ ├── dlgwhch.asm │ │ ├── rmsbits.asm │ │ ├── windows.asm │ │ ├── bmxflp.asm │ │ ├── srtflst.asm │ │ ├── regsbit.asm │ │ ├── regupw.asm │ │ ├── crbtmp.asm │ │ ├── whichw.asm │ │ ├── closew.asm │ │ ├── srchrgb.asm │ │ ├── openw.asm │ │ ├── _buffile.asm │ │ └── _makflst.asm ├── 3plib │ ├── 3plib.asm │ ├── 3plib.txt │ └── Make.bat ├── cwem │ ├── Debug │ │ └── I310600.3P │ ├── general.inc │ ├── print.inc │ ├── Makefile │ └── cwem.cfg ├── cwStub2 │ ├── MAKE.BAT │ └── Readme.txt └── cw32 │ └── CW32j.mak ├── doc ├── page_51.htm ├── page_6.htm ├── page_7.htm ├── page_76.htm ├── page_77.htm ├── page_78.htm ├── page_79.htm ├── page_80.htm ├── page_81.htm ├── page_122.htm ├── page_123.htm ├── page_124.htm ├── page_125.htm ├── page_126.htm ├── page_127.htm ├── page_128.htm ├── page_129.htm ├── page_100.htm ├── page_13.htm ├── page_1X2X.htm ├── page_48.htm ├── page_121.htm ├── page_74.htm ├── page_89.htm ├── page_99.htm ├── page_46.htm ├── page_91.htm ├── page_115.htm ├── page_41.htm ├── page_109.htm ├── page_69.htm ├── page_57.htm ├── page_84.htm ├── page_62.htm ├── page_70.htm ├── page_94.htm ├── page_68.htm ├── page_50.htm ├── page_75.htm ├── page_54.htm ├── page_114.htm ├── page_43.htm ├── page_49.htm ├── page_61.htm ├── page_58.htm ├── page_44.htm ├── page_72.htm └── page_59.htm ├── samples ├── dexdll.zip ├── watswap.zip ├── screen32.mak ├── DLLTESTA │ ├── Readme.txt │ ├── mdllapp2.bat │ ├── mdllapp1.bat │ ├── dll1.asm │ └── dllapp1.asm ├── DLLTEST │ ├── dll.c │ ├── makefile │ └── dlltest.c ├── tiny16.asm ├── dosshell.asm ├── flat.asm ├── croak2.c ├── croak1.c ├── small32.asm ├── tiny32.asm ├── croak3.c ├── showevar.asm ├── version.asm └── Readme.txt ├── license.txt └── Readme.txt /.gitignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | bin 3 | obj 4 | misc 5 | Ver 6 | -------------------------------------------------------------------------------- /src/cwDPMI/MAKE.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | jwasm -Fl CWDPMI.ASM 3 | wl32 CWDPMI 4 | -------------------------------------------------------------------------------- /doc/page_51.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_51.htm -------------------------------------------------------------------------------- /doc/page_6.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_6.htm -------------------------------------------------------------------------------- /doc/page_7.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_7.htm -------------------------------------------------------------------------------- /doc/page_76.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_76.htm -------------------------------------------------------------------------------- /doc/page_77.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_77.htm -------------------------------------------------------------------------------- /doc/page_78.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_78.htm -------------------------------------------------------------------------------- /doc/page_79.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_79.htm -------------------------------------------------------------------------------- /doc/page_80.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_80.htm -------------------------------------------------------------------------------- /doc/page_81.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_81.htm -------------------------------------------------------------------------------- /src/cwc/cwc.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwc/cwc.asm -------------------------------------------------------------------------------- /src/cwd/win.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwd/win.inc -------------------------------------------------------------------------------- /src/cwl/cwl.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwl/cwl.asm -------------------------------------------------------------------------------- /doc/page_122.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_122.htm -------------------------------------------------------------------------------- /doc/page_123.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_123.htm -------------------------------------------------------------------------------- /doc/page_124.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_124.htm -------------------------------------------------------------------------------- /doc/page_125.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_125.htm -------------------------------------------------------------------------------- /doc/page_126.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_126.htm -------------------------------------------------------------------------------- /doc/page_127.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_127.htm -------------------------------------------------------------------------------- /doc/page_128.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_128.htm -------------------------------------------------------------------------------- /doc/page_129.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/doc/page_129.htm -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.obj 2 | *.EXE 3 | *.MAP 4 | cw_ow 5 | le23p 6 | loadle 7 | Test 8 | watcom 9 | -------------------------------------------------------------------------------- /src/cwlib/cw.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwlib/cw.lib -------------------------------------------------------------------------------- /samples/dexdll.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/samples/dexdll.zip -------------------------------------------------------------------------------- /samples/watswap.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/samples/watswap.zip -------------------------------------------------------------------------------- /src/3plib/3plib.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/3plib/3plib.asm -------------------------------------------------------------------------------- /src/3plib/3plib.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/3plib/3plib.txt -------------------------------------------------------------------------------- /src/cwd/cwd-ovl.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwd/cwd-ovl.asm -------------------------------------------------------------------------------- /src/cwem/Debug/I310600.3P: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baron-von-Riedesel/CauseWay/HEAD/src/cwem/Debug/I310600.3P -------------------------------------------------------------------------------- /src/cwlib/cw.asm/make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist Build\NUL mkdir Build 3 | jwasm -nologo -c -Cx -FoBuild\ *.asm 4 | -------------------------------------------------------------------------------- /src/3plib/Make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem ml -c -nologo -I.. 3plib.asm 3 | jwasm -c -nologo -Fl -I.. 3plib.asm 4 | wl32 /q/m/cs/f 3plib.obj 5 | -------------------------------------------------------------------------------- /src/cwStub2/MAKE.BAT: -------------------------------------------------------------------------------- 1 | @echo off 2 | jwasm -nologo -mz -Fl cwStub2.asm 3 | rem jwasm -nologo -Fl cwStub2.asm 4 | rem jwlink format dos f cwStub2.obj op m 5 | -------------------------------------------------------------------------------- /samples/screen32.mak: -------------------------------------------------------------------------------- 1 | # 2 | all: screen32.exe 3 | 4 | screen32.exe : screen32.obj 5 | @wl32 /f/m screen32.obj 6 | 7 | screen32.obj: screen32.asm 8 | @jwasm -nologo screen32.asm 9 | 10 | 11 | -------------------------------------------------------------------------------- /samples/DLLTESTA/Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | samples to show how dlls may be used in assembly. 3 | 4 | dllapp1: uses the C wrapper functions LoadModule, GetProcAddress, FreeModule. 5 | dllapp2: uses the CauseWay int 31h API directly. 6 | -------------------------------------------------------------------------------- /src/cwl/make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not exist Build\NUL mkdir Build 3 | rem ml -c -nologo /Cx /Zf /Zd /FlBuild\ /FoBuild\ -I.. cwl.asm 4 | jwasm -c -nologo /Cx /Zf /Zd /FlBuild\ /FoBuild\ -I.. cwl.asm 5 | wl32 /f /m /cs Build\cwl.obj, Build\cwl.exe, Build\cwl.map 6 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/null.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Dummy routine for variables that need a call value that does nothing. 7 | ; 8 | NearNull proc near 9 | ret 10 | NearNull endp 11 | 12 | 13 | efile 14 | end 15 | 16 | -------------------------------------------------------------------------------- /doc/page_100.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 100 5 | 6 | 7 | 8 | 9 | 10 |

Next Page

11 |

Previous Page

12 |

Go to Table of Contents

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/closef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Close a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EBX - file handle. 11 | ; 12 | CloseFile proc near 13 | push eax 14 | mov ah,3eh 15 | int 21h 16 | pop eax 17 | ret 18 | CloseFile endp 19 | 20 | 21 | efile 22 | end 23 | 24 | -------------------------------------------------------------------------------- /doc/page_13.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 13 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Next Page

12 |

Previous Page

13 |

Go to Table of Contents

14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/waitkey.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Wait for a key press. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;none. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;EAX - Key code, same format as GetKey. 15 | ; 16 | WaitKey proc near 17 | mov ah,0 18 | int 16h 19 | call GetKey 20 | ret 21 | WaitKey endp 22 | 23 | 24 | efile 25 | end 26 | 27 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_waitkey.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Wait for a key press. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;none. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;EAX - Key code, same format as GetKey. 15 | ; 16 | _WaitKey proc syscall 17 | public _WaitKey 18 | call WaitKey 19 | ret 20 | _WaitKey endp 21 | 22 | 23 | efile 24 | end 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/getdrv.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get the current drive. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;nothing. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;AL - Drive code. 15 | ; 16 | GetDrive proc near 17 | mov ah,19h ;get current disc 18 | int 21h 19 | movzx eax,al 20 | ret 21 | GetDrive endp 22 | 23 | 24 | efile 25 | end 26 | 27 | -------------------------------------------------------------------------------- /samples/DLLTESTA/mdllapp2.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem A simple CauseWay dll sample in assembly. 4 | rem For CW v5.0, kernel imports (in cwapi.obj) are no longer needed, since the API 5 | rem directly supports FindModule, UnFindModule and FindFunction. 6 | rem 7 | jwasm -nologo dllapp2.asm 8 | wlink format os2 le f dllapp2.obj op q,m,stub=cwstub.exe 9 | rem 10 | jwasm -nologo dll1.asm 11 | wlink format os2 le dll f dll1.obj op q,m export _SayHello 12 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_getdrv.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get the current drive. 7 | ; 8 | ;Calling: 9 | ; 10 | ;GetDrive(); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;nothing. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;AL - Drive code. 19 | ; 20 | _GetDrive proc syscall 21 | public _GetDrive 22 | call GetDrive 23 | ret 24 | _GetDrive endp 25 | 26 | 27 | efile 28 | end 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_beep.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Beep, useful for simplistic debugging. 7 | ; 8 | ;Calling: 9 | ; 10 | ;Beep(); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;nothing. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | _Beep proc syscall 21 | public _Beep 22 | call Beep 23 | ret 24 | _Beep endp 25 | 26 | efile 27 | 28 | end 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_upprstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert a string into upper case. 7 | ; 8 | ;Inputs: 9 | ; 10 | ;string - String to convert. 11 | ; 12 | _UpperString proc syscall string:dword 13 | public _UpperString 14 | push esi 15 | mov esi,string 16 | call UpperString 17 | pop esi 18 | ret 19 | _UpperString endp 20 | 21 | 22 | efile 23 | end 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/deletef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Delete a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - File name to delete. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;Carry set on error. 15 | ; 16 | ;ALL registers preserved. 17 | ; 18 | DeleteFile proc near 19 | push eax 20 | mov ah,41h 21 | int 21h 22 | pop eax 23 | ret 24 | DeleteFile endp 25 | 26 | 27 | efile 28 | end 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/setdrv.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the current drive. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;AL - drive to set. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | SetDrive proc near 17 | pushm eax,edx 18 | mov dl,al 19 | mov ah,0eh ;Set drive 20 | int 21h 21 | popm eax,edx 22 | ret 23 | SetDrive endp 24 | 25 | 26 | efile 27 | end 28 | 29 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_delay.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Wait for a while. 7 | ; 8 | ;Calling: 9 | ; 10 | ;Delay(count); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;count - time to wait for. 15 | ; 16 | _Delay proc syscall count:dword 17 | public _Delay 18 | push ecx 19 | mov ecx,count 20 | call Delay 21 | pop ecx 22 | ret 23 | _Delay endp 24 | 25 | 26 | efile 27 | end 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/beep.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Beep, useful for simplistic debugging or indicateing an error. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;nothing. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | beep proc near 17 | pushm eax,edx 18 | mov dl,7 19 | mov ah,2 20 | int 21h 21 | popm eax,edx 22 | ret 23 | beep endp 24 | 25 | 26 | efile 27 | end 28 | 29 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_free.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Release some memory. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;memory - Address to release. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;All registers preserved. 15 | ; 16 | _Free proc syscall memory:dword 17 | public _Free 18 | push esi 19 | mov esi,memory 20 | call Free 21 | pop esi 22 | ret 23 | _Free endp 24 | 25 | 26 | efile 27 | end 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_prntstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Print null terminated string on screen via DOS. 7 | ; 8 | ;Inputs: 9 | ; 10 | ;stringptr - pointer to string. 11 | ; 12 | _PrintString proc syscall string:dword 13 | public _PrintString 14 | push esi 15 | mov esi,string 16 | call PrintString 17 | pop esi 18 | ret 19 | _PrintString endp 20 | 21 | 22 | efile 23 | end 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_closef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Close a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;CloseFile(handle); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - file handle. 15 | ; 16 | _CloseFile proc syscall handle:dword 17 | public _CloseFile 18 | push ebx 19 | mov ebx,handle 20 | call CloseFile 21 | pop ebx 22 | ret 23 | _CloseFile endp 24 | 25 | 26 | efile 27 | end 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/renfile.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Rename a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - Source file name. 11 | ;EDI - New file name. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;Carry set on error. 16 | ; 17 | ;ALL registers preserved. 18 | ; 19 | RenameFile proc near 20 | push eax 21 | mov ah,56h 22 | int 21h 23 | pop eax 24 | ret 25 | RenameFile endp 26 | 27 | 28 | efile 29 | end 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/cwd/History.txt: -------------------------------------------------------------------------------- 1 | 2 | Changelog 3 | 4 | - changed code so OPTION OLDSTRUCTS could be removed. 5 | - moved uninitialized arrays from .data to .data?, reducing 6 | binary size of CWD.OVL by about 32kB. 7 | - fixed: missing POP in handler for exception 0Ch. 8 | - trap EXCeption 00 instead of INTerrupt 00. 9 | - trap invalid opcode exception 06. 10 | - fixed: register ecx used in a loop was modified by int 31h, ax=ff08h, 11 | causing an infinite loop in .map file was scanned. 12 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/free.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | include ..\cw.inc 3 | scode 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Release some memory. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - Address to release. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;All registers preserved. 16 | ; 17 | Free proc near 18 | pushm eax,esi 19 | add esi,DataLinearBase ;make it a linear address again. 20 | sys RelMemLinear32 21 | popm eax,esi 22 | ret 23 | Free endp 24 | 25 | 26 | efile 27 | end 28 | 29 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/prntstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Print null terminated string on screen via DOS. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ESI - pointer to string to print. 11 | ; 12 | PrintString proc near 13 | pushm eax,esi,edx 14 | l0: mov dl,[esi] 15 | inc esi 16 | or dl,dl 17 | jz l2 18 | mov ah,2 19 | int 21h 20 | jmp l0 21 | l2: popm eax,esi,edx 22 | ret 23 | PrintString endp 24 | 25 | 26 | efile 27 | end 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/sys2hrd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert system pen number into hardware pen number. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;AL - pen number to convert. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;AL - new pen number. 15 | ; 16 | ;ALL other registers preserved. 17 | ; 18 | VideoSys2Hard proc 19 | push ebx 20 | mov ebx,offset SystemXlat 21 | xlat 22 | pop ebx 23 | ret 24 | VideoSys2Hard endp 25 | 26 | 27 | efile 28 | end 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_getkey.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get key press info. 7 | ; 8 | ;Calling: 9 | ; 10 | ;GetKey(); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;none. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;AL - ASCII character code. 19 | ;AH - Hardware key code. 20 | ;EAX high word - Shift keys status word from 417h. 21 | ; 22 | _GetKey proc syscall 23 | public _GetKey 24 | call GetKey 25 | ret 26 | _GetKey endp 27 | 28 | 29 | efile 30 | end 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/messw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Send a message to a window. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EAX - message 11 | ;ESI - window 12 | ; 13 | ;On Exit: 14 | ; 15 | ;nothing. 16 | ; 17 | ;ALL registers preserved. 18 | ; 19 | WinMessageWindow proc near 20 | pushad 21 | cmp Win_Handler[esi],0 22 | jz @@9 23 | call Win_Handler[esi] 24 | @@9: popad 25 | ret 26 | WinMessageWindow endp 27 | 28 | 29 | efile 30 | end 31 | 32 | -------------------------------------------------------------------------------- /src/cwd/print.inc: -------------------------------------------------------------------------------- 1 | .code 2 | 3 | ;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== 4 | ; 5 | ;Print characters on the screen. 6 | ; 7 | ;On Entry:- 8 | ; 9 | ;DS:EDX - String (0 terminated) 10 | ; 11 | ;ALL registers preserved. 12 | ; 13 | StringPrint proc near 14 | pushm eax,ebx,ecx,edx,esi,edi,ebp 15 | mov esi,edx 16 | @@0: lodsb 17 | or al,al 18 | jz @@9 19 | push esi 20 | mov dl,al 21 | mov ah,2 22 | int 21h 23 | pop esi 24 | jmp @@0 25 | @@9: popm eax,ebx,ecx,edx,esi,edi,ebp 26 | ret 27 | StringPrint endp 28 | 29 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setdrv.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the current drive. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SetDrive(drive); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;drive - drive to set. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | _SetDrive proc syscall drive:dword 21 | public _SetDrive 22 | push eax 23 | mov eax,drive 24 | call SetDrive 25 | pop eax 26 | ret 27 | _SetDrive endp 28 | 29 | 30 | efile 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_getpath.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get current drive and path. 7 | ; 8 | ;Calling: 9 | ; 10 | ;GetPath(buffer); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;buffer - pointer to buffer. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | _GetPath proc syscall buffer:dword 21 | public _GetPath 22 | push edx 23 | mov edx,buffer 24 | call GetPath 25 | pop edx 26 | ret 27 | _GetPath endp 28 | 29 | 30 | efile 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get main width of a dialog. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - Pointer to dialog structure. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - Width. 16 | ; 17 | ;ALL other registers preserved. 18 | ; 19 | DialogGetWidth proc near 20 | push edx 21 | mov eax,DlgM_FWide[esi] 22 | mul FontWidth 23 | add eax,DlgM_PWide[esi] 24 | pop edx 25 | ret 26 | DialogGetWidth endp 27 | 28 | 29 | efile 30 | end 31 | 32 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setpath.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set current drive and path. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SetPath(buffer); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;buffer - pointer to path string. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | _SetPath proc syscall buffer:dword 21 | public _SetPath 22 | push edx 23 | mov edx,buffer 24 | call SetPath 25 | pop edx 26 | ret 27 | _SetPath endp 28 | 29 | 30 | efile 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get main depth of a dialog. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - Pointer to dialog structure. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - Depth. 16 | ; 17 | ;ALL other registers preserved. 18 | ; 19 | DialogGetDepth proc near 20 | push edx 21 | mov eax,DlgM_FDepth[esi] 22 | mul FontDepth 23 | add eax,DlgM_PDepth[esi] 24 | pop edx 25 | ret 26 | DialogGetDepth endp 27 | 28 | 29 | efile 30 | end 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/cwStub2/Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | About 3 | 4 | cwStub2.exe may replace the standard cwstub.exe. Unlike cwstub.exe, 5 | which actually IS the CauseWay extender (compressed), cwstub2.exe is 6 | just bootstrap code that searches the (uncompressed) CauseWay extender 7 | CW32.EXE in the current directory and in the directories contained 8 | in the PATH environment variable. 9 | The advantage of using cwstub2.exe is that its size is less than 512 10 | bytes, while cwstub.exe is about 40 kB. The disadvantage is that the 11 | bound binary isn't self-contained anymore. 12 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/arrow.gsc: -------------------------------------------------------------------------------- 1 | Arrow00 BM <0,1,10,14> 2 | db 252,252,0,0,0,0,0,0,0,0 3 | db 252,7,252,0,0,0,0,0,0,0 4 | db 252,7,7,252,0,0,0,0,0,0 5 | db 252,7,254,7,252,0,0,0,0,0 6 | db 252,7,254,254,7,252,0,0,0,0 7 | db 252,7,254,254,254,7,252,0,0,0 8 | db 252,7,254,254,254,254,7,252,0,0 9 | db 252,7,254,254,254,254,254,7,252,0 10 | db 252,7,254,254,254,252,252,252,252,252 11 | db 252,7,254,252,254,7,252,0,0,0 12 | db 252,7,252,252,7,254,252,0,0,0 13 | db 252,252,0,0,252,254,7,252,0,0 14 | db 0,0,0,0,252,7,254,252,0,0 15 | db 0,0,0,0,0,252,252,252,0,0 16 | 17 |  18 | -------------------------------------------------------------------------------- /src/cwem/general.inc: -------------------------------------------------------------------------------- 1 | 2 | b equ byte ptr 3 | w equ word ptr 4 | d equ dword ptr 5 | ;f equ fword ptr 6 | 7 | Pushm MACRO R1,R2,R3,R4,R5,R6,R7,R8,R9,R10 8 | IRP X, 9 | IFNB ;IF THIS PARM NOT BLANK 10 | PUSH X ;SAVE THE REGISTER 11 | ENDIF ;END IFNB 12 | ENDM ;END IRP 13 | ENDM 14 | 15 | Popm macro R1,R2,R3,R4,R5,R6,R7,R8,R9,R10 16 | IRP X, ;REPEAT FOR EACH PARM 17 | IFNB ;IF THIS PARM NOT BLANK 18 | POP X ;POP THE REGISTER 19 | ENDIF ;END IFNB 20 | ENDM ;END IRP 21 | ENDM 22 | 23 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_openf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Open a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;filename - pointer to file name. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;Carry set on error and EAX=0 else, 15 | ; 16 | ;EAX - File handle. 17 | ; 18 | _OpenFile proc syscall filename:dword 19 | public _OpenFile 20 | pushm ebx,edx 21 | mov edx,filename 22 | call OpenFile 23 | mov eax,ebx 24 | popm ebx,edx 25 | ret 26 | _OpenFile endp 27 | 28 | 29 | efile 30 | end 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/upchr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Convert character to upper case. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;AL - character code. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;AL - upper case character code. 16 | ; 17 | ;ALL other registers preserved. 18 | ; 19 | UpperChar proc near 20 | cmp al,61h ; 'a' 21 | jb @@1 22 | cmp al,7Ah ; 'z' 23 | ja @@1 24 | and al,5Fh ;convert to upper case. 25 | @@1: ret 26 | UpperChar endp 27 | 28 | 29 | efile 30 | end 31 | 32 | -------------------------------------------------------------------------------- /src/cwem/print.inc: -------------------------------------------------------------------------------- 1 | ;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== 2 | StringPrint proc near 3 | ; 4 | ;Print characters on the screen. 5 | ; 6 | ;On Entry:- 7 | ; 8 | ;DS:EDX - String (0 terminated) 9 | ; 10 | ;ALL registers preserved. 11 | ; 12 | pushm eax,ebx,ecx,edx,esi,edi,ebp 13 | mov esi,edx 14 | @@0: 15 | mov al,[esi] 16 | inc esi 17 | or al,al 18 | jz @@9 19 | push esi 20 | mov dl,al 21 | mov ah,2 22 | int 21h 23 | pop esi 24 | jmp @@0 25 | @@9: 26 | popm eax,ebx,ecx,edx,esi,edi,ebp 27 | ret 28 | StringPrint endp 29 | 30 | 31 | 32 |  33 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_bord.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Change the border colour. Provided mainly for simplistic debugging. 7 | ; 8 | ;Calling: 9 | ; 10 | ;Bord(pen); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;pen - colour to set. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;ALL registers preserved. 21 | ; 22 | _Bord proc syscall pen:dword 23 | public _Bord 24 | push eax 25 | mov eax,pen 26 | call bord 27 | pop eax 28 | ret 29 | _Bord endp 30 | 31 | 32 | efile 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_rmsbits.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Re-map all bitmaps registered as useing "system" palette. 7 | ; 8 | ;Calling: 9 | ; 10 | ;RemapSystemBitmaps(); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;nothing. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;ALL registers preserved. 21 | ; 22 | _RemapSystemBitmaps proc syscall 23 | public _RemapSystemBitmaps 24 | call RemapSystemBitmaps 25 | ret 26 | _RemapSystemBitmaps endp 27 | 28 | 29 | efile 30 | end 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/openf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Open a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - File name. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;Carry set on error and EBX=0 else, 15 | ; 16 | ;EBX - File handle. 17 | ; 18 | OpenFile proc near 19 | push eax 20 | mov ax,3d02h ;Open with read & write access. 21 | int 21h 22 | mov bx,ax 23 | jnc l0 24 | xor bx,bx 25 | stc 26 | l0: pop eax 27 | movzx ebx,bx 28 | ret 29 | OpenFile endp 30 | 31 | 32 | efile 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/page_1X2X.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Pages 14-34 5 | 6 | 7 | 8 | 9 | 10 |

Chapter 2-5:   WL32 LINKER

11 |

These chapters have been removed; WL32 is now in a separate repository with its very own documentation.

12 |

Next Page

13 |

Previous Page

14 |

Go to Table of Contents

15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/cwd/isfpu.asm: -------------------------------------------------------------------------------- 1 | .386 2 | .model flat 3 | .stack 400h 4 | 5 | .data 6 | FoundText DB 'FPU detected.',13,10 7 | MissingText DB 'No FPU detected.',13,10 8 | 9 | .code 10 | 11 | start: 12 | mov ax,ss 13 | mov ds,ax 14 | finit 15 | push eax 16 | fstcw [esp] 17 | pop eax 18 | cmp ah,3 19 | jne nofpu 20 | 21 | isfpu: 22 | mov edx,OFFSET FoundText 23 | mov ecx,SIZEOF FoundText 24 | jmp output 25 | 26 | nofpu: 27 | mov edx,OFFSET MissingText 28 | mov ecx,SIZEOF MissingText 29 | 30 | output: 31 | mov bx,1 32 | mov ah,40h 33 | int 21h 34 | mov ax,4c00h 35 | int 21h 36 | end start 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/delay.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Wait for a while. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ECX - time to wait for. 11 | ; 12 | Delay proc near 13 | pushm eax,ebx,ecx,edx,esi 14 | mov esi,ecx 15 | mov ah,0 16 | int 1ah 17 | shl ecx,16 18 | mov cx,dx 19 | mov ebx,ecx 20 | l0: mov ah,0 21 | int 1ah 22 | shl ecx,16 23 | mov cx,dx 24 | sub ecx,ebx 25 | cmp ecx,esi 26 | jc l0 27 | popm eax,ebx,ecx,edx,esi 28 | ret 29 | Delay endp 30 | 31 | 32 | efile 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/cwd/getkeys.inc: -------------------------------------------------------------------------------- 1 | 2 | .data 3 | 4 | Keys dw 0 5 | 6 | .code 7 | 8 | ;==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== 9 | ; 10 | ;Ask DOS for any pending key press information. 11 | ; 12 | ;No entry conditions. 13 | ; 14 | ;On Exit:- 15 | ; 16 | ;If flags none zero,AL - main byte AH - Auxiluary byte 17 | ;otherwise, no keypress available. 18 | ; 19 | ;KEYS - copy of AX 20 | ; 21 | GetKeys proc near 22 | mov ah,1 23 | int 16h 24 | mov ax,0 25 | jz @@0 26 | mov ah,0 27 | int 16h 28 | mov Keys,ax 29 | cmp ax,0 30 | @@0: ret 31 | ; 32 | GetKeys endp 33 | 34 | 35 | -------------------------------------------------------------------------------- /samples/DLLTESTA/mdllapp1.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem 3 | rem A simple CauseWay dll sample in assembly. 4 | rem For CW v5.0, kernel imports (in cwapi.obj) are no longer needed, since the API 5 | rem directly supports FindModule, UnFindModule and FindFunction. 6 | rem 7 | jwasm -nologo dllapp1.asm 8 | rem wlink format os2 le f dllapp1.obj libfile ..\..\obj\dllfunc.obj,..\..\obj\cwapi.obj op q,m,stub=cwstub.exe 9 | wlink format os2 le f dllapp1.obj libfile ..\..\obj\dllfunc.obj op q,m,stub=cwstub.exe 10 | rem 11 | jwasm -nologo dll1.asm 12 | wlink format os2 le dll f dll1.obj op q,m export _SayHello 13 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_apndstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Append a string to another string. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;source - pointer to source string. 11 | ;dest - pointer to destination string to append to. 12 | ; 13 | _AppendString proc syscall source:dword, dest:dword 14 | public _AppendString 15 | pushm esi,edi 16 | mov esi,source 17 | mov edi,dest 18 | call AppendString ;Call ASM version. 19 | popm esi,edi 20 | ret 21 | _AppendString endp 22 | 23 | efile 24 | 25 | end 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setmode.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Attempt to set specified video mode. 7 | ; 8 | ;Calling: 9 | ; 10 | ;VideoSetMode(mode); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;mode - Mode to set. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;EAX - zero on error else mode number. 19 | ; 20 | ;ALL other registers preserved. 21 | ; 22 | _VideoSetMode proc syscall mode:dword 23 | public _VideoSetMode 24 | mov eax,mode 25 | call VideoSetMode 26 | ret 27 | _VideoSetMode endp 28 | 29 | 30 | efile 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_copystr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Copy a string from one place to another. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;source - Source string. 11 | ;destination - Destination string. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;ALL registers preserved. 16 | ; 17 | _CopyString proc syscall source:dword, dest:dword 18 | public _CopyString 19 | pushm esi,edi 20 | mov esi,source 21 | mov edi,dest 22 | call CopyString 23 | popm esi,edi 24 | ret 25 | _CopyString endp 26 | 27 | 28 | efile 29 | end 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_sys2hrd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert system pen number into hardware pen number. 7 | ; 8 | ;Calling: 9 | ; 10 | ;VideoSys2Hard(pen); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;pen - pen number to convert. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;AL - new pen number. 19 | ; 20 | ;ALL other registers preserved. 21 | ; 22 | _VideoSys2Hard proc syscall pen:dword 23 | public _VideoSys2Hard 24 | mov eax,pen 25 | call VideoSys2Hard 26 | ret 27 | _VideoSys2Hard endp 28 | 29 | 30 | efile 31 | end 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/createf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Create a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - File name. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;Carry set on error and EBX=0 else, 15 | ; 16 | ;EBX - File handle. 17 | ; 18 | CreateFile proc near 19 | pushm eax,ecx 20 | mov ah,3ch ;Create function. 21 | xor cx,cx ;normal attributes. 22 | int 21h 23 | mov bx,ax 24 | jnc l0 25 | xor bx,bx 26 | stc 27 | l0: movzx ebx,bx 28 | popm eax,ecx 29 | ret 30 | CreateFile endp 31 | 32 | 33 | efile 34 | end 35 | 36 | -------------------------------------------------------------------------------- /samples/DLLTEST/dll.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | int main(int reason) 6 | { 7 | int result; 8 | 9 | if (!reason) { 10 | 11 | /* ** DLL initialisation. */ 12 | printf("DLL startup...\n"); 13 | 14 | /* return zero to let the load continue */ 15 | result = 0; 16 | 17 | } else { 18 | 19 | /* ** DLL clean up. */ 20 | printf("DLL shutdown...\n"); 21 | 22 | } 23 | 24 | return(result); 25 | } 26 | 27 | 28 | void __export SayHello( char * message) 29 | { 30 | printf("Received DLL Message: "); 31 | printf(message); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_createf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Create a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;CreateFile(filename); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;filename - File name. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;Carry set on error and EAX=0 else, 19 | ; 20 | ;EAX - File handle. 21 | ; 22 | _CreateFile proc syscall filename:dword 23 | public _CreateFile 24 | pushm ebx,edx 25 | mov edx,filename 26 | call CreateFile 27 | mov eax,ebx 28 | popm ebx,edx 29 | ret 30 | _CreateFile endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/relsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Release a bitmap previously registered with the bitmap manager. Duplicate 7 | ;memory is free'd and entry in table is marked free. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - Handle 12 | ; 13 | ;On Exit: 14 | ; 15 | ;nothing. 16 | ; 17 | ;ALL registers preserved. 18 | ; 19 | ReleaseSystemBitmap proc near 20 | push esi 21 | mov esi,BMT_Duplicate[esi] 22 | call Free 23 | pop esi 24 | mov BMT_Flags[esi],0 25 | ret 26 | ReleaseSystemBitmap endp 27 | 28 | 29 | efile 30 | end 31 | 32 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_lnstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Work out length of a string. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LenString(stringptr); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;stringptr - pointer to string. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - length of string. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | _LenString proc syscall stringptr:dword 24 | public _LenString 25 | push esi 26 | mov esi,stringptr 27 | call LenString 28 | pop esi 29 | ret 30 | _LenString endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_upchr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Convert character to upper case. 8 | ; 9 | ;Calling: 10 | ; 11 | ;UpperChar(charcter); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;character - character code. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;AL - upper case character code. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | _UpperChar proc syscall character:dword 24 | public _UpperChar 25 | mov al,b[character] 26 | call UpperChar 27 | movzx eax,al 28 | ret 29 | _UpperChar endp 30 | 31 | 32 | efile 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bord.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Change the border colour. Provided mainly for simplistic debugging. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;AL - colour to set. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;nothing. 15 | ; 16 | ;ALL registers preserved. 17 | ; 18 | Bord proc near 19 | pushm ax,dx 20 | mov ah,al 21 | mov dx,3dah 22 | in al,dx 23 | mov dl,0c0h 24 | mov al,11h 25 | out dx,al 26 | mov al,ah 27 | out dx,al 28 | mov al,20h 29 | out dx,al 30 | popm ax,dx 31 | ret 32 | Bord endp 33 | 34 | 35 | efile 36 | end 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get main width of a dialog. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetWidth(dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;dialog - Pointer to dialog structure. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - Width. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | _DialogGetWidth proc syscall dialog:dword 24 | public _DialogGetWidth 25 | push esi 26 | mov esi,dialog 27 | call DialogGetWidth 28 | pop esi 29 | ret 30 | _DialogGetWidth endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/upprstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert a string into upper case. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ESI - String to convert. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | UpperString proc near 17 | pushm eax,esi,edi 18 | mov edi,esi 19 | l0: lodsb 20 | cmp al,61h ; 'a' 21 | jb l1 22 | cmp al,7Ah ; 'z' 23 | ja l1 24 | and al,5Fh ;convert to upper case. 25 | l1: stosb 26 | or al,al 27 | jnz l0 28 | popm eax,esi,edi 29 | ret 30 | UpperString endp 31 | 32 | 33 | efile 34 | end 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get main depth of a dialog. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetDepth(dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;dialog - Pointer to dialog structure. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - Depth. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | _DialogGetDepth proc syscall dialog:dword 24 | public _DialogGetDepth 25 | push esi 26 | mov esi,dialog 27 | call DialogGetDepth 28 | pop esi 29 | ret 30 | _DialogGetDepth endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/lnstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Work out length of a string. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - pointer to string. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - length of string. 16 | ; 17 | ;ALL other registers preserved. 18 | ; 19 | LenString proc near 20 | pushm edi,ecx 21 | mov edi,esi 22 | or ecx,-1 23 | xor al,al 24 | repnz scasb ;get the strings length. 25 | mov eax,ecx 26 | not eax 27 | dec eax ;Don't include terminator. 28 | popm edi,ecx 29 | ret 30 | LenString endp 31 | 32 | 33 | efile 34 | end 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_deletef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Delete a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;DeleteFile(filename); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;filename - File name to delete. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;Carry set on error and EAX=0 else EAX=-1. 19 | ; 20 | _DeleteFile proc syscall filename:dword 21 | public _DeleteFile 22 | push edx 23 | mov edx,filename 24 | call DeleteFile 25 | jc l0 26 | mov eax,-1 27 | jmp l1 28 | l0: xor eax,eax 29 | l1: pop edx 30 | ret 31 | _DeleteFile endp 32 | 33 | 34 | efile 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get state field of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Entry number. 12 | ;ESI - Pointer to dialog structure. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - State. 17 | ; 18 | ;ALL other registers preserved. 19 | ; 20 | DialogGetState proc near 21 | pushm ecx,edx 22 | mov eax,size Dlg 23 | mul ecx 24 | mov ecx,eax 25 | add ecx,size DlgMain 26 | add ecx,esi 27 | mov eax,Dlg_State[ecx] 28 | popm ecx,edx 29 | ret 30 | DialogGetState endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_malloc.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Allocate some DS relative memory. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;bytes - Bytes required. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;Carry set on error and EAX=0 undefined else, 15 | ; 16 | ;EAX - DS relative address of allocated memory. 17 | ; 18 | ;All other registers preserved. 19 | ; 20 | _Malloc proc syscall bytes:dword 21 | public _Malloc 22 | pushm ecx,esi 23 | mov ecx,bytes 24 | call Malloc 25 | mov eax,esi 26 | popm ecx,esi 27 | ret 28 | _Malloc endp 29 | 30 | 31 | efile 32 | end 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_closew.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Close a window and update the area underneath it if possible. 7 | ; 8 | ;Calling: 9 | ; 10 | ;WinCloseWindow(handle); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - Pointer to window structure (handle). 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;ALL registers preserved. 21 | ; 22 | _WinCloseWindow proc syscall handle:dword 23 | public _WinCloseWindow 24 | push eax 25 | mov eax,handle 26 | call WinCloseWindow 27 | pop eax 28 | ret 29 | _WinCloseWindow endp 30 | 31 | 32 | efile 33 | end 34 | 35 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlgstst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Set state field of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;EAX - State to set. 12 | ;ECX - Entry number. 13 | ;ESI - Pointer to dialog structure. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;nothing. 18 | ; 19 | ;ALL registers preserved. 20 | ; 21 | DialogSetState proc near 22 | pushm ecx,edx,eax 23 | mov eax,size Dlg 24 | mul ecx 25 | mov ecx,eax 26 | add ecx,size DlgMain 27 | add ecx,esi 28 | pop Dlg_State[ecx] 29 | popm ecx,edx 30 | ret 31 | DialogSetState endp 32 | 33 | 34 | efile 35 | end 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_renfile.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Rename a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;DeleteFile(source,dest); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;source - Source file name. 15 | ;dest - New file name. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;Carry set on error. 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | _RenameFile proc syscall source:dword, dest:dword 24 | public _RenameFile 25 | pushm edx,edi 26 | mov edx,source 27 | mov edi,dest 28 | call RenameFile 29 | popm edx,edi 30 | ret 31 | _RenameFile endp 32 | 33 | 34 | efile 35 | end 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_bin2dec.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert number into decimal ASCII. 7 | ; 8 | ;Calling: 9 | ; 10 | ;Bin2Dec(number,buffer); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;number - Number to convert. 15 | ;buffer - Buffer to put it in. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - Next available byte in buffer. 20 | ; 21 | _Bin2Dec proc syscall number:dword, buffer:dword 22 | public _Bin2Dec 23 | pushm edi 24 | mov eax,number 25 | mov edi,buffer 26 | call Bin2Dec 27 | mov eax,edi 28 | pop edi 29 | ret 30 | _Bin2Dec endp 31 | 32 | efile 33 | 34 | end 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_remsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Copy and re-map "system" bitmap duplicate. 7 | ; 8 | ;Calling: 9 | ; 10 | ;RemapSystemBitmap(tableptr); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;tableptr - pointer to "system" bitmap table entry. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;ALL registers preserved. 21 | ; 22 | _RemapSystemBitmap proc syscall tableptr:dword 23 | public _RemapSystemBitmap 24 | push esi 25 | mov esi,tableptr 26 | call RemapSystemBitmap 27 | pop esi 28 | ret 29 | _RemapSystemBitmap endp 30 | 31 | 32 | efile 33 | end 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_srchrgb.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Find closest match in HardwarePalette to RGB value specified. Must be more 7 | ;accurate ways of doing it than this but I don't know about them! 8 | ; 9 | ;Calling: 10 | ; 11 | ;SearchRGB(rgbvalue); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;rgbvalue - RGB value. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - Nearest pen value in HardwarePalette 20 | ; 21 | _SearchRGB proc syscall rgbvalue:dword 22 | public _SearchRGB 23 | mov eax,rgbvalue 24 | call SearchRGB 25 | ret 26 | _SearchRGB endp 27 | 28 | 29 | efile 30 | end 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/apndstr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Append a string to another string. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ESI - source string. 11 | ;EDI - destination string to append to. 12 | ; 13 | AppendString proc near 14 | pushm eax,ecx,esi,edi 15 | or ecx,-1 16 | xor al,al 17 | repne scasb ;Find end of destination string. 18 | dec edi 19 | push esi 20 | xchg esi,edi 21 | or ecx,-1 22 | repne scasb 23 | xchg esi,edi 24 | neg ecx 25 | inc ecx 26 | pop esi 27 | rep movsb 28 | popm eax,ecx,esi,edi 29 | ret 30 | AppendString endp 31 | 32 | 33 | efile 34 | end 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/malloc.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | include ..\cw.inc 3 | scode 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Allocate some DS relative memory. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Bytes required. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;Carry set on error and ESI=0 else, 16 | ; 17 | ;ESI - DS relative address of allocated memory. 18 | ; 19 | ;All other registers preserved. 20 | ; 21 | Malloc proc near 22 | push eax 23 | sys GetMemLinear32 24 | jc l0 25 | sub esi,DataLinearBase 26 | clc 27 | jmp l1 28 | l0: xor esi,esi 29 | stc 30 | l1: pop eax 31 | ret 32 | Malloc endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/setdacs.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the value's in VGA colour DAC's. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EBX - Starting DAC number. 11 | ;ECX - Number of DAC's to set. 12 | ;ESI - Pallet information 13 | ; 14 | ;On Exit: 15 | ; 16 | ;nothing. 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | SetDACs proc near 21 | pushm eax,ecx,edx,esi 22 | mov edx,03c8h 23 | mov al,bl 24 | out dx,al 25 | inc edx 26 | mov eax,ecx 27 | shl ecx,1 28 | add ecx,eax 29 | cld 30 | rep outsb 31 | popm eax,ecx,edx,esi 32 | ret 33 | SetDACs endp 34 | 35 | 36 | efile 37 | end 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_messw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Send a message to a window. 7 | ; 8 | ;Calling: 9 | ; 10 | ;WinMessageWindow(message,window); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;message - message to send. 15 | ;window - window to send it to. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | _WinMessageWindow proc syscall message:dword, window:dword 24 | pushm eax,esi 25 | mov eax,message 26 | mov esi,window 27 | call WinMessageWindow 28 | popm eax,esi 29 | ret 30 | _WinMessageWindow endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_msetype.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the type of graphic used for the mouse pointer. Only 2 are currently 7 | ;supported but others can be added to the table. 8 | ; 9 | ;Calling: 10 | ; 11 | ;MouseSetType(ptype); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;type - Pointer number. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | _MouseSetType proc syscall ptype:dword 24 | public _MouseSetType 25 | push eax 26 | mov eax,ptype 27 | call MouseSetType 28 | pop eax 29 | ret 30 | _MouseSetType endp 31 | 32 | 33 | efile 34 | end 35 | 36 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/copystr.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Copy a string from one place to another. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ESI - Source string. 11 | ;EDI - Destination string. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;ALL registers preserved. 16 | ; 17 | CopyString proc near 18 | pushm eax,ecx,esi,edi 19 | push esi 20 | xchg esi,edi 21 | or ecx,-1 22 | xor al,al 23 | repnz scasb ;get the strings length. 24 | inc ecx 25 | neg ecx 26 | xchg esi,edi 27 | pop esi 28 | rep movsb ;copy the string. 29 | popm eax,ecx,esi,edi 30 | ret 31 | CopyString endp 32 | 33 | 34 | efile 35 | end 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_mgetpos.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get the current position & button state for the mouse. 7 | ; 8 | ;Calling: 9 | ; 10 | ;MouseGet(mdet); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;mdet - pointer to 3 int's to fill in. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;ALL registers preserved. 21 | ; 22 | _MouseGet proc syscall mdet:dword 23 | public _MouseGet 24 | pushm ebx,ecx,edx,esi 25 | call MouseGet 26 | mov esi,mdet 27 | mov [esi+0],ebx 28 | mov [esi+4],ecx 29 | mov [esi+8],edx 30 | popm ebx,ecx,edx,esi 31 | ret 32 | _MouseGet endp 33 | 34 | 35 | efile 36 | end 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_readf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Read some data from a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;ReadFile(handle,dest,bytes); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - file handle. 15 | ;dest - Address to read to. 16 | ;bytes - length to read. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - bytes read. 21 | ; 22 | _ReadFile proc syscall handle:dword, dest:dword, bytes:dword 23 | public _ReadFile 24 | pushm ebx,ecx,edx 25 | mov ebx,handle 26 | mov ecx,bytes 27 | mov edx,dest 28 | call ReadFile 29 | popm ebx,ecx,edx 30 | ret 31 | _ReadFile endp 32 | 33 | 34 | efile 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtbw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get width of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Entry number. 12 | ;ESI - Pointer to dialog structure. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - Width. 17 | ; 18 | ;ALL other registers preserved. 19 | ; 20 | DialogGetButtonW proc near 21 | pushm ecx,edx 22 | mov eax,size Dlg 23 | mul ecx 24 | mov ecx,eax 25 | add ecx,size DlgMain 26 | add ecx,esi 27 | mov eax,Dlg_FWide[ecx] 28 | mul FontWidth 29 | add eax,Dlg_PWide[ecx] 30 | popm ecx,edx 31 | ret 32 | DialogGetButtonW endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtby.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get Y coord of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Entry number. 12 | ;ESI - Pointer to dialog structure. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - Y coord. 17 | ; 18 | ;ALL other registers preserved, 19 | ; 20 | DialogGetButtonY proc near 21 | pushm ecx,edx 22 | mov eax,size Dlg 23 | mul ecx 24 | mov ecx,eax 25 | add ecx,size DLGMain 26 | add ecx,esi 27 | mov eax,Dlg_FYCoord[ecx] 28 | mul FontDepth 29 | add eax,Dlg_PYCoord[ecx] 30 | popm ecx,edx 31 | ret 32 | DialogGetButtonY endp 33 | 34 | 35 | efile 36 | end 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_remallo.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Re-size previously allocated memory. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;memory - current address of memory 11 | ;bytes - new size. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;Carry set on error and EAX=0 else, 16 | ; 17 | ;EAX - New address of memory. 18 | ; 19 | ;All other registers preserved. 20 | ; 21 | _ReMalloc proc syscall memory:dword, bytes:dword 22 | public _ReMalloc 23 | pushm ecx,esi 24 | mov esi,memory 25 | mov ecx,bytes 26 | call ReMalloc 27 | mov eax,esi 28 | popm ecx,esi 29 | ret 30 | _ReMalloc endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtbd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get depth of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Entry number. 12 | ;ESI - Pointer to dialog structure. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - Depth. 17 | ; 18 | ;ALL other registers preserved. 19 | ; 20 | DialogGetButtonD proc near 21 | pushm ecx,edx 22 | mov eax,size Dlg 23 | mul ecx 24 | mov ecx,eax 25 | add ecx,size DlgMain 26 | add ecx,esi 27 | mov eax,Dlg_FDepth[ecx] 28 | mul FontDepth 29 | add eax,Dlg_PDepth[ecx] 30 | popm ecx,edx 31 | ret 32 | DialogGetButtonD endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/setpix.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set a pixel to specified colour. Cheats by useing VideoFillRectangle for now. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EAX - Flags, bit significant if set. 11 | ; 0 - FillValue is RGB. 12 | ;EBX - Fill value. 13 | ;ECX - X co-ord. 14 | ;EDX - Y co-ord. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;nothing. 19 | ; 20 | ;All registers preserved. 21 | ; 22 | VideoSetPixel proc near 23 | push 1 24 | push 1 25 | push edx 26 | push ecx 27 | push ebx 28 | push eax 29 | call VideoFillRectangle 30 | add esp,4*6 31 | ret 32 | VideoSetPixel endp 33 | 34 | 35 | efile 36 | end 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlggtbx.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get X coord of a dialog entry. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - Entry number. 12 | ;ESI - Pointer to dialog structure. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - X coord. 17 | ; 18 | ;ALL other registers preserved. 19 | ; 20 | DialogGetButtonX proc near 21 | pushm ecx,edx 22 | mov eax,size Dlg 23 | mul ecx 24 | mov ecx,eax 25 | add ecx,size DlgMain 26 | add ecx,esi 27 | mov eax,Dlg_FXCoord[ecx] 28 | mul FontWidth 29 | add eax,Dlg_PXCoord[ecx] 30 | popm ecx,edx 31 | ret 32 | DialogGetButtonX endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/setpath.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set current drive and path. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - pointer to path string. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | SetPath proc near 17 | pushm eax,edx 18 | push edx 19 | mov dl,[edx] 20 | cmp dl,61h ; 'a' 21 | jb @@0 22 | cmp dl,7Ah ; 'z' 23 | ja @@0 24 | and dl,5Fh ;convert to upper case. 25 | @@0: sub dl,"A" 26 | mov ah,0eh ;Set drive 27 | int 21h ;Get number of logical drives 28 | pop edx 29 | mov ah,3bh 30 | int 21h 31 | popm eax,edx 32 | ret 33 | SetPath endp 34 | 35 | 36 | efile 37 | end 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_writef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Write some data to a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;WriteFile(handle,source,bytes); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - file handle. 15 | ;source - Address to write from. 16 | ;bytes - Length to write. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Bytes written. 21 | ; 22 | _WriteFile proc syscall handle:dword, source:dword, bytes:dword 23 | public _WriteFile 24 | pushm ebx,ecx,edx 25 | mov ebx,handle 26 | mov ecx,bytes 27 | mov edx,source 28 | call WriteFile 29 | popm ebx,ecx,edx 30 | ret 31 | _WriteFile endp 32 | 33 | 34 | efile 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get state field of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetState(button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;button - Entry number. 16 | ;dialog - Pointer to dialog structure. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - State. 21 | ; 22 | ;ALL other registers preserved. 23 | ; 24 | _DialogGetState proc syscall button:dword, dialog:dword 25 | public _DialogGetState 26 | pushm ecx,esi 27 | mov ecx,button 28 | mov esi,dialog 29 | call DialogGetState 30 | popm ecx,esi 31 | ret 32 | _DialogGetState endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_srtflst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Sort a file list into alpha-numeric order. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SortFileList(filelist); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;filelist - pointer to file list to sort. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | ;File names are not case converted so upper case names will appear at the top 21 | ;of the list. 22 | ; 23 | _SortFileList proc syscall filelist:dword 24 | public _SortFileList 25 | push esi 26 | mov esi,filelist 27 | call SortFileList 28 | pop esi 29 | ret 30 | _SortFileList endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_strlnpx.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Work out the pixel length of a string. 8 | ; 9 | ;Calling: 10 | ; 11 | ;StringLenPixels(string,font); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;string - String to scan. 16 | ;font - Font to use. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Length in pixels. 21 | ; 22 | ;ALL other registers preserved. 23 | ; 24 | _StringLenPixels proc syscall string:dword, font:dword 25 | public _StringLenPixels 26 | pushm esi,edi 27 | mov esi,string 28 | mov edi,font 29 | call StringLenPixels 30 | popm esi,edi 31 | ret 32 | _StringLenPixels endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtbw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get width of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetButtonW(button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;button - Entry number. 16 | ;dialog - Pointer to dialog structure. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Width. 21 | ; 22 | ;ALL other registers preserved. 23 | ; 24 | _DialogGetButtonW proc syscall button:dword, dialog:dword 25 | public _DialogGetButtonW 26 | pushm ecx,esi 27 | mov ecx,button 28 | mov esi,dialog 29 | call DialogGetButtonW 30 | popm ecx,esi 31 | ret 32 | _DialogGetButtonW endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtby.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get Y coord of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetButtonY(button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;button - Entry number. 16 | ;dialog - Pointer to dialog structure. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Y coord. 21 | ; 22 | ;ALL other registers preserved, 23 | ; 24 | _DialogGetButtonY proc syscall button:dword, dialog:dword 25 | public _DialogGetButtonY 26 | pushm ecx,esi 27 | mov ecx,button 28 | mov esi,dialog 29 | call DialogGetButtonY 30 | popm ecx,esi 31 | ret 32 | _DialogGetButtonY endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/remallo.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | include ..\cw.inc 3 | scode 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Re-size previously allocated memory. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - New size. 12 | ;ESI - Current address of memory. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;Carry set on error and ESI=0 else, 17 | ; 18 | ;ESI - New address of memory. 19 | ; 20 | ;All other registers preserved. 21 | ; 22 | ReMalloc proc near 23 | pushm eax,edx 24 | add esi,DataLinearBase 25 | sys ResMemLinear32 26 | jc l0 27 | sub esi,DataLinearBase 28 | clc 29 | jmp l1 30 | l0: xor esi,esi 31 | stc 32 | l1: popm eax,edx 33 | ret 34 | ReMalloc endp 35 | 36 | 37 | efile 38 | end 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtbd.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get depth of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetButtonD(button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;button - Entry number. 16 | ;dialog - Pointer to dialog structure. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Depth. 21 | ; 22 | ;ALL other registers preserved. 23 | ; 24 | _DialogGetButtonD proc syscall button:dword, dialog:dword 25 | public _DialogGetButtonD 26 | pushm ecx,esi 27 | mov ecx,button 28 | mov esi,dialog 29 | call DialogGetButtonD 30 | popm ecx,esi 31 | ret 32 | _DialogGetButtonD endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlggtbx.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Get X coord of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogGetButtonX(button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;button - Entry number. 16 | ;dialog - Pointer to dialog structure. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - X coord. 21 | ; 22 | ;ALL other registers preserved. 23 | ; 24 | _DialogGetButtonX proc syscall button:dword, dialog:dword 25 | public _DialogGetButtonX 26 | pushm ecx,esi 27 | mov ecx,button 28 | mov esi,dialog 29 | call _DialogGetButtonX 30 | popm ecx,esi 31 | ret 32 | _DialogGetButtonX endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/strlnpx.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Work out the pixel length of a string. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - String to scan. 12 | ;EDI - Font to use. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - Length in pixels. 17 | ; 18 | ;ALL other registers preserved. 19 | ; 20 | StringLenPixels proc near 21 | pushm ebx,ecx,esi,edi 22 | xor ecx,ecx 23 | @@1: movzx eax,b[esi] 24 | or al,al 25 | jz @@0 26 | inc esi 27 | mov ebx,[edi+eax*4] ;point to this character. 28 | add ecx,BM_Wide[ebx] 29 | jmp @@1 30 | @@0: mov eax,ecx 31 | popm ebx,ecx,esi,edi 32 | ret 33 | StringLenPixels endp 34 | 35 | 36 | efile 37 | end 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/wsetpix.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set a pixel to specified colour. Cheats by useing WinFillRectangle for now. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EAX - Flags, bit significant if set. 11 | ; 0 - FillValue is RGB. 12 | ;EBX - Fill value. 13 | ;ECX - X co-ord. 14 | ;EDX - Y co-ord. 15 | ;EBP - Bitmap. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;All registers preserved. 22 | ; 23 | WinSetPixel proc near 24 | push 1 25 | push 1 26 | push edx 27 | push ecx 28 | push ebx 29 | push eax 30 | push ebp 31 | call WinFillRectangle 32 | add esp,4*7 33 | ret 34 | WinSetPixel endp 35 | 36 | 37 | efile 38 | end 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bsetpix.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set a pixel to specified colour. Cheats by useing BitmapFillRectangle for now. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EAX - Flags, bit significant if set. 11 | ; 0 - FillValue is RGB. 12 | ;EBX - Fill value. 13 | ;ECX - X co-ord. 14 | ;EDX - Y co-ord. 15 | ;EBP - Bitmap. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;All registers preserved. 22 | ; 23 | BitmapSetPixel proc near 24 | push ebp 25 | push 1 26 | push 1 27 | push edx 28 | push ecx 29 | push ebx 30 | push eax 31 | call BitmapFillRectangle 32 | add esp,4*7 33 | ret 34 | BitmapSetPixel endp 35 | 36 | 37 | efile 38 | end 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/getkey.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get key press info. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;none. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;AL - ASCII character code. 15 | ;AH - Hardware key code. 16 | ;EAX high word - Shift keys status word from 417h. 17 | ; 18 | GetKey proc near 19 | push ebx 20 | xor ebx,ebx 21 | mov ah,1 22 | int 16h ;keypress waiting? 23 | jz l0 24 | mov ah,0 25 | int 16h ;get key codes. 26 | movzx ebx,ax 27 | l0: push es 28 | mov es,ZeroSelector 29 | movzx eax,es:w[417h] ;get shift status. 30 | pop es 31 | shl eax,16 32 | or eax,ebx 33 | pop ebx 34 | ret 35 | GetKey endp 36 | 37 | 38 | efile 39 | end 40 | 41 | -------------------------------------------------------------------------------- /samples/tiny16.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- 16-bit sample, memory model tiny. 3 | ;--- assemble: ml -c tiny16.asm 4 | ;--- link: wl32 tiny16 5 | 6 | .286 7 | .model tiny 8 | .dosseg 9 | .stack 10 | 11 | .data 12 | 13 | text1 db "hello, world!",13,10,'$' 14 | 15 | .code 16 | 17 | main proc c 18 | 19 | mov dx,offset text1 20 | mov ah,9 21 | int 21h 22 | ret 23 | main endp 24 | 25 | start: 26 | ;--- model tiny needs an alias, since DGROUP is a code selector 27 | mov bx,cs 28 | mov ax,000ah 29 | int 31h 30 | mov ds,ax 31 | mov es,ax 32 | lsl dx,ax 33 | inc dx 34 | mov ss,ax 35 | mov sp,dx 36 | ;--- now tiny is setup correctly, cs=ss=ds=es 37 | call main 38 | mov ax,4c00h 39 | int 21h 40 | 41 | END start 42 | 43 | -------------------------------------------------------------------------------- /src/cwd/cwd.doc: -------------------------------------------------------------------------------- 1 | 2 | ; int 31h called with AX= 3 | 4 | GetRVect equ 0200h 5 | SetRVect equ 0201h 6 | GetEVect equ 0202h 7 | SetEVect equ 0203h 8 | GetVect equ 0204h 9 | SetVect equ 0205h 10 | 11 | Info equ 0ff00h ;Get general purpose segment selectors. 12 | GetSel equ 0ff03h 13 | AliasSel equ 0ff06h 14 | GetSelDet equ 0ff07h 15 | GetSelDet32 equ 0ff08h 16 | SetSelDet32 equ 0ff0ah 17 | RelMem equ 0ff0fh 18 | GetMemLinear32 equ 0ff11h 19 | ResMemLinear32 equ 0ff13h 20 | RelMemLinear32 equ 0ff15h 21 | LockMem32 equ 0ff1ch 22 | GetMemDOS equ 0ff21h 23 | SetDOSTrans equ 0ff26h 24 | 25 | ;--- encoded directly in cwd-ovl.asm: 26 | load program for debugging 0fffdh 27 | close all files 0fffeh 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_regsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Register a bitmap that needs to be re-mapped whenever the hardware palette 7 | ;changes so it stays in the system palette scheme. 8 | ; 9 | ;Calling: 10 | ; 11 | ;RegisterSystemBitmap(bitmap); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;bitmap - Pointer to bitmap. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - handle. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | _RegisterSystemBitmap proc syscall bitmap:dword 24 | public _RegisterSystemBitmap 25 | push esi 26 | mov esi,bitmap 27 | call RegisterSystemBitmap 28 | pop esi 29 | ret 30 | _RegisterSystemBitmap endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setdacs.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the value's in VGA colour DAC's. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SetDACs(base,count,palette); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;base - Starting DAC number. 15 | ;count - Number of DAC's to set. 16 | ;palette - Pallet information 17 | ; 18 | ;On Exit: 19 | ; 20 | ;nothing. 21 | ; 22 | ;ALL registers preserved. 23 | ; 24 | _SetDACs proc syscall base:dword, count:dword, palette:dword 25 | public _SetDACs 26 | pushm ebx,ecx,esi 27 | mov ebx,base 28 | mov ecx,count 29 | mov esi,palette 30 | call SetDACs 31 | popm ebx,ecx,esi 32 | ret 33 | _SetDACs endp 34 | 35 | 36 | efile 37 | end 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ldfont.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Load font file into a slot. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LoadFont(filename,slot); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filename - file name. 16 | ;slot - slot number. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - status. 21 | ; 0 - no error. 22 | ; 1 - file not found or I/O error. 23 | ; 2 - not enough memory. 24 | ; 25 | ;ALL other registers preserved. 26 | ; 27 | _LoadFont proc syscall filename:dword, slot:dword 28 | public _LoadFont 29 | pushm ecx,edx 30 | mov ecx,slot 31 | mov edx,filename 32 | call LoadFont 33 | popm ecx,edx 34 | ret 35 | _LoadFont endp 36 | 37 | 38 | efile 39 | end 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_relsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Release a bitmap previously regeistered with the bitmap manager. Duplicate 7 | ;memory is free'd and entry in table is marked free. 8 | ; 9 | ;Calling: 10 | ; 11 | ;ReleaseSystemBitmap(handle); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;handle - Handle returned by RegisterSystemBitmap 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | _ReleaseSystemBitmap proc syscall handle:dword 24 | public _ReleaseSystemBitmap 25 | push esi 26 | mov esi,handle 27 | call ReleaseSystemBitmap 28 | pop esi 29 | ret 30 | _ReleaseSystemBitmap endp 31 | 32 | 33 | efile 34 | end 35 | 36 | 37 | -------------------------------------------------------------------------------- /samples/dosshell.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ;Example of shell to DOS. 3 | ; 4 | .model small 5 | .386 6 | 7 | STACK Segment para stack use16 'STACK' 8 | DB 400h DUP (?) 9 | ENDS 10 | 11 | include cw.inc 12 | b equ byte ptr 13 | w equ word ptr 14 | 15 | .data 16 | aname db 'c:\command.com',0 ; change 'c' to drive containing COMMAND.COM 17 | ptab dw 0 18 | dw ctab 19 | dw dgroup 20 | dw 0 21 | dw dgroup 22 | dw 0 23 | dw dgroup 24 | ctab db 0,13 25 | 26 | sometext db 'hello world',13,10,'$' 27 | 28 | .code 29 | start: mov ax,DGROUP 30 | mov ds,ax 31 | mov es,ax 32 | 33 | mov dx,offset sometext 34 | mov ah,9 35 | int 21h 36 | 37 | mov dx,offset aname 38 | mov bx,offset ptab 39 | mov ax,4b00h 40 | int 21h 41 | 42 | mov ax,4c00h 43 | int 21h 44 | 45 | end start 46 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_bin2hex.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert number into Hex ASCII. 7 | ; 8 | ;Calling: 9 | ; 10 | ;Bin2Hex(number,digits,buffer); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;number - Number to convert. 15 | ;digits - digits to produce. 16 | ;buffer - Buffer to put it in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Next available byte in buffer. 21 | ; 22 | _Bin2Hex proc syscall number:dword, digits:dword, buffer:dword 23 | public _Bin2Hex 24 | pushm ecx,edi 25 | mov eax,number 26 | mov ecx,digits 27 | mov edi,buffer 28 | call Bin2Dec 29 | mov eax,edi 30 | popm ecx,edi 31 | ret 32 | _Bin2Hex endp 33 | 34 | efile 35 | 36 | end 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/getpath.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Get current drive and path. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - pointer to buffer. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | GetPath proc near 17 | pushm eax,edx,esi,edx 18 | mov ah,19h ;get current disc 19 | int 21h 20 | mov dl,al 21 | add al,'A' ;make it a character 22 | pop esi 23 | mov [esi],al 24 | inc esi 25 | mov b[esi],":" 26 | inc esi 27 | mov b[esi],"\" 28 | inc esi 29 | mov b[esi],0 30 | mov ah,47h ;get current directory 31 | xor dl,dl ;default drive 32 | int 21h ;get text 33 | popm eax,edx,esi 34 | ret 35 | GetPath endp 36 | 37 | 38 | efile 39 | end 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlgdraw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Draw a dialog entry. 7 | ; 8 | ;Calling: 9 | ; 10 | ;DrawDialog(button,dialog,window); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;button - Button number to draw, -1 for all. 15 | ;dialog - Dialog table to draw from. 16 | ;window - Window to draw in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;nothing. 21 | ; 22 | ;ALL registers preserved. 23 | ; 24 | _DrawDialog proc syscall button:dword, dialog:dword, window:dword 25 | public _DrawDialog 26 | pushm ecx,esi,edi 27 | mov ecx,button 28 | mov esi,dialog 29 | mov edi,window 30 | call DrawDialog 31 | popm ecx,esi,edi 32 | ret 33 | _DrawDialog endp 34 | 35 | 36 | efile 37 | end 38 | 39 | 40 | -------------------------------------------------------------------------------- /samples/flat.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- 32-bit sample, memory model flat. 3 | ;--- assemble: ml -c flat.asm 4 | ;--- link: WL32 flat 5 | ;--- or use OW's wlink: wlink system causeway f flat.obj 6 | 7 | ;--- to debug with OW's WD: 8 | ;--- assemble: jwasm -Zi -c flat.asm 9 | ;--- link wlink DEBUG c OP cvp,symfile SYSTEM causeway FILE flat.obj OP m 10 | ;--- debug: wd /tr=cw flat.exe 11 | 12 | .386 13 | .model flat 14 | .stack 15 | 16 | .data 17 | 18 | text1 db "hello, world",13,10,'$' 19 | 20 | .code 21 | 22 | main proc c 23 | 24 | mov edx,offset text1 25 | mov ah,9 26 | int 21h 27 | ret 28 | main endp 29 | 30 | start: 31 | mov eax,ss 32 | mov ds,eax 33 | mov es,eax 34 | call main 35 | mov ax,4c00h 36 | int 21h 37 | 38 | END start 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlgstst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Set state field of a dialog entry. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogSetState(state,button,dialog); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;state - State to set. 16 | ;button - Entry number. 17 | ;dialog - Pointer to dialog structure. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;nothing. 22 | ; 23 | ;ALL registers preserved. 24 | ; 25 | _DialogSetState proc syscall state:dword, button:dword, dialog:dword 26 | public _DialogSetState 27 | pushm eax,ecx,esi 28 | mov eax,state 29 | mov ecx,button 30 | mov esi,dialog 31 | call DialogSetState 32 | popm eax,ecx,esi 33 | ret 34 | _DialogSetState endp 35 | 36 | 37 | efile 38 | end 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/cw32/CW32j.mak: -------------------------------------------------------------------------------- 1 | 2 | # build the CauseWay extender with JWasm, no linker. 3 | # CW32.EXE: uncompressed 4 | # CWSTUB.EXE: compressed 5 | 6 | AOPT=-DNOEXPORTS -DDEFLOWMEM=256 7 | 8 | ALL : Build Build\cw32.exe Build\cwstub.exe 9 | 10 | Build: 11 | @mkdir Build 12 | 13 | Build\cwstub.exe: Build\cw32.exe 14 | @copy Build\cw32.exe Build\cwstub.exe >NUL 15 | @..\..\bin\cwc /q /m2 /l85 Build\cwstub.exe 16 | 17 | Build\cw32.exe: cw32.asm rawvcpi1.inc rawvcpi2.inc interrup.inc ldt.inc memory.inc dosmem.inc api.inc \ 18 | int10h.inc int21h.inc int33h.inc decode_c.inc exceptn.inc ..\strucs.inc ..\cw.inc loadle.inc load3p.inc 19 | @jwasm -Cp -mz $(AOPT) -nologo -DKRNLDBG -I.. -FlBuild\ -FoBuild\ cw32.asm 20 | 21 | clean: 22 | @del Build\cw32.exe 23 | @del Build\cwstub.exe 24 | @del Build\cw32.lst 25 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_getdrvs.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Build a list of all valid drives on the system. 7 | ; 8 | ;Calling: 9 | ; 10 | ;GetDrives(buffer); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;buffer - Address to build list of drives. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;EAX - number of drives. 19 | ; 20 | ;ALL other registers preserved. 21 | ; 22 | ;The drive list uses real drive codes (not ASCII). Each entry uses 1 byte 23 | ;and the list is terminated with -1. 24 | ; 25 | _GetDrives proc syscall buffer:dword 26 | public _GetDrives 27 | pushm ecx,edx 28 | mov edx,buffer 29 | call GetDrives 30 | mov eax,ecx 31 | popm ecx,edx 32 | ret 33 | _GetDrives endp 34 | 35 | 36 | efile 37 | end 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/setposf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the file pointer position for a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;AL - method. 11 | ;EBX - handle. 12 | ;ECX - position. 13 | ; 14 | ;Methods are: 15 | ; 16 | ;0 - Absolute offset from start. 17 | ;1 - signed offset from current position. 18 | ;2 - signed offset from end of file. 19 | ; 20 | ;On Exit: 21 | ; 22 | ;ECX - absolute offset from start of file. 23 | ; 24 | SetFilePointer proc near 25 | pushm eax,edx 26 | mov dx,cx 27 | shr ecx,16 28 | mov ah,42h ;set pointer function. 29 | int 21h 30 | mov cx,dx 31 | shl ecx,16 32 | mov cx,ax ;fetch small result. 33 | popm eax,edx 34 | ret 35 | SetFilePointer endp 36 | 37 | 38 | efile 39 | end 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_crbtmp.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Create a new bitmap. 8 | ; 9 | ;Calling: 10 | ; 11 | ;CreateBitmap(bflags,wide,depth); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;bflags - bitmap flags entry. 16 | ;wide - bitmap width. 17 | ;depth - bitmap depth. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;Carry set on error and EAX=0 else, 22 | ; 23 | ;EAX - pointer to bitmap. 24 | ; 25 | ;ALL other registers preserved. 26 | ; 27 | _CreateBitmap proc syscall bflags:dword, wide:dword, depth:dword 28 | public _CreateBitmap 29 | pushm ebx,ecx,edx 30 | mov ebx,bflags 31 | mov ecx,wide 32 | mov edx,depth 33 | call CreateBitmap 34 | popm ebx,ecx,edx 35 | ret 36 | _CreateBitmap endp 37 | 38 | 39 | efile 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/remsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Copy and re-map "system" bitmap duplicate. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDI - pointer to "system" bitmap table entry. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;nothing. 15 | ; 16 | ;ALL registers preserved. 17 | ; 18 | RemapSystemBitmap proc near 19 | pushm eax,ebx,ecx,esi,edi 20 | mov esi,BMT_Pointer[edi] 21 | mov eax,BM_Wide[esi] 22 | mul BM_Depth[esi] 23 | mov ecx,eax 24 | mov edi,BMT_Duplicate[edi] 25 | xchg esi,edi 26 | add edi,size BM 27 | mov ebx,offset SystemXLat 28 | l0: mov al,[esi] 29 | inc esi 30 | xlat 31 | mov [edi],al 32 | inc edi 33 | dec ecx 34 | jnz l0 35 | popm eax,ebx,ecx,esi,edi 36 | ret 37 | RemapSystemBitmap endp 38 | 39 | 40 | efile 41 | end 42 | 43 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_regupw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Update a particular rectangle of the display. 7 | ; 8 | ;Calling: 9 | ; 10 | ;WindowRegionUpdate(xcoord,ycoord,wide,depth); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;xcoord - X coord. 15 | ;ycoord - Y coord. 16 | ;wide - width. 17 | ;depth - depth. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;nothing. 22 | ; 23 | ;ALL registers preserved. 24 | ; 25 | _WindowRegionUpdate proc syscall xcoord:dword, ycoord:dword, wide:dword, depth:dword 26 | public _WindowRegionUpdate 27 | pushm ecx,edx,esi,edi 28 | mov ecx,xcoord 29 | mov edx,ycoord 30 | mov esi,wide 31 | mov edi,depth 32 | call WindowRegionUpdate 33 | popm ecx,edx,esi,edi 34 | ret 35 | _WindowRegionUpdate endp 36 | 37 | 38 | efile 39 | end 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bin2hex.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Convert number into ASCII Hex version. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;EAX - Number to convert. 12 | ;ECX - Digits to do. 13 | ;EDI - Buffer to put string in. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;EDI - Next un-used byte in buffer. 18 | ; 19 | ;All other registers preserved. 20 | ; 21 | Bin2Hex proc near 22 | pushm eax,ebx,ecx,edx,edi 23 | mov ebx,offset HexTable 24 | add edi,ecx 25 | dec edi 26 | mov edx,eax 27 | @@0: mov al,dl 28 | shr edx,4 29 | and al,15 30 | xlat 31 | mov [edi],al 32 | dec edi 33 | loop @@0 34 | popm eax,ebx,ecx,edx,edi 35 | add edi,ecx 36 | ret 37 | Bin2Hex endp 38 | 39 | 40 | sdata 41 | 42 | HexTable db "0123456789ABCDEF" 43 | 44 | 45 | efile 46 | end 47 | -------------------------------------------------------------------------------- /samples/croak2.c: -------------------------------------------------------------------------------- 1 | // croak2.c 2 | // C source example #2 on using UserDump API function 3 | #include 4 | #include 5 | 6 | char buffer[128]="Help me, I'm trapped in CW.ERR"; 7 | 8 | void main(void) 9 | { 10 | int i; 11 | union REGS regs; 12 | struct SREGS sregs; 13 | 14 | segread(&sregs); 15 | sregs.es=sregs.ds; 16 | regs.x.edi=(int)buffer; 17 | regs.w.cx=128; 18 | regs.h.bl='A'; // ASCII dump 19 | regs.h.bh=0; // no presetting dump bytes 20 | regs.w.ax=0xff2f; 21 | int386x(0x31,®s,®s,&sregs); 22 | croaker(); 23 | } 24 | 25 | void croaker(void) 26 | { 27 | int i,peekaboo=0x12345678; 28 | 29 | printf("%d ",*(int *)peekaboo); // if this one doesn't GPF, 30 | peekaboo=0x87654321; // then 31 | printf("%d\n",*(int *)peekaboo); // this one will 32 | } 33 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ldimage.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Load an image file. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LoadImageFile(filename,bitmap); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filename - pointer to name of file to load. 16 | ;bitmap - pointer to variable to store bitmap address in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Status, 21 | ; 0 - No error. 22 | ; 1 - Bad file format. 23 | ; 2 - File access error. 24 | ; 3 - Not enough memory. 25 | ;bitmap - pointer to bitmap. 26 | ; 27 | _LoadImageFile proc syscall filename:dword, bitmap:dword 28 | public _LoadImageFile 29 | pushm edx,esi 30 | mov edx,filename 31 | call LoadImageFile 32 | mov edx,bitmap 33 | mov [edx],esi 34 | popm edx,esi 35 | ret 36 | _LoadImageFile endp 37 | 38 | 39 | efile 40 | end 41 | 42 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setpal.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set hardware palette. Generates new system to hardware translation table 7 | ;and re-maps all "system" bitmaps. 8 | ; 9 | ;Calling: 10 | ; 11 | ;VideoSetPalette(base,count,palette); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;base - Base pen to set. 16 | ;count - Number of pens to set. 17 | ;palette - pointer to palette data. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;nothing. 22 | ; 23 | ;ALL registers preserved. 24 | ; 25 | _VideoSetPalette proc syscall base:dword, count:dword, palette:dword 26 | public _VideoSetPalette 27 | pushm eax,ecx,esi 28 | mov eax,base 29 | mov ecx,count 30 | mov esi,palette 31 | call VideoSetPalette 32 | popm eax,ecx,esi 33 | ret 34 | _VideoSetPalette endp 35 | 36 | 37 | efile 38 | end 39 | 40 | 41 | -------------------------------------------------------------------------------- /samples/croak1.c: -------------------------------------------------------------------------------- 1 | // croak1.c 2 | // C source example #1 on using UserDump API function 3 | #include 4 | #include 5 | 6 | void main(void) 7 | { 8 | int i; 9 | char buffer[128]; 10 | union REGS regs; 11 | struct SREGS sregs; 12 | 13 | segread(&sregs); 14 | sregs.es=sregs.ds; 15 | regs.x.edi=(int)buffer; 16 | regs.w.cx=128; 17 | regs.h.bl=0; // non-ASCII dump 18 | regs.w.ax=0xff2f; 19 | int386x(0x31,®s,®s,&sregs); 20 | for(i=0;i<128;i++){ // fill dump with discernable pattern 21 | buffer[i]=i; 22 | } 23 | croaker(); 24 | } 25 | 26 | void croaker(void) 27 | { 28 | int i,peekaboo=0x12345678; 29 | 30 | printf("%d ",*(int *)peekaboo); // if this one doesn't GPF, 31 | peekaboo=0x87654321; // then 32 | printf("%d\n",*(int *)peekaboo); // this one will 33 | } 34 | -------------------------------------------------------------------------------- /samples/small32.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- 32-bit sample, memory model small. To create: 3 | ;--- ml -c small32.asm 4 | ;--- wl32 small32 5 | ;--- or, alternatively: 6 | ;--- ml -c -D?FLAT small32.asm 7 | ;--- wl32 /f small32 8 | 9 | .386 10 | .model small 11 | .dosseg 12 | .stack 13 | 14 | .data 15 | 16 | text1 db "hello, world",13,10,'$' 17 | 18 | .code 19 | 20 | main proc c 21 | 22 | mov edx,offset text1 23 | mov ah,9 24 | int 21h 25 | ret 26 | main endp 27 | 28 | ;--- entry in 3P format: 29 | ;--- SS:ESP = segment stack 30 | ;--- DS,ES = PSP 31 | ;--- small model assumes: DS=ES=SS=DGROUP 32 | 33 | start: 34 | mov eax,@data 35 | mov ds,eax 36 | mov es,eax 37 | ifndef ?FLAT 38 | lsl edx,eax 39 | inc edx 40 | mov ss,eax 41 | mov esp,edx 42 | endif 43 | call main 44 | mov ax,4c00h 45 | int 21h 46 | 47 | END start 48 | 49 | -------------------------------------------------------------------------------- /samples/tiny32.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- 32-bit sample, memory model tiny. To create: 3 | ;--- ml -c tiny32.asm 4 | ;--- wl32 tiny32 5 | ;--- or, alternativly: 6 | ;--- ml -c -D?FLAT tiny32.asm 7 | ;--- wl32 /f tiny32 8 | 9 | .386 10 | .model tiny 11 | .dosseg 12 | .stack 13 | 14 | .data 15 | 16 | text1 db "hello, world",13,10,'$' 17 | 18 | .code 19 | 20 | main proc c 21 | 22 | mov edx,offset text1 23 | mov ah,9 24 | int 21h 25 | ret 26 | main endp 27 | 28 | start: 29 | ifndef ?FLAT 30 | ;--- model tiny needs an alias, since DGROUP is code 31 | mov ebx,cs 32 | mov ax,000ah 33 | int 31h 34 | mov ds,eax 35 | mov es,eax 36 | lsl edx,eax 37 | inc edx 38 | mov ss,eax 39 | mov esp,edx 40 | else 41 | mov eax,ss 42 | mov ds,eax 43 | mov es,eax 44 | endif 45 | call main 46 | mov ax,4c00h 47 | int 21h 48 | 49 | END start 50 | 51 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ldiff.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Loads and unpacks an IFF file. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LoadIFF(filename,bitmap); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filename - pointer to name of file to load. 16 | ;bitmap - pointer to variable to store bitmap address in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Status, 21 | ; 0 - No error. 22 | ; 1 - Bad file format. 23 | ; 2 - File access error. 24 | ; 3 - Not enough memory. 25 | ;bitmap - Bitmap pointer. 26 | ; 27 | ;ALL other registers preserved. 28 | ; 29 | _LoadIFF proc syscall filename:dword, bitmap:dword 30 | public _LoadIFF 31 | pushm edx,esi 32 | mov edx,filename 33 | call LoadIFF 34 | mov edx,bitmap 35 | mov [edx],esi 36 | popm edx,esi 37 | ret 38 | _LoadIFF endp 39 | 40 | 41 | efile 42 | end 43 | 44 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ldgif.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Loads and unpacks a GIF file. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LoadGIF(filename,bitmap); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filename - pointer to name of file to load. 16 | ;bitmap - pointer to variable to store bitmap address in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Status, 21 | ; 0 - No error. 22 | ; 1 - Bad file format. 23 | ; 2 - File access error. 24 | ; 3 - Not enough memory. 25 | ;bitmap - Bitmap pointer. 26 | ; 27 | ;ALL other registers preserved. 28 | ; 29 | _LoadGIF proc syscall filename:dword, bitmap:dword 30 | public _LoadGIF 31 | pushm edx,esi 32 | mov edx,filename 33 | call LoadGIF 34 | mov edx,bitmap 35 | mov [edx],esi 36 | popm edx,esi 37 | ret 38 | _LoadGIF endp 39 | 40 | 41 | efile 42 | end 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ldtga.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Loads and unpacks a TGA file. 8 | ; 9 | ;Calling: 10 | ; 11 | ;LoadTGA(filename,bitmap); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filename - pointer to name of file to load. 16 | ;bitmap - pointer to variable to store bitmap address in. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Status, 21 | ; 0 - No error. 22 | ; 1 - Bad file format. 23 | ; 2 - File access error. 24 | ; 3 - Not enough memory. 25 | ;bitmap - Bitmap pointer. 26 | ; 27 | ;ALL other registers preserved. 28 | ; 29 | _LoadTGA proc syscall filename:dword, bitmap:dword 30 | public _LoadTGA 31 | pushm edx,esi 32 | mov edx,filename 33 | call LoadTGA 34 | mov edx,bitmap 35 | mov [edx],esi 36 | popm edx,esi 37 | ret 38 | _LoadTGA endp 39 | 40 | 41 | efile 42 | end 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_svgif.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Encodes and writes a bitmap in GIF format. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SaveGIF(flags,filename,bitmap); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;flags - flags, bit significant if set. 15 | ;filename - pointer to name of file to load. 16 | ;bitmap - pointer to bitmap. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;EAX - Status, 21 | ; 0 - no error. 22 | ; 1 - file error. 23 | ; 2 - not enough memory (for buffers). 24 | ; 3 - format error. 25 | ; 26 | ;ALL other registers preserved. 27 | ; 28 | _SaveGIF proc syscall flags:dword, filename:dword, bitmap:dword 29 | public _SaveGIF 30 | pushm edx,esi 31 | mov eax,flags 32 | mov edx,filename 33 | mov esi,bitmap 34 | call SaveGIF 35 | popm edx,esi 36 | ret 37 | _SaveGIF endp 38 | 39 | 40 | efile 41 | end 42 | 43 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setpix.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set a pixel to specified colour. Cheats by useing VideoFillRectangle for now. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;C style stack with following parameters, 11 | ; 12 | ;flags - Flags, bit significant if set. 13 | ; 0 - FillValue is RGB. 14 | ;fillvalue - Fill value. 15 | ;xcoord - X co-ord. 16 | ;ycoord - Y co-ord. 17 | ; 18 | ;On Exit: 19 | ; 20 | ;nothing. 21 | ; 22 | ;All registers preserved. 23 | ; 24 | _VideoSetPixel: 25 | public _VideoSetPixel 26 | _VideoSetPixel_ proc syscall flags:dword, fillvalue:dword, xcoord:dword, ycoord:dword 27 | pushm eax,ebx,ecx,edx 28 | mov eax,flags 29 | mov ebx,fillvalue 30 | mov ecx,xcoord 31 | mov edx,ycoord 32 | call VideoSetPixel 33 | popm eax,ebx,ecx,edx 34 | ret 35 | _VideoSetPixel_ endp 36 | 37 | 38 | efile 39 | end 40 | 41 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_svtga.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Encodes and writes a bitmap in TGA format. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SaveTGA(flags,filename,bitmap); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;flags - flags, bit significant if set. 15 | ; 0 - compress. 16 | ;filename - pointer to name of file to load. 17 | ;bitmap - pointer to bitmap. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;EAX - Status, 22 | ; 0 - no error. 23 | ; 1 - file error. 24 | ; 2 - not enough memory (for buffers). 25 | ; 3 - format error. 26 | ; 27 | ;ALL other registers preserved. 28 | ; 29 | _SaveTGA proc syscall flags:dword, filename:dword, bitmap:dword 30 | public _SaveTGA 31 | pushm edx,esi 32 | mov eax,flags 33 | mov edx,filename 34 | mov esi,bitmap 35 | call SaveTGA 36 | popm edx,esi 37 | ret 38 | _SaveTGA endp 39 | 40 | 41 | efile 42 | end 43 | 44 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_whichw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;See which (if any) window co-ords fall inside and return relative values 7 | ; 8 | ;Calling: 9 | ; 10 | ;WinWhichWindow(ints1,ints2); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;ints1 - pointer to 3 int's with button, xcoord and ycoord info. 15 | ;ints2 - pointer to 3 int's to fill in, button becomes window. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;nothing. 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | _WinWhichWindow proc syscall ints1:dword, ints2:dword 24 | public _WinWhichWindow 25 | pushm eax,ecx,edx,esi 26 | mov esi,ints1 27 | mov ecx,[esi+4] 28 | mov edx,[esi+8] 29 | call WinWhichWindow 30 | mov esi,ints2 31 | mov [esi],eax 32 | mov [esi+4],ecx 33 | mov [esi+8],edx 34 | popm eax,ecx,edx,esi 35 | ret 36 | _WinWhichWindow endp 37 | 38 | 39 | efile 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /doc/page_48.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 48 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

FarCallReal Simulate real mode far call.

15 | 16 |

Inputs: AX = 0ff02h

17 |

ES:[E]DI = Real mode register list.

18 |

Outputs: Register list updated.

19 |

Errors: None.

20 | 21 | 22 | 23 |

Notes: This function works much the same as IntXX but provides a 16 bit FAR stack frame and the CS:IP values are used to pass control to the real mode code.

24 | 25 | 26 |
27 | 28 |

Next Page

29 |

Previous Page

30 |

Go to Table of Contents

31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_ulflist.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Convert normal names to lower case and directory names to upper case. 7 | ; 8 | ;Calling: 9 | ; 10 | ;ULFileList(filelist); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;filelist - pointer to file list. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | ;Most routines that need to display a file list want directory names in upper 21 | ;case and the remaining names in lower case. This routine formats a file list 22 | ;to that specification. Doing things this way means that if the file list is 23 | ;then sorted, directory names will appear at the top. 24 | ; 25 | _ULFileList proc syscall filelist:dword 26 | public _ULFileList 27 | pushm esi 28 | mov esi,filelist 29 | call ULFileList 30 | popm esi 31 | ret 32 | _ULFileList endp 33 | 34 | 35 | efile 36 | end 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_sviff.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Encodes and writes a bitmap in IFF format. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SaveIFF(flags,filename,bitmap); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;flags - flags, bit significant if set. 15 | ; 0 - compress output. 16 | ; 1 - old format. 17 | ;filename - pointer to name of file to load. 18 | ;bitmap - pointer to bitmap. 19 | ; 20 | ;On Exit: 21 | ; 22 | ;EAX - Status, 23 | ; 0 - no error. 24 | ; 1 - file error. 25 | ; 2 - not enough memory (for buffers). 26 | ; 3 - format error. 27 | ; 28 | ;ALL other registers preserved. 29 | ; 30 | _SaveIFF proc syscall flags:dword, filename:dword, bitmap:dword 31 | public _SaveIFF 32 | pushm edx,esi 33 | mov eax,flags 34 | mov edx,filename 35 | mov esi,bitmap 36 | call SaveIFF 37 | popm edx,esi 38 | ret 39 | _SaveIFF endp 40 | 41 | 42 | efile 43 | end 44 | 45 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_setposf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Set the file pointer position for a file. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SetFilePointer(handle,method,position); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - file handle. 15 | ;method - method to use. 16 | ;position - position to set. 17 | ; 18 | ;Methods are: 19 | ; 20 | ;0 - Absolute offset from start. 21 | ;1 - signed offset from current position. 22 | ;2 - signed offset from end of file. 23 | ; 24 | ;On Exit: 25 | ; 26 | ;EAX - new absolute offset from start of file. 27 | ; 28 | _SetFilePointer proc syscall handle:dword, method:dword, position:dword 29 | public _SetFilePointer 30 | pushm ebx,ecx 31 | mov eax,method 32 | mov ebx,handle 33 | mov ecx,position 34 | call SetFilePointer 35 | mov eax,ecx 36 | popm ebx,ecx 37 | ret 38 | _SetFilePointer endp 39 | 40 | 41 | efile 42 | end 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlgbtwn.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Make a piece of window look like a button. 7 | ; 8 | ;Calling: 9 | ; 10 | ;ButtonWindow(btype,xcoord,ycoord,wide,depth,window); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;btype - Type of button to draw. 15 | ;xcoord - X coord to draw at. 16 | ;ycoord - Y coord to draw at. 17 | ;wide - width of button. 18 | ;depth - depth of button. 19 | ;window - Pointer to window structure. 20 | ; 21 | ;On Exit: 22 | ; 23 | ;nothing. 24 | ; 25 | ;ALL registers preserved. 26 | ; 27 | _ButtonWindow proc syscall btype:dword, xcoord:dword, ycoord:dword, \ 28 | wide:dword, depth:dword, window:dword 29 | public _ButtonWindow 30 | pushad 31 | mov eax,btype 32 | mov ecx,xcoord 33 | mov ebx,ycoord 34 | mov edx,wide 35 | mov edi,depth 36 | mov esi,window 37 | call ButtonWindow 38 | popad 39 | ret 40 | _ButtonWindow endp 41 | 42 | 43 | efile 44 | end 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_svimage.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Encodes and writes a bitmap in chosen format. 7 | ; 8 | ;Calling: 9 | ; 10 | ;SaveImageFile(flags,filename,bitmap); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;flags - flags, bit significant if set. 15 | ; 0 - compress output. 16 | ; 1 - alternate format. 17 | ;filename - pointer to name of file to create. 18 | ;bitmap - pointer to bitmap. 19 | ; 20 | ;On Exit: 21 | ; 22 | ;EAX - Status, 23 | ; 0 - no error. 24 | ; 1 - file error. 25 | ; 2 - not enough memory (for buffers). 26 | ; 3 - format error. 27 | ; 28 | ;ALL other registers preserved. 29 | ; 30 | _SaveImageFile proc syscall flags:dword, filename:dword, bitmap:dword 31 | public _SaveImageFile 32 | pushm edx,esi 33 | mov eax,flags 34 | mov edx,filename 35 | mov esi,bitmap 36 | call SaveImageFile 37 | popm edx,esi 38 | ret 39 | _SaveImageFile endp 40 | 41 | 42 | efile 43 | end 44 | 45 | -------------------------------------------------------------------------------- /src/cwd/cwd.cfg: -------------------------------------------------------------------------------- 1 | 2 | ; 3 | ;Tell CWD where to look for source files. CWD will look in the current DIR first 4 | ;and then in any paths specified here. Seperate paths with a ; same as a normal 5 | ;PATH statement. This command can be used more than once to append extra paths. 6 | ; 7 | SourcePath= 8 | 9 | ; 10 | ;Tell CWD what TAB positions to use for source display. 11 | ; 12 | SourceTABs=16,22,35,48,61 13 | 14 | ; 15 | ;Tell CWD which keys to use for breaking into the program. Codes are raw 16 | ;keyboard scan codes in decimal, upto 4 of them seperated by commas. Don't use 17 | ;extended codes (0e0h etc). 18 | ; 19 | ;Some useful codes: 20 | ; 21 | ;CTRL - 29 22 | ;ALT - 56 23 | ; 24 | ;Built in default is 29,56 (CTRL-ALT). 25 | ; 26 | BreakKeys=29,56 27 | 28 | ; 29 | ;Games tend to re-program the timer interrupt with a different value and 30 | ;dropping out of a debug session half way through might leave the timer running 31 | ;fast so we can tell CWD to reset the timer to its normal value. 32 | ; 33 | ResetTimer=YES 34 | -------------------------------------------------------------------------------- /doc/page_121.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 121 5 | 6 | 7 | 8 | 9 | 10 |

VMM

11 | 12 |

Virtual Memory Manager. CauseWay's virtual memory manager consists of the routines which handle swapping memory containing code and data, to and from the disk, from and to physical memory.

13 | 14 |

Wildsmith, John

15 | 16 |

One of the CauseWay developers. John Wildsmith wrote the original versions of the CauseWay DOS extender and the CWC compression and CWD debugger utilities.

17 | 18 |

WL32

19 | 20 |

The linker contained within the CauseWay software program.

21 | 22 |

XMS

23 | 24 |

XMS stand for extended memory specification, a standard software interface for extended memory access.

25 | 26 |

Previous Page

27 |

Go to Table of Contents

28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/cwd/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # make CWD.EXE & CWD.OVL, now using WL32 instead of CWL. 3 | 4 | ALL : Build Build\cwd.exe Build\cwd.ovl 5 | 6 | Build: 7 | @mkdir Build 8 | 9 | Build\cwd.exe: Build\cwd.obj 10 | @wl32 /q/ex/m/non/cs Build\cwd.obj,Build\cwd.exe,Build\cwd.map 11 | 12 | Build\cwd.obj: cwd.asm cmacros.inc equates.inc ..\strucs.inc 13 | @ml -c -nologo -FlBuild\ -FoBuild\ -I.. cwd.asm 14 | 15 | Build\cwd.ovl: Build\cwd-ovl.obj 16 | # @..\cwl\build\cwl.exe /MAP Build\cwd-ovl.obj,Build\cwd.ovl,Build\cwd-ovl.map 17 | @wl32 /q/m/cs/non Build\cwd-ovl.obj,Build\cwd.ovl,Build\cwd-ovl.map 18 | # @..\..\bin\cwc Build\cwd.ovl 19 | 20 | Build\cwd-ovl.obj: cwd-ovl.asm disas.inc generr.inc fpu.inc disaseq.inc win.inc evaluate.inc macros.inc \ 21 | getkeys.inc print.inc fileacc.inc ..\cw.inc ..\strucs.inc 22 | @ml -c -nologo -FlBuild\ -Sg -FoBuild\ /I.. cwd-ovl.asm 23 | # @jwasm -c -nologo -FlBuild\ -Sg -FoBuild\ /I.. cwd-ovl.asm 24 | 25 | clean: 26 | @del Build\cwd.exe 27 | @del Build\cwd.ovl 28 | @del Build\cwd.obj 29 | @del Build\cwd-ovl.obj 30 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/writef.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Write some data to a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - Address to write from. 11 | ;ECX - Length to write. 12 | ;EBX - file handle. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - Bytes written. 17 | ; 18 | WriteFile proc near 19 | pushm ecx,edx,esi 20 | xor esi,esi 21 | @@0: pushm ebx,ecx,edx,esi 22 | cmp ecx,65535 ;size of chunks to load. 23 | jc @@1 24 | mov ecx,65535 ;as close to 64k as can get. 25 | @@1: mov ah,40h 26 | int 21h ;read from the file. 27 | popm ebx,ecx,edx,esi 28 | jc @@2 29 | movzx eax,ax ;get length read. 30 | add esi,eax ;update length read counter. 31 | add edx,eax ;move memory pointer. 32 | sub ecx,eax ;update length counter. 33 | jz @@2 ;read as much as was wanted. 34 | or eax,eax ;did we write anything? 35 | jz @@2 36 | jmp @@0 37 | @@2: mov eax,esi 38 | popm ecx,edx,esi 39 | ret 40 | WriteFile endp 41 | 42 | 43 | efile 44 | end 45 | 46 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_dlgwhch.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Work out which section of a dialog the specified co-ords relate to. 8 | ; 9 | ;Calling: 10 | ; 11 | ;DialogWhich(xcoord,ycoord,dialog,result); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;xcoord - X coord. 16 | ;ycoord - Y coord. 17 | ;dialog - pointer to dialog. 18 | ;result - 3 int buffer for result. 19 | ; 20 | ;On Exit: 21 | ; 22 | ;EAX - Entry number, -1 for none. 23 | ;result+0 - EAX 24 | ;result+4 - relative x co-ord. 25 | ;result+8 - relative y co-ord. 26 | ; 27 | ;ALL other registers preserved. 28 | ; 29 | _DialogWhich proc syscall xcoord:dword, ycoord:dword, dialog:dword, result:dword 30 | public _DialogWhich 31 | pushm ecx,edx,esi 32 | mov ecx,xcoord 33 | mov edx,ycoord 34 | mov esi,dialog 35 | call _DialogWhich 36 | mov esi,result 37 | mov [esi],eax 38 | mov [esi+4],ecx 39 | mov [esi+8],edx 40 | popm ecx,edx,esi 41 | ret 42 | _DialogWhich endp 43 | 44 | 45 | efile 46 | end 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bin2dec.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Convert number into decimal ASCII. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EAX - Number to convert. 11 | ;EDI - Buffer to put it in. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EDI - Next available byte in buffer. 16 | ; 17 | Bin2Dec proc near 18 | pushm eax,ebx,ecx,edx 19 | xor bl,bl ;Clear output flag. 20 | mov ecx,1000000000 ;Set initial divisor. 21 | l0: xor edx,edx 22 | div ecx 23 | cmp ecx,1 ;Last digit? 24 | jz l1 25 | or al,al ;a zero? 26 | jnz l1 27 | or bl,bl ;done any others yet? 28 | jz l2 29 | l1: mov [edi],al ;Store character. 30 | add b[edi],'0' ;make it ASCII. 31 | inc edi 32 | inc bl 33 | l2: push edx ;store remainder. 34 | mov eax,ecx 35 | xor edx,edx 36 | mov ecx,10 ;work out new divisor. 37 | div ecx 38 | mov ecx,eax 39 | pop eax ;get remaindor back. 40 | or ecx,ecx 41 | jnz l0 42 | popm eax,ebx,ecx,edx 43 | ret 44 | Bin2Dec endp 45 | 46 | 47 | efile 48 | end 49 | 50 | 51 | -------------------------------------------------------------------------------- /samples/croak3.c: -------------------------------------------------------------------------------- 1 | // croak3.c 2 | // C source example #3 on using UserDump API function 3 | #include 4 | #include 5 | 6 | char buffer[128]; 7 | char *oldstring="This is going away, so it can say anything it wants"; 8 | char *newstring="What I really wanted to say is this: Moo!"; 9 | 10 | void main(void) 11 | { 12 | int i; 13 | union REGS regs; 14 | struct SREGS sregs; 15 | 16 | strcpy(buffer,oldstring); 17 | segread(&sregs); 18 | sregs.es=sregs.ds; 19 | regs.x.edi=(int)buffer; 20 | regs.w.cx=128; 21 | regs.h.bl='A'; // ASCII dump 22 | regs.h.bh=1; // preset dump bytes 23 | regs.w.dx='-X'; // -X fill buffer 24 | regs.w.ax=0xff2f; 25 | int386x(0x31,®s,®s,&sregs); 26 | strcpy(buffer,newstring); 27 | croaker(); 28 | } 29 | 30 | void croaker(void) 31 | { 32 | int i,peekaboo=0x12345678; 33 | 34 | printf("%d ",*(int *)peekaboo); // if this one doesn't GPF, 35 | peekaboo=0x87654321; // then 36 | printf("%d\n",*(int *)peekaboo); // this one will 37 | } 38 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/readf.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Read some data from a file. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - Address to read to. 11 | ;ECX - length to read. 12 | ;EBX - file handle. 13 | ; 14 | ;On Exit: 15 | ; 16 | ;EAX - bytes read. 17 | ; 18 | ReadFile proc near 19 | pushm ecx,edx,esi 20 | xor esi,esi ;reset length read. 21 | @@0: pushm ebx,ecx,edx,esi 22 | cmp ecx,65535 ;size of chunks to load. 23 | jc @@1 24 | mov ecx,65535 ;as close to 64k as can get. 25 | @@1: mov ah,3fh 26 | int 21h ;read from the file. 27 | popm ebx,ecx,edx,esi 28 | jc @@2 ;DOS error so exit NOW. 29 | movzx eax,ax ;get length read. 30 | add esi,eax ;update length read counter. 31 | add edx,eax ;move memory pointer. 32 | sub ecx,eax ;update length counter. 33 | jz @@2 ;read as much as was wanted. 34 | or eax,eax ;did we read anything? 35 | jnz @@0 36 | @@2: mov eax,esi 37 | popm ecx,edx,esi 38 | ret 39 | ReadFile endp 40 | 41 | 42 | efile 43 | end 44 | 45 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_flmknm.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Make a full drive:path\file name from a file list path string and specified 7 | ;file name. 8 | ; 9 | ;Calling: 10 | ; 11 | ;FileListMakeName(filelist,entry,buffer); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;filelist - pointer to file list. 16 | ;entry - entry number to make name from. 17 | ;buffer - pointer to destination buffer. 18 | ; 19 | ;On Exit: 20 | ; 21 | ;ALL registers preserved. 22 | ; 23 | ;Name in a file list are just the 8.3 portion. A more useful name can be made 24 | ;by combineing the path string from the start of the list buffer with the file 25 | ;name which this routine does. 26 | ; 27 | _FileListMakeName proc syscall filelist:dword, entry:dword, buffer:dword 28 | public _FileListMakeName 29 | pushm ecx,esi,edi 30 | mov ecx,entry 31 | mov esi,filelist 32 | mov edi,buffer 33 | call FileListMakeName 34 | popm ecx,esi,edi 35 | ret 36 | _FileListMakeName endp 37 | 38 | 39 | efile 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/cwc/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # tool makeasm.com generates an assembly include file from a binary. 3 | # it's used to translate copystub.com and decstub.com; the include file are 4 | # included into cmc.asm. 5 | 6 | LINK = \msvc\bin\link 7 | ASM = jwasm 8 | 9 | ALL: Build Build\cwc.exe 10 | 11 | Build: 12 | @mkdir Build 13 | 14 | Build\cwc.exe: Build\cwc.obj 15 | @wl32 /q/m/cs/non Build\cwc.obj,Build\cwc.exe,Build\cwc.map,..\..\bin\cw.lib; 16 | # @..\..\bin\cwc /q /l245 Build\cwc.exe 17 | 18 | Build\cwc.obj: cwc.asm copystub.inc decstub.inc 19 | @$(ASM) -c -nologo -FlBuild\ -FoBuild\ -I.. cwc.asm 20 | 21 | copystub.inc: copystub.asm 22 | @ml -c -nologo -FlBuild\ -FoBuild\ copystub.asm 23 | @$(LINK) /TINY Build\copystub.obj; 24 | @..\..\bin\makeasm copystub.com 25 | @del copystub.com 26 | 27 | decstub.inc: decstub.asm 28 | @ml -c -nologo -FlBuild\ -FoBuild\ decstub.asm 29 | @$(LINK) /TINY Build\decstub.obj; 30 | @..\..\bin\makeasm decstub.com 31 | @del decstub.com 32 | 33 | clean: 34 | @del Build\cwc.exe 35 | @del Build\cwc.map 36 | @del Build\*.obj 37 | @del Build\*.lst 38 | -------------------------------------------------------------------------------- /samples/DLLTEST/makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Make file for CauseWay DLL support example. 3 | # For CauseWay v5.0, kernel imports are no longer required, 4 | # because the API directly supports FindModule, UnFindModule, FindFunction. 5 | # 6 | OBJDIR=..\..\obj 7 | #IMPORTS=$(OBJDIR)\cwapi.obj 8 | # calltype (r=register based - DLLR, s=stack based - DLLS) 9 | # switch CALLCONV in dlltest.c must be set accordingly! 10 | CALLTYPE=r 11 | 12 | all: dlltest.exe dlls.dll dllr.dll 13 | 14 | dlltest.exe : dlltest.obj $(IMPORTS) $(OBJDIR)\dllfunc.obj 15 | wlink @<< 16 | name DLLTEST 17 | debug all 18 | system causeway 19 | file dlltest.obj 20 | libfile {$(OBJDIR)\dllfunc.obj $(IMPORTS) } 21 | op q,m 22 | << 23 | 24 | dlltest.obj : dlltest.c dllfunc.h 25 | wcc386 /q /s /4$(CALLTYPE) /d2 dlltest.c 26 | 27 | dlls.dll : dll.c 28 | wcc386 /q /s /4s /bd dll.c /fo=dlls.obj 29 | wlink @<< 30 | name DLLS 31 | system cwdlls 32 | file dlls.obj 33 | op q,m 34 | << 35 | 36 | dllr.dll : dll.c 37 | wcc386 /q /s /4r /bd dll.c /fo=dllr.obj 38 | wlink @<< 39 | name DLLR 40 | system cwdllr 41 | file dllr.obj 42 | op q,m 43 | << 44 | -------------------------------------------------------------------------------- /doc/page_74.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 74 5 | 6 | 7 | 8 | 9 | 10 |

CauseWay runs applications at privilege level 3. Privilege level 0 reserved instructions will cause a general protection 11 | fault (GPF). CauseWay emulates the four instructions MOV EAX,CR0; MOV CR0,EAX; MOV EAX,CR3; and MOV CR3,EAX in the GPF 12 | handler so that they may be used by an application.

13 |

CauseWay will match a DPMI 0A00h function call with target string RATIONAL/4G. 14 | This in conjunction with CR0 emulation allows support of floating point emulation by an exception handler. 15 | Watcom uses this approach under DOS/4GW operation if the floating point emulation library is not linked in. 16 | Note that this routine does not work for either CauseWay or DOS/4GW under a DPMI host such as Windows or OS/2.

17 | 18 |

Next Page

19 |

Previous Page

20 |

Go to Table of Contents

21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /samples/showevar.asm: -------------------------------------------------------------------------------- 1 | .model small 2 | STDOUT EQU 1 3 | .stack 100h 4 | .data 5 | crlf DB 13,10 6 | DW 4000 DUP (0) ; bulk up size by 8K to make large enough for modifications 7 | .code 8 | start: 9 | mov ds,es:[2ch] ; ds -> e-var block (es -> PSP on entry) 10 | xor si,si ; init offset in block 11 | mov bx,STDOUT 12 | 13 | loop2: 14 | mov al,ds:[si] ; get first char of string 15 | or al,al ; see if null (no more strings) 16 | je done 17 | 18 | loop1: 19 | mov dx,si ; ds:dx -> string to print 20 | mov cx,1 21 | mov ah,40h ; write to device 22 | int 21h 23 | inc si ; move to next char in string 24 | mov al,ds:[si] ; print remaining chars in string one at a time 25 | or al,al ; see if null (end of string) 26 | jne loop1 ; nope 27 | 28 | push ds ; save ds -> e-var block 29 | mov ax,DGROUP 30 | mov ds,ax 31 | mov dx,OFFSET DGROUP:crlf ; write CR/LF pair after string end 32 | mov cl,2 33 | mov ah,40h ; write to device 34 | int 21h 35 | pop ds ; restore ds -> e-var block 36 | inc si 37 | jmp SHORT loop2 38 | 39 | done: 40 | mov ax,4c00h ; terminate with zero return code 41 | int 21h 42 | end start 43 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | 2 | Copyright (c) 2021 Andreas Grech (japheth) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bmyflp.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Flip a bitmap from top to bottom, eg, around X axis, but affecting it in the Y 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - bitmap 12 | ; 13 | ;On Exit: 14 | ; 15 | ;nothing. 16 | ; 17 | ;All registers preserved. 18 | ; 19 | BitmapYFlip proc near 20 | public BitmapYFlip 21 | pushad 22 | mov eax,BM_PWide[esi] 23 | mul BM_Wide[esi] 24 | mov ecx,eax ;Get line length. 25 | mul BM_Depth[esi] 26 | add eax,esi 27 | add eax,size BM 28 | sub eax,ecx 29 | mov edi,eax ;Point to last line. 30 | mov edx,BM_Depth[esi] 31 | shr edx,1 ;get depth to do. 32 | or edx,edx 33 | jz @@2 34 | add esi,size BM ;point to first line. 35 | @@0: pushm ecx,esi,edi 36 | @@1: mov al,[esi] ;swap the data round. 37 | xchg al,[edi] 38 | mov [esi],al 39 | inc esi 40 | inc edi 41 | loop @@1 ;do whole line. 42 | popm ecx,esi,edi 43 | add esi,ecx ;next line down. 44 | sub edi,ecx ;next line up. 45 | dec edx 46 | jnz @@0 ;do all lines. 47 | @@2: popad 48 | ret 49 | BitmapYFlip endp 50 | 51 | efile 52 | end 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/getdrvs.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Build a list of all valid drives on the system. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;EDX - Address to build list of drives. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ECX - number of drives. 15 | ; 16 | ;ALL other registers preserved. 17 | ; 18 | ;The drive list uses real drive codes (not ASCII). Each entry uses 1 byte 19 | ;and the list is terminated with -1. 20 | ; 21 | GetDrives proc near 22 | pushm eax,edx,edi 23 | mov edi,edx 24 | mov ah,19h ; use get drive function 25 | int 21h 26 | push eax ; save current drive. 27 | mov dl,-1 28 | xor cl,cl 29 | ; 30 | l0: inc dl 31 | cmp dl,26 32 | jz l1 33 | push edx 34 | mov ah,0eh ; use set drive function 35 | int 21h 36 | mov ah,19h ; now get it again. 37 | int 21h 38 | pop edx 39 | cmp al,dl ; right drive? 40 | jnz l0 41 | inc cl 42 | stosb 43 | xor al,al 44 | stosb 45 | jmp l0 46 | ; 47 | l1: xor al,al 48 | stosb 49 | pop edx 50 | mov ah,0eh ; use set drive function 51 | int 21h 52 | movzx ecx,cl 53 | popm eax,edx,edi 54 | ret 55 | GetDrives endp 56 | 57 | 58 | efile 59 | end 60 | 61 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/flmknm.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Make a full drive:path\file name from a file list path string and specified 7 | ;file name. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - entry number to make name from. 12 | ;ESI - pointer to file list. 13 | ;EDI - pointer to destination buffer. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;ALL registers preserved. 18 | ; 19 | ;Name in a file list are just the 8.3 portion. A more useful name can be made 20 | ;by combineing the path string from the start of the list buffer with the file 21 | ;name which this routine does. 22 | ; 23 | FileListMakeName proc near 24 | pushm eax,edx,esi,edi 25 | add esi,4 26 | call CopyString ;Copy path string into place. 27 | pushm ecx,edi 28 | or ecx,-1 29 | xor al,al 30 | repnz scasb ;find end of string. 31 | dec edi 32 | cmp b[edi-1],"\" 33 | jz @@0 34 | mov b[edi],"\" 35 | mov b[edi+1],0 36 | @@0: popm ecx,edi 37 | mov eax,14 38 | mul ecx 39 | add esi,eax 40 | add esi,256 41 | call AppendString ;Append file name. 42 | popm eax,edx,esi,edi 43 | ret 44 | FileListMakeName endp 45 | 46 | 47 | efile 48 | end 49 | 50 | -------------------------------------------------------------------------------- /samples/DLLTESTA/dll1.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- CauseWay dll in assembly 3 | 4 | .386 5 | .model flat 6 | option casemap:none 7 | 8 | CStr macro text:vararg 9 | local sym 10 | .const 11 | sym db text,0 12 | .code 13 | exitm 14 | endm 15 | 16 | .code 17 | 18 | LibMain proc c reason:dword 19 | 20 | cmp reason,0 21 | jnz @F 22 | mov edx, CStr("dll1.LibMain: start (reason == 0)",13,10,'$') 23 | mov ah,9 24 | int 21h 25 | mov eax,0 26 | ret 27 | @@: 28 | mov edx, CStr("dll1.LibMain: exit (reason != 0)",13,10,'$') 29 | mov ah,9 30 | int 21h 31 | mov eax,0 32 | ret 33 | LibMain endp 34 | 35 | 36 | SayHello proc c pMsg:ptr 37 | mov edx, CStr("dll1.SayHello: received message: $") 38 | mov ah,9 39 | int 21h 40 | mov edx, pMsg 41 | mov ecx, edx 42 | .while byte ptr [ecx] 43 | inc ecx 44 | .endw 45 | sub ecx, edx 46 | mov ebx,1 47 | mov ah,40h 48 | int 21h 49 | ret 50 | SayHello endp 51 | 52 | ;--- in CauseWay, ds & es hold the PSP selector on entry; ss=flat 4G 53 | 54 | start: 55 | mov edx,ss 56 | mov ds,edx 57 | mov es,edx 58 | invoke LibMain, eax 59 | retd 60 | 61 | end start 62 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_vesa.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;----------------------------------------------------------------------------- 5 | ; 6 | ;Have a look for VESA INT 10h BIOS extension and if present install a patch to 7 | ;make protected mode access transparent. 8 | ; 9 | ;Calling: 10 | ; 11 | ;InitVESA(); 12 | ; 13 | ;On Entry: 14 | ; 15 | ;nothing 16 | ; 17 | ;On Exit: 18 | ; 19 | ;Carry set on error and EAX=0 else, 20 | ; 21 | ;EAX - Address of bank switch code. Always != 0. 22 | ; 23 | ;ALL other registers preserved. 24 | ; 25 | _InitVESA proc syscall 26 | public _InitVESA 27 | call InitVESA 28 | ret 29 | _InitVESA endp 30 | 31 | 32 | ;----------------------------------------------------------------------------- 33 | ; 34 | ;Release VESA BIOS patch if installed. 35 | ; 36 | ;Calling: 37 | ; 38 | ;RelVESA(); 39 | ; 40 | ;On Entry: 41 | ; 42 | ;nothing. 43 | ; 44 | ;On Exit: 45 | ; 46 | ;nothing. 47 | ; 48 | ;ALL registers preserved. 49 | ; 50 | ;Notes: This routine can safely be called even if InitVESA hasn't been 51 | ; called or didn't install due to lack of VESA. 52 | ; 53 | _RelVESA proc syscall 54 | public _RelVESA 55 | call RelVESA 56 | ret 57 | _RelVESA endp 58 | 59 | 60 | efile 61 | end 62 | -------------------------------------------------------------------------------- /Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | About 3 | 4 | This repository contains the CauseWay DOS Extender v5.0. The origin of the 5 | extender itself are the CauseWay source files supplied with Open Watcom ( v4.05 ). 6 | The other parts of the source are based on CauseWay v3.49 (or maybe v3.52 - the 7 | documentation is a bit unclear here). The extender and the debugger have been 8 | significantly modified - for details see files History.txt in directories CW5 9 | and CWD. 10 | 11 | The sources are in Masm v6 syntax. Tools that are used to create the 12 | binaries are Masm/JWasm and WL32. At least the extender itself can also be 13 | created with JWasm's -mz option, thus avoiding a separate link step. Finally, 14 | the binaries are compressed, using the CauseWay compressor CMC. 15 | 16 | The CauseWay linker WL32 (and the 8086 linker WarpLink) are in a separate 17 | repository. 18 | 19 | The main source parts are: 20 | 21 | CW32 : CauseWay Extender v5 ( origin: v4.05 - supplied with Open Watcom ) 22 | CWC : CauseWay File Compressor 23 | CWD : CauseWay Debugger 24 | CWEM : CauseWay EXE maker 25 | CWL : (internal) CauseWay Linker - obsolete 26 | CWLIB : library modules to support CauseWay assembly programs 27 | 28 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_video.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Initialise video stuff, includeing VESA extension. 7 | ; 8 | ;Calling: 9 | ; 10 | ;VideoInitialise(); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;nothing. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;Carry set on error and EAX=error code. 19 | ; 20 | ;Error codes: 21 | ; 22 | ;0 - no error. 23 | ;1 - couldn't allocate selector for video memory. 24 | ;2 - not enough memory for bitmap control table. 25 | ;3 - video system not supported, ie, not (S)VGA. 26 | ; 27 | ;ValidModeList will be filled in with all modes supported. 28 | ; 29 | _VideoInitialise proc syscall 30 | public _VideoInitialise 31 | call VideoInitialise 32 | ret 33 | _VideoInitialise endp 34 | 35 | 36 | ;------------------------------------------------------------------------- 37 | ; 38 | ;Remove video stuff, includeing VESA support if installed. 39 | ; 40 | ;Calling: 41 | ; 42 | ;VideoRemove(); 43 | ; 44 | ;On Entry: 45 | ; 46 | ;nothing. 47 | ; 48 | ;On Exit: 49 | ; 50 | ;ALL registers preserved. 51 | ; 52 | _VideoRemove proc syscall 53 | public _VideoRemove 54 | call VideoRemove 55 | ret 56 | _VideoRemove endp 57 | 58 | 59 | efile 60 | end 61 | 62 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_command.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Read the command line tail for parameters. 7 | ; 8 | ;supports / or - or + as switch/option settings. Options and names may be in 9 | ;any order, text can be tagged onto options, names must be in correct sequence 10 | ;for current program. 11 | ; 12 | ;Each character ( 33 to 127) has an entry in OptionTable & OptionTable+128. 13 | ; 14 | ;The first entry is a byte, and is 0 for OFF & none-zero for ON. 15 | ;The second entry is a pointer to any additional text specified, 0 means none. 16 | ;Entries 0-32 are reserved for text not preceded by - or + or /. These are 17 | ;intended to be file names, but neadn't be. 18 | ;All text entries are 0 terminated. 19 | ; 20 | ;OptionCounter - Total command line parameters (files & switches). 21 | ;OptionTable - Switch table, ASCII code is index to check. 22 | ;OptionPointers - Pointer table, ASCII code*4 is index to use. 23 | ; 24 | ;On Entry: 25 | ; 26 | ;nothing. 27 | ; 28 | ;On Exit: 29 | ; 30 | ;nothing. 31 | ; 32 | _ReadCommand proc syscall 33 | public _ReadCommand 34 | call ReadCommand 35 | ret 36 | _ReadCommand endp 37 | 38 | 39 | efile 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /doc/page_89.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 89 5 | 6 | 7 | 8 | 9 | 10 |

GENERAL NOTES ON WINDOWING

11 |

To select any window other than the current foreground window, click the mouse once with the cursor inside the desired window. Release the mouse button before making further selections.

12 |

To move a window, click on the title bar of the foreground window and move the mouse while holding the mouse button down.

13 |

To adjust a window size, click on the bottom right corner of the current window and move the mouse while holding the mouse button down.

14 |

To cycle through available windows, press TAB.

15 |

To cycle through windows in reverse order, press SHIFT-TAB.

16 |

For those working with graphics, mode 13h is directly supported. However, the proliferation of numerous SVGA modes prohibits supporting of all of them. Therefore, using a monochrome monitor helps you to debug applications that use graphics modes.

17 | 18 |

Next Page

19 |

Previous Page

20 |

Go to Table of Contents

21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/ulflist.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Convert normal names to lower case and directory names to upper case. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ESI - pointer to file list. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;ALL registers preserved. 15 | ; 16 | ;Most routines that need to display a file list want directory names in upper 17 | ;case and the remaining names in lower case. This routine formats a file list 18 | ;to that specification. Doing things this way means that if the file list is 19 | ;then sorted, directory names will appear at the top. 20 | ; 21 | ULFileList proc near 22 | pushm eax,ecx,esi,edi 23 | mov ecx,[esi] ;Get number of entries. 24 | jecxz l9 25 | add esi,4+256 26 | l0: test b[esi+13],16 ;Directory? 27 | jnz l4 28 | push esi 29 | mov edi,esi 30 | l1: lodsb 31 | or al,al 32 | jz l3 33 | cmp al,61h ; 'a' 34 | jb l2 35 | cmp al,7Ah ; 'z' 36 | ja l2 37 | and al,5Fh ;convert to upper case. 38 | l2: cmp al,"A" 39 | jc l5 40 | cmp al,"Z"+1 41 | jnc l5 42 | sub al,"A" 43 | add al,"a" 44 | l5: stosb 45 | jmp l1 46 | l3: pop esi 47 | l4: add esi,14 48 | loop l0 49 | l9: popm eax,ecx,esi,edi 50 | ret 51 | ULFileList endp 52 | 53 | 54 | efile 55 | end 56 | 57 | -------------------------------------------------------------------------------- /doc/page_99.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 99 5 | 6 | 7 | 8 | 9 | 10 |

14 - Memory structures destroyed. Program terminated.

11 | 12 |

Generated if internal memory management structures become corrupted. This is caused by the CauseWay application 13 | writing to memory regions that have not been allocated to it and is a bug in the application. 14 | Obtain a corrected version of the application to fix this error.

15 | 16 |

15 - DOS reported an error while accessing swap file. Program terminated.

17 | 18 |

Generated if any level of error is detected while accessing the swap file. 19 | The swap file has probably been deleted inadvertently by the application or perhaps marked as read-only.

20 | 21 |

16 - Unsupported DOS function call. Program terminated.

22 | 23 |

The CauseWay application attempted to use an obsolete DOS function which used file control blocks (FCBs). 24 | Use the file handle DOS functions in the application instead.

25 | 26 |

Next Page

27 |

Previous Page

28 |

Go to Table of Contents

29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/dlgwhch.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Work out which section of a dialog the specified co-ords relate to. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ECX - X coord. 12 | ;EDX - Y coord. 13 | ;ESI - Dialog. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;EAX - Entry number, -1 for none. 18 | ;ECX - Relative X coord. 19 | ;EDX - Relative Y coord. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | DialogWhich proc near 24 | pushm ebx,esi,edi,ebp 25 | mov ebx,ecx 26 | mov edi,esi 27 | add edi,size DlgMain 28 | xor ecx,ecx 29 | ; 30 | @@0: cmp Dlg_State[edi],-1 31 | jz @@9 32 | call DialogGetButtonX 33 | cmp ebx,eax 34 | jl @@1 35 | mov ebp,eax 36 | call DialogGetButtonW 37 | add eax,ebp 38 | cmp ebx,eax 39 | jge @@1 40 | call DialogGetButtonY 41 | cmp edx,eax 42 | jl @@1 43 | mov ebp,eax 44 | call DialogGetButtonD 45 | add eax,ebp 46 | cmp edx,eax 47 | jge @@1 48 | call DialogGetButtonX 49 | sub ebx,eax 50 | call DialogGetButtonY 51 | sub edx,eax 52 | mov eax,ecx 53 | mov ecx,ebx 54 | jmp @@10 55 | ; 56 | @@1: add edi,size Dlg 57 | inc ecx 58 | jmp @@0 59 | ; 60 | @@9: mov eax,-1 61 | @@10: popm ebx,esi,edi,ebp 62 | ret 63 | DialogWhich endp 64 | 65 | 66 | efile 67 | end 68 | 69 | -------------------------------------------------------------------------------- /doc/page_46.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 46 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

CWErrName Change error file name, with optional drive/pathspec

15 | 16 | 17 | 18 | 19 | 20 |

Inputs: AX = 0ff32h

21 | 22 |

CX:[E]DX = selector:offset of ASCIIZ error file name

23 | 24 |

Outputs: None

25 |

Errors: None

26 | 27 |

Notes: If the error file name is invalid when a fault occurs, CauseWay defaults to using the standard CW.ERR file name in the current directory. The file name including any path and drive must not exceed 80 characters or it will be truncated. CX:EDX are not checked for validity and passing invalid values may cause a fault within the DOS extender. The ASCIIZ name pointed to by CX:EDX is copied to an internal DOS extender location and may be safely modified after calling the CWErrName function.

28 | 29 | 30 |
31 | 32 |

Next Page

33 |

Previous Page

34 |

Go to Table of Contents

35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /doc/page_91.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 91 5 | 6 | 7 | 8 | 9 | 10 |

A second way of using WARPWRAP replaces multiple environment variables, as well as performs other tasks. You may specify a script definition file to list the environment variable and memory setting manipulations desired. Precede the script definition file with the at-sign (@). A default extension of .DEF is assigned if none is specified.

11 |

For example:

12 |

WW @STUFF MYPROG

13 |

uses the contents of the definition file STUFF.DEF to modify the environment variables passed to MYPROG.EXE.

14 |

If no environment setting or definition file name is listed (i.e. ! or @ does not precede an EXE file name), WARPWRAP defaults to using a definitions file called WARPWRAP.DEF. If WARPWRAP.DEF does not exist, WARPWRAP aborts processing.

15 |

For example:

16 |

WW MYPROG

17 |

uses the contents of the definition file WARPWRAP.DEF to modify the environment variables passed to MYPROG.EXE.

18 | 19 |

Next Page

20 |

Previous Page

21 |

Go to Table of Contents

22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/rmsbits.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------ 5 | ; 6 | ;Re-map all bitmaps registered as useing "system" palette. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;nothing. 11 | ; 12 | ;On Exit: 13 | ; 14 | ;nothing. 15 | ; 16 | ;ALL registers preserved. 17 | ; 18 | RemapSystemBitmaps proc near 19 | pushad 20 | ; 21 | ;Work out new translation table. 22 | ; 23 | mov esi,offset SystemPalette+3 24 | mov edi,offset HardwarePalette+3 25 | mov ebx,offset SystemXLat+1 26 | mov edx,1 27 | mov ecx,255 28 | l2: push ebx 29 | mov eax,d[esi] 30 | mov ebx,d[edi] 31 | shl eax,2 32 | and eax,0FFFFFFh 33 | shl ebx,2 34 | and ebx,0FFFFFFh 35 | cmp eax,ebx 36 | jz l3 37 | mov bl,al 38 | shr eax,8 39 | xchg ah,bl 40 | shl eax,8 41 | mov al,bl 42 | call SearchRGB 43 | jmp l4 44 | l3: mov eax,edx 45 | l4: pop ebx 46 | mov [ebx],al 47 | add esi,3 48 | add edi,3 49 | inc ebx 50 | inc edx 51 | dec ecx 52 | jnz l2 53 | ; 54 | ;Now re-map them. 55 | ; 56 | mov edi,BMTable 57 | mov ecx,MaxBMEntries 58 | l0: test BMT_Flags[edi],BMT_InUse ;This entry in use? 59 | jz l1 60 | call RemapSystemBitmap 61 | l1: add edi,size BMT 62 | dec ecx 63 | jnz l0 64 | ; 65 | popad 66 | ret 67 | RemapSystemBitmaps endp 68 | 69 | 70 | efile 71 | end 72 | 73 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/windows.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Initialise Window's stuff so base handler gets a lookin. 7 | ; 8 | WinInitialise proc near 9 | call CalculateSplits 10 | ret 11 | WinInitialise endp 12 | 13 | 14 | ;------------------------------------------------------------------------- 15 | ; 16 | ;Provides region clearing for the background when windows are closed. 17 | ; 18 | BaseHandler proc near 19 | cmp eax,WinMess_Draw 20 | jnz @@9 21 | push 32767 22 | push 32767 23 | push 0 24 | push 0 25 | xor eax,eax 26 | test VideoModeFlags,8 27 | jz @@0 28 | mov ax,0720h 29 | @@0: push eax 30 | push 0 31 | push esi 32 | call WinFillRectangle 33 | add esp,4*7 34 | @@9: ret 35 | BaseHandler endp 36 | 37 | 38 | sdata 39 | 40 | ;------------------------------------------------------------------------- 41 | ; 42 | ;Some variables common to several routines. 43 | ; 44 | BaseWindow Win <0,0,0,32767,32767,BaseHandler> 45 | ; 46 | WinWindowList label dword 47 | dd offset BaseWindow, MaxWinWindows dup (-1) 48 | ; 49 | WindowRegionFlag dd 0 ;Forced region clipping? 50 | WindowRegionX dd ? 51 | WindowRegionY dd ? 52 | WindowRegionW dd ? 53 | WindowRegionD dd ? 54 | ; 55 | FontBuffer label byte 56 | db 1024 dup (?) 57 | 58 | 59 | efile 60 | end 61 | 62 | -------------------------------------------------------------------------------- /src/cwd/macros.inc: -------------------------------------------------------------------------------- 1 | b equ 2 | w equ 3 | d equ 4 | f equ 5 | 6 | pushm MACRO R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16 7 | IRP X, ;REPEAT FOR EACH PARM 8 | IFNB ;IF THIS PARM NOT BLANK 9 | PUSH X ;SAVE THE REGISTER 10 | ENDIF ;END IFNB 11 | ENDM ;END IRP 12 | ENDM 13 | 14 | popm macro R1,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12,R13,R14,R15,R16 15 | IRP X, ;REPEAT FOR EACH PARM 16 | IFNB ;IF THIS PARM NOT BLANK 17 | POP X ;POP THE REGISTER 18 | ENDIF ;END IFNB 19 | ENDM ;END IRP 20 | ENDM 21 | 22 | rep_movsb macro 23 | push ecx 24 | shr ecx,2 25 | rep movsd 26 | pop ecx 27 | and ecx,3 28 | rep movsb 29 | endm 30 | 31 | rep_movsw macro 32 | push ecx 33 | shr ecx,1 34 | rep movsd 35 | pop ecx 36 | and ecx,1 37 | rep movsw 38 | endm 39 | 40 | rep_stosb macro 41 | push eax 42 | mov ah,al 43 | push ax 44 | shl eax,16 45 | pop ax 46 | push ecx 47 | shr ecx,2 48 | rep stosd 49 | pop ecx 50 | and ecx,3 51 | rep stosb 52 | pop eax 53 | endm 54 | 55 | rep_stosw macro 56 | push eax 57 | push ax 58 | shl eax,16 59 | pop ax 60 | push ecx 61 | shr ecx,1 62 | rep stosd 63 | pop ecx 64 | and ecx,1 65 | rep stosw 66 | pop eax 67 | endm 68 | 69 | -------------------------------------------------------------------------------- /doc/page_115.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 115 5 | 6 | 7 | 8 | 9 | 10 |

Next, protected mode interrupt vectors are listed with the following headings:

11 |

No sel offset

12 |

Where:

13 |

No  Vector number.

14 |

sel  Selector value for handler.

15 |

offset  Offset value for handler.

16 |

This information allows a cross-reference with the other lists to ensure CauseWay application installed handlers have been properly made.

17 |

Next, protected mode exception vectors are listed using the same format as protected mode interrupts.

18 |

After the protected mode exception vector list, real mode interrupt vectors are listed. They are shown in the same format as protected mode interrupts although the selector values are real mode segment values.

19 |

Only those interrupt and exception vectors altered by the program will be listed.

20 |

Lastly, Call-Backs are listed in the CW.ERR file. They list all active Call-Backs for the active application at the time of its termination.

21 | 22 |

Next Page

23 |

Previous Page

24 |

Go to Table of Contents

25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/bmxflp.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Flip a bitmap from left to right, eg, around Y axis, but affecting it in the X 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - bitmap 12 | ; 13 | ;On Exit: 14 | ; 15 | ;nothing. 16 | ; 17 | ;All registers preserved. 18 | ; 19 | BitmapXFlip proc near 20 | public BitmapXFlip 21 | pushad 22 | mov eax,BM_Wide[esi] 23 | dec eax 24 | mul BM_PWide[esi] 25 | mov ebp,eax 26 | add ebp,BM_PWide[esi] ;line width. 27 | add eax,size BM 28 | add eax,esi 29 | mov edi,eax ;point to end of first line. 30 | mov ecx,BM_Wide[esi] 31 | shr ecx,1 ;width to process. 32 | mov edx,BM_Depth[esi] 33 | mov ebx,BM_PWide[esi] 34 | add esi,size BM ;point to start of first line. 35 | @@0: pushm ecx,esi,edi 36 | @@1: cmp ebx,3 37 | jz @@24bit 38 | cmp ebx,2 39 | jz @@16bit 40 | @@8bit: mov al,[esi] 41 | xchg al,[edi] 42 | mov [esi],al 43 | jmp @@2 44 | @@16bit: mov ax,[esi] 45 | xchg ax,[edi] 46 | mov [esi],ax 47 | jmp @@2 48 | @@24bit: mov ax,[esi+0] 49 | xchg ax,[edi+0] 50 | mov [esi+0],ax 51 | mov al,[esi+2] 52 | xchg al,[edi+2] 53 | mov [esi+2],al 54 | @@2: add esi,ebx 55 | sub edi,ebx 56 | dec ecx 57 | jnz @@1 58 | popm ecx,esi,edi 59 | add esi,ebp 60 | add edi,ebp 61 | dec edx 62 | jnz @@0 63 | popad 64 | ret 65 | BitmapXFlip endp 66 | 67 | 68 | efile 69 | end 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /doc/page_41.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 41 5 | 6 | 7 | 8 | 9 | 10 |

Note that the internal 8K buffer is optimized for file transfers. Average file transfers of greater than 8K will not necessarily improve performance with an increase in the buffer size. Generally speaking, the average file transfer must be 32K or larger to gain any efficiency with an increased buffer size. Also, if you are using virtual memory, increasing the buffer size may actually slow down performance due to the decreased available physical memory. Test your application with both the default buffer and the desired new buffer size before permanently increasing the buffer size beyond the default.

11 |

API MEMORY ALLOCATION

12 |

Inveterate tweakers may try out the SetMCBMax and GetMCBSize functions in the CauseWay API. These functions allow fine-tuning of the threshold used by CauseWay to allocate memory via a memory pool using memory control blocks (MCBs) rather than via normal DPMI functions. Since DPMI allocates memory in multiples of 4K, setting the MCB threshold too low may result in a good deal of wasted memory and subsequent performance degradation.

13 | 14 |

Next Page

15 |

Previous Page

16 |

Go to Table of Contents

17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /doc/page_109.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 109 5 | 6 | 7 | 8 | 9 | 10 |

d.Do not attempt to write to or read from the NULL (zero value) segment. Attempts to do so results in a fault. In addition to valid selector values, segment registers can be safely loaded with a value of 0 but this selector value cannot be used to access memory or execute code.

11 | 12 |

2.Do not execute code in a data segment and do not write to data in the code segment. Use the CauseWay AliasSel function to map a data selector to the same physical memory area shared by a code selector when necessary. Even in this case, however, never write to memory using a CS: code segment override because it always causes a processor fault.

13 |

3.CauseWay handles most of the standard DOS interrupts transparently. When passing pointers to buffers for software interrupt calls not handled by CauseWay, create the buffers in low (conventional) DOS memory using the GetMemDOS function of the CauseWay API. In addition, convert the pointers from protected mode selector:offset pairs to real mode segment:offset pairs prior to the interrupt, and back upon your return from the interrupt.

14 | 15 |

Next Page

16 |

Previous Page

17 |

Go to Table of Contents

18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/version.asm: -------------------------------------------------------------------------------- 1 | ; 2 | ;Example to detect if running under CauseWay and to get version if so. 3 | ; 4 | 5 | .model small 6 | .386 7 | .stack 1024 8 | 9 | .code 10 | 11 | start proc near 12 | mov ax,DGROUP 13 | mov ds,ax 14 | 15 | ; 16 | ;Get CauseWay API interrupt vector address. 17 | ; 18 | mov ax,3531h 19 | int 21h 20 | ; 21 | ;Check segment/selector isn't zero. 22 | ; 23 | mov ax,es 24 | or ax,ax 25 | jz @@NotCauseway 26 | ; 27 | ;Move back to where the CauseWay ID should be and check for it. 28 | ; 29 | ;CauseWay API handler is preceded by: 30 | ; 31 | ; DB "CAUSEWAY" 32 | ; DB MajorVersion 33 | ; DB MinorVersion 34 | ; 35 | ;MajorVersion is in the range 0-255 36 | ;MinorVersion is in the range 0-99 37 | ; 38 | ;Both version numbers are binary, ie, NOT ASCII or BCD. 39 | ; 40 | sub bx,10 41 | cmp es:dword ptr[bx],"SUAC" 42 | jnz @@NotCauseway 43 | cmp es:dword ptr[bx+4],"YAWE" 44 | jnz @@NotCauseway 45 | ; 46 | ;Running under CauseWay so let the user know. 47 | ; 48 | mov dx,offset IsCauseWayText 49 | mov ah,9 50 | int 21h 51 | jmp @@Done 52 | ; 53 | ;Not running under CauseWay so let the user know. 54 | ; 55 | @@NotCauseway: mov dx,offset NotCauseWayText 56 | mov ah,9 57 | int 21h 58 | ; 59 | ;Exit to DOS/CauseWay 60 | ; 61 | @@Done: mov ax,4c00h 62 | int 21h 63 | start endp 64 | 65 | .data 66 | 67 | IsCauseWayText db "Running under CauseWay.",13,10,"$" 68 | NotCauseWayText db "Not running under CauseWay.",13,10,"$" 69 | 70 | end start 71 | -------------------------------------------------------------------------------- /samples/DLLTESTA/dllapp1.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- dll sample in assembly, using C wrapper functions in dllfunc.obj. 3 | ;--- run mdllapp1.bat to create the binaries. 4 | 5 | .386 6 | .model flat 7 | ; .dosseg 8 | .const ;ensures that wlink puts CONST before STACK 9 | .stack 10 | 11 | LoadModule proto c :ptr 12 | GetProcAddress proto c :dword, :ptr 13 | FreeModule proto c :dword 14 | 15 | CStr macro text:vararg 16 | local sym 17 | .const 18 | sym db text,0 19 | .code 20 | exitm 21 | endm 22 | 23 | .code 24 | 25 | main proc c 26 | 27 | local pProc:dword 28 | local hModule:dword 29 | 30 | invoke LoadModule, CStr("dll1") 31 | .if eax 32 | mov hModule, eax 33 | mov edx,CStr("dllapp1: Module dll1.dll loaded sucessfully",13,10,'$') 34 | mov ah,9 35 | int 21h 36 | invoke GetProcAddress, hModule, CStr("_SayHello") 37 | .if eax 38 | mov pProc, eax 39 | push CStr("Hello World!",13,10) 40 | call pProc 41 | add esp,4 42 | .else 43 | mov edx,CStr("dllapp1: GetProcAddress('_SayHello') failed",13,10,'$') 44 | mov ah,9 45 | int 21h 46 | .endif 47 | 48 | invoke FreeModule, hModule 49 | mov edx, CStr("dllapp1: dll1.dll unloaded",13,10,'$') 50 | mov ah,9 51 | int 21h 52 | 53 | .else 54 | 55 | mov edx, CStr("dllapp1: Failed to load dll1.dll",13,10,'$') 56 | mov ah,9 57 | int 21h 58 | .endif 59 | ret 60 | main endp 61 | 62 | start: 63 | mov eax, ss 64 | mov ds, eax 65 | mov es, eax 66 | call main 67 | mov ax,4c00h 68 | int 21h 69 | 70 | end start 71 | -------------------------------------------------------------------------------- /samples/DLLTEST/dlltest.c: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // A short and hopefully easy to understand demonstration of CauseWay DLL 4 | // usage with Watcom. 5 | // 6 | // 7 | #include 8 | 9 | // Need function definitions 10 | #include "dllfunc.h" 11 | 12 | #define CALLCONV 1 /* 0=stack based, 1=register based */ 13 | 14 | // Name the module. DLLS for stack version and DLLR for register 15 | #if CALLCONV 16 | const char ModuleName[]={"DLLR"}; 17 | const char ProcName[]={"SayHello_"}; 18 | #else 19 | const char ModuleName[]={"DLLS"}; 20 | const char ProcName[]={"SayHello"}; 21 | #endif 22 | 23 | 24 | // 25 | //The actual do something code. 26 | // 27 | int main() 28 | { 29 | void *DLL; 30 | void (*DLLFunction)(char *); 31 | 32 | // Try and load the module. 33 | DLL=LoadModule(ModuleName); 34 | if (DLL) { 35 | 36 | printf("Module %s loaded sucessfully\n", ModuleName); 37 | 38 | // Fetch the test function address 39 | DLLFunction=GetProcAddress(DLL,ProcName); 40 | if (DLLFunction) { 41 | 42 | // Give the test function a shout 43 | DLLFunction("Hello World!\n"); 44 | 45 | } else { 46 | 47 | printf("GetProcAddress('%s') failed\n", ProcName); 48 | 49 | } 50 | 51 | // Lose the module again 52 | FreeModule(DLL); 53 | 54 | printf("Module %s discarded\n", ModuleName); 55 | 56 | } else { 57 | printf("Failed to load %s module...\n", ModuleName); 58 | 59 | } 60 | 61 | return(0); 62 | } 63 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/srtflst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Sort a file list into alpha-numeric order. Assumes you want DIR's at the top 7 | ;of the list. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - pointer to file list to sort. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;ALL registers preserved. 16 | ; 17 | ;File names are not case converted so upper case names will appear at the top 18 | ;of the list. 19 | ; 20 | SortFileList proc near 21 | pushm eax,ecx,edx,esi,edi 22 | mov ecx,[esi] ;Get number of entries. 23 | add esi,4+256 24 | or ecx,ecx 25 | jz l9 26 | dec ecx 27 | jz l9 28 | mov edi,esi 29 | add edi,14 30 | mov edx,ecx 31 | l5: pushm esi,edi,edx,ecx 32 | l4: pushm esi,edi,ecx 33 | test b[esi+13],16 ;Directory? 34 | jz l6 35 | test b[edi+13],16 ;Directory? 36 | jnz l7 37 | jmp l3 ;Force dir's to the top. 38 | l6: test b[edi+13],16 ;Directory? 39 | jnz l1 ;Force dir's to the top. 40 | l7: mov ecx,12 41 | l0: mov al,[esi] 42 | mov ah,[edi] 43 | inc esi 44 | inc edi 45 | cmp ah,al 46 | jc l1 47 | jnz l3 48 | loop l0 49 | jmp l3 50 | ; 51 | l1: popm esi,edi,ecx 52 | pushm esi,edi,ecx 53 | mov ecx,14 54 | l2: mov al,[edi] 55 | xchg al,[esi] 56 | stosb 57 | inc esi 58 | loop l2 59 | l3: popm esi,edi,ecx 60 | add esi,14 61 | add edi,14 62 | loop l4 63 | popm esi,edi,edx,ecx 64 | dec edx 65 | jnz l5 66 | ; 67 | l9: popm eax,ecx,edx,esi,edi 68 | ret 69 | SortFileList endp 70 | 71 | 72 | efile 73 | end 74 | 75 | -------------------------------------------------------------------------------- /doc/page_69.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 69 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

SetVect Set Protected mode interrupt handler address.

15 | 16 |

Inputs: AX = 0205h

17 |

BL= Interrupt vector number.

18 |

CX:[E]DX = selector:offset of new handler.

19 |

Outputs: None.

20 |

Errors: None.

21 |
22 | 23 | 25 | 26 |
24 |

UnLockMem Unlock a region of memory.

27 | 28 |

Inputs: AX = 0ff1dh

29 |

BX:CX = Starting linear address of memory to unlock

30 |

SI:DI = Size of region to unlock in bytes

31 |

Outputs: Carry set on error.

32 | 33 | 34 | 35 |

Errors: If any of the memory region specified is invalid this function returns carry set.

36 |

Notes: This function allows the unlocked memory to be swapped to disk by the VMM if necessary. Areas below and above the specified memory to the nearest 4K boundary are unlocked if the specified region is not aligned to a 4K boundary.

37 |
38 | 39 |

Next Page

40 |

Previous Page

41 |

Go to Table of Contents

42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/cwem/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # there are 2 variants: 3 | # CWEM.EXE is a CauseWay app. Needs text macro CWAPP to be defined in Masm 4 | # and WL32 linker ( with options /f and /ds ) 5 | # 6 | # CWEMJ.EXE: is a HX binary, using jwlink. 7 | 8 | !ifndef DEBUG 9 | DEBUG=0 10 | !endif 11 | 12 | NAME=CWEM 13 | NAME2=CWMAKE 14 | 15 | ASM=ml.exe 16 | 17 | !if $(DEBUG) 18 | AOPTD = /D_DEBUG 19 | ODIR=Debug 20 | !else 21 | AOPTD = 22 | ODIR=Build 23 | !endif 24 | 25 | #all: Build\cw.exe Build\cwmake.exe 26 | all: $(ODIR) $(ODIR)\$(NAME).exe $(ODIR)\$(NAME)j.exe $(ODIR)\$(NAME2).exe 27 | 28 | $(ODIR): 29 | mkdir $(ODIR) 30 | 31 | $(ODIR)\$(NAME).exe: $(ODIR)\$(NAME).obj 32 | @wl32 /q/m/ds $(ODIR)\$(NAME).obj; 33 | 34 | $(ODIR)\$(NAME).obj: $(NAME).asm general.inc 35 | @$(ASM) /c /DCWAPP /nologo $(AOPTD) /Fl$(ODIR)\ /Fo$(ODIR)\ $(NAME).asm 36 | 37 | $(ODIR)\$(NAME2).exe: $(ODIR)\$(NAME2).obj 38 | @wl32 /q/ex/m/cs/non $(ODIR)\cwmake.obj,,$(ODIR)\cwmake.map 39 | 40 | $(ODIR)\$(NAME2).obj: $(NAME2).asm general.inc 41 | @$(ASM) /c /nologo $(AOPTD) /Fl$(ODIR)\ /Fo$(ODIR)\ $(NAME2).asm 42 | 43 | $(ODIR)\$(NAME)j.exe: $(ODIR)\$(NAME)j.obj 44 | @jwlink format win pe hx f $(ODIR)\$(NAME)j.obj n $(ODIR)\$(NAME)j.exe op q,m=$(ODIR)\$(NAME)j.map,stub=loadpero.bin 45 | 46 | $(ODIR)\$(NAME)j.obj: $(NAME).asm 47 | @jwasm /c /nologo $(AOPTD) /Fl$(ODIR)\$(NAME)j.lst /Fo$(ODIR)\$(NAME)j.obj $(NAME).asm 48 | 49 | clean: 50 | @del $(ODIR)\*.obj 51 | @del $(ODIR)\*.exe 52 | @del $(ODIR)\*.map 53 | @del $(ODIR)\*.lst 54 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/regsbit.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Register a bitmap that needs to be re-mapped whenever the hardware palette 7 | ;changes so it stays in the system palette scheme. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;ESI - bitmap. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - handle. 16 | ; 17 | ;ALL other registers preserved. 18 | ; 19 | RegisterSystemBitmap proc near 20 | pushm ebx,ecx,edx,esi,edi,ebp 21 | ; 22 | ;Find a free table entry. 23 | ; 24 | mov edi,BMTable 25 | mov ecx,MaxBMEntries 26 | l0: test BMT_Flags[edi],BMT_InUse ;This entry in use? 27 | jz l1 28 | add edi,(size BMT) 29 | dec ecx 30 | jnz l0 31 | jmp l9_2 32 | ; 33 | l1: mov BMT_Pointer[edi],esi 34 | mov BMT_Flags[edi],BMT_InUse ;Mark this entry as used. 35 | ; 36 | ;Need to claim memory block to duplicate this bitmap 37 | ;for future remaps. 38 | ; 39 | pushm esi,edi 40 | mov eax,BM_Wide[esi] ;get bitmap dimensions. 41 | mul BM_Depth[esi] 42 | mov ecx,eax 43 | call Malloc 44 | mov eax,esi 45 | popm esi,edi 46 | jc l9_1 47 | mov BMT_Duplicate[edi],eax 48 | push edi 49 | mov edi,eax 50 | add esi,size BM ;skip its header. 51 | rep_movsb ;make a copy of it. 52 | pop edi 53 | mov eax,edi 54 | ; 55 | call RemapSystemBitmap ;now re-map it. 56 | jmp exit 57 | ; 58 | l9_1: mov BMT_Flags[edi],0 ;Clear flags again. 59 | l9_2: xor eax,eax 60 | ; 61 | exit: popm ebx,ecx,edx,esi,edi,ebp 62 | ret 63 | RegisterSystemBitmap endp 64 | 65 | 66 | efile 67 | end 68 | 69 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/regupw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Update a particular rectangle of the display. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ECX - X coord. 11 | ;EDX - Y coord. 12 | ;ESI - width. 13 | ;EDI - depth. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;nothing. 18 | ; 19 | ;ALL registers preserved. 20 | ; 21 | WindowRegionUpdate: 22 | public WindowRegionUpdate 23 | _WindowRegionUpdate_ proc syscall 24 | local @@Count:dword, @@Handle:dword 25 | pushad 26 | push WindowRegionFlag 27 | push WindowRegionX 28 | push WindowRegionY 29 | push WindowRegionW 30 | push WindowRegionD 31 | ; 32 | mov WindowRegionFlag,-1 33 | mov WindowRegionX,ecx 34 | mov WindowRegionW,ecx 35 | mov WindowRegionY,edx 36 | mov WindowRegionD,edx 37 | add WindowRegionW,esi 38 | add WindowRegionD,edi 39 | ; 40 | mov @@Count,MaxWinWindows 41 | mov @@Handle,offset WinWindowList 42 | ; 43 | @@0: mov ebx,@@Handle 44 | mov ebx,[ebx] 45 | cmp ebx,-1 46 | jz @@1 47 | mov ecx,Win_XCoord[ebx] 48 | mov edx,Win_YCoord[ebx] 49 | mov esi,Win_Wide[ebx] 50 | mov edi,Win_Depth[ebx] 51 | call WindowRegionClip 52 | jnz @@1 53 | ; 54 | mov esi,ebx 55 | mov eax,WinMess_Draw 56 | call WinMessageWindow 57 | ; 58 | @@1: add @@Handle,4 59 | dec @@Count 60 | jnz @@0 61 | ; 62 | pop WindowRegionD 63 | pop WindowRegionW 64 | pop WindowRegionY 65 | pop WindowRegionX 66 | pop WindowRegionFlag 67 | popad 68 | ret 69 | _WindowRegionUpdate_ endp 70 | 71 | 72 | efile 73 | end 74 | 75 | -------------------------------------------------------------------------------- /samples/Readme.txt: -------------------------------------------------------------------------------- 1 | 2 | various CauseWay samples 3 | 4 | - AliasSel.asm: shows how to create a code alias. 5 | - CallBack.asm: allocating and using a real-mode callback. 6 | - DllTest: causeway dll support for C (Open Watcom). 7 | - DllTestA: causeway dll support for assembly (Masm style). 8 | - DosShell.asm: show how to launch a DOS shell from a CauseWay app. 9 | - flat.asm: a minimal sample for FLAT memory model (Masm syntax). 10 | - IntAsm.asm: demonstration how to use int 31h, ax=300h (simulate real-mode interrupt) 11 | - MultFlat.asm: not functional 12 | - MultNear.asm: sample how to mix 16- and 32-bit segments 13 | - Screen.asm: showing usage of the peculiar NEAR model of WL32. 14 | - ShowEVar.asm: display environment variables. 15 | - Small32.asm: minimal sample for 32-bit SMALL model (Masm syntax). 16 | - Timer.asm: demonstrates installing an interrupt handler. 17 | - Tiny16.asm: minimal sample for 16-bit TINY model (Masm syntax). 18 | - Tiny32.asm: minimal sample for 32-bit TINY model (Masm syntax). 19 | - Version.asm: shows how to get the CauseWay version. 20 | - Vesa.asm: VESA support to be used by OW apps. 21 | 22 | - Croak1.c: force an exception - show how to use CauseWay's "user dump" feature. 23 | - Croak2.c: force an exception - show how to use CauseWay's "user dump" feature. 24 | - Croak3.c: force an exception - show how to use CauseWay's "user dump" feature. 25 | - Intc.c: demonstrates how to call int 31h, ax=300h in C. 26 | - TestTerm.c: shows CauseWay's UserErrTerm and SetDump features. 27 | -------------------------------------------------------------------------------- /doc/page_57.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 57 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

IntXX Simulate real mode interrupt.

15 | 16 |

Inputs: AX = 0ff01h

17 |

BL= Interrupt number.

18 |

ES:[E]DI = Real mode register list.

19 |

Outputs: Register list updated.

20 |

Errors: None.

21 | 22 | 23 | 24 |

Notes: The real mode register list referenced by ES:[E]DI should contain the register values you want passed to the real mode interrupt handler. CauseWay fills in the SS:SP and Flags values to ensure that legal values are used and the CS:IP entries are ignored. This function bypasses protected mode interrupt handlers and provides access to INT APIs that require segment pointers.

25 | 26 | 27 |
28 | 29 | 31 | 32 |
30 |

Linear2Near Convert linear address to application relative address.

33 | 34 |

Inputs: AX = 0ff19h

35 |

ESI = Linear address to convert.

36 |

Outputs: ESI = Application relative linear address.

37 |

Errors: None

38 |
39 | 40 |

Next Page

41 |

Previous Page

42 |

Go to Table of Contents

43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/crbtmp.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | 5 | ;------------------------------------------------------------------------------ 6 | ; 7 | ;Create a new bitmap. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;EBX - bitmap flags entry. 12 | ;ECX - bitmap width. 13 | ;EDX - bitmap depth. 14 | ; 15 | ;On Exit: 16 | ; 17 | ;Carry set on error and EAX=0 else, 18 | ; 19 | ;EAX - pointer to bitmap. 20 | ; 21 | ;ALL other registers preserved. 22 | ; 23 | CreateBitmap proc near 24 | pushm ebx,ecx,edx,esi,edi 25 | pushm ebx,ecx,edx 26 | xor eax,eax ;Work out bytes per pixel 27 | inc eax ;needed and how much memory 28 | and ebx,15 ;we need to allocate. 29 | jz @@0 ;8-bit? 30 | inc eax 31 | cmp ebx,2+1 ;15- or 16-bit? 32 | jc @@0 33 | inc eax ;must be 24-bit then. 34 | @@0: mov edi,eax 35 | mul edx 36 | mul ecx 37 | add eax,size BM ;allow for header. 38 | add eax,256*3 ;leave space for 256 colour palette. 39 | add eax,256 ;leave space for path. 40 | mov ecx,eax 41 | call Malloc ;try and allocate the memory. 42 | popm ebx,ecx,edx 43 | jc @@9 44 | mov BM_Flags[esi],ebx 45 | mov BM_PWide[esi],edi 46 | mov BM_Wide[esi],ecx 47 | mov BM_Depth[esi],edx 48 | mov BM_XOffset[esi],0 49 | mov BM_YOffset[esi],0 50 | ; 51 | mov eax,BM_PWide[esi] 52 | mul BM_Wide[esi] 53 | mul BM_Depth[esi] 54 | add eax,esi 55 | add eax,size BM 56 | mov edi,eax 57 | push esi 58 | mov esi,offset HardwarePalette 59 | mov ecx,256*3 60 | rep movsb 61 | pop esi 62 | ; 63 | clc 64 | @@9: mov eax,esi 65 | popm ebx,ecx,edx,esi,edi 66 | ret 67 | CreateBitmap endp 68 | 69 | 70 | efile 71 | end 72 | 73 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/whichw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;See which (if any) window co-ords fall inside and return relative values 7 | ; 8 | ;On Entry: 9 | ; 10 | ;ECX - Xcoord 11 | ;EDX - Ycoord 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - Window structure pointer (handle), -1 for none. 16 | ;ECX - relative X coord. 17 | ;EDX - relative Y coord. 18 | ; 19 | ;ALL other registers preserved. 20 | ; 21 | WinWhichWindow: 22 | public WinWhichWindow 23 | _WinWhichWindow_ proc syscall 24 | local @@window:dword, @@X:dword, @@Y:dword 25 | pushad 26 | ; 27 | mov @@X,ecx 28 | mov @@Y,edx 29 | mov esi,offset WinWindowList 30 | mov ecx,MaxWinWindows 31 | @@0: cmp d[esi],-1 32 | jz @@8 33 | ; 34 | push esi 35 | mov esi,[esi] 36 | mov edx,esi 37 | lea esi,Win_Splits[esi] 38 | @@1: cmp Split_Wide[esi],0 39 | jz @@7 40 | mov eax,Split_XCoord[esi] 41 | cmp eax,@@X 42 | jg @@6 43 | add eax,Split_Wide[esi] 44 | cmp eax,@@X 45 | jl @@6 46 | mov eax,Split_YCoord[esi] 47 | cmp eax,@@Y 48 | jg @@6 49 | add eax,Split_Depth[esi] 50 | cmp eax,@@Y 51 | jl @@6 52 | mov eax,@@X 53 | sub eax,Win_XCoord[edx] 54 | mov @@X,eax 55 | mov eax,@@Y 56 | sub eax,Win_YCoord[edx] 57 | mov @@Y,eax 58 | mov @@window,edx 59 | pop esi 60 | jmp @@9 61 | ; 62 | @@6: add esi,size Split 63 | jmp @@1 64 | ; 65 | @@7: pop esi 66 | @@8: add esi,4 67 | loop @@0 68 | mov @@window,-1 69 | @@9: popad 70 | mov eax,@@window 71 | mov ecx,@@X 72 | mov edx,@@Y 73 | ret 74 | _WinWhichWindow_ endp 75 | 76 | 77 | efile 78 | end 79 | 80 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/closew.asm: -------------------------------------------------------------------------------- 1 | 2 | include ..\cwlib.inc 3 | scode 4 | 5 | ;------------------------------------------------------------------------- 6 | ; 7 | ;Close a window and update the area underneath it if possible. 8 | ; 9 | ;On Entry: 10 | ; 11 | ;EAX - Pointer to window structure (handle). 12 | ; 13 | ;On Exit: 14 | ; 15 | ;nothing. 16 | ; 17 | ;ALL registers preserved. 18 | ; 19 | WinCloseWindow: 20 | public WinCloseWindow 21 | _WinCloseWindow_ proc syscall 22 | local @@XCoord:dword, @@YCoord:dword, @@Wide:dword, @@Depth:dword 23 | pushad 24 | mov esi,eax 25 | ; 26 | ;Let the windows handler know its being closed incase it wants to do something. 27 | ; 28 | mov eax,WinMess_Close 29 | call WinMessageWindow 30 | ; 31 | ;Find the window in the main list. 32 | ; 33 | @@2: mov edi,offset WinWindowList 34 | mov ecx,MaxWinWindows 35 | @@0: cmp [edi],esi 36 | jz @@1 37 | add edi,4 38 | loop @@0 39 | jmp @@9 40 | ; 41 | ;Delete list entry and retrieve coords. 42 | ; 43 | @@1: mov d[edi],-1 ;Remove it from the list. 44 | mov eax,Win_XCoord[esi] 45 | mov @@XCoord,eax 46 | mov eax,Win_YCoord[esi] 47 | mov @@YCoord,eax 48 | mov eax,Win_Wide[esi] 49 | mov @@Wide,eax 50 | mov eax,Win_Depth[esi] 51 | mov @@Depth,eax 52 | call Free ;Release window's memory. 53 | ; 54 | ;Now we try and re-build what was under this window. 55 | ; 56 | call CalculateSplits ;calculate splits again. 57 | mov ecx,@@XCoord 58 | mov edx,@@YCoord 59 | mov esi,@@Wide 60 | mov edi,@@Depth 61 | call WindowRegionUpdate ;Update this area of the display. 62 | ; 63 | @@9: popad 64 | ret 65 | _WinCloseWindow_ endp 66 | 67 | 68 | efile 69 | end 70 | 71 | -------------------------------------------------------------------------------- /doc/page_84.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 84 5 | 6 | 7 | 8 | 9 | 10 |

CWD OPTIONS

11 | 12 | 14 | 15 | 17 | 18 |
13 |

/dm Use a monochrome monitor for output from CWD.

16 |

/eSYMBOL Run the program until SYMBOL is reached.

19 | 20 | 21 |

CS:EIP WINDOW

22 |

The quick help bar shows most of the available keypresses across the bottom of the screen. To move within the current view, use the cursor keys but remember that this doesn't alter the code in the CS:EIP window.

23 |

The current CS:EIP position is marked by a greater than (>) symbol as well as a green bar.

24 |

The current display position is marked by a blue bar.

25 |

Breakpoints are marked with an asterisk (*) symbol and a red bar with a countdown value in brackets to the right of the asterisk. Note that a countdown value of 0 means the breakpoint will trigger next time the code at the breakpoint address is executed. A value of 1 means the count will be decremented next time the breakpoint address is encountered but another pass will be needed to trigger a break.

26 |

Register values are highlighted when changed by the application or operator.

27 | 28 |

Next Page

29 |

Previous Page

30 |

Go to Table of Contents

31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/srchrgb.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Find closest match in HardwarePalette to RGB value specified. Must be more 7 | ;accurate ways of doing it than this but I don't know about them! 8 | ; 9 | ;On Entry: 10 | ; 11 | ;EAX - RGB value. 12 | ; 13 | ;On Exit: 14 | ; 15 | ;EAX - Nearest pen value in HardwarePalette 16 | ; 17 | SearchRGB: 18 | public SearchRGB 19 | _SearchRGB_ proc syscall 20 | local @@Pen:byte, @@Chosen:byte, @@Count:dword, @@Data:dword 21 | pushad 22 | mov @@Pen,0 23 | mov @@Chosen,0 24 | mov @@Count,256 25 | ; 26 | ;Put bytes into right order for memory variable. 27 | ; 28 | mov bl,al 29 | shr eax,8 30 | xchg ah,bl 31 | shl eax,8 32 | mov al,bl 33 | mov @@Data,eax 34 | lea edi,@@Data 35 | ; 36 | ;Scale 0-255 values to suit VGA DAC 0-63 values. 37 | ; 38 | shr b[edi+0],2 39 | shr b[edi+1],2 40 | shr b[edi+2],2 41 | ; 42 | ;Now find the nearest match. 43 | ; 44 | mov esi,offset HardwarePalette 45 | mov ecx,0FFFFFFh 46 | l0: xor edx,edx 47 | movzx eax,b[0+esi] 48 | movzx ebx,b[0+edi] 49 | sub eax,ebx 50 | jns l1 51 | neg eax 52 | l1: add eax,eax 53 | add edx,eax 54 | ; 55 | movzx eax,b[1+esi] 56 | movzx ebx,b[1+edi] 57 | sub eax,ebx 58 | jns l2 59 | neg eax 60 | l2: add eax,eax 61 | add edx,eax 62 | ; 63 | movzx eax,b[2+esi] 64 | movzx ebx,b[2+edi] 65 | sub eax,ebx 66 | jns l3 67 | neg eax 68 | l3: add eax,eax 69 | add edx,eax 70 | ; 71 | cmp edx,ecx 72 | jnc l4 73 | mov ecx,edx 74 | mov al,@@Pen 75 | mov @@Chosen,al 76 | l4: add esi,3 77 | inc @@pen 78 | dec @@Count 79 | jnz l0 80 | ; 81 | popad 82 | movzx eax,@@Chosen 83 | ret 84 | _SearchRGB_ endp 85 | 86 | 87 | efile 88 | end 89 | 90 | 91 | -------------------------------------------------------------------------------- /doc/page_62.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 62 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

RelSel Release a selector.

15 | 16 |

Inputs: AX = 0ff04h

17 |

BX = Selector.

18 |

Outputs: Carry set on error.

19 | 20 | 21 | 22 |

Errors: If an invalid selector is passed in BX, this function returns with carry set.

23 |

Notes: Use this function to release selectors allocated by GetSel or AliasSel.

24 | 25 | 26 |
27 | 28 | 30 | 31 |
29 |

ResMem Resize a previously allocated block of memory.

32 | 33 |

Inputs: AX = 0ff0dh

34 |

BX = Selector for block.

35 |

CX:DX = New size of block required in bytes.

36 |

Outputs: Carry set on error.

37 | 38 | 39 | 40 |

Errors: If an invalid selector is passed in BX or not enough memory is available when increasing the block size, then this function returns carry set.

41 |

Notes: If the memory block cannot be resized in its current location, but a free block of memory of the new size exists, the memory is copied to a new block and the old one is released. The application is not affected as long as only the selector originally allocated with GetMem accesses the memory.

42 |
43 | 44 |

Next Page

45 |

Previous Page

46 |

Go to Table of Contents

47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /doc/page_70.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 70 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

UnLockMem32 Unlock a region of memory.

15 | 16 |

Inputs: AX = 0ff1eh

17 |

ESI = Starting linear address of memory to unlock

18 |

ECX = Size of region to unlock in bytes

19 |

Outputs: Carry set on error.

20 |

Errors: See UnLockMem

21 | 22 | 23 |

Notes: This function allows the memory to be swapped to disk by the VMM if necessary. Areas below and above the specified memory to the nearest 4K boundary are unlocked if the specified region is not aligned to a 4K boundary.

24 | 25 |
26 | 27 | 29 | 30 |
28 |

UnLockMemNear Unlock a region of memory using application relative address.

31 | 32 |

Inputs: AX = 0ff20h

33 |

ESI = Starting linear address of memory to unlock

34 |

EBX = Size of region to unlock in bytes

35 |

Outputs: Carry set on error.

36 |

Errors: See UnLockMem

37 | 38 | 39 | 40 |

Notes: This function allows the memory to be swapped to disk by the VMM if necessary. Areas below and above the specified memory to the nearest 4K boundary are unlocked if the specified region is not aligned to a 4K boundary.

41 |
42 | 43 |

Next Page

44 |

Previous Page

45 |

Go to Table of Contents

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/cwem/cwem.cfg: -------------------------------------------------------------------------------- 1 | ; 2 | ;Define the text that marks the start of segment definitions. This is searched 3 | ;for to make sure we start in the right place. Single space will do in place of 4 | ;multiple space/tab, only the words and the fact that they have a space 5 | ;is significant. 6 | ; 7 | SegmentHeader=start stop length name class 8 | 9 | 10 | ; 11 | ;Define the layout of segment definitions. The names used are 386Prep variables. 12 | ;There is no relationship between this and SegmentHeader. Only Null, Start, 13 | ;Length & Class are currently defined. This tells 386Prep which column to find 14 | ;each piece of information. 15 | ; 16 | SegmentFormat=Start Null Length Null Class 17 | 18 | 19 | 20 | ; 21 | ;Define CODE type class's. List of CLASS names that need to be defined as code 22 | ;execute/read segments. Multiple entries should be seperated by space. 23 | ; 24 | CodeClass=*code* 25 | 26 | 27 | 28 | ; 29 | ;Define DATA type class's. List of CLASS names that need to be defined as data 30 | ;read/write segments. Multiple entries should be seperated by space. 31 | ; 32 | DataClass=*bss* 33 | DataClass=*data* 34 | 35 | 36 | 37 | 38 | ; 39 | ;Define STACK type class's. List of CLASS names that need to be defined as stack 40 | ;segments. Multiple entries should be seperated by space. 41 | ; 42 | StackClass=*stack* 43 | 44 | 45 | 46 | ; 47 | ;Define CONST type class's. List of CLASS names that need to be defined as data 48 | ;read only segments. Multiple entries should be seperated by space. 49 | ; 50 | ConstClass=*const* 51 | 52 | 53 | ; 54 | ;Define NEAR type class's. List of CLASS names that need to be defined as both 55 | ;code & data. Multiple entries should be seperated by space. 56 | ; 57 | NearClass=*near* 58 | -------------------------------------------------------------------------------- /doc/page_94.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 94 5 | 6 | 7 | 8 | 9 | 10 |

WARPWRAP EXAMPLES

11 |

Two files that are included on the CauseWay distribution disk, SHOWEVAR.ASM and SHOWEVAR.OBJ, demonstrate WARPWRAP's operations. SHOWEVAR.ASM is the source code to a small assembly language program that displays the current environment variables passed to it. SHOWEVAR.ASM was included for reference purposes to illustrate what the SHOWEVAR program does. It is not needed for testing WARPWRAP.

12 |

Link SHOWEVAR.OBJ to the executable file SHOWEVAR.EXE for use with WARPWRAP. You must relink SHOWEVAR.OBJ to try a new WARPWRAP setting because you cannot restore a WARPWRAP- modified EXE file to its former state.

13 |

Another file included on the CauseWay distribution disk, WARPWRAP.DEF, demonstrates many of the features one might find in a WARPWRAP script definition file. Since this is the default script definition file name, it can be used by WARPWRAP two ways. Use the following format on the command line:

14 |

WW <EXE program>

15 |

Within a program, use the following format to explicitly call WARPWRAP:

16 |

WW @WARPWRAP <EXE program>

17 |

<EXE program> is the name of the EXE file to modify.

18 |

Refer to the WARPWRAP.DEF file included with CauseWay for a few tips about using script definition files.

19 | 20 |

Next Page

21 |

Previous Page

22 |

Go to Table of Contents

23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/openw.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Initialise a window structure and add it to the list of windows in service. 7 | ; 8 | ;On Entry: 9 | ; 10 | ;C style stack parameters as follows: 11 | ; 12 | ;flags - undefined at the moment, set to zero. 13 | ;priority - priority to assign. 14 | ;xcoord - x co-ord for window. 15 | ;ycoord - y co-ord for window. 16 | ;wide - width of window in pixels. 17 | ;depth - depth of window in pixels. 18 | ;handler - address of handler (0 for none). 19 | ; 20 | ;On Exit: 21 | ; 22 | ;EAX - pointer to window structure (handle). 23 | ; 24 | ;ALL other registers presereved. 25 | ; 26 | WinOpenWindow: 27 | _WinOpenWindow proc syscall flags:dword, priority:dword, xcoord:dword, \ 28 | ycoord:dword, wide:dword, depth:dword, handler:dword 29 | local @@Window:dword 30 | pushad 31 | mov ecx,size Win 32 | call Malloc 33 | mov @@Window,esi 34 | jc @@9 35 | mov eax,XCoord 36 | mov Win_XCoord[esi],eax 37 | mov eax,YCoord 38 | mov Win_YCoord[esi],eax 39 | mov eax,Wide 40 | mov Win_Wide[esi],eax 41 | mov eax,Depth 42 | mov Win_Depth[esi],eax 43 | mov eax,Priority 44 | mov Win_Priority[esi],eax 45 | mov eax,Handler 46 | mov Win_Handler[esi],eax 47 | lea edi,Win_Splits[esi] 48 | mov Split_Wide[edi],0 49 | ; 50 | mov edi,offset WinWindowList 51 | mov ecx,MaxWinWindows 52 | @@0: cmp d[edi],-1 53 | jz @@1 54 | add edi,4 55 | loop @@0 56 | ; 57 | mov esi,@@Window 58 | call Free 59 | mov @@Window,0 60 | jmp @@9 61 | ; 62 | @@1: mov [edi],esi 63 | call CalculateSplits 64 | ; 65 | mov eax,WinMess_Draw 66 | call WinMessageWindow 67 | ; 68 | @@9: popad 69 | mov eax,@@Window 70 | ret 71 | _WinOpenWindow endp 72 | 73 | 74 | efile 75 | end 76 | 77 | -------------------------------------------------------------------------------- /doc/page_68.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 68 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

SetRVect Set real mode interrupt handler address.

15 | 16 |

Inputs: AX = 0201h

17 |

BL= Interrupt vector number.

18 |

CX:DX = selector:offset of new handler.

19 |

Outputs: None.

20 |

Errors: None.

21 |
22 | 23 | 25 | 26 |
24 |

SetSelDet Set selector linear base and limit.

27 | 28 |

Inputs: AX = 0ff09h

29 |

BX = Selector.

30 |

CX:DX = Linear base.

31 |

SI:DI = Byte granular limit.

32 |

Outputs: Carry set on error.

33 | 34 | 35 | 36 |

Errors: If an invalid selector is passed in BX, this function returns with carry set.

37 | 38 |
39 | 40 | 42 | 43 |
41 |

SetSelDet32 Set selector linear base and limit.

44 | 45 |

Inputs: AX = 0ff0ah

46 |

BX = Selector.

47 |

EDX = Linear base.

48 |

ECX = Byte granular limit.

49 |

Outputs: Carry set on error.

50 | 51 | 52 | 53 |

Errors: If an invalid selector is passed in BX, this function returns with carry set.

54 | 55 |
56 | 57 |

Next Page

58 |

Previous Page

59 |

Go to Table of Contents

60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/page_50.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 50 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

GetDOSTrans Get current address and size of the buffer used for DOS memory transfers.

15 | 16 |

Inputs: AX = 0ff25h

17 |

Outputs: BX = Real mode segment of buffer.

18 |

DX = Protected mode selector for buffer.

19 |

ECX = Buffer size

20 |

Errors: None

21 | 22 | 23 | 24 |

Notes: This buffer is used by the INT API translation services, e.g., INT 21h, AH=40h (write to file). The default buffer is 8K and uses memory that would otherwise be wasted. This default is sufficient for most file I/O but if you are writing a program that reads/writes large amounts of data you should consider allocating your own larger buffer and pass the buffer's address to CauseWay to speed file I/O.

25 | 26 | 27 |
28 | 29 | 31 | 32 |
30 |

GetEVect Get Protected mode exception handler address.

33 | 34 |

Inputs: AX = 0202h

35 |

BL= Exception vector number.

36 |

Outputs: Carry set on error else,

37 |

CX:[E]DX = selector:offset of handler.

38 | 39 | 40 | 41 |

Errors: The number in BL must be in the range 0-1Fh. Anything outside this range returns carry set.

42 | 43 | 44 |
45 | 46 |

Next Page

47 |

Previous Page

48 |

Go to Table of Contents

49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_buffile.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------- 5 | ; 6 | ;Initialise file buffer. 7 | ; 8 | ;Calling: 9 | ; 10 | ;InitFileBuffer(handle); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;handle - File handle. 15 | ; 16 | ;On Exit: 17 | ; 18 | ;ALL registers preserved. 19 | ; 20 | _InitFileBuffer proc syscall handle:dword 21 | public _InitFileBuffer 22 | push ebx 23 | mov ebx,handle 24 | call InitFileBuffer 25 | pop ebx 26 | ret 27 | _InitFileBuffer endp 28 | 29 | 30 | ;------------------------------------------------------------------------- 31 | ; 32 | ;Read a byte from the file buffer. 33 | ; 34 | ;Calling: 35 | ; 36 | ;ReadBufferByte(); 37 | ; 38 | ;On Entry: 39 | ; 40 | ;None 41 | ; 42 | ;On Exit: 43 | ; 44 | ;AH - Bytes read, ie, AH=0 indicates EOF or an error. 45 | ;AL - Byte read. 46 | ; 47 | ;High word of EAX is zero'd. 48 | ; 49 | ;eg, if AX=0 then EOF reached. 50 | ; 51 | ;Don't mix normal ReadFile call's with this call, they don't take account of 52 | ;each other. 53 | ; 54 | _ReadBufferByte proc syscall 55 | public _ReadBufferByte 56 | call ReadBufferByte 57 | movzx eax,ax 58 | ret 59 | _ReadBufferByte endp 60 | 61 | 62 | ;------------------------------------------------------------------------- 63 | ; 64 | ;Read a line of text from input file specified. 65 | ; 66 | ;Calling: 67 | ; 68 | ;ReadBufferLine(buffer); 69 | ; 70 | ;On Entry: 71 | ; 72 | ;buffer - Buffer to put line into. 73 | ; 74 | ;On Exit: 75 | ; 76 | ;EAX - Bytes read, 0 = EOF or error. 77 | ; 78 | _ReadBufferLine proc syscall buffer:dword 79 | public _ReadBufferLine 80 | pushm ecx,edi 81 | mov edi,buffer 82 | call ReadBufferLine 83 | mov eax,ecx 84 | popm ecx,edi 85 | ret 86 | _ReadBufferLine endp 87 | 88 | 89 | efile 90 | end 91 | 92 | 93 | -------------------------------------------------------------------------------- /doc/page_75.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 75 5 | 6 | 7 | 8 | 9 | 10 |

Chapter 10:   INTERRUPT SERVICES

11 |

EXTENDED OR ALTERED INTERRUPT SERVICES

12 |

The size of register used by CauseWay's extended or modified interrupt services depends on the limit of the selector. 13 | Extended 32-bit registers are used for 32-bit sized selectors and 16-bit registers are used for selectors within 16-bits. 14 | To reflect this, the convention of an [E] in brackets is used before a listed register when it must be a 32-bit value with 15 | a 32-bit selector and a 16-bit value with a 16-bit selector.

16 |

Required registers that are not specified in this list should be set up in the same way as required for normal DOS real 17 | mode operation. For INT APIs that are not listed and require segment pointers, either handle them using the CauseWay IntXX 18 | function or create your own interrupt translation code.

19 | 20 | 22 | 23 |
21 |

INT 10h

24 | 25 |

10h sub function 02h, [E]DX instead of DX.

26 |

10h sub function 09h, [E]DX instead of DX.

27 |

10h sub function 12h, [E]DX instead of DX.

28 |

10h sub function 17h, [E]DX instead of DX.

29 |

13h [E]BP instead of BP.

30 |

1Ch sub function 01h, [E]BX instead of BX.

31 |

1Ch sub function 02h, [E]BX instead of BX.

32 |
33 | 34 |

Next Page

35 |

Previous Page

36 |

Go to Table of Contents

37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/cwc/decstub.inc: -------------------------------------------------------------------------------- 1 | db 252,87,6,232,137,0,7,95,54,161,248,3,54,139,30,250 2 | db 3,209,235,209,216,209,235,209,216,209,235,209,216,209,235,209 3 | db 216,140,194,3,208,142,218,54,139,54,248,3,131,230,15,30 4 | db 86,139,76,6,131,198,27,11,201,116,35,86,30,6,139,68 5 | db 2,139,52,140,195,3,195,142,192,38,1,28,7,31,94,73 6 | db 131,198,4,117,226,140,216,5,0,16,142,216,235,217,94,31 7 | db 140,195,139,68,14,3,195,139,208,139,108,16,139,68,22,3 8 | db 195,46,163,203,1,139,68,20,46,163,201,1,54,142,6,252 9 | db 3,54,142,30,252,3,142,210,139,229,46,255,46,201,1,50 10 | db 237,138,76,3,184,1,0,211,224,72,46,163,80,1,128,233 11 | db 8,46,136,14,70,1,131,198,12,139,44,131,198,2,178,16 12 | db 138,242,19,237,254,202,117,6,139,44,70,70,138,214,115,9 13 | db 138,4,38,136,5,70,71,235,233,19,237,254,202,117,6,139 14 | db 44,70,70,138,214,115,65,51,201,19,237,254,202,117,6,139 15 | db 44,70,70,138,214,18,201,19,237,254,202,117,6,139,44,70 16 | db 70,138,214,18,201,128,193,2,51,192,138,4,70,72,120,16 17 | db 3,193,86,30,6,31,139,247,43,240,243,164,31,94,235,162 18 | db 138,4,70,65,243,170,235,154,19,237,254,202,117,6,139,44 19 | db 70,70,138,214,115,26,51,192,139,4,131,198,2,138,232,177 20 | db 4,211,232,138,205,131,225,15,128,193,2,72,121,194,235,208 21 | db 139,68,1,138,232,177,4,211,232,138,12,131,198,3,129,225 22 | db 255,15,131,193,2,72,121,168,131,249,18,115,179,128,249,4 23 | db 116,60,128,249,3,116,22,128,249,5,116,7,128,249,2,116 24 | db 87,235,85,50,237,138,12,70,243,164,233,53,255,129,254,0 25 | db 192,115,3,233,44,255,139,198,209,232,209,232,209,232,209,232 26 | db 83,140,219,3,195,142,216,131,230,15,91,233,20,255,129,255 27 | db 0,192,115,3,233,11,255,139,199,45,0,192,80,83,209,232 28 | db 209,232,209,232,209,232,140,195,3,195,142,192,91,88,43,248 29 | db 131,224,15,3,248,233,234,254,195,0,0,0,0 30 | -------------------------------------------------------------------------------- /doc/page_54.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 54 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

GetMemSO Allocate a block of memory with selector:offset

15 | 16 |

Inputs: AX = 0ff2ch

17 |

CX:DX = Size of block required in bytes

18 | 19 | 20 | 21 | 22 |

Outputs: Carry set on error else,

23 | 24 |

SI:DI = selector:offset of allocated memory

25 |

Errors: See GetMem

26 | 27 |

Notes: This function allocates a block of memory with an associated selector:offset. The allocation does not consume a selector on each call as does GetMem because a non-zero offset from an existing selector for this allocation type is returned. GetMemSO is useful for applications which make a large number of allocations where running out of selectors with GetMem could be a problem. A potential drawback is that memory accesses beyond the allocation boundary may go undetected since the selector is shared among several allocations. Also, resizing the block can change the selector:offset of the block.

28 | 29 | 30 |
31 | 32 | 34 | 35 |
33 |

GetRVect Get real mode interrupt handler address.

36 | 37 |

Inputs: AX = 0200h

38 |

BL= Interrupt vector number.

39 |

Outputs: CX:DX = selector:offset of handler.

40 |

Errors: None.

41 |
42 | 43 |

Next Page

44 |

Previous Page

45 |

Go to Table of Contents

46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/page_114.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 114 5 | 6 | 7 | 8 | 9 | 10 | the following headings:

11 |

handle base length

12 |

Where:

13 | 14 | 15 | 16 |

handle  Linear memory [de]allocation uses handles to control the blocks. This field is the block's handle.

17 |

base  Linear base address of the memory block.

18 | 19 |

length  Length of the block in bytes.

20 | 21 | 22 | 23 | 24 |

The linear memory list ends with a display of the total linear memory allocated to the program, the real (rounded to 4K pages) memory allocated in parentheses, and finally the total number of memory blocks. For example:

25 |

Total Linear memory: 000FEAC9 (001AA000) in 00000103 blocks

26 |

Entries in the selector list that have Y under "mem" should have a corresponding entry in the linear memory list.

27 |

Linear memory locks are listed after the linear memory block list and contain the following headings:

28 |

base length

29 |

Where:

30 |

base  Linear base of the locked region.

31 |

limit  Length of the locked region.

32 | 33 | 34 | 35 |

NOTE:These values are passed by the program but the actual values have the base rounded down a page and the length rounded up a page to match 4K boundary restrictions on locking. The values are reported in CW.ERR without using a rounded format to make it easier to cross reference this list to the other lists in CW.ERR.

36 | 37 | 38 | 39 |

Next Page

40 |

Previous Page

41 |

Go to Table of Contents

42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /doc/page_43.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 43 5 | 6 | 7 | 8 | 9 | 10 |

CAUSEWAY API

11 |

CauseWay provides an API for C and assembly language programmers as an extension of the DPMI API via INT 31h. Including the file CW.INC allows easy access to this API through appropriately named functions. You may also call the CauseWay API directly with appropriate register setup.

12 |

CauseWay also provides all of the DPMI 0.9 API services on systems without a true DPMI server.

13 |

Some of the API services require pointers to a real mode register list. It's the standard 14 | DPMI format for real-mode code execution, as follows:

15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
dwordEDI
dwordESI
dwordEBP
dwordReserved
dwordEBX
dwordEDX
dwordECX
dwordEAX
wordFlags
wordES
wordDS
wordFS
wordGS
wordIP
wordCS
wordSP
wordSS
34 |

The values are passed to the target routine without any interpretation of their contents. There is no need to set the high words of the extended register entries unless the target routine requires them.

35 | 36 |

Next Page

37 |

Previous Page

38 |

Go to Table of Contents

39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/cwlib/cw.asm/_makflst.asm: -------------------------------------------------------------------------------- 1 | include ..\cwlib.inc 2 | scode 3 | 4 | ;------------------------------------------------------------------------------- 5 | ; 6 | ;Generate list of files that match a given file mask. Wild cards permitted. 7 | ; 8 | ;Calling: 9 | ; 10 | ;MakeFileList(filemask,attribs); 11 | ; 12 | ;On Entry: 13 | ; 14 | ;filemask - File name mask (can include a path). 15 | ;attribs - search attributes. 16 | ; 17 | ;On Exit: 18 | ; 19 | ;EAX - buffer with file names etc, EAX=0 if not enough memory. 20 | ; 21 | ;Each entry in the buffer will have the following format. 22 | ; 23 | ;13 bytes zero terminated ASCII file name (may be less) 24 | ; 1 byte file attribute (directory,vulume,hidden,system etc.) 25 | ; 26 | ; If you specify directories in the attribute search mask the names . & .. will 27 | ; be removed from the list to avoid making special checks for them. Anything 28 | ; that might have found these useful will have to have knowledge of its 29 | ; current path anyway. 30 | ; 31 | ; 32 | ;Attributes are as follows:- 33 | ; 34 | ; 5 4 3 2 1 0 35 | ; | | | | | | 36 | ; | | | | | \_ Read only. (1) 37 | ; | | | | \____ Hidden. (2) 38 | ; | | | \_______ System. (4) 39 | ; | | \__________ Label. (8) 40 | ; | \_____________ Directory. (16) 41 | ; \________________ Archive. (32) 42 | ; 43 | ; Bits 6-15 are reserved and may be used in the search mask, but bits 8-15 won't 44 | ; appear in the attributes for listed files. 45 | ; 46 | ; The first dword in the buffer is the number of entries. 47 | ; Next 256 bytes is the path to append the names to. 48 | ; 49 | _MakeFileList proc syscall filemask:dword, attribs:dword 50 | public _MakeFileList 51 | pushm ecx,edx 52 | mov edx,filemask 53 | mov ecx,attribs 54 | call MakeFileList 55 | popm ecx,edx 56 | ret 57 | _MakeFileList endp 58 | 59 | 60 | efile 61 | end 62 | 63 | 64 | -------------------------------------------------------------------------------- /doc/page_49.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 49 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

GetCallBack Allocate real mode call back address.

15 | 16 |

Inputs: AX = 0303h

17 |

DS:[E]SI = Call address.

18 |

ES:[E]DI = Real mode register structure.

19 |

Outputs: Carry set on error, else,

20 |

CX:DX = Real mode address to trigger mode switch.

21 | 22 | 23 | 24 |

Errors: Call-backs are a limited resource. Normally only 16 are available per virtual machine. Use them carefully and release them as soon as they are no longer required.

25 | 26 | 27 | 28 |

Call-Back:Interrupts disabled.

29 |

DS:[E]SI = Selector:Offset of real mode SS:SP.

30 |

ES:[E]DI = Selector:Offset of real mode call structure.

31 |

SS:[E]SP = Locked protected mode stack.

32 |

All other registers undefined

33 | 34 | 35 | 36 |

To return from call-back procedure, execute an IRET to return.

37 |

ES:[E]DI = Selector:Offset of real mode call structure to restore.

38 |

Notes: Real mode call-backs provide a means of switching from real mode to protected mode. This function returns a unique real mode address that when given control in real mode, switches to protected mode and passes control to the protected mode routine supplied at entry to this function. On entry to the protected mode code the real mode register structure contains all the real mode register values.

39 | 40 |
41 | 42 |

Next Page

43 |

Previous Page

44 |

Go to Table of Contents

45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /doc/page_61.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 61 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

RelMemLinear32 Release previously allocated block of memory (linear address).

15 | 16 |

Inputs: AX = 0ff15h

17 |

ESI = Linear address of block to release.

18 |

Outputs: Carry set on error.

19 |

Errors: See RelMemLinear

20 |
21 | 22 | 25 | 26 |
23 |

RelMemNear Release previously allocated application relative block

24 |

of memory.

27 | 28 |

Inputs: AX = 0ff18h

29 |

ESI = Application relative linear address of block to release.

30 |

Outputs: Carry set on error.

31 | 32 | 33 | 34 |

Errors: If the address passed in ESI is not a valid memory block this function returns carry set.

35 | 36 | 37 |
38 | 39 | 41 | 42 |
40 |

RelMemSO Release a block of memory allocated via GetMemSO.

43 | 44 |

Inputs: AX = 0ff2eh

45 |

SI:DI = Selector:offset of block to release

46 |

Outputs: Carry set on error.

47 | 48 | 49 | 50 |

Errors: If an invalid selector:offset is passed in SI:DI or the memory was not allocated via GetMemSO, then this function returns carry set.

51 | 52 | 53 |
54 | 55 |

Next Page

56 |

Previous Page

57 |

Go to Table of Contents

58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /doc/page_58.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 58 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

LockMem Lock a region of memory.

15 | 16 |

Inputs: AX = 0ff1bh

17 |

BX:CX = Starting linear address of memory to lock.

18 |

SI:DI = Size of region to lock in bytes.

19 |

Outputs: Carry set on error.

20 | 21 |

Errors: If any of the region specified is invalid or if not enough physical memory is available to fill the region specified, then none of the memory is locked and this function returns carry set.

22 |

Notes: Memory that is locked cannot be swapped to disk by the VMM. Locking applies to memory on 4K boundaries. Therefore, areas of memory below and above the memory being locked are locked if the specified region is not aligned to a 4K boundary.

23 | 24 | 25 |
26 | 27 | 29 | 30 |
28 |

LockMem32 Lock a region of memory.

31 | 32 |

Inputs: AX = 0ff1ch

33 |

ESI = Starting linear address of memory to lock.

34 |

ECX = Size of region to lock in bytes.

35 |

Outputs: Carry set on error.

36 |

Errors: See LockMem.

37 | 38 |

Notes: Memory that is locked cannot be swapped to disk by the VMM. Locking applies to memory on 4K boundaries. Therefore, areas of memory below and above the memory being locked are locked if the specified region is not aligned to a 4K boundary.

39 |
40 | 41 |

Next Page

42 |

Previous Page

43 |

Go to Table of Contents

44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /doc/page_44.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 44 5 | 6 | 7 | 8 | 9 | 10 |

STACK FRAMES

11 |

Stack frames for 16-bit interrupts are the same as for real mode.

12 |

The stack frame for 16-bit exceptions follows:

13 |

word SS

14 |

word SP - Original stack address

15 |

word Flags

16 |

word CS

17 |

word IP - Original Flags:CS:IP values that caused the exception

18 |

word Err Code - Processor supplied exception error code

19 |

word CS

20 | 21 | 22 | 23 | 24 | 25 | 26 |

word IP - Return address, returns to interrupt/exception

27 | 28 | 29 | 30 | 31 | 32 | 33 |

dispatch code

34 |

DEFAULT API

35 |

The default CauseWay API follows. Functions that end in the text near are intended only for backwards compatibility with CauseWay's NEAR memory model. This model is now obsolete. The assembly language program include file CW.INC also contains the following list.

36 | 37 | 39 | 40 | 41 |
38 |

AliasSel Create a read/write data selector from source selector.

42 | 43 |

Inputs: AX = 0ff06h

44 |

BX = Source selector

45 |

Outputs: Carry set on error else,

46 |

AX = New data selector

47 | 48 | 49 | 50 |

Errors: If an invalid selector is passed in BX, this function returns with carry set.

51 |

Notes: This function always creates a read/write data selector regardless of the source selector type. It can be used to provide write access to variables in a code segment.

52 | 53 |

Next Page

54 |

Previous Page

55 |

Go to Table of Contents

56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /doc/page_72.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 72 5 | 6 | 7 | 8 | 9 | 10 |

Notes: The user termination routine is responsible for returning to the CauseWay termination routines to allow proper 11 | shutdown of the application. The instruction must be the proper 16- or 32-bit return to match the CL register setting. 12 | For ease of use with high-level languages (specifically Watcom C and setting SS back to DGROUP), [E]SI equals the internal 13 | DOS extender stack ESP immediately prior to the 32- or 16-bit call to the termination routine. If an information dump buffer 14 | address is provided, register and other termination values are placed into it using the following format:

15 |

dword  EBP;

16 |

dword  EDI;

17 |

dword  ESI;

18 |

dword  EDX;

19 |

dword  ECX;

20 |

dword  EBX;

21 |

dword  EAX;

22 |

dword  GS;

23 |

dword  FS;

24 |

dword  ES;

25 |

dword  DS;

26 |

dword  EIP;

27 |

dword  CS;

28 |

dword  EFLAGS;

29 |

dword  ESP;

30 |

dword  SS;

31 |

word  TR;

32 |

dword  CR0;

33 |

dword  CR2;

34 |

dword  CR3;

35 |

dword  csAddress;

36 |

dword  dsAddress;

37 |

dword  esAddress;

38 |

dword  fsAddress;

39 |

dword  gsAddress;

40 |

dword  ssAddress;

41 |

word  ExceptionNumber;

42 |

dword  ErrorCode;

43 | 44 | 45 |

Next Page

46 |

Previous Page

47 |

Go to Table of Contents

48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /doc/page_59.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CauseWay for Watcom C/C++ & Assembly Language: Manual Page 59 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 |
12 |

LockMemNear Lock a region of memory using application relative address.

15 | 16 |

Inputs: AX = 0ff1fh

17 |

ESI = Starting linear address of memory to lock.

18 |

EBX = Size of region to lock in bytes.

19 |

Outputs: Carry set on error.

20 |

Errors: See LockMem

21 | 22 |

Notes: Memory that is locked cannot be swapped to disk by the VMM. Locking applies to memory on 4K boundaries. Therefore, areas of memory below and above the memory being locked are locked if the specified region is not aligned to a 4K boundary.

23 | 24 | 25 |
26 | 27 | 29 | 30 |
28 |

Near2Linear Convert application relative address to linear address.

31 | 32 |

Inputs: AX = 0ff1ah

33 |

ESI = Application relative linear address.

34 |

Outputs: ESI = Linear address.

35 |

Errors: None

36 |
37 | 38 | 40 | 41 |
39 |

RelCallBack Release a real mode call back entry.

42 | 43 |

Inputs: AX = 0304h

44 |

CX:DX = Real mode address returned by GetCallBack

45 |

Errors: None.

46 |

Outputs: None.

47 | 48 | 49 | 50 |

Notes: Use this function to release call-back addresses once they are no longer needed.

51 | 52 | 53 |
54 | 55 |

Next Page

56 |

Previous Page

57 |

Go to Table of Contents

58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/cwc/copystub.asm: -------------------------------------------------------------------------------- 1 | 2 | ;--- this file is included into CWC.EXE as copystub.inc 3 | 4 | .model tiny 5 | option oldstructs 6 | option proc:private 7 | 8 | CWCStackSize equ 1024 ; cannot exceed EXECopyStubLen size (1135 bytes) 9 | 10 | .code 11 | 12 | var_struc struc 13 | ; db 100h-10h dup (0) 14 | db CWCStackSize-10h dup (0) 15 | 16 | var_SourceSeg dw ? 17 | var_CopyLen dw ? 18 | var_EntryIP dw 0 19 | var_EntryCS dw ? 20 | var_ImageLen dw ?,? 21 | var_EntryES dw ? 22 | var_struc ends 23 | 24 | b equ byte ptr 25 | w equ word ptr 26 | d equ dword ptr 27 | f equ fword ptr 28 | 29 | start: cli 30 | push ss ;make data addressable. 31 | pop ds 32 | mov ax,es:[2] ;Get highest address. 33 | 34 | ; sub ax,10h 35 | sub ax,(CWCStackSize/10h) 36 | 37 | mov ss,ax 38 | sti 39 | push es 40 | push ss 41 | pop es 42 | ; mov si,100h-10h 43 | mov si,CWCStackSize-10h 44 | 45 | mov di,si 46 | mov cx,10h 47 | rep movsb 48 | pop es 49 | mov ss:w[var_EntryES],es ;need this for program entry. 50 | ; 51 | ;Setup destination copy address. 52 | ; 53 | mov bx,ax 54 | mov dx,cs 55 | add dx,ss:w[var_SourceSeg] 56 | mov bp,ss:w[var_CopyLen] 57 | ; 58 | ;Do the copy. 59 | ; 60 | std 61 | @@0: mov ax,bp 62 | cmp ax,1000h 63 | jbe @@1 64 | mov ax,1000h 65 | @@1: sub bp,ax 66 | sub dx,ax 67 | sub bx,ax 68 | mov ds,dx 69 | mov es,bx 70 | mov cl,3 71 | shl ax,cl 72 | mov cx,ax 73 | shl ax,1 74 | dec ax 75 | dec ax 76 | mov si,ax 77 | mov di,ax 78 | rep movsw 79 | or bp,bp 80 | jnz @@0 81 | ; 82 | ;Point to the data to decompress. 83 | ; 84 | mov si,es 85 | mov ds,si 86 | xor si,si 87 | mov di,cs 88 | mov es,di 89 | xor di,di 90 | ; 91 | ;Setup the decompressor entry address. 92 | ; 93 | mov ax,ds 94 | add ss:w[var_EntryCS],ax 95 | ; 96 | ;Jump into the decompressor code. 97 | ; 98 | jmp ss:dword ptr[var_EntryIP] 99 | 100 | db 1056 dup (0) 101 | 102 | end start 103 | 104 | --------------------------------------------------------------------------------