.asm.obj:\r
$(ASMC) $(ASMO) $<\r
\r
-target: modex.lib
+target: modex.lib\r
# modex.tpu modex.tpp\r
\r
#modex.tpu: $(LIBOBJS) modex.pas\r
.asm.obj:\r
$(ASMC) $(ASMO) $<\r
\r
-target: modex.lib
+target: modex.lib\r
# modex.tpu modex.tpp\r
\r
#modex.tpu: $(LIBOBJS) modex.pas\r
+++ /dev/null
-!ifdef __LINUX__
-REMOVECOMMAND=rm -f
-COPYCOMMAND=cp -f
-DIRSEP=/
-OBJ=o
-!else
-REMOVECOMMAND=del
-COPYCOMMAND=copy /y
-DIRSEP=\
-OBJ=obj
-!endif
-
-TARGET_OS = dos
-
-DISS=wdis -a
-REDR=">" ..$(DIRSEP)xw_$(DIRSEP)
-
-all:
- @beep
-
-pee: .symbolic
-$(DISS) MXBB.OBJ $(REDR)mxbb.asm
-$(DISS) MXCC.OBJ $(REDR)mxcc.asm
-$(DISS) MXCG.OBJ $(REDR)mxcg.asm
-$(DISS) MXCL.OBJ $(REDR)mxcl.asm
-$(DISS) MXCR.OBJ $(REDR)mxcl.asm
-$(DISS) MXFB.OBJ $(REDR)mxfb.asm
-$(DISS) MXFP.OBJ $(REDR)mxfp.asm
-$(DISS) MXGC.OBJ $(REDR)mxgc.asm
-$(DISS) MXGI.OBJ $(REDR)mxgi.asm
-$(DISS) MXGM.OBJ $(REDR)mxgm.asm
-$(DISS) MXGP.OBJ $(REDR)mxgp.asm
-$(DISS) MXGV.OBJ $(REDR)mxgv.asm
-$(DISS) MXHL.OBJ $(REDR)mxhl.asm
-$(DISS) MXIT.OBJ $(REDR)mxit.asm
-$(DISS) MXLL.OBJ $(REDR)mxll.asm
-$(DISS) MXLN.OBJ $(REDR)mxln.asm
-$(DISS) MXOT.OBJ $(REDR)mxot.asm
-$(DISS) MXPB.OBJ $(REDR)mxpb.asm
-$(DISS) MXPF.OBJ $(REDR)mxpf.asm
-$(DISS) MXPG.OBJ $(REDR)mxpg.asm
-$(DISS) MXPI.OBJ $(REDR)mxpi.asm
-$(DISS) MXPN.OBJ $(REDR)mxpn.asm
-$(DISS) MXPP.OBJ $(REDR)mxpp.asm
-$(DISS) MXRA.OBJ $(REDR)mxra.asm
-$(DISS) MXRP.OBJ $(REDR)mxrp.asm
-$(DISS) MXSA.OBJ $(REDR)mxsa.asm
-$(DISS) MXSC.OBJ $(REDR)mxsc.asm
-$(DISS) MXSI.OBJ $(REDR)mxsi.asm
-$(DISS) MXSL.OBJ $(REDR)mxsl.asm
-$(DISS) MXSM.OBJ $(REDR)mxsm.asm
-$(DISS) MXSP.OBJ $(REDR)mxsp.asm
-$(DISS) MXSS.OBJ $(REDR)mxss.asm
-$(DISS) MXTL.OBJ $(REDR)mxtl.asm
-$(DISS) MXVS.OBJ $(REDR)mxvs.asm
-$(DISS) MXWD.OBJ $(REDR)mxwd.asm
-$(DISS) MXWM.OBJ $(REDR)mxwm.asm
-$(DISS) MXWP.OBJ $(REDR)mxwp.asm
-$(DISS) MXWR.OBJ $(REDR)mxwr.asm
--- /dev/null
+;\r
+; MODEX library default font\r
+; Copyright (c) 1993-1994 by Alessandro Scotti\r
+;\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; #0\r
+ DB 07Eh, 081h, 0A5h, 081h, 0A5h, 099h, 081h, 07Eh ; #1\r
+ DB 07Eh, 0FFh, 0DBh, 0FFh, 0DBh, 0E7h, 0FFh, 07Eh ; #2\r
+ DB 06Ch, 0FEh, 0FEh, 0FEh, 07Ch, 038h, 010h, 000h ; #3\r
+ DB 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 010h, 000h ; #4\r
+ DB 010h, 038h, 010h, 054h, 0FEh, 054h, 010h, 0FEh ; #5\r
+ DB 010h, 038h, 07Ch, 0FEh, 0FEh, 07Ch, 010h, 0FEh ; #6\r
+ DB 000h, 018h, 03Ch, 07Eh, 07Eh, 03Ch, 018h, 000h ; #7\r
+ DB 0FFh, 0E7h, 0C3h, 081h, 081h, 0C3h, 0E7h, 0FFh ; #8\r
+ DB 000h, 03Ch, 066h, 042h, 042h, 066h, 03Ch, 000h ; #9\r
+ DB 0FFh, 0C3h, 099h, 0BDh, 0BDh, 099h, 0C3h, 0FFh ; #10\r
+ DB 007h, 003h, 005h, 078h, 084h, 084h, 084h, 078h ; #11\r
+ DB 07Ch, 082h, 082h, 082h, 07Ch, 010h, 038h, 010h ; #12\r
+ DB 01Ch, 010h, 01Ch, 010h, 010h, 010h, 030h, 030h ; #13\r
+ DB 03Eh, 022h, 03Eh, 022h, 022h, 026h, 066h, 060h ; #14\r
+ DB 099h, 05Ah, 03Ch, 0E7h, 0E7h, 03Ch, 05Ah, 099h ; #15\r
+ DB 000h, 010h, 030h, 070h, 0F0h, 070h, 030h, 010h ; #16\r
+ DB 000h, 080h, 0C0h, 0E0h, 0F0h, 0E0h, 0C0h, 080h ; #17\r
+ DB 010h, 038h, 054h, 010h, 010h, 054h, 038h, 010h ; #18\r
+ DB 048h, 048h, 048h, 048h, 048h, 000h, 048h, 000h ; #19\r
+ DB 07Eh, 092h, 092h, 072h, 012h, 012h, 012h, 000h ; #20\r
+ DB 03Ch, 022h, 018h, 024h, 024h, 018h, 044h, 03Ch ; #21\r
+ DB 000h, 000h, 000h, 000h, 000h, 03Eh, 03Eh, 000h ; #22\r
+ DB 038h, 054h, 010h, 010h, 010h, 054h, 038h, 0FEh ; #23\r
+ DB 000h, 010h, 038h, 054h, 010h, 010h, 010h, 000h ; #24\r
+ DB 000h, 010h, 010h, 010h, 054h, 038h, 010h, 000h ; #25\r
+ DB 000h, 008h, 004h, 0FEh, 004h, 008h, 000h, 000h ; #26\r
+ DB 000h, 020h, 040h, 0FEh, 040h, 020h, 000h, 000h ; #27\r
+ DB 000h, 000h, 080h, 080h, 080h, 0FCh, 000h, 000h ; #28\r
+ DB 000h, 024h, 042h, 0FFh, 042h, 024h, 000h, 000h ; #29\r
+ DB 000h, 000h, 010h, 038h, 07Ch, 0FEh, 000h, 000h ; #30\r
+ DB 000h, 000h, 0FEh, 07Ch, 038h, 010h, 000h, 000h ; #31\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; \r
+ DB 010h, 010h, 010h, 010h, 010h, 000h, 010h, 000h ; !\r
+ DB 000h, 024h, 024h, 000h, 000h, 000h, 000h, 000h ; "\r
+ DB 024h, 024h, 07Eh, 024h, 07Eh, 024h, 024h, 000h ; #\r
+ DB 038h, 054h, 050h, 038h, 014h, 054h, 038h, 010h ; $\r
+ DB 000h, 002h, 044h, 008h, 010h, 020h, 042h, 000h ; %\r
+ DB 038h, 044h, 038h, 060h, 094h, 088h, 074h, 000h ; &\r
+ DB 020h, 020h, 040h, 000h, 000h, 000h, 000h, 000h ; '\r
+ DB 010h, 020h, 040h, 040h, 040h, 020h, 010h, 000h ; (\r
+ DB 040h, 020h, 010h, 010h, 010h, 020h, 040h, 000h ; )\r
+ DB 000h, 024h, 018h, 07Eh, 018h, 024h, 000h, 000h ; *\r
+ DB 000h, 010h, 010h, 07Ch, 010h, 010h, 000h, 000h ; +\r
+ DB 000h, 000h, 000h, 000h, 000h, 010h, 010h, 020h ; ,\r
+ DB 000h, 000h, 000h, 0FCh, 000h, 000h, 000h, 000h ; -\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 010h, 000h ; .\r
+ DB 000h, 004h, 008h, 010h, 020h, 040h, 080h, 000h ; /\r
+ DB 07Ch, 0C6h, 08Ah, 092h, 0A2h, 0C6h, 07Ch, 000h ; 0\r
+ DB 010h, 030h, 010h, 010h, 010h, 010h, 038h, 000h ; 1\r
+ DB 078h, 084h, 004h, 018h, 060h, 080h, 0FCh, 000h ; 2\r
+ DB 078h, 084h, 004h, 038h, 004h, 084h, 078h, 000h ; 3\r
+ DB 01Ch, 024h, 044h, 084h, 0FEh, 004h, 00Eh, 000h ; 4\r
+ DB 0FCh, 080h, 0F8h, 004h, 004h, 084h, 078h, 000h ; 5\r
+ DB 078h, 084h, 080h, 0F8h, 084h, 084h, 078h, 000h ; 6\r
+ DB 0FCh, 004h, 004h, 008h, 010h, 020h, 020h, 000h ; 7\r
+ DB 078h, 084h, 084h, 078h, 084h, 084h, 078h, 000h ; 8\r
+ DB 078h, 084h, 084h, 07Ch, 004h, 084h, 078h, 000h ; 9\r
+ DB 000h, 000h, 010h, 000h, 000h, 000h, 010h, 000h ; :\r
+ DB 000h, 000h, 010h, 000h, 000h, 010h, 010h, 020h ; ;\r
+ DB 008h, 010h, 020h, 040h, 020h, 010h, 008h, 000h ; <\r
+ DB 000h, 000h, 0FCh, 000h, 000h, 0FCh, 000h, 000h ; =\r
+ DB 040h, 020h, 010h, 008h, 010h, 020h, 040h, 000h ; >\r
+ DB 078h, 084h, 004h, 008h, 010h, 000h, 010h, 000h ; ?\r
+ DB 07Ch, 082h, 0BAh, 0A6h, 0BEh, 080h, 07Ch, 000h ; @\r
+ DB 078h, 084h, 084h, 0FCh, 084h, 084h, 084h, 000h ; A\r
+ DB 0F8h, 084h, 084h, 0F8h, 084h, 084h, 0F8h, 000h ; B\r
+ DB 078h, 084h, 080h, 080h, 080h, 084h, 078h, 000h ; C\r
+ DB 0F0h, 088h, 084h, 084h, 084h, 088h, 0F0h, 000h ; D\r
+ DB 0FCh, 080h, 080h, 0F0h, 080h, 080h, 0FCh, 000h ; E\r
+ DB 0FCh, 080h, 080h, 0F0h, 080h, 080h, 080h, 000h ; F\r
+ DB 078h, 084h, 080h, 09Ch, 084h, 084h, 078h, 000h ; G\r
+ DB 084h, 084h, 084h, 0FCh, 084h, 084h, 084h, 000h ; H\r
+ DB 038h, 010h, 010h, 010h, 010h, 010h, 038h, 000h ; I\r
+ DB 01Ch, 008h, 008h, 008h, 088h, 088h, 070h, 000h ; J\r
+ DB 084h, 088h, 090h, 0E0h, 090h, 088h, 084h, 000h ; K\r
+ DB 080h, 080h, 080h, 080h, 080h, 080h, 0FCh, 000h ; L\r
+ DB 0C6h, 0AAh, 092h, 082h, 082h, 082h, 082h, 000h ; M\r
+ DB 082h, 0C2h, 0A2h, 092h, 08Ah, 086h, 082h, 000h ; N\r
+ DB 078h, 084h, 084h, 084h, 084h, 084h, 078h, 000h ; O\r
+ DB 0F8h, 084h, 084h, 0F8h, 080h, 080h, 080h, 000h ; P\r
+ DB 078h, 084h, 084h, 084h, 094h, 088h, 076h, 000h ; Q\r
+ DB 0F8h, 084h, 084h, 0F8h, 090h, 088h, 084h, 000h ; R\r
+ DB 078h, 084h, 080h, 078h, 004h, 084h, 078h, 000h ; S\r
+ DB 0FEh, 010h, 010h, 010h, 010h, 010h, 010h, 000h ; T\r
+ DB 084h, 084h, 084h, 084h, 084h, 084h, 078h, 000h ; U\r
+ DB 084h, 084h, 084h, 084h, 084h, 048h, 030h, 000h ; V\r
+ DB 082h, 082h, 082h, 082h, 092h, 0AAh, 0C6h, 000h ; W\r
+ DB 082h, 044h, 028h, 010h, 028h, 044h, 082h, 000h ; X\r
+ DB 044h, 044h, 044h, 038h, 010h, 010h, 010h, 000h ; Y\r
+ DB 0FEh, 004h, 008h, 010h, 020h, 040h, 0FEh, 000h ; Z\r
+ DB 078h, 040h, 040h, 040h, 040h, 040h, 078h, 000h ; [\r
+ DB 000h, 080h, 040h, 020h, 010h, 008h, 004h, 000h ; \\r
+ DB 078h, 008h, 008h, 008h, 008h, 008h, 078h, 000h ; ]\r
+ DB 010h, 028h, 044h, 082h, 000h, 000h, 000h, 000h ; ^\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh ; _\r
+ DB 020h, 020h, 010h, 000h, 000h, 000h, 000h, 000h ; `\r
+ DB 000h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; a\r
+ DB 000h, 040h, 040h, 078h, 044h, 044h, 078h, 000h ; b\r
+ DB 000h, 000h, 03Ch, 040h, 040h, 040h, 03Ch, 000h ; c\r
+ DB 000h, 004h, 004h, 03Ch, 044h, 044h, 03Ch, 000h ; d\r
+ DB 000h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; e\r
+ DB 000h, 00Ch, 010h, 03Ch, 010h, 010h, 010h, 000h ; f\r
+ DB 000h, 000h, 03Ch, 044h, 044h, 03Ch, 004h, 038h ; g\r
+ DB 000h, 040h, 040h, 078h, 044h, 044h, 044h, 000h ; h\r
+ DB 000h, 010h, 000h, 010h, 010h, 010h, 010h, 000h ; i\r
+ DB 000h, 004h, 000h, 004h, 004h, 004h, 044h, 038h ; j\r
+ DB 000h, 040h, 040h, 050h, 060h, 050h, 048h, 000h ; k\r
+ DB 000h, 030h, 010h, 010h, 010h, 010h, 010h, 000h ; l\r
+ DB 000h, 000h, 068h, 054h, 054h, 044h, 044h, 000h ; m\r
+ DB 000h, 000h, 078h, 044h, 044h, 044h, 044h, 000h ; n\r
+ DB 000h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; o\r
+ DB 000h, 000h, 078h, 044h, 044h, 078h, 040h, 040h ; p\r
+ DB 000h, 000h, 03Ch, 044h, 044h, 03Ch, 004h, 004h ; q\r
+ DB 000h, 000h, 05Ch, 060h, 040h, 040h, 040h, 000h ; r\r
+ DB 000h, 000h, 038h, 040h, 07Ch, 004h, 07Ch, 000h ; s\r
+ DB 000h, 010h, 038h, 010h, 010h, 010h, 018h, 000h ; t\r
+ DB 000h, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; u\r
+ DB 000h, 000h, 044h, 044h, 044h, 028h, 010h, 000h ; v\r
+ DB 000h, 000h, 044h, 044h, 054h, 054h, 06Ch, 000h ; w\r
+ DB 000h, 000h, 044h, 028h, 010h, 028h, 044h, 000h ; x\r
+ DB 000h, 000h, 044h, 044h, 044h, 03Ch, 004h, 07Ch ; y\r
+ DB 000h, 000h, 07Ch, 004h, 038h, 040h, 07Ch, 000h ; z\r
+ DB 000h, 008h, 010h, 010h, 030h, 010h, 010h, 008h ; {\r
+ DB 000h, 010h, 010h, 010h, 000h, 010h, 010h, 010h ; |\r
+ DB 000h, 020h, 010h, 010h, 018h, 010h, 010h, 020h ; }\r
+ DB 064h, 098h, 000h, 000h, 000h, 000h, 000h, 000h ; ~\r
+ DB 000h, 010h, 028h, 044h, 082h, 082h, 0FEh, 000h ; \7f\r
+ DB 07Ch, 080h, 080h, 080h, 080h, 07Ch, 004h, 07Ch ; #128\r
+ DB 000h, 028h, 000h, 044h, 044h, 044h, 038h, 000h ; #129\r
+ DB 03Ch, 000h, 07Ch, 044h, 07Ch, 040h, 07Ch, 000h ; #130\r
+ DB 07Eh, 081h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #131\r
+ DB 024h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #132\r
+ DB 078h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #133\r
+ DB 018h, 018h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #134\r
+ DB 000h, 000h, 078h, 080h, 080h, 078h, 008h, 038h ; #135\r
+ DB 07Ch, 082h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #136\r
+ DB 048h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #137\r
+ DB 078h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #138\r
+ DB 000h, 028h, 000h, 010h, 010h, 010h, 010h, 000h ; #139\r
+ DB 010h, 028h, 000h, 010h, 010h, 010h, 010h, 000h ; #140\r
+ DB 000h, 030h, 000h, 010h, 010h, 010h, 010h, 000h ; #141\r
+ DB 048h, 000h, 078h, 084h, 0FCh, 084h, 084h, 000h ; #142\r
+ DB 030h, 030h, 078h, 084h, 0FCh, 084h, 084h, 000h ; #143\r
+ DB 038h, 000h, 0FCh, 080h, 0F0h, 080h, 0FCh, 000h ; #144\r
+ DB 000h, 000h, 07Eh, 008h, 07Eh, 048h, 07Eh, 000h ; #145\r
+ DB 07Eh, 090h, 090h, 0FCh, 090h, 090h, 09Eh, 000h ; #146\r
+ DB 07Ch, 082h, 038h, 044h, 044h, 044h, 038h, 000h ; #147\r
+ DB 028h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #148\r
+ DB 070h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #149\r
+ DB 038h, 044h, 000h, 044h, 044h, 044h, 038h, 000h ; #150\r
+ DB 070h, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; #151\r
+ DB 028h, 000h, 044h, 044h, 044h, 03Ch, 004h, 07Ch ; #152\r
+ DB 048h, 000h, 078h, 084h, 084h, 084h, 078h, 000h ; #153\r
+ DB 048h, 000h, 084h, 084h, 084h, 084h, 078h, 000h ; #154\r
+ DB 000h, 010h, 038h, 040h, 040h, 040h, 038h, 010h ; #155\r
+ DB 038h, 044h, 040h, 0E0h, 040h, 040h, 082h, 0FCh ; #156\r
+ DB 044h, 07Ch, 010h, 07Ch, 010h, 07Ch, 010h, 000h ; #157\r
+ DB 0F0h, 088h, 08Ah, 0F7h, 082h, 082h, 082h, 000h ; #158\r
+ DB 00Ch, 012h, 010h, 018h, 030h, 010h, 090h, 060h ; #159\r
+ DB 03Ch, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #160\r
+ DB 000h, 018h, 000h, 010h, 010h, 010h, 010h, 000h ; #161\r
+ DB 01Ch, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #162\r
+ DB 01Ch, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; #163\r
+ DB 07Ch, 000h, 078h, 044h, 044h, 044h, 044h, 000h ; #164\r
+ DB 07Ch, 000h, 044h, 064h, 054h, 04Ch, 044h, 000h ; #165\r
+ DB 018h, 024h, 024h, 01Eh, 000h, 03Eh, 000h, 000h ; #166\r
+ DB 01Ch, 022h, 022h, 01Ch, 000h, 03Eh, 000h, 000h ; #167\r
+ DB 010h, 000h, 010h, 020h, 040h, 042h, 03Ch, 000h ; #168\r
+ DB 000h, 000h, 000h, 0FCh, 080h, 080h, 000h, 000h ; #169\r
+ DB 000h, 000h, 000h, 0FCh, 004h, 004h, 000h, 000h ; #170\r
+ DB 040h, 044h, 048h, 057h, 021h, 047h, 004h, 007h ; #171\r
+ DB 040h, 044h, 048h, 052h, 026h, 04Ah, 01Fh, 002h ; #172\r
+ DB 010h, 000h, 010h, 010h, 010h, 010h, 010h, 000h ; #173\r
+ DB 000h, 024h, 048h, 090h, 048h, 024h, 000h, 000h ; #174\r
+ DB 000h, 048h, 024h, 012h, 024h, 048h, 000h, 000h ; #175\r
+ DB 022h, 088h, 022h, 088h, 022h, 088h, 022h, 088h ; #176\r
+ DB 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh ; #177\r
+ DB 0DBh, 077h, 0DBh, 0EEh, 0DBh, 077h, 0DBh, 0EEh ; #178\r
+ DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h ; #179\r
+ DB 018h, 018h, 018h, 018h, 0F8h, 018h, 018h, 018h ; #180\r
+ DB 018h, 018h, 0F8h, 018h, 0F8h, 018h, 018h, 018h ; #181\r
+ DB 036h, 036h, 036h, 036h, 0F6h, 036h, 036h, 036h ; #182\r
+ DB 000h, 000h, 000h, 000h, 0FEh, 036h, 036h, 036h ; #183\r
+ DB 000h, 000h, 0F8h, 018h, 0F8h, 018h, 018h, 018h ; #184\r
+ DB 036h, 036h, 0F6h, 006h, 0F6h, 036h, 036h, 036h ; #185\r
+ DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h ; #186\r
+ DB 000h, 000h, 0FEh, 006h, 0F6h, 036h, 036h, 036h ; #187\r
+ DB 036h, 036h, 0F6h, 006h, 0FEh, 000h, 000h, 000h ; #188\r
+ DB 036h, 036h, 036h, 036h, 0FEh, 000h, 000h, 000h ; #189\r
+ DB 018h, 018h, 0F8h, 018h, 0F8h, 000h, 000h, 000h ; #190\r
+ DB 000h, 000h, 000h, 000h, 0F8h, 018h, 018h, 018h ; #191\r
+ DB 018h, 018h, 018h, 018h, 01Fh, 000h, 000h, 000h ; #192\r
+ DB 018h, 018h, 018h, 018h, 0FFh, 000h, 000h, 000h ; #193\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 018h, 018h, 018h ; #194\r
+ DB 018h, 018h, 018h, 018h, 01Fh, 018h, 018h, 018h ; #195\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 000h, 000h, 000h ; #196\r
+ DB 018h, 018h, 018h, 018h, 0FFh, 018h, 018h, 018h ; #197\r
+ DB 018h, 018h, 01Fh, 018h, 01Fh, 018h, 018h, 018h ; #198\r
+ DB 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h ; #199\r
+ DB 036h, 036h, 037h, 030h, 03Fh, 000h, 000h, 000h ; #200\r
+ DB 000h, 000h, 03Fh, 030h, 037h, 036h, 036h, 036h ; #201\r
+ DB 036h, 036h, 0F7h, 000h, 0FFh, 000h, 000h, 000h ; #202\r
+ DB 000h, 000h, 0FFh, 000h, 0F7h, 036h, 036h, 036h ; #203\r
+ DB 036h, 036h, 037h, 030h, 037h, 036h, 036h, 036h ; #204\r
+ DB 000h, 000h, 0FFh, 000h, 0FFh, 000h, 000h, 000h ; #205\r
+ DB 036h, 036h, 0F7h, 000h, 0F7h, 036h, 036h, 036h ; #206\r
+ DB 018h, 018h, 0FFh, 000h, 0FFh, 000h, 000h, 000h ; #207\r
+ DB 036h, 036h, 036h, 036h, 0FFh, 000h, 000h, 000h ; #208\r
+ DB 000h, 000h, 0FFh, 000h, 0FFh, 018h, 018h, 018h ; #209\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 036h, 036h, 036h ; #210\r
+ DB 036h, 036h, 036h, 036h, 03Fh, 000h, 000h, 000h ; #211\r
+ DB 018h, 018h, 01Fh, 018h, 01Fh, 000h, 000h, 000h ; #212\r
+ DB 000h, 000h, 01Fh, 018h, 01Fh, 018h, 018h, 018h ; #213\r
+ DB 000h, 000h, 000h, 000h, 03Fh, 036h, 036h, 036h ; #214\r
+ DB 036h, 036h, 036h, 036h, 0FFh, 036h, 036h, 036h ; #215\r
+ DB 018h, 018h, 0FFh, 018h, 0FFh, 018h, 018h, 018h ; #216\r
+ DB 018h, 018h, 018h, 018h, 0F8h, 000h, 000h, 000h ; #217\r
+ DB 000h, 000h, 000h, 000h, 01Fh, 018h, 018h, 018h ; #218\r
+ DB 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh ; #219\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh ; #220\r
+ DB 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h ; #221\r
+ DB 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh ; #222\r
+ DB 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h, 000h, 000h ; #223\r
+ DB 000h, 000h, 062h, 094h, 088h, 094h, 062h, 000h ; #224\r
+ DB 000h, 0F0h, 088h, 0F0h, 088h, 088h, 0F0h, 080h ; #225\r
+ DB 000h, 0F8h, 088h, 080h, 080h, 080h, 080h, 000h ; #226\r
+ DB 000h, 0FCh, 048h, 048h, 048h, 048h, 048h, 000h ; #227\r
+ DB 0FCh, 084h, 040h, 020h, 040h, 084h, 0FCh, 000h ; #228\r
+ DB 03Ch, 040h, 038h, 044h, 044h, 044h, 038h, 000h ; #229\r
+ DB 000h, 000h, 044h, 044h, 044h, 078h, 040h, 040h ; #230\r
+ DB 000h, 036h, 048h, 008h, 008h, 008h, 008h, 000h ; #231\r
+ DB 038h, 010h, 038h, 044h, 044h, 038h, 010h, 038h ; #232\r
+ DB 078h, 084h, 084h, 0FCh, 084h, 084h, 078h, 000h ; #233\r
+ DB 078h, 084h, 084h, 084h, 048h, 048h, 0CCh, 000h ; #234\r
+ DB 078h, 004h, 038h, 044h, 044h, 044h, 038h, 000h ; #235\r
+ DB 000h, 000h, 06Ch, 092h, 092h, 06Ch, 000h, 000h ; #236\r
+ DB 000h, 000h, 03Ah, 044h, 05Ah, 022h, 05Ch, 000h ; #237\r
+ DB 018h, 020h, 040h, 078h, 040h, 020h, 018h, 000h ; #238\r
+ DB 078h, 084h, 084h, 084h, 084h, 084h, 084h, 000h ; #239\r
+ DB 000h, 0FCh, 000h, 0FCh, 000h, 0FCh, 000h, 000h ; #240\r
+ DB 020h, 020h, 0F8h, 020h, 020h, 000h, 0F8h, 000h ; #241\r
+ DB 020h, 010h, 008h, 010h, 020h, 000h, 07Ch, 000h ; #242\r
+ DB 008h, 010h, 020h, 010h, 008h, 000h, 07Ch, 000h ; #243\r
+ DB 00Ch, 012h, 010h, 010h, 010h, 010h, 010h, 010h ; #244\r
+ DB 010h, 010h, 010h, 010h, 010h, 010h, 090h, 060h ; #245\r
+ DB 000h, 010h, 000h, 07Ch, 000h, 010h, 000h, 000h ; #246\r
+ DB 000h, 032h, 04Ch, 000h, 032h, 04Ch, 000h, 000h ; #247\r
+ DB 038h, 044h, 044h, 038h, 000h, 000h, 000h, 000h ; #248\r
+ DB 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h ; #249\r
+ DB 000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h ; #250\r
+ DB 00Eh, 008h, 008h, 008h, 048h, 028h, 018h, 008h ; #251\r
+ DB 038h, 024h, 024h, 024h, 024h, 000h, 000h, 000h ; #252\r
+ DB 03Ch, 004h, 03Ch, 020h, 03Ch, 000h, 000h, 000h ; #253\r
+ DB 000h, 000h, 03Ch, 03Ch, 03Ch, 03Ch, 000h, 000h ; #254\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; #255\r
--- /dev/null
+#\r
+# MODEX library makefile (for Borland MAKE)\r
+# Copyright (c) 1993,1994 by Alessandro Scotti\r
+#\r
+LIBINCS = MODEX.DEF\r
+\r
+LIBOBJS = MXBB.OBJ \\r
+ MXCC.OBJ \\r
+ MXCG.OBJ \\r
+ MXCL.OBJ \\r
+ MXCR.OBJ \\r
+ MXFB.OBJ \\r
+ MXFP.OBJ \\r
+ MXGC.OBJ \\r
+ MXGI.OBJ \\r
+ MXGM.OBJ \\r
+ MXGP.OBJ \\r
+ MXGV.OBJ \\r
+ MXHL.OBJ \\r
+ MXIT.OBJ \\r
+ MXLL.OBJ \\r
+ MXLN.OBJ \\r
+ MXOT.OBJ \\r
+ MXPB.OBJ \\r
+ MXPF.OBJ \\r
+ MXPG.OBJ \\r
+ MXPI.OBJ \\r
+ MXPN.OBJ \\r
+ MXPP.OBJ \\r
+ MXRA.OBJ \\r
+ MXRP.OBJ \\r
+ MXSA.OBJ \\r
+ MXSC.OBJ \\r
+ MXSI.OBJ \\r
+ MXSL.OBJ \\r
+ MXSM.OBJ \\r
+ MXSP.OBJ \\r
+ MXSS.OBJ \\r
+ MXTL.OBJ \\r
+ MXVS.OBJ \\r
+ MXWD.OBJ \\r
+ MXWM.OBJ \\r
+ MXWP.OBJ \\r
+ MXWR.OBJ\r
+\r
+#\r
+# ASM compiler\r
+#\r
+ASMC = tasm\r
+ASMO = /m5 /zi\r
+#/p\r
+\r
+#\r
+# PAS compiler\r
+#\r
+PASC = tpc\r
+PASO = /m -$D- -$L- -$S-\r
+\r
+#\r
+# LIB maker, uses response file\r
+#\r
+LIBC = tlib\r
+\r
+.asm.obj:\r
+ $(ASMC) $(ASMO) $<\r
+\r
+target: modex.lib\r
+# modex.tpu modex.tpp\r
+\r
+#modex.tpu: $(LIBOBJS) modex.pas\r
+# $(PASC) $(PASO) modex\r
+# copy modex.tpu ..\r
+# copy modex.pas ..\r
+\r
+#modex.tpp: $(LIBOBJS) modex.pas\r
+# $(PASC) /cp $(PASO) modex\r
+# copy modex.tpp ..\r
+\r
+modex.lib: modex.lbr $(LIBOBJS)\r
+ $(LIBC) modex.lib @modex.lbr\r
+\r
+$(LIBOBJS): modex.def\r
--- /dev/null
+;------------------------------------------------------------\r
+;\r
+; MODEX.DEF - Include file\r
+; Copyright (c) 1993-1994 by Alessandro Scotti\r
+;\r
+JUMPS\r
+LOCALS\r
+\r
+TRUE EQU 1 ; Boolean constants\r
+FALSE EQU 0\r
+\r
+USE286 = FALSE ; TRUE enables 80286 instructions\r
+USE386 = FALSE ; TRUE enables 80386 (and 80286) instructions\r
+\r
+IF USE286 EQ TRUE\r
+ P286\r
+ENDIF\r
+\r
+IF USE386 EQ TRUE\r
+ P386\r
+ USE286 = TRUE\r
+ENDIF\r
+\r
+MXVERSION EQU 0128h ; Library version (1.40)\r
+\r
+;------------------------------------------------------------\r
+;\r
+; VGA definitions\r
+;\r
+MISC EQU 3C2h ; Miscellaneous output\r
+TS EQU 3C4h ; Timing Sequencer index register\r
+GDC EQU 3CEh ; Graphics Data Controller index register\r
+CRTC EQU 3D4h ; CRTC index register\r
+STATUS EQU 3DAh ; Input Status register one\r
+\r
+;------------------------------------------------------------\r
+;\r
+; Raster operators\r
+;\r
+OP_SET EQU 0\r
+OP_MOVE EQU 0 ; Same as OP_SET\r
+OP_AND EQU 1\r
+OP_OR EQU 2\r
+OP_XOR EQU 3\r
+OP_TRANS EQU 4\r
+OP_ADD EQU 5 ; Must be last op\r
+\r
+;------------------------------------------------------------\r
+;\r
+; Polygon fill functions\r
+;\r
+POLYSCANBUFSIZE EQU 4*1024\r
+\r
+;------------------------------------------------------------\r
+; Macro to push registers, variables or flags onto the stack\r
+; Usage: .push "loc16"[,"loc16"...]\r
+; where "loc16" is a 16-bit register, a word-sized variable or the\r
+; keyword "FLAGS".\r
+; Exmpl: .push ax, flags, var1\r
+; .pop ax, flags, var1\r
+;\r
+.push MACRO r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10\r
+ IFNB <r10>\r
+ .ERROR <.PUSH has more than 10 arguments>\r
+ ENDIF\r
+ IRP $reg, <r0, r1, r2, r3, r4, r5, r6, r7, r8, r9>\r
+ IFB <$reg> ;; Is argument blank?\r
+ EXITM ;; Yes, exit\r
+ ELSEIFIDNI <$reg>, <FLAGS> ;; Is argument the keyword "FLAGS"?\r
+ pushf ;; Yes, push flags\r
+ ELSE\r
+ push $reg ;; Push argument\r
+ ENDIF\r
+ ENDM\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+; Macro to pop registers, variables or flags from the stack\r
+; Usage: .pop "loc16"[,"loc16"...]\r
+; where "loc16" is a 16-bit register, a word-sized variable or the\r
+; keyword "FLAGS".\r
+; Exmpl: .push ax, flags, var1\r
+; .pop ax, flags, var1\r
+;\r
+.pop MACRO r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10\r
+ IFNB <r10>\r
+ .ERROR <.POP has more than 10 arguments>\r
+ ENDIF\r
+ IRP $reg, <r9, r8, r7, r6, r5, r4, r3, r2, r1, r0>\r
+ IFNB <$reg> ;; Is argument non-blank?\r
+ IFIDNI <$reg>, <FLAGS> ;; Yes, is it the keyword "FLAGS"?\r
+ popf ;; Yes, pop flags\r
+ ELSE\r
+ pop $reg ;; Pop argument\r
+ ENDIF\r
+ ENDIF\r
+ ENDM\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+.enter MACRO localsize\r
+ IF USE286 EQ TRUE\r
+ enter localsize, 0\r
+ ELSE\r
+ push bp\r
+ mov bp, sp\r
+ sub sp, localsize\r
+ ENDIF\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+.leave MACRO argsize\r
+ IF USE286 EQ TRUE\r
+ leave\r
+ ELSE\r
+ mov sp, bp\r
+ pop bp\r
+ ENDIF\r
+ IFNB <argspace>\r
+ ret argsize\r
+ ELSE\r
+ ret\r
+ ENDIF\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+.shr MACRO arg, count\r
+ IF USE286 EQ TRUE\r
+ shr arg, count\r
+ ELSE\r
+ $temp = count\r
+ WHILE $temp GT 0\r
+ shr arg, 1\r
+ $temp = $temp-1\r
+ ENDM\r
+ ENDIF\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+.shl MACRO arg, count\r
+ IF USE286 EQ TRUE\r
+ shl arg, count\r
+ ELSE\r
+ $temp = count\r
+ WHILE $temp GT 0\r
+ shl arg, 1\r
+ $temp = $temp-1\r
+ ENDM\r
+ ENDIF\r
+ENDM\r
--- /dev/null
+/*\r
+ MODEX.H - C/C++ include file for the MODEX library\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*/\r
+\r
+#ifndef _MODEX_H_ // Avoid nested inclusions\r
+#define _MODEX_H_\r
+\r
+//\r
+// Video modes\r
+//\r
+#define MX_TEXT 0 // 80x25 text\r
+#define MX_320x175 1 // 320x175x256\r
+#define MX_320x200 2 // 320x200x256, 4 pages, aspect 6:5\r
+#define MX_320x240 3 // 320x240x256, 3 pages, aspect 1:1\r
+#define MX_320x350 4 // 320x350x256\r
+#define MX_320x400 5 // 320x400x256, 2 pages\r
+#define MX_320x480 6 // 320x480x256, 1 page\r
+#define MX_360x175 7 // 360x175x256\r
+#define MX_360x200 8 // 360x200x256, 3 pages\r
+#define MX_360x240 9 // 360x240x256, 2 pages\r
+#define MX_360x350 10 // 360x350x256\r
+#define MX_360x400 11 // 360x400x256, 1 page\r
+#define MX_360x480 12 // 360x480x256, 1 page\r
+#define MX_400x600 13 // 400x600x256, 1 page\r
+\r
+//\r
+// Fade effects\r
+//\r
+#define MX_FADEIN 0\r
+#define MX_FADEOUT 1\r
+\r
+//\r
+// Raster ops\r
+//\r
+#define OP_SET 0 // No operator\r
+#define OP_AND 1 // And\r
+#define OP_OR 2 // Or\r
+#define OP_XOR 3 // Xor\r
+#define OP_TRANS 4 // Transparent\r
+#define OP_ADD 5 // Additive\r
+#define OP_MOVE 0 // Alias for OP_SET\r
+\r
+//\r
+// Temporary definitions\r
+//\r
+#define MXBYTE unsigned char\r
+#define MXBOOL short int\r
+#define MXSINT short int\r
+#define MXUINT unsigned short int\r
+#define MXAPI far pascal\r
+#define MXPTR void far *\r
+\r
+// Functions\r
+\r
+#ifdef __cplusplus // Avoid C++ name mangling\r
+extern "C" {\r
+#endif\r
+\r
+//\r
+// Initialization\r
+//\r
+MXSINT MXAPI mxInit( void ); // Returns 0 if successful\r
+void MXAPI mxTerm( void );\r
+MXUINT MXAPI mxGetVersion( void );\r
+//\r
+// Mode setting\r
+//\r
+void MXAPI mxChangeMode( MXUINT mode );\r
+void MXAPI mxSetMode( MXUINT mode );\r
+void MXAPI mxGetAspect( MXUINT far *aspectx, MXUINT far *aspecty );\r
+void MXAPI mxGetScreenSize( MXUINT far *width, MXUINT far *height );\r
+//\r
+// Hardware support\r
+//\r
+void MXAPI mxWriteMode( MXBYTE wm );\r
+void MXAPI mxSplitScreen( MXUINT line );\r
+void MXAPI mxStartAddress( MXUINT sa );\r
+void MXAPI mxStartLine( MXUINT sl );\r
+void MXAPI mxWaitDisplay( void );\r
+void MXAPI mxWaitRetrace( void );\r
+void MXAPI mxWritePlane( MXBYTE wp );\r
+void MXAPI mxReadPlane( MXBYTE rp );\r
+void MXAPI mxRowAddress( MXBYTE ra );\r
+//\r
+// Virtual screen\r
+//\r
+void MXAPI mxGetVirtualScreen( MXUINT far *width, MXUINT far *height );\r
+void MXAPI mxSetVirtualScreen( MXUINT width, MXUINT height );\r
+void MXAPI mxPan( MXUINT x, MXUINT y );\r
+//\r
+// Clipping\r
+//\r
+MXBOOL MXAPI mxGetClip( void );\r
+MXBOOL MXAPI mxGetClipRegion( MXSINT far *x, MXSINT far *y, MXSINT far *w, MXSINT far *h );\r
+MXBOOL MXAPI mxSetClip( MXBOOL );\r
+void MXAPI mxSetClipRegion( MXUINT x, MXUINT y, MXUINT width, MXUINT height );\r
+//\r
+// Graphics\r
+//\r
+void MXAPI mxBitBlt( MXSINT sx, MXSINT sy, MXUINT width, MXUINT height, MXSINT dx, MXSINT dy );\r
+void MXAPI mxFillBox( MXSINT x, MXSINT y, MXUINT width, MXUINT height, MXUINT color, MXUINT op );\r
+MXBYTE MXAPI mxGetPixel( MXSINT x, MXSINT y );\r
+void MXAPI mxPutPixel( MXSINT x, MXSINT y, MXBYTE color );\r
+void MXAPI mxLine( MXSINT x1, MXSINT y1, MXSINT x2, MXSINT y2, MXUINT color, MXUINT op );\r
+void MXAPI mxGetImage( MXPTR img, MXSINT x, MXSINT y, MXUINT width, MXUINT height );\r
+void MXAPI mxPutImage( MXPTR img, MXSINT x, MXSINT y, MXUINT w, MXUINT h, MXUINT op );\r
+void MXAPI mxPutTile( MXPTR tile, MXSINT x, MXSINT y, MXUINT width, MXUINT height );\r
+void MXAPI mxTransPutTile( MXPTR tile, MXSINT x, MXSINT y, MXUINT w, MXUINT h );\r
+void MXAPI mxCircle( MXSINT x, MXSINT y, MXUINT radius, MXBYTE color );\r
+void MXAPI mxStretchImage( MXPTR img, MXSINT x, MXSINT y, MXUINT w, MXUINT h, MXUINT neww, MXUINT newh, MXUINT op );\r
+//\r
+// Palette\r
+//\r
+void MXAPI mxColorToGray( MXPTR source, MXPTR dest, MXUINT count );\r
+void MXAPI mxGammaCorrect( MXPTR source, MXPTR dest, MXUINT count );\r
+void MXAPI mxGetColor( MXUINT index, MXSINT far *r, MXSINT far *g, MXSINT far *b );\r
+void MXAPI mxSetColor( MXUINT index, MXSINT red, MXSINT green, MXSINT blue );\r
+void MXAPI mxGetPalette( MXPTR palette, MXUINT index, MXUINT count );\r
+void MXAPI mxSetPalette( MXPTR palette, MXUINT index, MXUINT count );\r
+void MXAPI mxFadePalette( MXPTR, MXUINT, MXUINT, MXUINT, MXUINT, MXUINT, MXUINT );\r
+void MXAPI mxRotatePalette( MXPTR palette, MXUINT count, MXSINT step );\r
+//\r
+// Text\r
+//\r
+MXSINT MXAPI mxSetFont( MXPTR font, MXUINT charwidth, MXUINT charheight );\r
+void MXAPI mxSetTextColor( MXUINT color, MXUINT op );\r
+void MXAPI mxGetTextStep( MXSINT far *deltax, MXSINT far *deltay );\r
+void MXAPI mxSetTextStep( MXSINT deltax, MXSINT deltay );\r
+void MXAPI mxOutChar( MXSINT x, MXSINT y, char c );\r
+void MXAPI mxOutText( MXSINT x, MXSINT y, char far *sz );\r
+//\r
+// Convex polygons\r
+//\r
+void MXAPI mxFillPoly( MXUINT, MXPTR, MXPTR, MXUINT, MXUINT );\r
+void MXAPI mxGouraudPoly( MXUINT, MXPTR, MXPTR, MXPTR, MXUINT, MXUINT );\r
+void MXAPI mxTexturePoly( MXUINT, MXPTR, MXPTR, MXPTR, MXPTR, MXUINT, MXUINT );\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+//\r
+// Remove temporary defines\r
+//\r
+#undef MXBYTE\r
+#undef MXBOOL\r
+#undef MXSINT\r
+#undef MXUINT\r
+#undef MXPTR\r
+#undef MXAPI\r
+\r
+#endif // _MODEX_H_\r
--- /dev/null
++-MXBB.OBJ &\r
++-MXCC.OBJ &\r
++-MXCG.OBJ &\r
++-MXCL.OBJ &\r
++-MXCR.OBJ &\r
++-MXFB.OBJ &\r
++-MXFP.OBJ &\r
++-MXGC.OBJ &\r
++-MXGI.OBJ &\r
++-MXGM.OBJ &\r
++-MXGP.OBJ &\r
++-MXGV.OBJ &\r
++-MXHL.OBJ &\r
++-MXIT.OBJ &\r
++-MXLL.OBJ &\r
++-MXLN.OBJ &\r
++-MXOT.OBJ &\r
++-MXPB.OBJ &\r
++-MXPF.OBJ &\r
++-MXPG.OBJ &\r
++-MXPI.OBJ &\r
++-MXPN.OBJ &\r
++-MXPP.OBJ &\r
++-MXRA.OBJ &\r
++-MXRP.OBJ &\r
++-MXSA.OBJ &\r
++-MXSC.OBJ &\r
++-MXSI.OBJ &\r
++-MXSL.OBJ &\r
++-MXSM.OBJ &\r
++-MXSP.OBJ &\r
++-MXSS.OBJ &\r
++-MXTL.OBJ &\r
++-MXVS.OBJ &\r
++-MXWD.OBJ &\r
++-MXWM.OBJ &\r
++-MXWP.OBJ &\r
++-MXWR.OBJ\r
--- /dev/null
+(*\r
+ Turbo Pascal interface to the MODEX library\r
+ Copyright (c) 1993,1994 by Alessandro Scotti\r
+*)\r
+unit ModeX;\r
+interface\r
+\r
+const\r
+ (* Video modes *)\r
+ MX_TEXT = 0;\r
+ MX_320x175 = 1;\r
+ MX_320x200 = 2;\r
+ MX_320x240 = 3;\r
+ MX_320x350 = 4;\r
+ MX_320x400 = 5;\r
+ MX_320x480 = 6;\r
+ MX_360x175 = 7;\r
+ MX_360x200 = 8;\r
+ MX_360x240 = 9;\r
+ MX_360x350 = 10;\r
+ MX_360x400 = 11;\r
+ MX_360x480 = 12;\r
+ MX_400x600 = 13;\r
+\r
+ (* Fade effects *)\r
+ MX_FADEIN = 0;\r
+ MX_FADEOUT = 1;\r
+\r
+ (* Raster ops *)\r
+ OP_SET = 0;\r
+ OP_AND = 1;\r
+ OP_OR = 2;\r
+ OP_XOR = 3;\r
+ OP_TRANS = 4;\r
+ OP_ADD = 5;\r
+ OP_MOVE = 0; (* Alias for OP_SET *)\r
+\r
+procedure mxBitBlt( SX, SY: integer; Width, Height: word; DX, DY: integer );\r
+procedure mxCircle( CX, CY: integer; Radius: word; Color: byte );\r
+procedure mxChangeMode( Mode: word );\r
+procedure mxColorToGray( ColorPalette, GrayPalette: pointer; Count: word );\r
+procedure mxFadePalette( Palette: pointer; Cmd, Start, Count, R, G, B: word );\r
+procedure mxFillBox( X, Y: integer; Width, Height: word; Color: byte; Op: word );\r
+procedure mxGammaCorrect( ColorPalette, GammaPalette: pointer; Count: word );\r
+procedure mxGetAspect( var AspectX, AspectY: word );\r
+function mxGetClipRegion( var X1, Y1, Width, Height: word ): boolean;\r
+function mxGetClip: boolean;\r
+procedure mxGetImage( Image: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxGetPalette( Palette: pointer; Start, Count: word );\r
+function mxGetPixel( X, Y: word ): byte;\r
+procedure mxGetScreenSize( var Width, Height: word );\r
+procedure mxGetTextStep( var DeltaX, DeltaY: integer );\r
+function mxGetVersion: word;\r
+procedure mxGetVirtualScreen( var Width, Height: word );\r
+procedure mxInit;\r
+procedure mxLine( X1, Y1, X2, Y2: integer; Color, Op: word );\r
+procedure mxOutChar( X, Y: integer; C: char );\r
+procedure mxOutText( X, Y: integer; S: pointer );\r
+procedure mxPan( X, Y: word );\r
+procedure mxPutImage( Image: pointer; X, Y: integer; Width, Height, Op: word );\r
+procedure mxPutPixel( X, Y: word; C: byte );\r
+procedure mxPutTile( Tile: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxReadPlane( Plane: byte );\r
+procedure mxRotatePalette( Palette: pointer; Count: word; Step: integer );\r
+procedure mxRowAddress( RowAddress: byte );\r
+function mxSetClip( Clip: boolean ): boolean;\r
+procedure mxSetClipRegion( X1, Y1, Width, Height: word );\r
+procedure mxSetColor( Index, R, G, B: word );\r
+procedure mxSetFont( Font: pointer; Width, Height: word );\r
+procedure mxSetMode( Mode: word );\r
+procedure mxSetPalette( Palette: pointer; Start, Count: word );\r
+procedure mxSetTextColor( Color, Op: word );\r
+procedure mxSetTextStep( DeltaX, DeltaY: integer );\r
+procedure mxSetVirtualScreen( Width, Height: word );\r
+procedure mxStretchImage( Image: pointer; X, Y: integer; Width, Height, NewWidth, NewHeight, Op: word );\r
+procedure mxSplitScreen( Line: word );\r
+procedure mxStartAddress( StartAddress: word );\r
+procedure mxStartLine( Line: word );\r
+procedure mxTerm;\r
+procedure mxTransPutTile( Tile: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxWaitDisplay;\r
+procedure mxWaitRetrace;\r
+procedure mxWriteMode( Mode: byte );\r
+procedure mxWritePlane( Plane: byte );\r
+\r
+procedure mxFillPoly( Count: word; var Map, Points; Color: word );\r
+procedure mxGouraudPoly( Count: word; var Map, Points, Colors; BaseColor: word );\r
+procedure mxTexturePoly( Count: word; var Map, Points, ImgPoints, Texture; Width: word );\r
+\r
+procedure mxOutStr( X, Y: integer; S: string );\r
+\r
+implementation\r
+\r
+procedure mxBitBlt; external;\r
+procedure mxChangeMode( Mode: word ); external;\r
+procedure mxCircle; external;\r
+procedure mxColorToGray; external;\r
+procedure mxFadePalette; external;\r
+procedure mxFillBox; external;\r
+procedure mxGammaCorrect; external;\r
+procedure mxGetAspect( var AspectX, AspectY: word ); external;\r
+function mxGetClipRegion; external;\r
+function mxGetClip: boolean; external;\r
+procedure mxGetImage; external;\r
+procedure mxGetPalette( Palette: pointer; Start, Count: word ); external;\r
+function mxGetPixel( X, Y: word ): byte; external;\r
+procedure mxGetScreenSize( var Width, Height: word ); external;\r
+procedure mxGetTextStep( var DeltaX, DeltaY: integer ); external;\r
+function mxGetVersion: word; external;\r
+procedure mxGetVirtualScreen( var Width, Height: word ); external;\r
+procedure mxInit; external;\r
+procedure mxLine( X1, Y1, X2, Y2: integer; Color, Op: word ); external;\r
+procedure mxOutChar( X, Y: integer; C: char ); external;\r
+procedure mxOutText( X, Y: integer; S: pointer ); external;\r
+procedure mxPan( X, Y: word ); external;\r
+procedure mxPutImage; external;\r
+procedure mxPutPixel( X, Y: word; C: byte ); external;\r
+procedure mxPutTile; external;\r
+procedure mxReadPlane( Plane: byte ); external;\r
+procedure mxRotatePalette; external;\r
+procedure mxRowAddress( RowAddress: byte ); external;\r
+function mxSetClip( Clip: boolean ): boolean; external;\r
+procedure mxSetClipRegion( X1, Y1, Width, Height: word ); external;\r
+procedure mxSetColor( Index, R, G, B: word ); external;\r
+procedure mxSetFont( Font: pointer; Width, Height: word ); external;\r
+procedure mxSetMode( Mode: word ); external;\r
+procedure mxSetPalette( Palette: pointer; Start, Count: word ); external;\r
+procedure mxSetTextColor( Color, Op: word ); external;\r
+procedure mxSetTextStep( DeltaX, DeltaY: integer ); external;\r
+procedure mxSetVirtualScreen( Width, Height: word ); external;\r
+procedure mxSplitScreen( Line: word ); external;\r
+procedure mxStartAddress( StartAddress: word ); external;\r
+procedure mxStartLine; external;\r
+procedure mxStretchImage; external;\r
+procedure mxTerm; external;\r
+procedure mxTransPutTile; external;\r
+procedure mxWaitDisplay; external;\r
+procedure mxWaitRetrace; external;\r
+procedure mxWriteMode( Mode: byte ); external;\r
+procedure mxWritePlane( Plane: byte ); external;\r
+\r
+procedure mxFillPoly; external;\r
+procedure mxGouraudPoly; external;\r
+procedure mxTexturePoly; external;\r
+{$L MXPB}\r
+{$L MXPF}\r
+{$L MXPG}\r
+{$L MXPT}\r
+\r
+{$L MXBB}\r
+{$L MXCC}\r
+{$L MXCG}\r
+{$L MXCL}\r
+{$L MXCR}\r
+{$L MXFB}\r
+{$L MXFP}\r
+{$L MXGI}\r
+{$L MXGM}\r
+{$L MXGP}\r
+{$L MXGV}\r
+{$L MXHL}\r
+{$L MXIT}\r
+{$L MXLN}\r
+{$L MXOT}\r
+{$L MXPI}\r
+{$L MXPN}\r
+{$L MXPP}\r
+{$L MXRA}\r
+{$L MXRP}\r
+{$L MXSA}\r
+{$L MXSC}\r
+{$L MXSI}\r
+{$L MXSL}\r
+{$L MXSM}\r
+{$L MXSP}\r
+{$L MXSS}\r
+{$L MXTL}\r
+{$L MXVS}\r
+{$L MXWD}\r
+{$L MXWM}\r
+{$L MXWP}\r
+{$L MXWR}\r
+\r
+(*\r
+ Prints a Turbo Pascal string.\r
+ Note: BP 7.0 supports ASCIIZ strings (PChar type).\r
+*)\r
+procedure mxOutStr;\r
+begin\r
+ S := S + #0;\r
+ mxOutText( X, Y, @S[1] );\r
+end;\r
+\r
+end.\r
--- /dev/null
+(*\r
+ DEMO01 - Sprites, page flipping and palette rotation\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ MAX_SPRITE = 100;\r
+type\r
+ (* Sprite structure *)\r
+ TSprite = record\r
+ X, Y : integer; (* Sprite coordinates *)\r
+ DX,DY: integer; (* Deltas for sprite movement *)\r
+ W, H : integer; (* Sprite width and height *)\r
+ Image: array[ 1..16, 1..16 ] of byte; (* Sprite image data *)\r
+ end;\r
+ (* RGB color structure *)\r
+ TRgb = record\r
+ R, G, B: byte;\r
+ end;\r
+var\r
+ S : array[ 1..MAX_SPRITE ] of TSprite; (* An array of sprites *)\r
+ Palette: array[ byte ] of TRgb; (* Palette *)\r
+ Page : word; (* Page offset *)\r
+ I : word;\r
+\r
+(* Initializes a sprite structure *)\r
+procedure sxInit( var S: TSprite );\r
+var\r
+ I: word;\r
+begin\r
+ S.X := Random( 320 ); (* Initialize position with random values *)\r
+ S.Y := Random( 240 );\r
+ S.DX := Random( 7 )-3; (* Initialize speed with random values *)\r
+ S.DY := Random( 7 )-3;\r
+ S.W := 16; (* Size is fixed in this program *)\r
+ S.H := 16;\r
+ (* The image is a square with a hole inside *)\r
+ FillChar( S.Image, SizeOf(S.Image), Random(15)+1 );\r
+ for I:=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 );\r
+end;\r
+\r
+(* Moves a sprite *)\r
+procedure sxMove( var S: TSprite );\r
+begin\r
+ Inc( S.X, S.DX ); (* Get new position *)\r
+ Inc( S.Y, S.DY );\r
+ (* Check sprite position, change delta if needed *)\r
+ if( S.X > 320 ) then begin\r
+ S.X := 320;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.X < -16 ) then begin\r
+ S.X := -16;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.Y > 240 ) then begin\r
+ S.Y := 240;\r
+ S.DY := -S.DY;\r
+ end;\r
+ if( S.Y < -16 ) then begin\r
+ S.Y := -16;\r
+ S.DY := -S.DY;\r
+ end;\r
+ (* Draw the sprite, note the Page offset added to the *)\r
+ (* Y coordinate of the image *)\r
+ mxPutImage( @S.Image, S.X, Page+S.Y, S.W, S.H, OP_TRANS );\r
+end;\r
+\r
+begin\r
+ (* Initialize library *)\r
+ mxInit;\r
+\r
+ (* Enter graphics mode *)\r
+ mxSetMode( MX_320x240 );\r
+\r
+ (* Print initialization message *)\r
+ mxSetTextColor( 15, OP_TRANS );\r
+ mxOutStr( 4, 4, 'Initializing...' );\r
+\r
+ (* Initialize sprites *)\r
+ for I:=1 to MAX_SPRITE do sxInit( S[I] );\r
+\r
+ (* Draw background *)\r
+ for I:=1 to 192 do begin\r
+ mxCircle( 160, 480+120, I, I+63 );\r
+ mxCircle( 161, 480+120, I, I+63 );\r
+ end;\r
+\r
+ (* Compute and set palette *)\r
+ for I:=1 to 192 do with Palette[I+63] do begin\r
+ R := 0;\r
+ G := 0;\r
+ B := 0;\r
+ if( I < 64 ) then\r
+ R := I shr 1+31\r
+ else if( I < 128 ) then\r
+ G := (I-64) shr 1+31\r
+ else\r
+ B := (I-128) shr 1+31;\r
+ end;\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+\r
+ (* Main loop *)\r
+ Page := 240;\r
+ while( not KeyPressed ) do begin\r
+ (* Set clip region to current page *)\r
+ mxSetClipRegion( 0, Page, 320, 240 );\r
+ mxSetClip( TRUE );\r
+ (* Restore background *)\r
+ mxBitBlt( 0, 480, 320, 240, 0, Page );\r
+ (* Draw sprites *)\r
+ for I:=1 to MAX_SPRITE do sxMove( S[I] );\r
+ (* Print message *)\r
+ mxOutStr( 4, Page+4, 'Some sprites moving...' );\r
+ (* Flip page *)\r
+ mxStartLine( Page );\r
+ Page := 240-Page;\r
+ (* Animate palette *)\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+ mxRotatePalette( @Palette[64], 192, 3 );\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO02 - Texture mapping and palette rotation\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Plasma, Threed;\r
+\r
+const\r
+ LSIZE = 85;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ TTexture = record\r
+ Desc : array[ 0..3 ] of T2DPoint;\r
+ Width : word;\r
+ Data : array[ 1..64*64 ] of byte;\r
+ end;\r
+ TQuad = record\r
+ VtxCnt : word;\r
+ Vtx : array[ 0..3 ] of word;\r
+ Texture: word;\r
+ end;\r
+var\r
+ Vtx : array[ 0..7 ] of TPoint;\r
+ XVtx : array[ 0..7 ] of TPoint;\r
+ VVtx : array[ 0..7 ] of T2DPoint;\r
+ Face : array[ 0..5 ] of TQuad;\r
+ Txts : array[ 0..5 ] of TTexture;\r
+ Nrm : array[ 0..5 ] of TPoint;\r
+ XNrm : array[ 0..5 ] of TPoint;\r
+ Page : word;\r
+ Palette: array[ byte ] of record R, G, B: byte; end;\r
+\r
+(* Make a 64x64 plasma to be used as texture *)\r
+procedure MakeTexture( Idx: word );\r
+var\r
+ I: word;\r
+begin\r
+ mxFillBox( 0, 0, 64, 64, 0, OP_SET );\r
+ MakePlasma( 0, 0, 64, 64, 96, Random(192)+1, Random(192)+1, Random(192)+1 );\r
+ mxGetImage( @Txts[Idx].Data, 0, 0, 64, 64 );\r
+ (* Texture vertexes are 8:8 fixed, add $80 (0.5) for best results *)\r
+ with Txts[Idx] do begin\r
+ Desc[0].X := $80; Desc[0].Y := $80;\r
+ Desc[1].X := $80; Desc[1].Y := $3F80;\r
+ Desc[2].X := $3F80; Desc[2].Y := $3F80;\r
+ Desc[3].X := $3F80; Desc[3].Y := $80;\r
+ Width := 64;\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ I: integer;\r
+begin\r
+ (* Build vertexes for a cube *)\r
+ with Vtx[0] do begin X:=-LSIZE; Y:=-LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[1] do begin X:=+LSIZE; Y:=-LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[2] do begin X:=-LSIZE; Y:=+LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[3] do begin X:=+LSIZE; Y:=+LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[4] do begin X:=-LSIZE; Y:=-LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[5] do begin X:=+LSIZE; Y:=-LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[6] do begin X:=-LSIZE; Y:=+LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[7] do begin X:=+LSIZE; Y:=+LSIZE; Z:=+LSIZE; end;\r
+ for I:=0 to 7 do begin (* Make points 16:16 fixed *)\r
+ Vtx[I].X := Vtx[I].X*$10000;\r
+ Vtx[I].Y := Vtx[I].Y*$10000;\r
+ Vtx[I].Z := Vtx[I].Z*$10000;\r
+ end;\r
+ (* Build faces *)\r
+ with Face[0] do begin Vtx[0]:=0; Vtx[1]:=2; Vtx[2]:=3; Vtx[3]:=1; end;\r
+ with Face[1] do begin Vtx[0]:=4; Vtx[1]:=5; Vtx[2]:=7; Vtx[3]:=6; end;\r
+ with Face[2] do begin Vtx[0]:=0; Vtx[1]:=1; Vtx[2]:=5; Vtx[3]:=4; end;\r
+ with Face[3] do begin Vtx[0]:=1; Vtx[1]:=3; Vtx[2]:=7; Vtx[3]:=5; end;\r
+ with Face[4] do begin Vtx[0]:=2; Vtx[1]:=0; Vtx[2]:=4; Vtx[3]:=6; end;\r
+ with Face[5] do begin Vtx[0]:=7; Vtx[1]:=3; Vtx[2]:=2; Vtx[3]:=6; end;\r
+ for I:=0 to 5 do Face[I].Texture := I;\r
+ (* Build textures and palette *)\r
+ Randomize;\r
+ FillChar( Palette, SizeOf(Palette), 0 );\r
+ MakePlasmaPalette( Palette, PAL_RGB );\r
+ mxSetPalette( @Palette, 0, 193 );\r
+ for I:=0 to 5 do MakeTexture( I );\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, 8 ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, 8, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 1 );\r
+ Inc( AZ, 2 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ mxRotatePalette( @Palette[1], 192, 3 ); (* Rotate palette *)\r
+ (* Draw cube: backface culling is straighforward in this case, so *)\r
+ (* it can be handled by the polygon filling procedure *)\r
+ for I:=0 to 5 do\r
+ mxTexturePoly( 4, Face[I].Vtx, VVtx, Txts[I].Desc, Txts[I].Data, Txts[I].Width );\r
+ mxStartLine( Page ); (* Flip pages *)\r
+ mxSetPalette( @Palette[1], 1, 192 ); (* Set new palette *)\r
+ Page := 240-Page;\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO03 - Simple star animation, morphs between a cube and a sphere\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+const\r
+ MAXVTX = 1000; (* Number of points *)\r
+ EDGE = 70; (* Length of cube edge *)\r
+ RADIUS = 90; (* Radius of sphere *)\r
+ WAITCOUNT = 192; (* Frames to wait for non-morphing shapes *)\r
+ MS = 32; (* Number of steps for morphing *)\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+ InitMorph1: array[ 0..3 ] of integer = ( 0, MS, 0, 0 );\r
+ InitMorph2: array[ 0..3 ] of integer = ( 0, 0, 0, MS );\r
+ InitDelta1: array[ 0..3 ] of integer = ( 0, -1, 0, +1 );\r
+ InitDelta2: array[ 0..3 ] of integer = ( 0, +1, 0, -1 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ T3DPointArray = array[ 0..MAXVTX-1 ] of TPoint;\r
+ P3DPointArray = ^T3DPointArray;\r
+var\r
+ CubeVtx, SphereVtx, Vtx, XVtx: P3DPointArray;\r
+ VVtx : array[ 0..MAXVTX-1 ] of T2DPoint;\r
+ Page : word;\r
+ Status, Count, Delta1, Delta2, Morph1, Morph2: integer;\r
+\r
+procedure Swap( var A, B: longint );\r
+var\r
+ L: longint;\r
+begin\r
+ L := A; A := B; B := L;\r
+end;\r
+\r
+function Toggle( A: longint ): longint;\r
+begin\r
+ Toggle := A;\r
+ if( Random(2) = 0 ) then Toggle := -A;\r
+end;\r
+\r
+procedure Init;\r
+label Retry;\r
+var\r
+ I: integer;\r
+begin\r
+ New( CubeVtx );\r
+ New( SphereVtx );\r
+ New( Vtx );\r
+ New( XVtx );\r
+ (* Build vertexes (yes, I know this piece of code is terrible) *)\r
+ Randomize;\r
+ for I:=0 to MAXVTX-1 do begin\r
+ with CubeVtx^[I] do begin\r
+ (* Build cube *)\r
+ X := (longint(Random(2*EDGE))-EDGE)*$10000;\r
+ Y := (longint(Random(2*EDGE))-EDGE)*$10000;\r
+ Z := Toggle( EDGE*$10000 );\r
+ case Random(3) of\r
+ 0: Swap( X, Z );\r
+ 1: Swap( Y, Z );\r
+ end;\r
+ end;\r
+ with SphereVtx^[I] do begin\r
+ (* Build sphere *)\r
+Retry:\r
+ X := (longint(Random(2*RADIUS))-RADIUS);\r
+ Y := (longint(Random(2*RADIUS))-RADIUS);\r
+ if( X*X+Y*Y > RADIUS*RADIUS ) then goto Retry;\r
+ Z := Toggle( Round( Sqrt( Abs( RADIUS*RADIUS-X*X-Y*Y ) ) ) );\r
+ case Random(3) of\r
+ 0: Swap( X, Z );\r
+ 1: Swap( Y, Z );\r
+ end;\r
+ X := X * $10000; Y := Y * $10000; Z := Z * $10000;\r
+ end;\r
+ end;\r
+ (* Initialize morphing *)\r
+ Move( CubeVtx^, Vtx^, SizeOf(Vtx^) );\r
+ Status := 0;\r
+ Count := WAITCOUNT;\r
+end;\r
+\r
+procedure Morph;\r
+var\r
+ I: integer;\r
+begin\r
+ (* Fully unoptimized, slowest loop I could think of! *)\r
+ for I:=0 to MAXVTX-1 do begin\r
+ Vtx^[I].X := ((CubeVtx^[I].X * Morph1)+(SphereVtx^[I].X * Morph2)) div MS;\r
+ Vtx^[I].Y := ((CubeVtx^[I].Y * Morph1)+(SphereVtx^[I].Y * Morph2)) div MS;\r
+ Vtx^[I].Z := ((CubeVtx^[I].Z * Morph1)+(SphereVtx^[I].Z * Morph2)) div MS;\r
+ end;\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+ C: char;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ C := #0;\r
+ repeat\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx^, XVtx^, MAXVTX ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx^, VVtx, MAXVTX, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 1 );\r
+ Inc( AZ, 2 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw points *)\r
+ for I:=0 to MAXVTX-1 do\r
+ mxPutPixel( VVtx[I].X, VVtx[I].Y, 128 + XVtx^[I].Z shr 18 );\r
+ mxStartLine( Page ); (* Flip pages *)\r
+ Page := 240-Page;\r
+ (* Morph *)\r
+ if( Odd(Status) ) then begin\r
+ Morph;\r
+ Inc( Morph1, Delta1 );\r
+ Inc( Morph2, Delta2 );\r
+ if( Morph1 < 0 )or( Morph2 < 0 ) then Inc( Status );\r
+ if( Status = 4 ) then Status := 0;\r
+ end\r
+ else begin\r
+ Dec( Count );\r
+ if( Count < 0 ) then begin\r
+ Inc( Status );\r
+ Count := WAITCOUNT;\r
+ Morph1 := InitMorph1[Status];\r
+ Morph2 := InitMorph2[Status];\r
+ Delta1 := InitDelta1[Status];\r
+ Delta2 := InitDelta2[Status];\r
+ end;\r
+ end;\r
+ until( KeyPressed );\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO04 - Multiple textures and triple buffering (3 pages)\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+const\r
+ MAXVTX = 256;\r
+ MAXCUB = 2;\r
+ MAXTXT = 2;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+ TxtSunDial: array[ 0..7 ] of word = (\r
+ $7F80,$0080, $0080,$0080, $0080,$7E80, $7F80,$7E80 );\r
+ TxtSapphire : array[ 0..7 ] of word = (\r
+ $0080,$0080, $0080,$1F80, $1F80,$1F80, $1F80,$0080 );\r
+ TxtMarble: array[ 0..7 ] of word = (\r
+ $0080,$8080, $0080,$FD80, $7F80,$FD80, $7F80,$8080 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ TTexture = record\r
+ Desc : array[ 0..3 ] of record X, Y: word end;\r
+ Width : word;\r
+ Data : pointer;\r
+ end;\r
+ TQuad = record\r
+ Vtx : array[ 0..3 ] of word;\r
+ Texture: word;\r
+ end;\r
+ TCube = record\r
+ Face : array[ 0..5 ] of TQuad;\r
+ Base : integer;\r
+ end;\r
+var\r
+ Vtx, XVtx: array[ 0..MAXVTX ] of TPoint;\r
+ VVtx : array[ 0..MAXVTX ] of T2DPoint;\r
+ Cube : array[ 0..MAXCUB ] of TCube;\r
+ ZList : array[ 0..MAXCUB ] of integer;\r
+ VtxCnt : word;\r
+ Txts : array[ 0..MAXTXT ] of TTexture;\r
+ Page : word;\r
+ Palette : array[ byte ] of record R, G, B: byte; end;\r
+ TxtDat1, TxtDat2: pointer;\r
+\r
+(* Add a new entry to the vertex array *)\r
+procedure AddVtx( PX, PY, PZ: longint );\r
+begin\r
+ with Vtx[VtxCnt] do begin X:=PX*$10000; Y:=PY*$10000; Z:=PZ*$10000; end;\r
+ Inc( VtxCnt );\r
+end;\r
+\r
+procedure MakeCube( var C: TCube; X1,Y1,Z1, X2,Y2,Z2, TX,TY,TZ, Texture: integer );\r
+const\r
+ FaceIdx: array[ 0..23 ] of integer = (\r
+ 0,1,2,3, 0,4,5,1, 1,5,6,2, 2,6,7,3, 3,7,4,0, 6,5,4,7 );\r
+var\r
+ I, VC: integer;\r
+begin\r
+ VC := VtxCnt;\r
+ C.Base := VC;\r
+ AddVtx( X1+TX, Y1+TY, Z1+TZ );\r
+ AddVtx( X2+TX, Y1+TY, Z1+TZ );\r
+ AddVtx( X2+TX, Y2+TY, Z1+TZ );\r
+ AddVtx( X1+TX, Y2+TY, Z1+TZ );\r
+ AddVtx( X1+TX, Y1+TY, Z2+TZ );\r
+ AddVtx( X2+TX, Y1+TY, Z2+TZ );\r
+ AddVtx( X2+TX, Y2+TY, Z2+TZ );\r
+ AddVtx( X1+TX, Y2+TY, Z2+TZ );\r
+ for I:=0 to 23 do C.Face[I shr 2].Vtx[I and 3] := VC+FaceIdx[I];\r
+ for I:=0 to 5 do C.Face[I].Texture := Texture;\r
+end;\r
+\r
+procedure MakeTexture( Idx: integer; var VtxData );\r
+var\r
+ P: ^word;\r
+ I: integer;\r
+begin\r
+ P := @VtxData;\r
+ with Txts[Idx] do begin\r
+ for I:=0 to 3 do begin\r
+ Desc[I].X := P^; Inc( P );\r
+ Desc[I].Y := P^; Inc( P );\r
+ end;\r
+ Width := 129;\r
+ Data := TxtDat1;\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ I: integer;\r
+ V: integer;\r
+ F: file;\r
+ P: array[ 1..768 ] of byte;\r
+begin\r
+ (* Initialize objects *)\r
+ VtxCnt := 0;\r
+ MakeCube( Cube[0], -64,-64,8, 64,64,-8, 0,0,0, 1 ); (* Sundial *)\r
+ Cube[0].Face[0].Texture := 0;\r
+ V := VtxCnt;\r
+ MakeCube( Cube[1], -16,-16,16, 16,16,-16, 0,0,0, 2 ); (* Sapphire *)\r
+ tdSetTranslation( Trans );\r
+ tdSetRotation( 32, 32, 00 );\r
+ tdRotate( Vtx[V], XVtx[V], 8 ); (* Got to rotate this cube *)\r
+ for I:=V to V+7 do begin\r
+ Vtx[I].X := XVtx[I].X;\r
+ Vtx[I].Y := XVtx[I].Y;\r
+ Vtx[I].Z := XVtx[I].Z + 100*$10000;\r
+ end;\r
+ MakeCube( Cube[2], -64,-4,48, 64,4,-48, 0,68,56, 1 ); (* Marble *)\r
+ (* Load texture and palette *)\r
+ Assign( F, 'DEMO04.DAT' );\r
+ Reset( F, 1 );\r
+ BlockRead( F, P, SizeOf(P) );\r
+ mxSetPalette( @P, 0, 256 );\r
+ GetMem( TxtDat1, 63*1024 );\r
+ BlockRead( F, TxtDat1^, 129*286 );\r
+ Close( F );\r
+ TxtDat2 := Ptr( Seg(TxtDat1^), Ofs(TxtDat1^)+129*254 );\r
+ (* Init textures *)\r
+ MakeTexture( 0, TxtSundial );\r
+ MakeTexture( 1, TxtMarble );\r
+ MakeTexture( 2, TxtSapphire );\r
+ Txts[2].Data := TxtDat2;\r
+end;\r
+\r
+(* Sort procedure, not worth optimizing with only a few objects *)\r
+procedure SortObjects;\r
+var\r
+ I, J, K: integer;\r
+ ZMax: array[ 0..MAXCUB ] of longint;\r
+ ZI: integer;\r
+ L: longint;\r
+begin\r
+ for I:=0 to MAXCUB do begin\r
+ L := XVtx[Cube[I].Base].Z;\r
+ for J:=1 to 7 do\r
+ if( L > XVtx[Cube[I].Base+J].Z ) then L := XVtx[Cube[I].Base+J].Z;\r
+ ZMax[I] := L;\r
+ ZList[I] := I;\r
+ end;\r
+ for I:=0 to MAXCUB-1 do begin\r
+ ZI := I;\r
+ for J:=I+1 to MAXCUB do\r
+ if( ZMax[ZList[J]] > ZMax[ZList[ZI]] ) then ZI := J;\r
+ if( ZI <> I ) then begin\r
+ K := ZList[I];\r
+ ZList[I] := ZList[ZI];\r
+ ZList[ZI] := K;\r
+ end;\r
+ end;\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I, J, K: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ AX := 0; AY := 0; AZ := 0;\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 600*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, VtxCnt ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, VtxCnt, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 2 );\r
+ Inc( AZ, 1 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw objects *)\r
+ SortObjects;\r
+ for I:=0 to MAXCUB do with Cube[ZList[I]] do begin\r
+ for J:=0 to 5 do begin\r
+ K := Face[J].Texture;\r
+ mxTexturePoly( 4, Face[J].Vtx, VVtx, Txts[K].Desc, Txts[K].Data^, Txts[K].Width );\r
+ end;\r
+ end;\r
+ (* Flip page: at 320x240 the Start Address Register Low is always zero *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 480; end;\r
+ 480: begin PortW[$3D4] := $960C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* If the frame rate seems low, try to remove this line *)\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO05 - A Gouraud-shaded rotating torus\r
+ (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+(* Define ALTPAL for alternate palette *)\r
+{$define ALTPAL}\r
+\r
+const\r
+ MAXVTX1 = 15; RADIUS1 = 70; (* MAXVTX1+1 must be multiple of 4 *)\r
+ MAXVTX2 = 15; RADIUS2 = 30;\r
+ MAXVTX = (MAXVTX1+1)*(MAXVTX2+1)-1;\r
+ MAXFACE = MAXVTX;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 ); (* Object translation *)\r
+ Light : TPoint = ( X:0; Y:0; Z:-63*$10000 ); (* Light direction *)\r
+type\r
+ TQuad = record\r
+ QVtx : array[ 0..3 ] of integer;\r
+ end;\r
+var\r
+ Vtx, XVtx : array[ 0..MAXVTX ] of TPoint; (* Points *)\r
+ VVtx : array[ 0..MAXVTX ] of record X, Y: integer end;\r
+ Face : array[ 0..MAXFACE ] of TQuad; (* Polys *)\r
+ Culled : array[ 0..MAXFACE ] of integer;\r
+ GNrm,XGNrm: array[ 0..MAXVTX ] of TVector; (* Gouraud normals *)\r
+ VtxLight : array[ 0..MAXVTX ] of integer; (* Points brightness *)\r
+ Page : word;\r
+\r
+function GetVtx( I1, I2: integer ): integer;\r
+begin\r
+ GetVtx := (I1 mod (MAXVTX1+1))*(MAXVTX2+1) + I2 mod (MAXVTX2+1);\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ R, N, X, Y, Z: real;\r
+ I, J, K, V: integer;\r
+begin\r
+ (* Build vertexes *)\r
+ for I:=0 to MAXVTX1 do begin\r
+ K := (I + (MAXVTX1+1) shr 2) mod (MAXVTX1+1);\r
+ R := RADIUS1 + RADIUS2*Cos( 2*K*Pi / (MAXVTX1+1) );\r
+ for J:=0 to MAXVTX2 do begin\r
+ V := I*(MAXVTX2+1)+J; (* Index of current vertex *)\r
+ (* Compute coordinates of current vertex *)\r
+ X := R*Cos(2*J*Pi / (MAXVTX2+1)); (* Get coordinates *)\r
+ Y := R*Sin(2*J*Pi / (MAXVTX2+1));\r
+ Z := RADIUS2*Sin(2*K*Pi / (MAXVTX1+1));\r
+ Vtx[V].X := Round( X )*$10000; (* Save coordinates *)\r
+ Vtx[V].Y := Round( Y )*$10000;\r
+ Vtx[V].Z := Round( Z )*$10000;\r
+ (* Compute direction of Gouraud normal thru current vertex *)\r
+ X := X - RADIUS1*Cos(2*J*Pi / (MAXVTX2+1));\r
+ Y := Y - RADIUS1*Sin(2*J*Pi / (MAXVTX2+1));\r
+ N := Sqrt( X*X + Y*Y + Z*Z ); (* Get vector length *)\r
+ GNrm[V].X := Trunc( X*$10000/N ); (* Save normal vector *)\r
+ GNrm[V].Y := Trunc( Y*$10000/N );\r
+ GNrm[V].Z := Trunc( Z*$10000/N );\r
+ end;\r
+ end;\r
+ (* Generate faces so that depth-sorting is not needed: there are still *)\r
+ (* some *very* little errors, but this is the best I could devise *)\r
+ J := 0;\r
+ K := 0;\r
+ for I:=0 to MAXFACE do with Face[I] do begin\r
+ QVtx[0] := GetVtx( J, K );\r
+ QVtx[1] := GetVtx( J, K+1 );\r
+ QVtx[2] := GetVtx( J+1, K+1 );\r
+ QVtx[3] := GetVtx( J+1, K );\r
+ Inc( K );\r
+ if( K > MAXVTX2 ) then begin\r
+ K := 0;\r
+ Inc( J );\r
+ end;\r
+ end;\r
+{$ifndef ALTPAL}\r
+ for I:=0 to 63 do mxSetColor( I+64, 0, 0, I ); (* Blue palette *)\r
+{$else}\r
+ for I:=0 to 31 do mxSetColor(I+64, 0, I shl 1, 0); (* Green neon palette *)\r
+ for I:=32 to 63 do mxSetColor ( I+64, (I-32) shl 1, 63, (I-32) shl 1 );\r
+{$endif}\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetLight( Light );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, MAXVTX+1 ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, MAXVTX+1, 160, 120+Page );\r
+ tdRotate( GNrm, XGNrm, MAXVTX+1 ); (* Rotate Gouraud normals *)\r
+ tdTransformLight( XGNrm, VtxLight, MAXVTX+1 );\r
+ (* Backplane culling is not really needed here! *)\r
+ FillChar( Culled, SizeOf(Culled), 0 );\r
+ tdBackPlaneCull( Face, XVtx, Culled, MAXFACE+1, SizeOf(TQuad) );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 2 );\r
+ Inc( AZ, 3 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw polygons *)\r
+ for I:=0 to MAXFACE do with Face[I] do\r
+ if( Culled[I] >= 0 ) then mxGouraudPoly( 4, QVtx, VVtx, VtxLight, 64 );\r
+ (* Flip page: at 320x240 the Start Address Register Low is always zero *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 480; end;\r
+ 480: begin PortW[$3D4] := $960C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* Uncomment this instruction if screen flickers *)\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO06 - Magnifying glass\r
+ (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ R = 40; (* Lens radius *)\r
+ K : real = 1.8; (* Magnifying factor, less makes a stronger lens *)\r
+type\r
+ TLine = array[ 0..319 ] of byte;\r
+ PLine = ^TLine;\r
+ TScreen = array[ 0..239 ] of PLine;\r
+var\r
+ VScreen: TScreen; (* Virtual screen *)\r
+ BallX : array[ 0..R, 0..R ] of integer;\r
+ BallY : array[ 0..R, 0..R ] of integer;\r
+ Sprite : array[ -R..R, -R..R ] of byte;\r
+ Page : word;\r
+\r
+(* Returns "lens-view" coordinates of X,Y *)\r
+procedure GetCoords( var X, Y: integer );\r
+var\r
+ LR, Z, SinA, SinB, TgB, Q: real;\r
+begin\r
+ LR := Sqrt( X*X + Y*Y );\r
+ if( LR = 0 ) then Exit;\r
+ if( LR < R ) then begin\r
+ Z := Sqrt( R*R - LR*LR );\r
+ SinA := LR / R;\r
+ SinB := SinA / K;\r
+ TgB := SinB / Sqrt( 1-SinB*SinB );\r
+ Q := LR - TgB*Z;\r
+ X := Round( X * ( Q/LR ) );\r
+ Y := Round( Y * ( Q/LR ) );\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ F : file;\r
+ Palette: array[ 0..767 ] of record R, G, B: byte; end;\r
+ X, Y,\r
+ X2, Y2 : integer;\r
+begin\r
+ (* Load background image *)\r
+ Assign( F, 'demo06.dat' );\r
+ Reset( F, 1 );\r
+ BlockRead( F, Palette, 768 );\r
+ mxSetPalette( @Palette, 0, 256 );\r
+ for Y:=0 to 239 do begin\r
+ New( VScreen[Y] );\r
+ BlockRead( F, VScreen[Y]^, 320 );\r
+ mxPutImage( VScreen[Y], 0, 480+Y, 320, 1, OP_MOVE );\r
+ end;\r
+ Close( F );\r
+ (* Build lens *)\r
+ for X:=0 to R do begin\r
+ for Y:=0 to R do begin\r
+ X2 := X;\r
+ Y2 := Y;\r
+ GetCoords( X2, Y2 );\r
+ BallX[X, Y] := X2;\r
+ BallY[X, Y] := Y2;\r
+ end;\r
+ end;\r
+end;\r
+\r
+procedure PutLens( OX, OY: integer );\r
+var\r
+ X, Y: integer;\r
+begin\r
+ for X:=0 to R do begin\r
+ for Y:=0 to R do begin\r
+ Sprite[Y][X] := VScreen[ OY+BallY[X,Y] ]^[ OX+BallX[X,Y] ];\r
+ Sprite[Y][-X] := VScreen[ OY+BallY[X,Y] ]^[ OX-BallX[X,Y] ];\r
+ Sprite[-Y][X] := VScreen[ OY-BallY[X,Y] ]^[ OX+BallX[X,Y] ];\r
+ Sprite[-Y][-X] := VScreen[ OY-BallY[X,Y] ]^[ OX-BallX[X,Y] ];\r
+ end;\r
+ end;\r
+ (* Draw the sprite *)\r
+ mxPutImage( @Sprite, OX-R, OY-R+Page, 2*R+1, 2*R+1, OP_MOVE );\r
+end;\r
+\r
+function Delta: integer;\r
+begin\r
+ Delta := Random(3)+2;\r
+end;\r
+\r
+procedure Check( Cond: boolean; var Coord, DeltaC: integer; NewCoord, Sign: integer );\r
+begin\r
+ if( Cond ) then begin\r
+ Coord := NewCoord;\r
+ DeltaC := Sign*Delta;\r
+ end;\r
+end;\r
+\r
+var\r
+ X, Y, DX, DY: integer;\r
+ C: char;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240;\r
+ X := R;\r
+ Y := R;\r
+ Randomize;\r
+ DX := Delta;\r
+ DY := Delta;\r
+\r
+ (* Main loop *)\r
+ repeat\r
+ (* Update video *)\r
+ mxBitBlt( 0, 480, 320, 240, 0, Page );\r
+ PutLens( X, Y );\r
+ mxCircle( X, Page+Y, R, 0 );\r
+ (* Update lens coordinates *)\r
+ Inc( X, DX );\r
+ Check( X+R >= 319, X, DX, 319-R, -1 );\r
+ Check( X <= R, X, DX, R, +1 );\r
+ Inc( Y, DY );\r
+ Check( Y+R >= 239, Y, DY, 239-R, -1 );\r
+ Check( Y <= R, Y, DY, R, +1 );\r
+ (* Flip pages: double buffering, avoid wait for display *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* Wait for hidden page to show *)\r
+ until( KeyPressed );\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO07 - Hardware scrolling\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ (* Change this if scrolling seems jerky (this simple program does *)\r
+ (* not handle vertical retrace/display very well) *)\r
+ STEPS = 5;\r
+\r
+procedure Check( Cond: boolean; var Coord, DeltaC: integer; NewCoord, Sign: integer );\r
+begin\r
+ if( Cond ) then begin\r
+ Coord := NewCoord;\r
+ DeltaC := Sign*(Random(3)+2);\r
+ end;\r
+end;\r
+\r
+var\r
+ I, X, Y, DX, DY: integer;\r
+begin\r
+ (* Initialize library and graphics mode *)\r
+ mxInit;\r
+ mxSetMode( MX_320x200 );\r
+ (* Set a 640x400 virtual screen *)\r
+ mxSetVirtualScreen( 640, 400 );\r
+ mxSetClip( TRUE );\r
+\r
+ X := 0;\r
+ Y := 0;\r
+ DX := 1;\r
+ DY := 1;\r
+\r
+ (* Main loop: draw lines, circles, points and rectangles in separate *)\r
+ (* 320x200 windows, while smoothly panning virtual screen *)\r
+ while( not KeyPressed ) do begin\r
+ (* Points *)\r
+ mxSetClipRegion( 0, 0, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxPutPixel( Random(320), Random(200), Random(16) );\r
+ (* Lines *)\r
+ mxSetClipRegion( 0, 200, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxLine( Random(320), Random(200)+200, Random(320), Random(200)+200, Random(16), OP_SET );\r
+ (* Circles *)\r
+ mxSetClipRegion( 320, 0, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxCircle( Random(320)+320, Random(200), Random(100), Random(16) );\r
+ (* Boxes *)\r
+ mxSetClipRegion( 320, 200, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxFillBox( Random(320)+320, Random(200)+200, Random(100)+1, Random(100)+1, Random(16), OP_SET );\r
+ (* Pan *)\r
+ Inc( X, DX );\r
+ Check( X+320 >= 639, X, DX, 319, -1 );\r
+ Check( X < 0, X, DX, 0, +1 );\r
+ Inc( Y, DY );\r
+ Check( Y+200 >= 399, Y, DY, 199, -1 );\r
+ Check( Y < 0, Y, DY, 0, +1 );\r
+ mxPan( X, Y );\r
+ mxWaitRetrace;\r
+ end;\r
+\r
+ (* Shutdown *)\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+;\r
+; MATH.INC - Include file for THREED.ASM\r
+;\r
+\r
+; 3-dimensional point, coordinates in fixed format (16:16)\r
+;\r
+TPOINT STRUC\r
+ X DD ?\r
+ Y DD ?\r
+ Z DD ?\r
+TPOINT ENDS\r
+\r
+; 2-dimensional point, coordinates in integer format\r
+;\r
+TIMAGEPOINT STRUC\r
+ IX DW ?\r
+ IY DW ?\r
+TIMAGEPOINT ENDS\r
+\r
+; Fixed-point divide: EAX = EAX / arg\r
+;\r
+.xdiv MACRO arg\r
+ xor edx, edx\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv arg\r
+ENDM\r
+\r
+; Fixed-point multiply: EAX = EAX * arg\r
+;\r
+.xmul MACRO arg\r
+ imul arg\r
+ shrd eax, edx, 16\r
+ENDM\r
--- /dev/null
+unit Plasma;\r
+interface\r
+\r
+const\r
+ PAL_RGB = 0;\r
+ PAL_CLOUDS = 1;\r
+ PAL_LANDSCAPE = 2;\r
+\r
+procedure MakePlasma( X, Y: integer; W, H: word; C1, C2, C3, C4: byte );\r
+procedure MakePlasmaPalette( var Palette; What: word );\r
+\r
+implementation uses Modex;\r
+\r
+procedure NewColor( XA, YA, X, Y, XB, YB: integer );\r
+var\r
+ Color: longint;\r
+begin\r
+ Color := Abs( XA-XB )+Abs( YA-YB );\r
+ Color := Random( Color shl 1 )-Color;\r
+ Color := (Color+mxGetPixel( XA, YA )+mxGetPixel( XB, YB )+1) shr 1;\r
+ if( Color < 1 ) then Color := 1;\r
+ if( Color > 192 ) then Color := 192;\r
+ if( mxGetPixel( X, Y ) = 0 ) then\r
+ mxPutPixel( X, Y, Lo(Color) );\r
+end;\r
+\r
+procedure Divide( X1, Y1, X2, Y2: integer );\r
+var\r
+ X, Y, Color: integer;\r
+begin\r
+ if not( (X2-X1<2)and(Y2-Y1<2) ) then begin\r
+ X := (X1+X2) shr 1;\r
+ Y := (Y1+Y2) shr 1;\r
+ NewColor( X1, Y1, X, Y1, X2, Y1 );\r
+ NewColor( X2, Y1, X2, Y, X2, Y2 );\r
+ NewColor( X1, Y2, X, Y2, X2, Y2 );\r
+ NewColor( X1, Y1, X1, Y, X1, Y2 );\r
+ Color := (mxGetPixel( X1, Y1 )+mxGetPixel( X2, Y1 )+\r
+ mxGetPixel( X2, Y2 )+mxGetPixel( X1, Y2 )) shr 2;\r
+ mxPutPixel( X, Y, Color );\r
+ Divide( X1, Y1, X, Y );\r
+ Divide( X, Y1, X2, Y );\r
+ Divide( X, Y, X2, Y2 );\r
+ Divide( X1, Y, X, Y2 );\r
+ end;\r
+end;\r
+\r
+procedure MakePlasma;\r
+begin\r
+ Dec( W );\r
+ Dec( H );\r
+ mxPutPixel( X, Y, C1 );\r
+ mxPutPixel( X, Y+H, C2 );\r
+ mxPutPixel( X+W, Y+H, C3 );\r
+ mxPutPixel( X+W, Y, C4 );\r
+ Divide( X, Y, X+W, Y+H );\r
+end;\r
+\r
+procedure MakePlasmaPalette;\r
+type\r
+ TPal = array[ byte ] of record R, G, B: byte end;\r
+var\r
+ I: word;\r
+begin\r
+ FillChar( TPal(Palette)[1], 192*3, 0 );\r
+ case What of\r
+ PAL_CLOUDS:\r
+ for I:=1 to 192 do begin\r
+ TPal(Palette)[I].R := Abs( I-96 )*63 div 96;\r
+ TPal(Palette)[I].G := Abs( I-96 )*63 div 96;\r
+ TPal(Palette)[I].B := 63;\r
+ end;\r
+ PAL_LANDSCAPE:\r
+ begin\r
+ for I:=0 to 31 do begin\r
+ TPal(Palette)[I+1].R := I;\r
+ TPal(Palette)[I+1].G := I;\r
+ TPal(Palette)[I+1].B := I + I shr 1+15;\r
+ end;\r
+ for I:=32 to 63 do begin\r
+ TPal(Palette)[I+1].R := 0;\r
+ TPal(Palette)[I+1].G := I;\r
+ TPal(Palette)[I+1].B := 0;\r
+ end;\r
+ for I:=64 to 191 do begin\r
+ TPal(Palette)[I+1].R := (I-64) div 3 + 15;\r
+ TPal(Palette)[I+1].G := (I-64) div 3 + 15;\r
+ TPal(Palette)[I+1].B := (I-64) div 3 + 15;\r
+ end;\r
+ end;\r
+ else\r
+ for I:=1 to 64 do begin\r
+ TPal(Palette)[I].G := I-1;\r
+ TPal(Palette)[I].B := 64-I;\r
+ TPal(Palette)[I+64].R := I-1;\r
+ TPal(Palette)[I+64].G := 64-I;\r
+ TPal(Palette)[I+128].B := I-1;\r
+ TPal(Palette)[I+128].R := 64-I;\r
+ end;\r
+ end;\r
+end;\r
+\r
+end.
\ No newline at end of file
--- /dev/null
+{$E-,N+}\r
+uses Crt, Modex;\r
+\r
+const\r
+ DEFVERT = 12; (* Vertex count *)\r
+ DEFREPL = 3; (* Repetition count *)\r
+ DEFQIXS = 2; (* Qixs *)\r
+ FADESPEED = 48;\r
+type\r
+ TPoint = record\r
+ X, Y : integer;\r
+ end;\r
+ TRGB = record\r
+ R, G, B: byte;\r
+ end;\r
+ TQix = record\r
+ Color: integer;\r
+ Vert : array[ 0..DEFVERT-1, 0..DEFREPL-1 ] of TPoint;\r
+ Delta: array[ 0..DEFVERT-1 ] of TPoint;\r
+ end;\r
+var\r
+ Page : integer;\r
+ MaxX,\r
+ MaxY : word;\r
+ Qix : array[ 0..DEFQIXS-1 ] of TQix;\r
+ Pal : array[ byte ] of TRGB;\r
+\r
+type\r
+ TReal = double;\r
+ TRPoint = record\r
+ X, Y: TReal;\r
+ end;\r
+ TMatrix = array[ 0..3, 0..3 ] of TReal;\r
+var\r
+ M: TMatrix;\r
+ G: array[ 0..DEFVERT-1 ] of TRPoint;\r
+ C: array[ 0..DEFVERT-1 ] of TRPoint;\r
+\r
+procedure BumpPal( Idx, DR, DG, DB, Steps: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=1 to Steps do begin\r
+ Pal[Idx+1].R := Pal[Idx].R + DR;\r
+ Pal[Idx+1].G := Pal[Idx].G + DG;\r
+ Pal[Idx+1].B := Pal[Idx].B + DB;\r
+ Inc( Idx );\r
+ end;\r
+end;\r
+\r
+procedure InitPalette;\r
+begin\r
+ with Pal[0] do begin R:=0; G:=0; B:=0; end;\r
+ with Pal[1] do begin R:=0; G:=0; B:=62; end;\r
+ BumpPal( 1, 0, 2, -2, 31 );\r
+ BumpPal( 32, 2, -2, 0, 31 );\r
+ BumpPal( 63, -2, 2, 2, 31 );\r
+ BumpPal( 94, 2, 0, -2, 31 );\r
+ BumpPal( 125, -2, -2, 2, 31 );\r
+end;\r
+\r
+procedure Init( var Qix: TQix; Color: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ FillChar( Qix.Vert, SizeOf(Qix.Vert), 0 );\r
+ for I:=0 to DEFVERT-1 do begin\r
+ Qix.Vert[I, DEFREPL-1].X := Random( MaxX );\r
+ Qix.Vert[I, DEFREPL-1].Y := Random( MaxY );\r
+ Qix.Delta[I].X := Random(5)+1;\r
+ Qix.Delta[I].Y := Random(5)+1;\r
+ end;\r
+ Qix.Color := Color;\r
+\r
+ (* Initialize matrix (Catmull-Rom) *)\r
+ M[0,0] := -1/2; M[0,1] := 3/2; M[0,2] := -3/2; M[0,3] := 1/2;\r
+ M[1,0] := 1; M[1,1] := -5/2; M[1,2] := 2; M[1,3] := -1/2;\r
+ M[2,0] := -1/2; M[2,1] := 0; M[2,2] := 1/2; M[2,3] := 0;\r
+ M[3,0] := 0; M[3,1] := 1; M[3,2] := 0; M[3,3] := 0;\r
+end;\r
+\r
+procedure mxBezier( var Qix: TQix; I0, Idx, N: integer );\r
+var\r
+ I, J: integer;\r
+ T, T2, T3: TReal;\r
+ X0, Y0, X, Y: TReal;\r
+ Delta: TReal;\r
+begin\r
+ (* Compute coefficients *)\r
+ for I:=0 to 3 do begin\r
+ C[I].X := 0;\r
+ for J:=0 to 3 do C[I].X := C[I].X + M[I,J]*Qix.Vert[(I0+J) mod DEFVERT,Idx].X;\r
+ C[I].Y := 0;\r
+ for J:=0 to 3 do C[I].Y := C[I].Y + M[I,J]*Qix.Vert[(I0+J) mod DEFVERT,Idx].Y;\r
+ end;\r
+ X0 := C[3].X;\r
+ Y0 := C[3].Y;\r
+ Delta := 1 / N;\r
+ T := 0;\r
+ for I:=1 to N do begin\r
+ T := T + Delta;\r
+ T2 := T*T;\r
+ T3 := T*T2;\r
+ X := C[0].X*T3 + C[1].X*T2 + C[2].X*T + C[3].X;\r
+ Y := C[0].Y*T3 + C[1].Y*T2 + C[2].Y*T + C[3].Y;\r
+ mxLine( Round(X0), Page+Round(Y0), Round(X), Page+Round(Y), Qix.Color, OP_SET );\r
+ X0 := X;\r
+ Y0 := Y;\r
+ end;\r
+end;\r
+\r
+procedure Plot( var Qix: TQix; Idx: integer );\r
+var\r
+ I, J: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do begin\r
+ mxBezier( Qix, I, Idx, 12 );\r
+ end;\r
+end;\r
+\r
+procedure Update( var Qix: TQix; Idx: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do with Qix do begin\r
+ Inc( Vert[I,Idx].X, Delta[I].X );\r
+ if( Vert[I,Idx].X < 0 ) then begin\r
+ Vert[I,Idx].X := 0;\r
+ Delta[I].X := Random( 5 )+1;\r
+ end;\r
+ if( Vert[I,Idx].X > MaxX ) then begin\r
+ Vert[I,Idx].X := MaxX;\r
+ Delta[I].X := -Random( 5 )-1;\r
+ end;\r
+ Inc( Vert[I,Idx].Y, Delta[I].Y );\r
+ if( Vert[I,Idx].Y < 0 ) then begin\r
+ Vert[I,Idx].Y := 0;\r
+ Delta[I].Y := Random( 5 )+1;\r
+ end;\r
+ if( Vert[I,Idx].Y > MaxY ) then begin\r
+ Vert[I,Idx].Y := MaxY;\r
+ Delta[I].Y := -Random( 5 )-1;\r
+ end;\r
+ end;\r
+end;\r
+\r
+procedure Copy( var Qix: TQix; Dest, Src: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do with Qix do begin\r
+ Vert[I,Dest].X := Vert[I,Src].X;\r
+ Vert[I,Dest].Y := Vert[I,Src].Y;\r
+ end;\r
+end;\r
+\r
+procedure AnimateQix;\r
+var\r
+ Q, Idx, I, J, P, Count: integer;\r
+begin\r
+ Count := 0;\r
+ P := DEFREPL-1;\r
+ I := 0;\r
+ J := 1;\r
+ repeat\r
+ mxSetClipRegion( 0, Page, MaxX+1, MaxY+1 );\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, MaxX+1, MaxY+1, 0, OP_SET );\r
+ for Q:=0 to DEFQIXS-1 do begin\r
+ Copy( Qix[Q], I, P );\r
+ Update( Qix[Q], I );\r
+ for Idx:=0 to DEFREPL-1 do begin\r
+ Plot( Qix[Q], Idx );\r
+ end;\r
+ end;\r
+ I := (I+1) mod DEFREPL;\r
+ J := (J+1) mod DEFREPL;\r
+ P := (P+1) mod DEFREPL;\r
+ Inc( Count );\r
+ mxStartLine( Page );\r
+ if( Count >= FADESPEED ) then begin\r
+ for Q:=0 to DEFQIXS-1 do begin\r
+ Inc( Qix[Q].Color );\r
+ if( Qix[Q].Color > 156 ) then\r
+ Qix[Q].Color := 1;\r
+ end;\r
+ Count := 0;\r
+ end;\r
+ Page := 240-Page;\r
+ until( KeyPressed );\r
+end;\r
+\r
+var\r
+ I: integer;\r
+begin\r
+ Randomize;\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ mxGetScreenSize( MaxX, MaxY );\r
+ for I:=0 to DEFQIXS-1 do\r
+ Init( Qix[I], (I*(155 div DEFQIXS)) mod 155 + 1 );\r
+ InitPalette;\r
+ mxSetPalette( @Pal, 0, 157 );\r
+ Page := 240;\r
+ Dec( MaxX );\r
+ Dec( MaxY );\r
+ AnimateQix;\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+ModeX - A graphical library for DOS programs\r
+Copyright (c) 1993-1994 Alessandro Scotti\r
+http://www.ascotti.org/\r
+\r
+Please look at the above site in the "Art of..." and\r
+then in the "Old programs" section for more information.\r
+\r
+\r
--- /dev/null
+;\r
+; SINCOS.INC - Sin/cos tables for THREED.ASM\r
+;\r
+\r
+tblSin LABEL DWORD\r
+ DD 0\r
+ DD 411733\r
+ DD 823219\r
+ DD 1234209\r
+ DD 1644455\r
+ DD 2053710\r
+ DD 2461729\r
+ DD 2868265\r
+ DD 3273072\r
+ DD 3675909\r
+ DD 4076531\r
+ DD 4474698\r
+ DD 4870169\r
+ DD 5262706\r
+ DD 5652074\r
+ DD 6038037\r
+ DD 6420363\r
+ DD 6798821\r
+ DD 7173184\r
+ DD 7543226\r
+ DD 7908725\r
+ DD 8269459\r
+ DD 8625213\r
+ DD 8975771\r
+ DD 9320922\r
+ DD 9660458\r
+ DD 9994176\r
+ DD 10321873\r
+ DD 10643353\r
+ DD 10958422\r
+ DD 11266890\r
+ DD 11568571\r
+ DD 11863283\r
+ DD 12150850\r
+ DD 12431097\r
+ DD 12703856\r
+ DD 12968963\r
+ DD 13226258\r
+ DD 13475586\r
+ DD 13716797\r
+ DD 13949745\r
+ DD 14174291\r
+ DD 14390298\r
+ DD 14597637\r
+ DD 14796184\r
+ DD 14985817\r
+ DD 15166424\r
+ DD 15337895\r
+ DD 15500126\r
+ DD 15653022\r
+ DD 15796488\r
+ DD 15930439\r
+ DD 16054795\r
+ DD 16169479\r
+ DD 16274424\r
+ DD 16369565\r
+ DD 16454846\r
+ DD 16530216\r
+ DD 16595628\r
+ DD 16651044\r
+ DD 16696429\r
+ DD 16731757\r
+ DD 16757007\r
+ DD 16772163\r
+ DD 16777216\r
+ DD 16772163\r
+ DD 16757007\r
+ DD 16731757\r
+ DD 16696429\r
+ DD 16651044\r
+ DD 16595628\r
+ DD 16530216\r
+ DD 16454846\r
+ DD 16369565\r
+ DD 16274424\r
+ DD 16169479\r
+ DD 16054795\r
+ DD 15930439\r
+ DD 15796488\r
+ DD 15653022\r
+ DD 15500126\r
+ DD 15337895\r
+ DD 15166424\r
+ DD 14985817\r
+ DD 14796184\r
+ DD 14597637\r
+ DD 14390298\r
+ DD 14174291\r
+ DD 13949745\r
+ DD 13716797\r
+ DD 13475586\r
+ DD 13226258\r
+ DD 12968963\r
+ DD 12703856\r
+ DD 12431097\r
+ DD 12150850\r
+ DD 11863283\r
+ DD 11568571\r
+ DD 11266890\r
+ DD 10958422\r
+ DD 10643353\r
+ DD 10321873\r
+ DD 9994176\r
+ DD 9660458\r
+ DD 9320922\r
+ DD 8975771\r
+ DD 8625213\r
+ DD 8269459\r
+ DD 7908725\r
+ DD 7543226\r
+ DD 7173184\r
+ DD 6798821\r
+ DD 6420363\r
+ DD 6038037\r
+ DD 5652074\r
+ DD 5262706\r
+ DD 4870169\r
+ DD 4474698\r
+ DD 4076531\r
+ DD 3675909\r
+ DD 3273072\r
+ DD 2868265\r
+ DD 2461729\r
+ DD 2053710\r
+ DD 1644455\r
+ DD 1234209\r
+ DD 823219\r
+ DD 411733\r
+ DD 0\r
+ DD -411733\r
+ DD -823219\r
+ DD -1234209\r
+ DD -1644455\r
+ DD -2053710\r
+ DD -2461729\r
+ DD -2868265\r
+ DD -3273072\r
+ DD -3675909\r
+ DD -4076531\r
+ DD -4474698\r
+ DD -4870169\r
+ DD -5262706\r
+ DD -5652074\r
+ DD -6038037\r
+ DD -6420363\r
+ DD -6798821\r
+ DD -7173184\r
+ DD -7543226\r
+ DD -7908725\r
+ DD -8269459\r
+ DD -8625213\r
+ DD -8975771\r
+ DD -9320922\r
+ DD -9660458\r
+ DD -9994176\r
+ DD -10321873\r
+ DD -10643353\r
+ DD -10958422\r
+ DD -11266890\r
+ DD -11568571\r
+ DD -11863283\r
+ DD -12150850\r
+ DD -12431097\r
+ DD -12703856\r
+ DD -12968963\r
+ DD -13226258\r
+ DD -13475586\r
+ DD -13716797\r
+ DD -13949745\r
+ DD -14174291\r
+ DD -14390298\r
+ DD -14597637\r
+ DD -14796184\r
+ DD -14985817\r
+ DD -15166424\r
+ DD -15337895\r
+ DD -15500126\r
+ DD -15653022\r
+ DD -15796488\r
+ DD -15930439\r
+ DD -16054795\r
+ DD -16169479\r
+ DD -16274424\r
+ DD -16369565\r
+ DD -16454846\r
+ DD -16530216\r
+ DD -16595628\r
+ DD -16651044\r
+ DD -16696429\r
+ DD -16731757\r
+ DD -16757007\r
+ DD -16772163\r
+ DD -16777216\r
+ DD -16772163\r
+ DD -16757007\r
+ DD -16731757\r
+ DD -16696429\r
+ DD -16651044\r
+ DD -16595628\r
+ DD -16530216\r
+ DD -16454846\r
+ DD -16369565\r
+ DD -16274424\r
+ DD -16169479\r
+ DD -16054795\r
+ DD -15930439\r
+ DD -15796488\r
+ DD -15653022\r
+ DD -15500126\r
+ DD -15337895\r
+ DD -15166424\r
+ DD -14985817\r
+ DD -14796184\r
+ DD -14597637\r
+ DD -14390298\r
+ DD -14174291\r
+ DD -13949745\r
+ DD -13716797\r
+ DD -13475586\r
+ DD -13226258\r
+ DD -12968963\r
+ DD -12703856\r
+ DD -12431097\r
+ DD -12150850\r
+ DD -11863283\r
+ DD -11568571\r
+ DD -11266890\r
+ DD -10958422\r
+ DD -10643353\r
+ DD -10321873\r
+ DD -9994176\r
+ DD -9660458\r
+ DD -9320922\r
+ DD -8975771\r
+ DD -8625213\r
+ DD -8269459\r
+ DD -7908725\r
+ DD -7543226\r
+ DD -7173184\r
+ DD -6798821\r
+ DD -6420363\r
+ DD -6038037\r
+ DD -5652074\r
+ DD -5262706\r
+ DD -4870169\r
+ DD -4474698\r
+ DD -4076531\r
+ DD -3675909\r
+ DD -3273072\r
+ DD -2868265\r
+ DD -2461729\r
+ DD -2053710\r
+ DD -1644455\r
+ DD -1234209\r
+ DD -823219\r
+ DD -411733\r
+tblCos LABEL DWORD\r
+ DD 16777216\r
+ DD 16772163\r
+ DD 16757007\r
+ DD 16731757\r
+ DD 16696429\r
+ DD 16651044\r
+ DD 16595628\r
+ DD 16530216\r
+ DD 16454846\r
+ DD 16369565\r
+ DD 16274424\r
+ DD 16169479\r
+ DD 16054795\r
+ DD 15930439\r
+ DD 15796488\r
+ DD 15653022\r
+ DD 15500126\r
+ DD 15337895\r
+ DD 15166424\r
+ DD 14985817\r
+ DD 14796184\r
+ DD 14597637\r
+ DD 14390298\r
+ DD 14174291\r
+ DD 13949745\r
+ DD 13716797\r
+ DD 13475586\r
+ DD 13226258\r
+ DD 12968963\r
+ DD 12703856\r
+ DD 12431097\r
+ DD 12150850\r
+ DD 11863283\r
+ DD 11568571\r
+ DD 11266890\r
+ DD 10958422\r
+ DD 10643353\r
+ DD 10321873\r
+ DD 9994176\r
+ DD 9660458\r
+ DD 9320922\r
+ DD 8975771\r
+ DD 8625213\r
+ DD 8269459\r
+ DD 7908725\r
+ DD 7543226\r
+ DD 7173184\r
+ DD 6798821\r
+ DD 6420363\r
+ DD 6038037\r
+ DD 5652074\r
+ DD 5262706\r
+ DD 4870169\r
+ DD 4474698\r
+ DD 4076531\r
+ DD 3675909\r
+ DD 3273072\r
+ DD 2868265\r
+ DD 2461729\r
+ DD 2053710\r
+ DD 1644455\r
+ DD 1234209\r
+ DD 823219\r
+ DD 411733\r
+ DD 0\r
+ DD -411733\r
+ DD -823219\r
+ DD -1234209\r
+ DD -1644455\r
+ DD -2053710\r
+ DD -2461729\r
+ DD -2868265\r
+ DD -3273072\r
+ DD -3675909\r
+ DD -4076531\r
+ DD -4474698\r
+ DD -4870169\r
+ DD -5262706\r
+ DD -5652074\r
+ DD -6038037\r
+ DD -6420363\r
+ DD -6798821\r
+ DD -7173184\r
+ DD -7543226\r
+ DD -7908725\r
+ DD -8269459\r
+ DD -8625213\r
+ DD -8975771\r
+ DD -9320922\r
+ DD -9660458\r
+ DD -9994176\r
+ DD -10321873\r
+ DD -10643353\r
+ DD -10958422\r
+ DD -11266890\r
+ DD -11568571\r
+ DD -11863283\r
+ DD -12150850\r
+ DD -12431097\r
+ DD -12703856\r
+ DD -12968963\r
+ DD -13226258\r
+ DD -13475586\r
+ DD -13716797\r
+ DD -13949745\r
+ DD -14174291\r
+ DD -14390298\r
+ DD -14597637\r
+ DD -14796184\r
+ DD -14985817\r
+ DD -15166424\r
+ DD -15337895\r
+ DD -15500126\r
+ DD -15653022\r
+ DD -15796488\r
+ DD -15930439\r
+ DD -16054795\r
+ DD -16169479\r
+ DD -16274424\r
+ DD -16369565\r
+ DD -16454846\r
+ DD -16530216\r
+ DD -16595628\r
+ DD -16651044\r
+ DD -16696429\r
+ DD -16731757\r
+ DD -16757007\r
+ DD -16772163\r
+ DD -16777216\r
+ DD -16772163\r
+ DD -16757007\r
+ DD -16731757\r
+ DD -16696429\r
+ DD -16651044\r
+ DD -16595628\r
+ DD -16530216\r
+ DD -16454846\r
+ DD -16369565\r
+ DD -16274424\r
+ DD -16169479\r
+ DD -16054795\r
+ DD -15930439\r
+ DD -15796488\r
+ DD -15653022\r
+ DD -15500126\r
+ DD -15337895\r
+ DD -15166424\r
+ DD -14985817\r
+ DD -14796184\r
+ DD -14597637\r
+ DD -14390298\r
+ DD -14174291\r
+ DD -13949745\r
+ DD -13716797\r
+ DD -13475586\r
+ DD -13226258\r
+ DD -12968963\r
+ DD -12703856\r
+ DD -12431097\r
+ DD -12150850\r
+ DD -11863283\r
+ DD -11568571\r
+ DD -11266890\r
+ DD -10958422\r
+ DD -10643353\r
+ DD -10321873\r
+ DD -9994176\r
+ DD -9660458\r
+ DD -9320922\r
+ DD -8975771\r
+ DD -8625213\r
+ DD -8269459\r
+ DD -7908725\r
+ DD -7543226\r
+ DD -7173184\r
+ DD -6798821\r
+ DD -6420363\r
+ DD -6038037\r
+ DD -5652074\r
+ DD -5262706\r
+ DD -4870169\r
+ DD -4474698\r
+ DD -4076531\r
+ DD -3675909\r
+ DD -3273072\r
+ DD -2868265\r
+ DD -2461729\r
+ DD -2053710\r
+ DD -1644455\r
+ DD -1234209\r
+ DD -823219\r
+ DD -411733\r
+ DD 0\r
+ DD 411733\r
+ DD 823219\r
+ DD 1234209\r
+ DD 1644455\r
+ DD 2053710\r
+ DD 2461729\r
+ DD 2868265\r
+ DD 3273072\r
+ DD 3675909\r
+ DD 4076531\r
+ DD 4474698\r
+ DD 4870169\r
+ DD 5262706\r
+ DD 5652074\r
+ DD 6038037\r
+ DD 6420363\r
+ DD 6798821\r
+ DD 7173184\r
+ DD 7543226\r
+ DD 7908725\r
+ DD 8269459\r
+ DD 8625213\r
+ DD 8975771\r
+ DD 9320922\r
+ DD 9660458\r
+ DD 9994176\r
+ DD 10321873\r
+ DD 10643353\r
+ DD 10958422\r
+ DD 11266890\r
+ DD 11568571\r
+ DD 11863283\r
+ DD 12150850\r
+ DD 12431097\r
+ DD 12703856\r
+ DD 12968963\r
+ DD 13226258\r
+ DD 13475586\r
+ DD 13716797\r
+ DD 13949745\r
+ DD 14174291\r
+ DD 14390298\r
+ DD 14597637\r
+ DD 14796184\r
+ DD 14985817\r
+ DD 15166424\r
+ DD 15337895\r
+ DD 15500126\r
+ DD 15653022\r
+ DD 15796488\r
+ DD 15930439\r
+ DD 16054795\r
+ DD 16169479\r
+ DD 16274424\r
+ DD 16369565\r
+ DD 16454846\r
+ DD 16530216\r
+ DD 16595628\r
+ DD 16651044\r
+ DD 16696429\r
+ DD 16731757\r
+ DD 16757007\r
+ DD 16772163\r
--- /dev/null
+COMMENT /\r
+ Fixed-point math functions and 3D transforms\r
+ Copyright (c) 1993,94 by Alessandro Scotti\r
+/\r
+WARN PRO\r
+P386\r
+JUMPS\r
+LOCALS\r
+\r
+INCLUDE MATH.INC\r
+\r
+PUBLIC tdFixedMul\r
+PUBLIC tdGetNormal\r
+PUBLIC tdRotate\r
+PUBLIC tdGetSurfaceLight\r
+PUBLIC tdSetLight\r
+PUBLIC tdSetRotation\r
+PUBLIC tdSetTranslation\r
+PUBLIC tdTransform\r
+PUBLIC tdTransformToImage\r
+PUBLIC tdTransformLight\r
+PUBLIC tdBackPlaneCull\r
+PUBLIC tdSetPerspective\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Data segment\r
+;\r
+MATH_DATA SEGMENT USE16 PARA PUBLIC 'DATA'\r
+ ASSUME ds:MATH_DATA\r
+\r
+INCLUDE SINCOS.INC ; Fixed 8:24 sin/cos table\r
+\r
+XRotation TPOINT <> ; 3x3 rotation matrix\r
+YRotation TPOINT <>\r
+ZRotation TPOINT <>\r
+\r
+Translation TPOINT <> ; Translation vector\r
+\r
+Light TPOINT <> ; Light vector\r
+AmbientLight DW 00 ; Ambient light\r
+\r
+XScale DD 10000h ; Scaling factor for X coordinate\r
+YScale DD 10000h ; Scaling factor for Y coordinate\r
+PerspectiveDistance DD 20000000h\r
+\r
+MATH_DATA ENDS\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Code segment\r
+;\r
+MATH_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MATH_TEXT, es:NOTHING, fs:NOTHING\r
+\r
+tdSetPerspective PROC PASCAL FAR\r
+ ARG Perspective:DWORD, \\r
+ ScaleX:DWORD, \\r
+ ScaleY:DWORD\r
+ USES ds\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ mov eax, [Perspective]\r
+ mov [PerspectiveDistance], eax\r
+ mov eax, [ScaleX]\r
+ mov [XScale], eax\r
+ mov eax, [ScaleY]\r
+ mov [YScale], eax\r
+\r
+ ret\r
+tdSetPerspective ENDP\r
+\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the rotation matrix.\r
+;\r
+; Input:\r
+; RX = X-axis rotation angle\r
+; RY = X-axis rotation angle\r
+; RZ = X-axis rotation angle\r
+; Output:\r
+; none\r
+;\r
+tdSetRotation PROC PASCAL FAR\r
+ ARG RX:WORD, \\r
+ RY:WORD, \\r
+ RZ:WORD\r
+ USES ds, si, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ mov bx, [RZ]\r
+ mov si, [RY]\r
+ mov di, [RX]\r
+ shl bx, 2\r
+ shl si, 2\r
+ shl di, 2\r
+\r
+ push ebp ; We use EBP as a scratch register\r
+\r
+; Set X rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblCos[si]\r
+ mov [XRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblCos[si]\r
+ mov [XRotation.Y], edx\r
+\r
+ mov eax, tblSin[si]\r
+ sar eax, 8 ; Convert fixed 8:24 to fixed 16:16\r
+ mov [XRotation.Z], eax\r
+\r
+; Set Y rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[si] ; EDX:EAX = fixed 16:48\r
+ shrd eax, edx, 24 ; EAX = fixed 8:24\r
+ imul tblSin[di] ; EDX:EAX = fixed 16:48\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblSin[bx]\r
+ imul tblCos[di]\r
+ add eax, ebp\r
+ adc edx, ecx ; EDX:EAX = fixed 16:48\r
+ neg edx\r
+ mov [YRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblSin[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblCos[bx]\r
+ imul tblCos[di]\r
+ sub eax, ebp\r
+ sbb edx, ecx\r
+ mov [YRotation.Y], edx\r
+\r
+ mov eax, tblCos[si]\r
+ imul tblSin[di]\r
+ mov [YRotation.Z], edx\r
+\r
+; Set Z rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblCos[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[di]\r
+ sub eax, ebp\r
+ sbb edx, ecx\r
+ mov [ZRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblCos[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[di]\r
+ add eax, ebp\r
+ add edx, ecx\r
+ neg edx\r
+ mov [ZRotation.Y], edx\r
+\r
+ mov eax, tblCos[si]\r
+ imul tblCos[di]\r
+ mov [ZRotation.Z], edx\r
+\r
+ pop ebp ; Restore EBP\r
+\r
+ ret\r
+tdSetRotation ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the translation vector.\r
+;\r
+; Input:\r
+; TV = pointer to translation vector\r
+; Output:\r
+; none\r
+;\r
+tdSetTranslation PROC PASCAL FAR\r
+ ARG TV:DWORD\r
+ USES ds, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [TV]\r
+ mov eax, es:[di].X\r
+ mov [Translation.X], eax\r
+ mov eax, es:[di].Y\r
+ mov [Translation.Y], eax\r
+ mov eax, es:[di].Z\r
+ mov [Translation.Z], eax\r
+\r
+ ret\r
+tdSetTranslation ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Transforms an array of TPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TPOINT\r
+; Count = number of entries to transform\r
+; Output:\r
+; none\r
+;\r
+tdTransform PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ LOCAL Adjust:DWORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+\r
+ ALIGN DWORD\r
+@@Loop:\r
+; Transform Z coordinate\r
+ mov eax, fs:[si].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ mov ebx, eax\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.Z] ; EAX = new Z coord (fixed 16:16)\r
+ mov es:[di].Z, eax\r
+; Get perspective factor\r
+ mov ebx, [PerspectiveDistance]\r
+ sub eax, ebx\r
+ neg eax ; EAX = PD - Z\r
+ xor edx, edx\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx ; EAX = fixed 16:16 result\r
+ mov [Adjust], eax\r
+\r
+; Transform X coordinate\r
+ mov eax, fs:[si].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.X]\r
+ imul [Adjust]\r
+ shrd eax, edx, 16\r
+ mov es:[di].X, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, fs:[si].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.Y]\r
+ imul [Adjust]\r
+ shrd eax, edx, 16\r
+ mov es:[di].Y, eax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdTransform ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Transforms an array of TPOINT into an array of TIMAGEPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TIMAGEPOINT\r
+; Count = number of entries to transform\r
+; DeltaX = translation distance for the X coordinate\r
+; DeltaY = translation distance for the Y coordinate\r
+; Output:\r
+; the maximum Z value\r
+;\r
+tdTransformToImage PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD, \\r
+ DeltaX:WORD, \\r
+ DeltaY:WORD\r
+ LOCAL Adjust:DWORD, \\r
+ Max:DWORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+ mov [Max], 80000000h\r
+\r
+@@Loop:\r
+; Check max Z\r
+ mov eax, fs:[si].Z\r
+ cmp eax, [Max]\r
+ jle @@1\r
+ mov [Max], eax\r
+@@1:\r
+\r
+; Transform X coordinate\r
+ mov ax, WORD PTR fs:[si].X[2]\r
+ add ax, [DeltaX]\r
+ mov es:[di].IX, ax\r
+\r
+; Transform Y coordinate\r
+ mov ax, WORD PTR fs:[si].Y[2]\r
+ add ax, [DeltaY]\r
+ mov es:[di].IY, ax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TIMAGEPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ mov eax, [Max]\r
+ shld edx, eax, 16\r
+ ret\r
+tdTransformToImage ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the light source.\r
+;\r
+; Input:\r
+; Light = pointer to light vector\r
+; Output:\r
+; none\r
+;\r
+tdSetLight PROC PASCAL FAR\r
+ ARG L:DWORD\r
+ USES ds, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [L]\r
+ mov eax, es:[di].X\r
+ mov [Light.X], eax\r
+ mov eax, es:[di].Y\r
+ mov [Light.Y], eax\r
+ mov eax, es:[di].Z\r
+ mov [Light.Z], eax\r
+\r
+ ret\r
+tdSetLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Computes light intensity for an array of surfaces.\r
+;\r
+; Input:\r
+; Normals = pointer to an array of surface normals\r
+; Lights = pointer to an array of integer to be filled with\r
+; light intensity\r
+; Count = number of elements to transform\r
+; Output:\r
+; none\r
+;\r
+tdTransformLight PROC PASCAL FAR\r
+ ARG Normals:DWORD, \\r
+ Lights:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov fs, ax\r
+ ASSUME fs:MATH_DATA\r
+\r
+ lds si, [Normals]\r
+ les di, [Lights]\r
+ ASSUME ds:NOTHING\r
+\r
+; Intensity is given by the dot product between the Light vector and\r
+; the surface normal\r
+@@Loop:\r
+ mov eax, ds:[si].Z\r
+ imul [Light.Z]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, ds:[si].Y\r
+ imul [Light.Y]\r
+ add ebx, eax\r
+ adc ecx, edx\r
+ mov eax, ds:[si].X\r
+ imul [Light.X]\r
+ add eax, ebx\r
+ adc edx, ecx ; EDX:EAX = fixed 32:32 intensity\r
+ add dx, [AmbientLight]\r
+ test dx, dx\r
+ jg @@1\r
+ xor dx, dx ; Return 0 for no light\r
+@@1:\r
+ mov es:[di], dx\r
+ inc di\r
+ inc di\r
+ add si, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ASSUME fs:NOTHING\r
+ ret\r
+tdTransformLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the light value given the normal to a surface.\r
+;\r
+; Input:\r
+; Normal = pointer to TPOINT surface normal vector\r
+; Output:\r
+; AX = light intensity (>=0)\r
+; Notes:\r
+; the normal is rotated according to the current setting.\r
+;\r
+tdGetSurfaceLight PROC PASCAL FAR\r
+ ARG Normal:DWORD\r
+ USES ds, esi, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [Normal]\r
+\r
+; Transform Z coordinate\r
+ mov eax, es:[di].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.Z]\r
+ shrd eax, edx, 16\r
+ mov esi, eax\r
+\r
+; Transform X coordinate\r
+ mov eax, es:[di].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.X]\r
+ shrd eax, edx, 16\r
+ add esi, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, es:[di].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.X]\r
+ shrd eax, edx, 16\r
+ add eax, esi\r
+ shr eax, 16\r
+\r
+; Add ambient light\r
+ add ax, [AmbientLight]\r
+ test ax, ax\r
+ jge @@Exit\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ ret\r
+tdGetSurfaceLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Rotates an array of TPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TPOINT\r
+; Count = number of entries to transform\r
+; Output:\r
+; none\r
+;\r
+tdRotate PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+\r
+@@Loop:\r
+; Transform Z coordinate\r
+ mov eax, fs:[si].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].Z, eax\r
+\r
+; Transform X coordinate\r
+ mov eax, fs:[si].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].X, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, fs:[si].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].Y, eax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdRotate ENDP\r
+\r
+tdFixedMul PROC PASCAL FAR\r
+ ARG F1:DWORD, \\r
+ F2:DWORD\r
+\r
+ mov eax, [F1]\r
+ imul [F2]\r
+ shr eax, 16\r
+\r
+ ret\r
+tdFixedMul ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns in EAX the square root of EDX:EAX.\r
+;\r
+subSqrt PROC NEAR\r
+ push esi\r
+ push edi\r
+\r
+ add eax, eax\r
+ adc edx, 0\r
+ mov eax, edx ; Just discard the low bits\r
+\r
+ mov esi, eax\r
+ xor edi, edi\r
+ shld edi, esi, 16\r
+ shl esi, 16\r
+@@Loop:\r
+ mov ebx, eax\r
+ mul eax\r
+ add eax, esi\r
+ adc edx, edi\r
+ shrd eax, edx, 1\r
+ shr edx, 1\r
+ div ebx\r
+ cmp eax, ebx\r
+ jne @@Loop\r
+\r
+; Adjust EAX\r
+ shl eax, 8\r
+\r
+ pop edi\r
+ pop esi\r
+ ret\r
+subSqrt ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Finds the unitary normal to a given surface.\r
+;\r
+; Input:\r
+; Dest = pointer to TPOINT (vector) result\r
+; P1, P2, P3 = pointer to TPOINT points on surface\r
+; Output:\r
+; none\r
+; Notes:\r
+; the normal is given by the cross-product between (P3-P1) and\r
+; (P2-P1), so its orientation depends on the parameters order.\r
+;\r
+tdGetNormal PROC PASCAL FAR\r
+ ARG Dest:DWORD, \\r
+ P1:DWORD, \\r
+ P2:DWORD, \\r
+ P3:DWORD\r
+ LOCAL V1:TPOINT, \\r
+ V2:TPOINT, \\r
+ N:TPOINT\r
+ USES ds, si, es, di\r
+\r
+; Get vector V1\r
+ lds si, [P1]\r
+ les di, [P3]\r
+ mov eax, es:[di].X\r
+ sub eax, ds:[si].X\r
+ mov [V1.X], eax\r
+ mov eax, es:[di].Y\r
+ sub eax, ds:[si].Y\r
+ mov [V1.Y], eax\r
+ mov eax, es:[di].Z\r
+ sub eax, ds:[si].Z\r
+ mov [V1.Z], eax\r
+\r
+; Get vector V2\r
+ les di, [P2]\r
+ mov eax, es:[di].X\r
+ sub eax, ds:[si].X\r
+ mov [V2.X], eax\r
+ mov eax, es:[di].Y\r
+ sub eax, ds:[si].Y\r
+ mov [V2.Y], eax\r
+ mov eax, es:[di].Z\r
+ sub eax, ds:[si].Z\r
+ mov [V2.Z], eax\r
+\r
+; Get normal vector (V1 x V2)\r
+ mov eax, [V1.Z]\r
+ imul [V2.Y]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.Y]\r
+ imul [V2.Z]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.X], eax\r
+\r
+ mov eax, [V1.X]\r
+ imul [V2.Z]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.Z]\r
+ imul [V2.X]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.Y], eax\r
+\r
+ mov eax, [V1.Y]\r
+ imul [V2.X]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.X]\r
+ imul [V2.Y]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.Z], eax\r
+\r
+; Get normal length\r
+ mov eax, [N.X]\r
+ imul eax\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [N.Y]\r
+ imul eax\r
+ add ebx, eax\r
+ adc ecx, edx\r
+ mov eax, [N.Z]\r
+ imul eax\r
+ add eax, ebx\r
+ adc edx, ecx ; EDX:EAX = N.X*N.X + N.Y*N.Y + N.Z*N.Z\r
+ call subSqrt ; EAX = normal length\r
+ mov ebx, eax\r
+\r
+; Adjust vector and save it\r
+ les di, [Dest]\r
+ mov eax, [N.X]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].X, eax\r
+ mov eax, [N.Y]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].Y, eax\r
+ mov eax, [N.Z]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].Z, eax\r
+\r
+ ret\r
+tdGetNormal ENDP\r
+\r
+TPOLY STRUC\r
+ Vtx DW 4 DUP(?)\r
+TPOLY ENDS\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Performs surface removal on an array of polygons.\r
+;\r
+; Input:\r
+; Poly = pointer to an array of TPOLY\r
+; Vertex = pointer to an array of TPOINT\r
+; Dest = pointer to an array of integer\r
+; Count = number of polygons to check\r
+; Step = size of TPOLY structure\r
+; Output:\r
+; if the n-th polygon is invisible the n-th entry of the\r
+; Dest array is set to -1, other entries are not modified\r
+; (so it's possible to use the Light array for Dest, because\r
+; the light intensity is always >= 0)\r
+;\r
+tdBackPlaneCull PROC PASCAL FAR\r
+ ARG Step:WORD, \\r
+ Poly:DWORD, \\r
+ Vertex:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ds, WORD PTR Vertex[2]\r
+ les di, [Poly]\r
+ mov fs, WORD PTR Dest[2]\r
+\r
+@@Loop:\r
+ mov ax, es:[di].Vtx[2] ; Index of 2nd vertex\r
+ shl ax, 2\r
+ mov bx, ax\r
+ shl ax, 1\r
+ add bx, ax ; BX = index*SIZE TPOINT\r
+ add bx, WORD PTR [Vertex] ; BX = offset of 2nd vertex\r
+ mov ax, es:[di].Vtx[4] ; Index of 3rd vertex\r
+ shl ax, 2\r
+ mov si, ax\r
+ shl ax, 1\r
+ add si, ax\r
+ add si, WORD PTR [Vertex] ; SI = offset of 3rd vertex\r
+ mov ecx, ds:[si].X\r
+ sub ecx, ds:[bx].X ; ECX = V3.X-V2.X\r
+ mov edx, ds:[si].Y\r
+ sub edx, ds:[bx].Y ; EDX = V3.Y-V2.Y\r
+ mov ax, es:[di].Vtx[0] ; Index of 1st vertex\r
+ shl ax, 2\r
+ mov si, ax\r
+ shl ax, 1\r
+ add si, ax\r
+ add si, WORD PTR [Vertex] ; SI = offset of 1st vertex\r
+ mov eax, ds:[si].X\r
+ sub eax, ds:[bx].X ; EAX = V1.X-V2.X\r
+ mov esi, ds:[si].Y\r
+ sub esi, ds:[bx].Y ; ESI = V1.Y-V2.Y\r
+ imul edx\r
+ mov ebx, eax\r
+ xchg ecx, edx ; ECX:EBX = (V1.X-V2.X)*(V3.Y-V2.Y)\r
+ mov eax, esi\r
+ imul edx ; EDX:EAX = (V1.Y-V2.Y)*(V3.X-V2.X)\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ jl @@Next ; Polygon is visible\r
+ mov bx, WORD PTR [Dest] ; FS:BX -> current Dest entry\r
+ mov WORD PTR fs:[bx], -1 ; Remove polygon\r
+@@Next:\r
+ add WORD PTR [Dest], 2 ; Next entry for dest\r
+ add di, [Step] ; Next polygon\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdBackPlaneCull ENDP\r
+\r
+MATH_TEXT ENDS\r
+END\r
--- /dev/null
+typedef struct {\r
+ long x, y, z;\r
+} TVECTOR;\r
+\r
+#define PVECTOR TVECTOR far *\r
+\r
+#define TPOINT TVECTOR\r
+#define PPOINT PVECTOR\r
+\r
+#define VPTR void far *\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+long far pascal tdFixedMul( long, long );\r
+int far pascal tdGetSurfaceLight( PPOINT );\r
+long far pascal tdTransformToImage( VPTR, VPTR, short, short, short );\r
+\r
+void far pascal tdBackPlaneCull( VPTR, VPTR, VPTR, short, short );\r
+void far pascal tdGetNormal( VPTR, PPOINT, PPOINT, PPOINT );\r
+void far pascal tdRotate( VPTR, VPTR, short );\r
+void far pascal tdSetLight( PVECTOR );\r
+void far pascal tdSetRotation( short, short, short );\r
+void far pascal tdSetTranslation( PVECTOR );\r
+void far pascal tdSetPerspective( long, long, long );\r
+void far pascal tdTransform( VPTR, VPTR, short );\r
+void far pascal tdTransformLight( VPTR, VPTR, short );\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
--- /dev/null
+unit ThreeD;\r
+interface\r
+\r
+type\r
+ TVector = record\r
+ X, Y, Z : longint;\r
+ end;\r
+ TPoint = TVector;\r
+\r
+function tdFixedMul( F1, F2: longint ): longint;\r
+function tdGetSurfaceLight( var Normal: TPoint ): integer;\r
+function tdTransformToImage( var Source, Dest; Count, DeltaX, DeltaY: integer ): longint;\r
+\r
+procedure tdBackPlaneCull( var Poly, Vertex, Dest; Count, Step: word );\r
+procedure tdGetNormal( var Dest, P1, P2, P3: TVector );\r
+procedure tdRotate( var Source, Dest; Count: word );\r
+procedure tdSetLight( var Light: TVector );\r
+procedure tdSetRotation( RX, RY, RZ: word );\r
+procedure tdSetTranslation( var TV: TVector );\r
+procedure tdSetPerspective( PD, XF, YF: longint );\r
+procedure tdTransform( var Source, Dest; Count: word );\r
+procedure tdTransformLight( var Source, Dest; Count: word );\r
+\r
+implementation\r
+\r
+function tdGetSurfaceLight; external;\r
+procedure tdSetRotation( RX, RY, RZ: word ); external;\r
+procedure tdGetNormal; external;\r
+procedure tdSetTranslation( var TV: TVector ); external;\r
+procedure tdTransform( var Source, Dest; Count: word ); external;\r
+procedure tdRotate; external;\r
+function tdTransformToImage; external;\r
+procedure tdSetLight( var Light: TVector ); external;\r
+procedure tdSetPerspective; external;\r
+procedure tdTransformLight; external;\r
+function tdFixedMul( F1, F2: longint ): longint; external;\r
+procedure tdBackPlaneCull; external;\r
+{$L THREED}\r
+\r
+end.\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXBB.ASM - Bit block transfer\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxBitBlt\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN subHorizontalLineInfo : NEAR\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Moves a block of video memory.\r
+;\r
+; Input:\r
+; SX, SY = source coordinates\r
+; Width = source width\r
+; Height = source height\r
+; DX, DY = destination coordinates\r
+; Output:\r
+; none\r
+;\r
+; Note: overlapping regions are not allowed.\r
+;\r
+mxBitBlt PROC FAR\r
+ ARG DestY:WORD, \\r
+ DestX:WORD, \\r
+ Height:WORD, \\r
+ Width:WORD, \\r
+ SY:WORD, \\r
+ SX:WORD = ARG_SIZE\r
+ LOCAL PlaneWidth:WORD:4, \\r
+ SourceOffset:WORD, \\r
+ DestOffset:WORD, \\r
+ Count:BYTE, \\r
+ ReadPlane:BYTE, \\r
+ WritePlane:BYTE, \\r
+ LeftMask:BYTE, \\r
+ RightMask:BYTE = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+; Exit now if null width\r
+ cmp [Width], 0\r
+ je @@Exit\r
+\r
+; Calls the proper procedure to handle transfer\r
+ mov ax, [SX]\r
+ and al, 03h ; AL = source plane\r
+ mov dx, [DestX]\r
+ and dl, 03h ; DL = destination plane\r
+ mov bx, OFFSET subPlaneBlt\r
+ cmp al, dl ; Same source and destination plane?\r
+ jne @@BitBlt ; No, use slow procedure\r
+ mov bx, OFFSET subMoveBlt\r
+@@BitBlt:\r
+ call bx\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+\r
+;-----------------------------------------------------------\r
+; Uses write mode 1 for maximum speed. Only works if source\r
+; and destination are plane-aligned.\r
+;\r
+subMoveBlt PROC NEAR\r
+; Get horizontal line info and address of destination\r
+ mov bx, [DestX]\r
+ mov ax, [DestY]\r
+ mov cx, [Width]\r
+ call subHorizontalLineInfo\r
+ mov [LeftMask], al\r
+ mov [RightMask], ah\r
+ mov [Width], cx\r
+\r
+; Setup segments\r
+ mov ax, [mx_VideoSegment]\r
+ mov ds, ax\r
+ mov es, ax\r
+\r
+; Get address of source pixel\r
+ mov ax, [SY]\r
+ mul [mx_BytesPerLine]\r
+ mov si, [SX]\r
+ .shr si, 2\r
+ add si, ax\r
+\r
+; Set write mode 1\r
+ mov dx, GDC\r
+ mov ax, 4105h\r
+ out dx, ax\r
+ cld\r
+\r
+; Move left block\r
+@@L0:\r
+ mov ah, [LeftMask]\r
+ or ah, ah\r
+ jz @@C0\r
+ mov dx, TS\r
+ mov al, 02h\r
+ out dx, ax ; Set write plane mask\r
+ mov ax, [mx_BytesPerLine]\r
+ dec ax\r
+ mov cx, [Height]\r
+ .push si, di\r
+@@L1:\r
+ movsb\r
+ add si, ax\r
+ add di, ax\r
+ dec cx\r
+ jnz @@L1\r
+ .pop si, di\r
+ inc si\r
+ inc di\r
+\r
+; Move center block\r
+@@C0:\r
+ mov bx, [Width]\r
+ test bx, bx\r
+ jz @@R0\r
+ mov dx, TS\r
+ mov ax, 0F02h\r
+ out dx, ax ; Enable all planes\r
+ mov ax, [mx_BytesPerLine]\r
+ sub ax, bx\r
+ mov dx, [Height]\r
+ .push si, di\r
+@@C1:\r
+ mov cx, bx ; CX = image width\r
+ rep movsb ; Cannot use "movsw" here!\r
+ add si, ax ; Next scan line\r
+ add di, ax ; Next scan line\r
+ dec dx ; All lines processed?\r
+ jnz @@C1 ; No, continue\r
+ .pop si, di\r
+ add si, bx\r
+ add di, bx\r
+\r
+; Move right block\r
+@@R0:\r
+ mov ah, [RightMask]\r
+ or ah, ah\r
+ jz @@Done\r
+ mov dx, TS\r
+ mov al, 02h\r
+ out dx, ax ; Set write plane mask\r
+ mov ax, [mx_BytesPerLine]\r
+ dec ax\r
+ mov cx, [Height]\r
+@@R1:\r
+ movsb\r
+ add si, ax\r
+ add di, ax\r
+ dec cx\r
+ jnz @@R1\r
+\r
+@@Done:\r
+ mov dx, GDC\r
+ mov ax, 4005h\r
+ out dx, ax ; Restore write mode 0\r
+\r
+@@Exit:\r
+ ret\r
+subMoveBlt ENDP\r
+\r
+;-----------------------------------------------------------\r
+; Moves one plane at a time.\r
+;\r
+subPlaneBlt PROC NEAR\r
+; Compute extra bytes and width count for each plane\r
+ mov cx, [Width]\r
+ mov bx, cx\r
+ shr bx, 1\r
+ shr bx, 1 ; Width for each plane\r
+ and cl, 03h\r
+ mov al, 00001000b\r
+ shr al, cl\r
+ mov si, 3 SHL 1\r
+@@PatchLoop:\r
+ mov PlaneWidth[si], bx\r
+ shr al, 1\r
+ adc bx, 0\r
+ dec si\r
+ dec si\r
+ jge @@PatchLoop\r
+\r
+; Get pixel addresses\r
+ mov ax, [mx_VideoSegment]\r
+ mov ds, ax\r
+ mov es, ax\r
+ mov ax, [SY]\r
+ mul [mx_BytesPerLine]\r
+ mov si, [SX]\r
+ shr si, 1\r
+ shr si, 1\r
+ add si, ax ; DS:SI points to source\r
+ mov [SourceOffset], si\r
+ mov ax, [DestY]\r
+ mul [mx_BytesPerLine]\r
+ mov di, [DestX]\r
+ shr di, 1\r
+ shr di, 1\r
+ add di, ax ; ES:DI points to destination\r
+ mov [DestOffset], di\r
+\r
+; Adjust plane for output to VGA registers\r
+ mov ax, [SX]\r
+ and al, 03h\r
+ mov [ReadPlane], al\r
+ mov cx, [DestX]\r
+ and cl, 03h\r
+ mov al, 00010001b\r
+ shl al, cl\r
+ mov [WritePlane], al\r
+\r
+; Ready to move now\r
+ cld\r
+ mov [Count], 4 ; Four planes\r
+ lea bx, PlaneWidth ; SS:[BX] = width in bytes for plane\r
+@@PlaneLoop:\r
+ cmp WORD PTR ss:[bx], 0\r
+ je @@Done\r
+ mov ah, [WritePlane]\r
+ and ah, 0Fh\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax ; Select write plane\r
+ mov ah, [ReadPlane]\r
+ mov al, 04h\r
+ mov dx, GDC\r
+ out dx, ax ; Select read plane\r
+ mov dx, [Height]\r
+ mov ax, [mx_BytesPerLine]\r
+ sub ax, ss:[bx] ; AX = extra bytes per line\r
+@@Loop:\r
+ mov cx, ss:[bx]\r
+ shr cx, 1\r
+ rep movsw\r
+ rcl cx, 1\r
+ rep movsb\r
+ add si, ax\r
+ add di, ax\r
+ dec dx\r
+ jnz @@Loop ; Repeat for all lines\r
+ inc bx\r
+ inc bx ; Select width for next plane\r
+ inc [ReadPlane]\r
+ and [ReadPlane], 03h ; Should be faster on 386 using\r
+ jnz @@ReadPlaneOk ; BTR and ADC...\r
+ inc [SourceOffset]\r
+@@ReadPlaneOk:\r
+ rol [WritePlane], 1\r
+ adc [DestOffset], 0\r
+ mov si, [SourceOffset]\r
+ mov di, [DestOffset]\r
+ dec [Count]\r
+ jnz @@PlaneLoop ; Repeat for all planes\r
+\r
+@@Done:\r
+ ret\r
+subPlaneBlt ENDP\r
+\r
+mxBitBlt ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXCC.ASM - Fast clip line function\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC xsubClipLine\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+\r
+tblGroups LABEL WORD\r
+ DW 10, tbl00\r
+ DW 10, tbl10\r
+ DW 9, tbl20\r
+ DW -1, 0\r
+ DW 10, tbl40\r
+ DW 10, tbl50\r
+ DW 9, tbl60\r
+ DW -1, 0\r
+ DW 6, tbl80\r
+ DW 6, tbl90\r
+ DW 5, tblA0\r
+ DW -1, 0\r
+ DW -1, 0\r
+ DW -1, 0\r
+ DW -1, 0\r
+ DW -1, 0\r
+tbl00 DW cc00, cc01, cc02, ccFF, cc04, cc05, cc06, ccFF, cc08, cc09, cc0A\r
+tbl10 DW cc10, ccFF, cc12, ccFF, cc14, ccFF, cc16, ccFF, cc18, ccFF, cc1A\r
+tbl20 DW cc20, cc21, ccFF, ccFF, cc24, cc25, ccFF, ccFF, cc28, cc29\r
+tbl40 DW cc40, cc41, cc42, ccFF, ccFF, ccFF, ccFF, ccFF, cc48, cc49, cc4A\r
+tbl50 DW cc50, ccFF, cc52, ccFF, ccFF, ccFF, ccFF, ccFF, cc58, ccFF, cc5A\r
+tbl60 DW cc60, cc61, ccFF, ccFF, ccFF, ccFF, ccFF, ccFF, cc68, cc69\r
+tbl80 DW cc80, cc81, cc82, ccFF, cc84, cc85, cc86\r
+tbl90 DW cc90, ccFF, cc92, ccFF, cc94, ccFF, cc96\r
+tblA0 DW ccA0, ccA1, ccFF, ccFF, ccA4, ccA5\r
+\r
+ccTT: clc\r
+ ret\r
+ccFF: stc\r
+ ret\r
+\r
+; Group 00 -------------------------------------------------\r
+;\r
+cc00:\r
+ clc\r
+ ret\r
+cc01:\r
+ jmp ClipQLeft\r
+cc02:\r
+ jmp ClipQRight\r
+cc04:\r
+ jmp ClipQTop\r
+cc05:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY1]\r
+ jge ccTT\r
+ jmp ClipQTop\r
+cc06:\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY1]\r
+ jge ccTT\r
+ jmp ClipQTop\r
+cc08:\r
+ jmp ClipQBottom\r
+cc09:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY2]\r
+ jle ccTT\r
+ jmp ClipQBottom\r
+cc0A:\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY2]\r
+ jle ccTT\r
+ jmp ClipQBottom\r
+\r
+; Group 10 -------------------------------------------------\r
+;\r
+cc10FF:\r
+ stc\r
+ ret\r
+cc10TT:\r
+ clc\r
+ ret\r
+cc10:\r
+ jmp ClipPLeft\r
+cc12:\r
+ call ClipPLeft\r
+ jmp ClipQRight\r
+cc14:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc10FF\r
+ jmp ClipQTop\r
+cc16:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc10FF\r
+ call ClipQTop\r
+ cmp cx, [mx_ClipX2]\r
+ jle cc10TT\r
+ jmp ClipQRight\r
+cc18:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc10FF\r
+ jmp ClipQBottom\r
+cc1A:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc10FF\r
+ call ClipQBottom\r
+ cmp cx, [mx_ClipX2]\r
+ jle cc10TT\r
+ jmp ClipQRight\r
+\r
+; Group 20 -------------------------------------------------\r
+;\r
+cc20TT:\r
+ clc\r
+ ret\r
+cc20FF:\r
+ stc\r
+ ret\r
+cc20:\r
+ jmp ClipPRight\r
+cc21:\r
+ call ClipPRight\r
+ jmp ClipQLeft\r
+cc24:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc20FF\r
+ jmp ClipQTop\r
+cc25:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc20FF\r
+ call ClipQTop\r
+ cmp cx, [mx_ClipX1]\r
+ jge cc20TT\r
+ jmp ClipQLeft\r
+cc28:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc20FF\r
+ jmp ClipQBottom\r
+cc29:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc20FF\r
+ call ClipQBottom\r
+ cmp cx, [mx_ClipX1]\r
+ jge cc20TT\r
+ jmp ClipQLeft\r
+\r
+; Group 40 -------------------------------------------------\r
+;\r
+cc40TT:\r
+ clc\r
+ ret\r
+cc40FF:\r
+ stc\r
+ ret\r
+cc40:\r
+ jmp ClipPTop\r
+cc41:\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX1]\r
+ jl cc40FF\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY1]\r
+ jge cc40TT\r
+ jmp ClipQTop\r
+cc42:\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX2]\r
+ jg cc40FF\r
+ jmp ClipQRight\r
+cc48:\r
+ call ClipPTop\r
+ jmp ClipQBottom\r
+cc49:\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX1]\r
+ jl cc40FF\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY2]\r
+ jle cc40TT\r
+ jmp ClipQBottom\r
+cc4A:\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX2]\r
+ jg cc40FF\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY2]\r
+ jle cc40TT\r
+ jmp ClipQBottom\r
+\r
+\r
+; Group 50 -------------------------------------------------\r
+;\r
+cc50TT:\r
+ clc\r
+ ret\r
+cc50FF:\r
+ stc\r
+ ret\r
+cc50:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY1]\r
+ jge cc50TT\r
+ jmp ClipPTop\r
+cc52:\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY1]\r
+ jl cc50FF\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX1]\r
+ jge cc50TT\r
+ jmp ClipPLeft\r
+cc58:\r
+ call ClipQBottom\r
+ cmp cx, [mx_ClipX1]\r
+ jl cc50FF\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX1]\r
+ jge cc50TT\r
+ jmp ClipPLeft\r
+cc5A:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc50FF\r
+ call ClipQRight\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc50FF\r
+ cmp si, [mx_ClipY2]\r
+ jle cc50TT\r
+ jmp ClipQBottom\r
+\r
+; Group 60 -------------------------------------------------\r
+;\r
+cc60TT:\r
+ clc\r
+ ret\r
+cc60FF:\r
+ stc\r
+ ret\r
+cc60:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY1]\r
+ jge cc60TT\r
+ jmp ClipPTop\r
+cc61:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY2]\r
+ jl cc60FF\r
+ call ClipPTop\r
+ cmp di, [mx_ClipX2]\r
+ jle cc60TT\r
+ jmp ClipPRight\r
+cc68:\r
+ call ClipQBottom\r
+ cmp cx, [mx_ClipX2]\r
+ jg cc60FF\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY1]\r
+ jge cc60TT\r
+ jmp ClipPTop\r
+cc69:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY1]\r
+ jl cc60FF\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY2]\r
+ jg cc60FF\r
+ cmp si, [mx_ClipY2]\r
+ jle cc69_1\r
+ call ClipQBottom\r
+cc69_1:\r
+ cmp bx, [mx_ClipY1]\r
+ jge cc60TT\r
+ jmp ClipPTop\r
+\r
+; Group 80 -------------------------------------------------\r
+;\r
+cc80TT:\r
+ clc\r
+ ret\r
+cc80FF:\r
+ stc\r
+ ret\r
+cc80:\r
+ jmp ClipPBottom\r
+cc81:\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX1]\r
+ jl cc80FF\r
+ jmp ClipQLeft\r
+cc82:\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX2]\r
+ jg cc80FF\r
+ jmp ClipQRight\r
+cc84:\r
+ call ClipPBottom\r
+ jmp ClipQTop\r
+cc85:\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX1]\r
+ jl cc80FF\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY1]\r
+ jge cc80FF\r
+ jmp ClipQTop\r
+cc86:\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX2]\r
+ jg cc80FF\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY1]\r
+ jge cc80TT\r
+ jmp ClipQTop\r
+\r
+; Group 90 -------------------------------------------------\r
+;\r
+cc90TT:\r
+ clc\r
+ ret\r
+cc90FF:\r
+ stc\r
+ ret\r
+cc90:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY2]\r
+ jle cc90TT\r
+ jmp ClipPBottom\r
+cc92:\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY2]\r
+ jg cc90FF\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX1]\r
+ jge cc90TT\r
+ jmp ClipPLeft\r
+cc94:\r
+ call ClipQTop\r
+ cmp cx, [mx_ClipX1]\r
+ jl cc90FF\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY2]\r
+ jle cc90TT\r
+ jmp ClipPBottom\r
+cc96:\r
+ call ClipPLeft\r
+ cmp bx, [mx_ClipY1]\r
+ jl cc90FF\r
+ call ClipQRight\r
+ cmp si, [mx_ClipY2]\r
+ jg cc90FF\r
+ cmp bx, [mx_ClipY2]\r
+ jle cc96_1\r
+ call ClipPBottom\r
+cc96_1:\r
+ cmp si, [mx_ClipY1]\r
+ jge cc90TT\r
+ jmp ClipQTop\r
+\r
+; Group A0 -------------------------------------------------\r
+;\r
+ccA0TT:\r
+ clc\r
+ ret\r
+ccA0FF:\r
+ stc\r
+ ret\r
+ccA0:\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY2]\r
+ jle ccA0TT\r
+ jmp ClipPBottom\r
+ccA1:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY2]\r
+ jg ccA0FF\r
+ call ClipPBottom\r
+ cmp di, [mx_ClipX2]\r
+ jle ccA0TT\r
+ jmp ClipPRight\r
+ccA4:\r
+ call ClipQTop\r
+ cmp cx, [mx_ClipX2]\r
+ jg ccA0FF\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY2]\r
+ jle ccA0TT\r
+ jmp ClipPBottom\r
+ccA5:\r
+ call ClipQLeft\r
+ cmp si, [mx_ClipY2]\r
+ jg ccA0FF\r
+ call ClipPRight\r
+ cmp bx, [mx_ClipY1]\r
+ jl ccA0FF\r
+ cmp si, [mx_ClipY1]\r
+ jge ccA5_1\r
+ call ClipQTop\r
+ccA5_1:\r
+ cmp bx, [mx_ClipY2]\r
+ jle ccA0TT\r
+ jmp ClipPBottom\r
+\r
+; Y1 = (Y2-Y1)*(mx_ClipX1-X1)/(X2-X1)+Y1 = (SI-BX)*(mx_ClipX1-DI)/(CX-DI)+BX\r
+; X1 = mx_ClipX1\r
+ClipPLeft:\r
+ mov ax, si\r
+ sub ax, bx\r
+ mov dx, [mx_ClipX1]\r
+ sub dx, di\r
+ imul dx\r
+ mov bp, cx\r
+ sub bp, di\r
+ idiv bp\r
+ add bx, ax\r
+ mov di, [mx_ClipX1]\r
+ clc\r
+ ret\r
+\r
+; Y1 = (Y2-Y1)*(mx_ClipX2-X1)/(X2-X1)+Y1 = (SI-BX)*(mx_ClipX2-DI)/(CX-DI)+BX\r
+; X1 = mx_ClipX2\r
+ClipPRight:\r
+ mov ax, si\r
+ sub ax, bx\r
+ mov dx, [mx_ClipX2]\r
+ sub dx, di\r
+ imul dx\r
+ mov bp, cx\r
+ sub bp, di\r
+ idiv bp\r
+ add bx, ax\r
+ mov di, [mx_ClipX2]\r
+ clc\r
+ ret\r
+\r
+; X1 = (X2-X1)*(mx_ClipY2-Y1)/(Y2-Y1)+X1 = (CX-DI)*(mx_ClipY2-BX)/(SI-BX)+DI\r
+; Y1 = mx_ClipY2\r
+ClipPBottom:\r
+ mov ax, cx\r
+ sub ax, di\r
+ mov dx, [mx_ClipY2]\r
+ sub dx, bx\r
+ imul dx\r
+ mov bp, si\r
+ sub bp, bx\r
+ idiv bp\r
+ add di, ax\r
+ mov bx, [mx_ClipY2]\r
+ clc\r
+ ret\r
+\r
+; X1 = (X2-X1)*(mx_ClipY1-Y1)/(Y2-Y1)+X1 = (CX-DI)*(mx_ClipY1-BX)/(SI-BX)+DI\r
+; Y1 = mx_ClipY1\r
+ClipPTop:\r
+ mov ax, cx\r
+ sub ax, di\r
+ mov dx, [mx_ClipY1]\r
+ sub dx, bx\r
+ imul dx\r
+ mov bp, si\r
+ sub bp, bx\r
+ idiv bp\r
+ add di, ax\r
+ mov bx, [mx_ClipY1]\r
+ clc\r
+ ret\r
+\r
+; Y2 = (Y1-Y2)*(mx_ClipX1-X2)/(X1-X2)+Y2 = (BX-SI)*(mx_ClipX1-CX)/(DI-CX)+SI\r
+; X2 = mx_ClipX1\r
+ClipQLeft:\r
+ mov ax, bx\r
+ sub ax, si\r
+ mov dx, [mx_ClipX1]\r
+ sub dx, cx\r
+ imul dx\r
+ mov bp, di\r
+ sub bp, cx\r
+ idiv bp\r
+ add si, ax\r
+ mov cx, [mx_ClipX1]\r
+ clc\r
+ ret\r
+\r
+; Y2 = (Y1-Y2)*(mx_ClipX2-X2)/(X1-X2)+Y2 = (BX-SI)*(mx_ClipX2-CX)/(DI-CX)+SI\r
+; X2 = mx_ClipX1\r
+ClipQRight:\r
+ mov ax, bx\r
+ sub ax, si\r
+ mov dx, [mx_ClipX2]\r
+ sub dx, cx\r
+ imul dx\r
+ mov bp, di\r
+ sub bp, cx\r
+ idiv bp\r
+ add si, ax\r
+ mov cx, [mx_ClipX2]\r
+ clc\r
+ ret\r
+\r
+; X2 = (X1-X2)*(mx_ClipY2-Y2)/(Y1-Y2)+X2 = (DI-CX)*(mx_ClipY2-SI)/(BX-SI)+CX\r
+; Y2 = mx_ClipY1\r
+ClipQBottom:\r
+ mov ax, di\r
+ sub ax, cx\r
+ mov dx, [mx_ClipY2]\r
+ sub dx, si\r
+ imul dx\r
+ mov bp, bx\r
+ sub bp, si\r
+ idiv bp\r
+ add cx, ax\r
+ mov si, [mx_ClipY2]\r
+ clc\r
+ ret\r
+\r
+; X2 = (X1-X2)*(mx_ClipY1-Y2)/(Y1-Y2)+X2 = (DI-CX)*(mx_ClipY1-SI)/(BX-SI)+CX\r
+; Y2 = mx_ClipY1\r
+ClipQTop:\r
+ mov ax, di\r
+ sub ax, cx\r
+ mov dx, [mx_ClipY1]\r
+ sub dx, si\r
+ imul dx\r
+ mov bp, bx\r
+ sub bp, si\r
+ idiv bp\r
+ add cx, ax\r
+ mov si, [mx_ClipY1]\r
+ clc\r
+ ret\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Checks the coordinates of a line against the active\r
+; clip region.\r
+; Uses the Sobkow-Pospisil-Yang (SPY) algorithm: this was\r
+; supposed to be twice as fast as Cohen-Sutherland, but my\r
+; tests show only a very small increase in speed and a noticeable\r
+; increase of the program size! Maybe this is caused by the\r
+; slow speed of VGA cards, so probably a better test should\r
+; be performed with lines drawn in RAM.\r
+;\r
+; Input:\r
+; AX, BX = X1, Y1\r
+; CX, DX = X2, Y2\r
+; Output:\r
+; CF = set if line is full clipped\r
+; AX, BX = clipped X1, Y1\r
+; CX, DX = clipped X2, Y2\r
+; Note:\r
+; destroys SI, DI\r
+;\r
+xsubClipLine PROC NEAR\r
+ push bp\r
+ xor si, si ; SPY code\r
+\r
+ cmp dx, [mx_ClipY2]\r
+ jle @@1\r
+ or si, 08h\r
+ jmp @@2\r
+@@1:\r
+ cmp dx, [mx_ClipY1]\r
+ jge @@2\r
+ or si, 04h\r
+@@2:\r
+\r
+ cmp cx, [mx_ClipX2]\r
+ jle @@3\r
+ or si, 02h\r
+ jmp @@4\r
+@@3:\r
+ cmp cx, [mx_ClipX1]\r
+ jge @@4\r
+ or si, 01h\r
+@@4:\r
+\r
+ cmp bx, [mx_ClipY2]\r
+ jle @@5\r
+ or si, 80h\r
+ jmp @@6\r
+@@5:\r
+ cmp bx, [mx_ClipY1]\r
+ jge @@6\r
+ or si, 40h\r
+@@6:\r
+\r
+ cmp ax, [mx_ClipX2]\r
+ jle @@7\r
+ or si, 20h\r
+ jmp @@8\r
+@@7:\r
+ cmp ax, [mx_ClipX1]\r
+ jge @@8\r
+ or si, 10h\r
+@@8:\r
+\r
+ mov di, si\r
+ and di, 000Fh ; Index of procedure\r
+ and si, 00F0h\r
+ .shr si, 2 ; Index of group (times 4)\r
+ cmp di, cs:tblGroups[si] ; Is index within range?\r
+ jg @@Exit ; No, line is full clipped\r
+ mov si, cs:tblGroups[si+2] ; Get offset of group table\r
+ shl di, 1 ; We must index word elements\r
+ add si, di ; Make full offset\r
+ mov di, ax ; Move X1 to DI and free AX\r
+ mov si, cs:[si] ; Get subroutine address\r
+ xchg dx, si ; Move Y2 to SI and free DX\r
+ call dx ; Call the proper subroutine\r
+ mov ax, di ; Restore AX to X1\r
+ mov dx, si ; Restore DX to Y2\r
+ pop bp\r
+ ret\r
+\r
+@@Exit:\r
+ pop bp\r
+ stc\r
+ ret\r
+xsubClipLine ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXCG.ASM - Color to gray conversion\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxColorToGray\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Converts RGB colors to gray shades.\r
+;\r
+; Input:\r
+; CPal = pointer to color palette\r
+; GPal = pointer to destination (gray) palette\r
+; Count = number of colors to convert\r
+; Output:\r
+; none\r
+;\r
+; Note: CPal and GPal may point to the same buffer.\r
+;\r
+mxColorToGray PROC FAR\r
+ ARG Count:WORD, \\r
+ DPal:DWORD, \\r
+ SPal:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+ mov cx, [Count]\r
+ jcxz @@Exit\r
+ lds si, [SPal]\r
+ les di, [DPal]\r
+ cld\r
+; We use the standard formula\r
+; gray=(red*30 + green*59 + blue*11)/100\r
+; in the equivalent form\r
+; gray=(red*77 + green*151 + blue*28)/256\r
+; which doesn't need the last divide.\r
+ mov bx, 77 SHL 8 + 151\r
+@@Loop:\r
+ lodsb ; Red\r
+ mul bh\r
+ mov dx, ax\r
+ lodsb ; Green\r
+ mul bl\r
+ add dx, ax\r
+ lodsb ; Blue\r
+ mov ah, 28\r
+ mul ah\r
+ add ax, dx\r
+ mov al, ah\r
+ stosw ; Save new RGB\r
+ stosb\r
+ loop @@Loop\r
+\r
+@@Exit:\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxColorToGray ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXCL.ASM - Bresenham circle\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxCircle\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Draws a circle using the Bresenham algorithm.\r
+;\r
+; Input:\r
+; XC, YC = center coordinates\r
+; Radius = circle radius\r
+; Color = circle color\r
+; Output:\r
+; none\r
+; Note:\r
+; computes only points in the first octant, all other\r
+; points are obtained by symmetry.\r
+;\r
+mxCircle PROC FAR\r
+ ARG Color:BYTE:2, \\r
+ Radius:WORD, \\r
+ YC:WORD, \\r
+ XC:WORD = ARG_SIZE\r
+ LOCAL Delta:WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, di\r
+\r
+ xor si, si ; X\r
+ mov di, [Radius] ; Y\r
+ mov ax, 3\r
+ sub ax, di\r
+ sub ax, di\r
+ mov [Delta], ax ; Delta = 3-R*2\r
+\r
+ mov ds, [mx_VideoSegment]\r
+\r
+@@Loop:\r
+ cmp si, di ;\r
+ jg @@Done ; Exit when X > Y\r
+; Draw points\r
+ mov ax, si\r
+ mov bx, di\r
+ call @@subPutPixel\r
+ mov ax, si\r
+ neg ax\r
+ mov bx, di\r
+ call @@subPutPixel\r
+ mov ax, si\r
+ mov bx, di\r
+ neg bx\r
+ call @@subPutPixel\r
+ mov ax, si\r
+ neg ax\r
+ mov bx, di\r
+ neg bx\r
+ call @@subPutPixel\r
+ mov ax, di\r
+ mov bx, si\r
+ call @@subPutPixel\r
+ mov ax, di\r
+ neg ax\r
+ mov bx, si\r
+ call @@subPutPixel\r
+ mov ax, di\r
+ mov bx, si\r
+ neg bx\r
+ call @@subPutPixel\r
+ mov ax, di\r
+ neg ax\r
+ mov bx, si\r
+ neg bx\r
+ call @@subPutPixel\r
+; Moves coordinates to next point\r
+ mov ax, [Delta]\r
+ test ax, ax\r
+ jl @@Next\r
+ mov ax, di\r
+ .shl ax, 2\r
+ sub ax, 4\r
+ sub [Delta], ax\r
+ dec di\r
+@@Next:\r
+ mov ax, si\r
+ .shl ax, 2\r
+ add ax, 6\r
+ add [Delta], ax\r
+ inc si\r
+ jmp @@Loop\r
+\r
+@@Done:\r
+ xor ax, ax\r
+ .pop ds, si, di\r
+ .leave ARG_SIZE\r
+\r
+;---------------------------------------\r
+; Put pixel function.\r
+; Input:\r
+; BX = X coordinate (relative to center)\r
+; AX = Y coordinate (relative to center)\r
+; DS = video segment\r
+@@subPutPixel:\r
+ add bx, [XC] ; Get absolute coordinates\r
+ add ax, [YC]\r
+\r
+ cmp bx, [mx_ClipX1] ; Clip pixel\r
+ jl @@subExit\r
+ cmp bx, [mx_ClipX2]\r
+ jg @@subExit\r
+ cmp ax, [mx_ClipY1]\r
+ jl @@subExit\r
+ cmp ax, [mx_ClipY2]\r
+ jg @@subExit\r
+\r
+ mul [mx_BytesPerLine] ; Get pixel offset\r
+ mov cx, bx ; Save X coordinate\r
+ .shr bx, 2\r
+ add bx, ax ; DS:BX = pixel offset\r
+\r
+ and cl, 3 ; Set write plane\r
+ mov ax, 0102h\r
+ shl ah, cl\r
+ mov dx, TS\r
+ out dx, ax\r
+\r
+ mov al, [Color] ; Write pixel\r
+ mov ds:[bx], al\r
+\r
+@@subExit:\r
+ retn\r
+mxCircle ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXCR.ASM - Clip functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxSetSysClipRegion\r
+PUBLIC mxGetClipRegion\r
+PUBLIC mxSetClipRegion\r
+PUBLIC mxSetClip\r
+PUBLIC mxGetClip\r
+\r
+PUBLIC subClipBox\r
+PUBLIC subClipImage\r
+\r
+PUBLIC mx_ClipX1\r
+PUBLIC mx_ClipY1\r
+PUBLIC mx_ClipX2\r
+PUBLIC mx_ClipY2\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_CodeSegment : WORD\r
+\r
+mx_ClipX1 DW ? ; Clip coordinates\r
+mx_ClipY1 DW ?\r
+mx_ClipX2 DW ?\r
+mx_ClipY2 DW ?\r
+\r
+mx_SysClipX1 DW ? ; System clip coordinates\r
+mx_SysClipY1 DW ? ; (active when mx_ClipStatus is FALSE)\r
+mx_SysClipX2 DW ?\r
+mx_SysClipY2 DW ?\r
+\r
+mx_UserClipX1 DW ? ; User clip coordinates\r
+mx_UserClipY1 DW ? ; (active when mx_ClipStatus is TRUE)\r
+mx_UserClipX2 DW ?\r
+mx_UserClipY2 DW ?\r
+\r
+mx_ClipStatus DB ?\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Toggles clipping between user and system regions.\r
+;\r
+; Input:\r
+; ClipStatus = TRUE (FALSE) to enable (disable) clipping\r
+; Output:\r
+; AX = old clip status\r
+;\r
+mxSetClip PROC FAR\r
+ ARG ClipStatus:BYTE:2 = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [mx_UserClipX1]\r
+ mov bx, [mx_UserClipY1]\r
+ mov cx, [mx_UserClipX2]\r
+ mov dx, [mx_UserClipY2]\r
+ cmp [ClipStatus], TRUE\r
+ je @@Done\r
+ mov ax, [mx_SysClipX1]\r
+ mov bx, [mx_SysClipY1]\r
+ mov cx, [mx_SysClipX2]\r
+ mov dx, [mx_SysClipY2]\r
+@@Done:\r
+ mov [mx_ClipX1], ax\r
+ mov [mx_ClipY1], bx\r
+ mov [mx_ClipX2], cx\r
+ mov [mx_ClipY2], dx\r
+\r
+ mov al, [ClipStatus]\r
+ xchg al, [mx_ClipStatus]\r
+ xor ah, ah\r
+\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetClip ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current clipping status.\r
+;\r
+; Input:\r
+; none\r
+; Output:\r
+; TRUE (FALSE) if clipping enabled (disabled)\r
+;\r
+mxGetClip PROC FAR\r
+ ASSUME ds:NOTHING\r
+ mov al, [mx_ClipStatus]\r
+ xor ah, ah\r
+ ret\r
+mxGetClip ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the system clip region and disables user clipping.\r
+;\r
+; Input:\r
+; Width = width in pixels of clip region\r
+; Height = height in pixels of clip region\r
+; Output:\r
+; old clip status.\r
+;\r
+mxSetSysClipRegion PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ xor ax, ax ; Sys clip region always starts at (0,0)\r
+ mov [mx_SysClipX1], ax\r
+ mov [mx_SysClipY1], ax\r
+ mov ax, [Width]\r
+ dec ax\r
+ mov [mx_SysClipX2], ax\r
+ mov ax, [Height]\r
+ dec ax\r
+ mov [mx_SysClipY2], ax\r
+\r
+ IF USE286 EQ TRUE\r
+ push FALSE\r
+ ELSE\r
+ mov ax, FALSE\r
+ push ax\r
+ ENDIF\r
+ call mxSetClip\r
+\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetSysClipRegion ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the clip region.\r
+;\r
+; Input:\r
+; X, Y = coordinates of top left corner of clip region\r
+; Width = width in pixels of clip region\r
+; Height = height in pixels of clip region\r
+; Output:\r
+; none (no checking on parameters)\r
+;\r
+mxSetClipRegion PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [X]\r
+ mov [mx_UserClipX1], ax\r
+ mov ax, [Y]\r
+ mov [mx_UserClipY1], ax\r
+ mov ax, [Width]\r
+ add ax, [X]\r
+ dec ax\r
+ mov [mx_UserClipX2], ax\r
+ mov ax, [Height]\r
+ add ax, [Y]\r
+ dec ax\r
+ mov [mx_UserClipY2], ax\r
+\r
+ mov al, [mx_ClipStatus]\r
+ cmp al, TRUE\r
+ jne @@Exit\r
+ push ax\r
+ call mxSetClip\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetClipRegion ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current user clip region.\r
+;\r
+; Input:\r
+; X, Y = pointers to integer coordinates of top left corner\r
+; Width = pointer to word width of clip region\r
+; Height = pointer to word height of clip region\r
+; Output:\r
+; AX = current clip status\r
+;\r
+mxGetClipRegion PROC FAR\r
+ ARG Height:DWORD, \\r
+ Width:DWORD, \\r
+ Y:DWORD, \\r
+ X:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push es, di\r
+\r
+ mov ax, [mx_UserClipX1]\r
+ les di, [X]\r
+ mov es:[di], ax\r
+ mov ax, [mx_UserClipY1]\r
+ les di, [Y]\r
+ mov es:[di], ax\r
+\r
+ mov ax, [mx_UserClipX2]\r
+ sub ax, [mx_UserClipX1]\r
+ inc ax\r
+ les di, [Width]\r
+ mov es:[di], ax\r
+ mov ax, [mx_UserClipY2]\r
+ sub ax, [mx_UserClipY1]\r
+ inc ax\r
+ les di, [Height]\r
+ mov es:[di], ax\r
+\r
+ mov al, [mx_ClipStatus]\r
+ xor ah, ah\r
+ .pop es, di\r
+ .leave ARG_SIZE\r
+mxGetClipRegion ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Internal use: checks the coordinates of a rectangle against\r
+; the active clip region.\r
+; This function assumes that a "raw" image has to be clipped,\r
+; so it returns in SI the number of "raw" bytes to skip if\r
+; X, Y were clipped.\r
+;\r
+; Input:\r
+; BX, AX = X, Y coordinates of rectangle (signed)\r
+; CX = box width\r
+; DX = box height\r
+; Output:\r
+; CF = set if rectangle is full clipped\r
+; BX, AX = new X, Y coordinates of rectangle\r
+; CX, DX = clipped width and height\r
+; SI = number of bytes to skip before copying a buffer\r
+; DI destroyed\r
+;\r
+subClipImage PROC NEAR\r
+ ASSUME ds:NOTHING\r
+ xor si, si\r
+\r
+; Check clip height\r
+ mov di, [mx_ClipY1]\r
+ cmp ax, di\r
+ jge @@CheckBottom\r
+ sub di, ax ; Number of lines to clip\r
+ sub dx, di ; New box height\r
+ jle @@Exit\r
+ mov ax, di\r
+ mov di, dx ; Save box height into DI\r
+ mul cx ; DX:AX = number of bytes to skip\r
+ mov si, ax\r
+ mov dx, di ; Restore box height\r
+ mov ax, [mx_ClipY1]\r
+@@CheckBottom:\r
+ mov di, [mx_ClipY2]\r
+ cmp ax, di\r
+ jg @@Exit\r
+ inc di\r
+ sub di, dx\r
+ sub di, ax\r
+ jge @@DoneHeight ; None, continue\r
+ add dx, di ; Clip lines\r
+@@DoneHeight:\r
+\r
+; Check clip width\r
+@@CheckLeft:\r
+ mov di, [mx_ClipX1]\r
+ cmp bx, di\r
+ jge @@CheckRight\r
+ sub di, bx ; Number of columns to clip left\r
+ sub cx, di\r
+ jle @@Exit\r
+ add si, di ; Update skip count\r
+ mov bx, [mx_ClipX1]\r
+@@CheckRight:\r
+ mov di, [mx_ClipX2]\r
+ cmp bx, di\r
+ jg @@Exit\r
+ inc di\r
+ sub di, bx\r
+ sub di, cx\r
+ jge @@DoneWidth ; None, exit\r
+ add cx, di ; New box width\r
+@@DoneWidth:\r
+\r
+; Set return flag and exit\r
+@@Done:\r
+ clc\r
+ ret\r
+@@Exit:\r
+ stc\r
+ ret\r
+subClipImage ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Internal use: checks the coordinates of a rectangle against\r
+; the active clip region.\r
+;\r
+; Input:\r
+; BX, AX = X, Y coordinates of rectangle (signed)\r
+; CX = box width\r
+; DX = box height\r
+; Output:\r
+; CF = set if rectangle is full clipped\r
+; BX, AX = new X, Y coordinates of rectangle\r
+; CX, DX = clipped width and height\r
+; DI destroyed\r
+;\r
+subClipBox PROC NEAR\r
+ ASSUME ds:NOTHING\r
+\r
+; Check clip height\r
+ mov di, [mx_ClipY1]\r
+ cmp ax, di\r
+ jge @@CheckBottom\r
+ sub di, ax ; Number of lines to clip\r
+ sub dx, di ; New box height\r
+ jle @@Exit\r
+ mov ax, [mx_ClipY1]\r
+@@CheckBottom:\r
+ mov di, [mx_ClipY2]\r
+ cmp ax, di\r
+ jg @@Exit\r
+ inc di\r
+ sub di, dx\r
+ sub di, ax ; Clipped some point?\r
+ jge @@DoneHeight ; No, continue\r
+ add dx, di ; Clip lines (DI is negative)\r
+@@DoneHeight:\r
+\r
+; Check clip width\r
+@@CheckLeft:\r
+ mov di, [mx_ClipX1]\r
+ cmp bx, di\r
+ jge @@CheckRight\r
+ sub di, bx ; Number of columns to clip left\r
+ sub cx, di\r
+ jle @@Exit\r
+ mov bx, [mx_ClipX1]\r
+@@CheckRight:\r
+ mov di, [mx_ClipX2]\r
+ cmp bx, di\r
+ jg @@Exit\r
+ inc di\r
+ sub di, bx\r
+ sub di, cx ; Clipped some point?\r
+ jge @@DoneWidth ; No, exit\r
+ add cx, di ; New box width (DI is negative)\r
+@@DoneWidth:\r
+\r
+; Set return flag and exit\r
+@@Done:\r
+ clc\r
+ ret\r
+@@Exit:\r
+ stc\r
+ ret\r
+subClipBox ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXEL.ASM - Mid-point ellipse\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxEllipse\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Draws an ellipse using the mid-point algorithm.\r
+;\r
+; Input:\r
+; XC, YC = center coordinates\r
+; A = horizontal radius\r
+; B = vertical radius\r
+; Color = ellipse color\r
+; Output:\r
+; none\r
+; Note:\r
+; computes only points in the first quadrant, all other\r
+; points are obtained by symmetry.\r
+;\r
+mxEllipse PROC FAR\r
+ ARG Color:BYTE:2, \\r
+ B:WORD, \\r
+ A:WORD, \\r
+ YC:WORD, \\r
+ XC:WORD = ARG_SIZE\r
+ LOCAL A2:DWORD, \\r
+ B2:DWORD, \\r
+ CC:DWORD, \\r
+ DD:DWORD, \\r
+ X:DWORD, \\r
+ Y:DWORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, di\r
+\r
+ .chk386 mxEllipse, @@Exit\r
+\r
+; Initialize variables\r
+ xor eax, eax\r
+ mov [X], ax ; X = 0\r
+ mov ax, [A]\r
+ mul eax ; EAX = A*A\r
+ mov [DD], eax ; DD = A*A\r
+ shl eax, 1\r
+ mov [CC], eax ; CC = 2*A*A\r
+ shl eax, 1\r
+ mov [A2], eax ; A2 = 4*A*A\r
+ movzx edx, [B]\r
+ mov [Y], edx\r
+ mul edx ; EAX = 4*A*A*B\r
+ sub [DD], eax ; DD = A*A - 4*A*A*B\r
+ movzx eax, [B]\r
+ mul eax ; EAX = B*B\r
+ shl eax, 2 ; EAX = 4*B*B\r
+ mov [B2], eax ; B2 = 4*B*B\r
+ add [CC], eax ; CC = 2*A*A + 4*B*B\r
+ add [D1], eax ; DD = A*A - 4*A*A*B + 4*B*B\r
+\r
+; Draw initial points\r
+ call subPlot4\r
+\r
+; First loop\r
+@@Loop1:\r
+ mov eax, [X] ; Check slope\r
+ mul [B2]\r
+ mov ecx, eax\r
+ mov eax, [Y]\r
+ mul [A2]\r
+ sub eax, ecx\r
+ sub eax, [CC] ; EAX = Y*A2 - X*B2 - CC\r
+ jle @@Done1 ; Crossed critical point, jump to next loop\r
+\r
+ mov ecx, [DD] ; Get error\r
+ test ecx, ecx ; Positive?\r
+ jl @@Draw1 ; No, use default step\r
+\r
+ mov eax, 1\r
+ sub eax, [Y]\r
+ mul [A2]\r
+ shl eax, 1\r
+ add ecx, eax ; Bump error\r
+ dec WORD PTR [Y] ; Decrement Y coordinate\r
+\r
+@@Draw1:\r
+ mov eax, [X]\r
+ shl eax, 1\r
+ add eax, 3\r
+ mul [B2]\r
+ add ecx, eax ; Bump error\r
+ mov [DD], ecx ; Save error\r
+ inc WORD PTR [X] ; Increment X coordinate\r
+\r
+ call subPlot4 ; Draw points\r
+ jmp @@Loop1\r
+@@Done1:\r
+\r
+; Initialize variables\r
+ shr [B2], 2\r
+ mov eax, [X]\r
+ mul eax\r
+ add [X]\r
+ shl eax, 2\r
+ inc eax\r
+ mul [B2]\r
+ mov [DD], eax\r
+ mov eax, [Y]\r
+ mul eax\r
+ add [Y]\r
+ dec eax\r
+ add [Y]\r
+ sub eax, [B2]\r
+ add [DD], eax\r
+ shl [B2], 3\r
+ inc WORD PTR [X]\r
+\r
+; Second loop\r
+@@Loop2:\r
+ cmp WORD PTR [Y], 0\r
+ ja @@Done2\r
+\r
+ mov ecx, [DD]\r
+ test ecx, ecx\r
+ jge @@Draw2\r
+\r
+ mov eax, [X]\r
+ inc eax\r
+ mul [B2]\r
+ add ecx, eax\r
+ inc WORD PTR [X]\r
+\r
+@@Draw2:\r
+ mov eax, [Y]\r
+ shl eax, 1\r
+ sub eax, 3\r
+ neg eax\r
+ imul [A2]\r
+ add ecx, eax\r
+ dec WORD PTR [Y]\r
+\r
+ call subPlot4\r
+ jmp @@Loop2\r
+@@Done2:\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .leave ARG_SIZE\r
+mxEllipse ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXFB.ASM - Fill box function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxFillBox\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN subClipBox : NEAR\r
+EXTRN subHorizontalLineInfo : NEAR\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Raster op functions. Raster op is limited to OP_MOVE,\r
+; OP_AND, OP_OR and OP_XOR. The VGA hardware is used to\r
+; perform the selected logical functions on up to four\r
+; pixel at a time.\r
+;\r
+subRepFill PROC NEAR\r
+ mov ah, al\r
+ shr cx, 1\r
+ rep stosw\r
+ rcl cx, 1\r
+ rep stosb\r
+ ret\r
+subRepFill ENDP\r
+;\r
+subFill PROC NEAR\r
+@@Loop:\r
+ mov ds:[bx], al\r
+ add bx, dx\r
+ loop @@Loop\r
+ ret\r
+subFill ENDP\r
+;\r
+subRepMove PROC NEAR\r
+ mov si, di\r
+@@Loop:\r
+ mov ah, ds:[si] ; Dummy read to latch the data\r
+ mov ds:[si], al\r
+ inc si\r
+ loop @@Loop\r
+ ret\r
+subRepMove ENDP\r
+;\r
+subMove PROC NEAR\r
+@@Loop:\r
+ mov ah, ds:[bx] ; Dummy read to latch the data\r
+ mov ds:[bx], al\r
+ add bx, dx\r
+ loop @@Loop\r
+ ret\r
+subMove ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Fills a rectangle with a specified color.\r
+;\r
+; Input:\r
+; X, Y = X, Y coordinates of rectangle\r
+; Width = width of rectangle\r
+; Height = height of rectangle\r
+; Color = fill color\r
+; Op = raster operator\r
+; Output:\r
+; none\r
+;\r
+; Note: raster op is limited to OP_MOVE, OP_AND, OP_OR and OP_XOR.\r
+;\r
+mxFillBox PROC FAR\r
+ ARG Op:WORD, \\r
+ Color:BYTE:2, \\r
+ Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ LOCAL LeftMask:BYTE, \\r
+ RightMask:BYTE, \\r
+ FillFunction:WORD, \\r
+ RepFillFunction:WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Clip rectangle\r
+ mov bx, [X]\r
+ mov ax, [Y]\r
+ mov cx, [Width]\r
+ mov dx, [Height]\r
+ call subClipBox\r
+ jc @@Exit ; Full clipped\r
+\r
+ mov [Height], dx ; Save clipped height\r
+ call subHorizontalLineInfo ; Get additional info, init DI\r
+ mov [Width], cx\r
+ mov [LeftMask], al\r
+ mov [RightMask], ah\r
+\r
+; Initialize segments\r
+ mov ax, [mx_VideoSegment]\r
+ mov es, ax ; ES:DI points to pixel\r
+ mov ds, ax\r
+ cld ; Clear direction flag\r
+\r
+; Select fill functions\r
+ mov [FillFunction], OFFSET subFill\r
+ mov [RepFillFunction], OFFSET subRepFill\r
+ mov ax, [Op] ; Get raster op\r
+ cmp al, OP_XOR\r
+ ja @@1 ; Assume it's a fill\r
+ cmp al, OP_MOVE\r
+ je @@1\r
+ .shl al, 3\r
+ mov ah, al\r
+ mov al, 03h\r
+ mov dx, GDC\r
+ out dx, ax ; Set GDC logical function\r
+ mov [FillFunction], OFFSET subMove\r
+ mov [RepFillFunction], OFFSET subRepMove\r
+@@1:\r
+\r
+; Fill left block\r
+@@L0:\r
+ mov ah, [LeftMask]\r
+ or ah, ah\r
+ jz @@C0 ; Nothing to do, go to center block\r
+ mov dx, TS\r
+ mov al, 02h\r
+ out dx, ax ; Set write plane mask\r
+ mov dx, [mx_BytesPerLine]\r
+ mov cx, [Height]\r
+ mov bx, di\r
+ mov al, [Color]\r
+ call [FillFunction] ; Fill this column\r
+ inc di ; Update starting video offset\r
+\r
+; Fill center block\r
+@@C0:\r
+ mov cx, [Width]\r
+ jcxz @@R0 ; Nothing to do, go to right block\r
+ mov dx, TS\r
+ mov ax, 0F02h\r
+ out dx, ax ; Write to all planes\r
+ mov al, [Color]\r
+ mov bx, di\r
+ mov dx, [Height]\r
+ push di ; Save pixel address\r
+@@C1:\r
+ mov di, bx ; Update video offset\r
+ call [RepFillFunction] ; Fill current scan line\r
+ mov cx, [Width] ; Restore byte count\r
+ add bx, [mx_BytesPerLine] ; Bump to next scan line\r
+ dec dx ; Done all lines?\r
+ jnz @@C1 ; No, continue\r
+ pop di ; Restore pixel address\r
+ add di, [Width] ; Go to right block\r
+\r
+; Fill right block\r
+@@R0:\r
+ mov ah, [RightMask]\r
+ or ah, ah\r
+ jz @@Done ; Nothing to do, exit\r
+ mov dx, TS\r
+ mov al, 02h\r
+ out dx, ax ; Set write plane mask\r
+ mov dx, [mx_BytesPerLine]\r
+ mov cx, [Height]\r
+ mov bx, di\r
+ mov al, [Color]\r
+ call [FillFunction] ; Fill this column\r
+\r
+; Restore VGA registers\r
+@@Done:\r
+ mov dx, GDC\r
+ mov ax, 0003h\r
+ out dx, ax ; Set logical function to "move"\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxFillBox ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXFP.ASM - Fade palette function\r
+; Copyright (c) 1992-1994 ARTIS s.r.l.\r
+; Author: Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxFadePalette\r
+\r
+MAXCOLOR EQU 256\r
+FADE_IN EQU 0\r
+FADE_OUT EQU 1\r
+\r
+; The actual speed of fading depends on the number of passes (FADE_SPEED) and\r
+; the delay between two consecutive passes (FADE_DELAY). Below are the\r
+; default values, used when no parameters are specified.\r
+;\r
+FADE_DELAY EQU 1 ; Vert. retraces between video updates\r
+FADE_SPEED EQU 48 ; Speed of effect (max 127)\r
+\r
+; Bit field record for fade commands\r
+;\r
+FADE_COMMAND RECORD fpDELAY:8,fpSPEED:7,fpDIRECTION:1\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+DB 'Copyright (c) 1992-1994 ARTIS s.r.l. All rights reserved.'\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Fades a VGA palette.\r
+;\r
+; Input:\r
+; Buffer = pointer to source/destination palette\r
+; Command = fading direction and optional parameters\r
+; Start = index of first color to fade\r
+; Count = number of color to fade\r
+; Red = destination red\r
+; Green = destination green\r
+; Blue = destination blue\r
+; Output:\r
+; none\r
+; Notes:\r
+; - about 1.5 Kbytes of stack space are needed for internal buffers;\r
+; - the Command argument usually is 0 to fade in and 1 to fade out,\r
+; however additional parameters may be specified. To set the effect\r
+; speed, i.e. the number of iterations needed to completely fade a\r
+; palette, shift the value one bit left and "or" it with the\r
+; direction bit (range is 0..127). To set the delay between two\r
+; consecutive passes, shift it eight bits left (range is 0..255).\r
+;\r
+mxFadePalette PROC FAR\r
+ ARG bBlue:WORD, \\r
+ bGreen:WORD, \\r
+ bRed:WORD, \\r
+ wCount:WORD, \\r
+ wStartIdx:WORD, \\r
+ wCommand:WORD, \\r
+ vfpPalette:DWORD = ARG_SIZE\r
+ LOCAL bSPalette:BYTE:MAXCOLOR*3, \\r
+ bDPalette:BYTE:MAXCOLOR*3, \\r
+ bLoopIndex:BYTE, \\r
+ bLoopStep:BYTE, \\r
+ bLoopCount:BYTE, \\r
+ wDelay:WORD, \\r
+ wSpeed:WORD = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push si, di, ds, es ; Save registers\r
+;\r
+; Check parameters and setup variables\r
+;\r
+@@GetDelay:\r
+ mov [wDelay], FADE_DELAY ; Set default delay\r
+ mov ax, [wCommand] ; Get command word\r
+ and ax, MASK fpDELAY ; Mask delay command\r
+ jz @@GetSpeed ; No command, get speed\r
+ IF USE286 EQ TRUE\r
+ shr ax, fpDELAY\r
+ ELSE\r
+ mov cl, fpDELAY ; Get size of delay field\r
+ shr ax, cl ; Right justify the field\r
+ ENDIF\r
+ mov [wDelay], ax ; Set new delay\r
+\r
+@@GetSpeed:\r
+ mov ax, [wCommand] ; Get command\r
+ and ax, MASK fpSPEED ; Mask speed\r
+ IF USE286 EQ TRUE\r
+ shr ax, fpSPEED\r
+ ELSE\r
+ mov cl, fpSPEED ; Get size of speed field\r
+ shr ax, cl ; Right justify the field\r
+ ENDIF\r
+ or ax, ax ; Any speed specified?\r
+ jnz @@SetVariables ; Yes, set variables\r
+ mov ax, FADE_SPEED ; Set default speed\r
+\r
+@@SetVariables:\r
+ mov [wSpeed], ax ; Set speed\r
+ inc ax ; Number of iterations\r
+ mov [bLoopCount], al ; Set loop count\r
+ mov [bLoopStep], 1 ; Assume we're fading in\r
+ mov [bLoopIndex], 0\r
+;\r
+; Check bounds for bad values\r
+;\r
+ mov ax, [wStartIdx] ; Get first index\r
+ cmp ax, MAXCOLOR ; Is in the valid range?\r
+ jae @@Exit ; No, exit\r
+ add ax, [wCount] ; Get last index\r
+ cmp ax, MAXCOLOR ; Is in the valid range?\r
+ jbe @@BoundsOk ; Yes, continue\r
+ mov ax, MAXCOLOR\r
+ sub ax, [wStartIdx]\r
+ mov [wCount], ax ; Set count to maximum value\r
+ or ax, ax\r
+ jz @@Exit ; Nothing to do, exit\r
+@@BoundsOk:\r
+;\r
+; Copy the source palette in a local array: if we fade in it's ready to\r
+; use, otherwise we'll overwrite it later\r
+;\r
+ mov cx, [wCount]\r
+ mov ax, cx\r
+ shl ax, 1\r
+ add cx, ax ; CX = wCount * 3\r
+ mov ax, ss\r
+ mov es, ax\r
+ lea di, [bSPalette] ; ES:DI points to local palette\r
+ mov ax, [wStartIdx]\r
+ mov si, ax\r
+ shl ax, 1\r
+ add ax, si\r
+ lds si, [vfpPalette] ; DS:SI points to user palette\r
+ add si, ax ; Skip unused entries\r
+ cld\r
+ shr cx, 1\r
+ rep movsw\r
+ rcl cx, 1\r
+ rep movsb\r
+;\r
+; Check direction\r
+;\r
+ test [wCommand], MASK fpDIRECTION ; Are we fading in?\r
+ jz @@Main ; Yes, ok to continue\r
+ mov ax, [wSpeed] ; Get speed\r
+ mov [bLoopIndex], al ; Exchange first and last index\r
+ mov [bLoopStep], -1 ; Move backward\r
+ mov ax, ss ; Overwrite our copy of\r
+ mov ds, ax ; user palette with the\r
+ mov es, ax ; current active palette\r
+ lea di, [bSPalette]\r
+ mov ax, [wStartIdx]\r
+ mov cx, [wCount]\r
+ call ReadPalette ; Read current palette\r
+;\r
+; Prepare variables and registers for fading\r
+;\r
+@@Main:\r
+ mov bh, BYTE PTR [bRed] ; Destination red\r
+ and bh, 00111111b ; Be sure it's a valid VGA value\r
+ mov bl, BYTE PTR [bGreen] ; Destination green\r
+ and bl, 00111111b ; Be sure it's a valid VGA value\r
+ mov dh, BYTE PTR [bBlue] ; Destination blue\r
+ and dh, 00111111b ; Be sure it's a valid VGA value\r
+ mov dl, [bLoopIndex] ; Loop index\r
+ mov ax, ss ; All tables are stored\r
+ mov ds, ax ; in the stack segment,\r
+ mov es, ax ; set DS and ES\r
+;\r
+; Main loop\r
+;\r
+@@Loop:\r
+ mov ax, [wCount] ; Store count in AX\r
+ mov cx, [wSpeed] ; Set maximum speed in CX\r
+ lea si, [bSPalette] ; DS:SI points to source palette\r
+ lea di, [bDPalette] ; ES:DI points to dest. palette\r
+ call RecalcPalette ; Build a faded palette\r
+\r
+ .push bx, dx ; Save registers we need\r
+ lea si, [bDPalette] ; DS:SI points to palette\r
+ mov ax, [wStartIdx] ; First index to write\r
+ mov bx, [wCount] ; Total entries to write\r
+ mov cx, [wDelay] ; Fade delay between updates\r
+ call WritePalette ; Write palette\r
+ .pop bx, dx ; Restore BX and DX\r
+\r
+ add dl, [bLoopStep] ; Change fade intensity\r
+ dec [bLoopCount] ; Done?\r
+ jnz @@Loop ; No, loop again\r
+\r
+@@Exit:\r
+ .pop si, di, ds, es ; Restore registers\r
+ .leave ARG_SIZE\r
+mxFadePalette ENDP\r
+\r
+;------- INTERNAL USE ONLY ------------------------------------------------\r
+;\r
+; Calculates a partially faded palette.\r
+;\r
+; Input:\r
+; AX = number of entries in palette\r
+; CX = maximum fade intensity (same as fade speed)\r
+; DS:SI = pointer to source palette\r
+; ES:DI = pointer to destination palette\r
+; BH = destination red\r
+; BL = destination green\r
+; DH = destination blue\r
+; DL = relative intensity of destination palette\r
+; Note:\r
+; it's important that a new palette can be calculated in less\r
+; than 1/70th of second. Fading to any RGB value requires use\r
+; of "imul" instructions: "idiv" may be replaced with faster\r
+; "sar", but only when the number of passes is a power of two,\r
+; thus reducing the range of selectable speeds.\r
+; In both cases an extimate of CPU cycles required by this\r
+; procedure shows that it's too slow to run on a 4.77 Mhz 8086\r
+; CPU and a 256 color palette, so we keep "idiv" and hope\r
+; the target machine to be at least a 6 Mhz 80286 (that's not\r
+; asking too much...).\r
+;\r
+RecalcPalette PROC NEAR\r
+ cld\r
+ push bp ; Save BP\r
+ mov bp, ax ; Copy counter in BP\r
+@@Loop:\r
+ lodsb ; Red: read value\r
+ sub al, bh ; Subtract destination value\r
+ imul dl ; Scale to desired weight\r
+ idiv cl ; Put value in AL\r
+ add al, bh ; Add destination value...\r
+ stosb ; ...and store it\r
+ lodsb ; Green: read value\r
+ sub al, bl ; Subtract destination value\r
+ imul dl ; Scale to desired weight\r
+ idiv cl ; Put value in AL\r
+ add al, bl ; Add destination value...\r
+ stosb ; ...and store it\r
+ lodsb ; Blue: read value\r
+ sub al, dh ; Subtract destination value\r
+ imul dl ; Scale to desired weight\r
+ idiv cl ; Put value in AL\r
+ add al, dh ; Add destination value...\r
+ stosb ; ...and store it\r
+ dec bp\r
+ jnz @@Loop\r
+ pop bp ; Restore BP\r
+ ret\r
+RecalcPalette ENDP\r
+\r
+;------- INTERNAL USE ONLY ------------------------------------------------\r
+;\r
+; Writes a 256 color palette.\r
+;\r
+; Input:\r
+; AX = index of first color to write\r
+; BX = number of colors to write (each color is an RGB triplet)\r
+; CX = number of vertical retraces to wait before writing to DACs\r
+; DS:SI = pointer to first entry of palette\r
+;\r
+WritePalette PROC NEAR\r
+ ASSUME ds:NOTHING\r
+ mov ah, al ; Save index\r
+ mov dx, 03DAh ; Input status register\r
+@@Delay1:\r
+ in al, dx\r
+ test al, 08h\r
+ jnz @@Delay1 ; Wait for display mode\r
+@@Delay2:\r
+ in al, dx\r
+ test al, 08h\r
+ jz @@Delay2 ; Wait for vertical retrace mode\r
+ loop @@Delay1 ; Repeat CX times\r
+@@Write:\r
+ mov cx, bx ; Get number of colors\r
+ mov dx, 03C8h ; PEL write address register\r
+ mov al, ah ; Restore index\r
+ out dx, al ; Select index of first color\r
+ inc dx ; PEL data register\r
+ cld ; Move forward\r
+ cli ; Disable interrupts\r
+@@Loop:\r
+ lodsb\r
+ out dx, al ; Red\r
+ lodsb\r
+ out dx, al ; Green\r
+ lodsb\r
+ out dx, al ; Blue\r
+ loop @@Loop ; Loop until done\r
+ sti ; Enable interrupts\r
+ ret\r
+WritePalette ENDP\r
+\r
+;------- INTERNAL USE ONLY ------------------------------------------------\r
+;\r
+; Reads the current palette.\r
+;\r
+; Input:\r
+; AX = index of first color to read\r
+; CX = number of colors\r
+; ES:DI = pointer to destination buffer\r
+;\r
+ReadPalette PROC NEAR\r
+ mov dx, 03C7h\r
+ out dx, al\r
+ inc dx\r
+ inc dx\r
+ cld\r
+@@Loop:\r
+ in al, dx\r
+ stosb\r
+ in al, dx\r
+ stosb\r
+ in al, dx\r
+ stosb\r
+ loop @@Loop\r
+ ret\r
+ReadPalette ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXGC.ASM - Get color function\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGetColor\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current setting of the selected DAC register.\r
+;\r
+; Input:\r
+; Index = color index (0-255)\r
+; R, G, B = byte pointers to red, green and blue\r
+; Output:\r
+; none\r
+;\r
+mxGetColor PROC FAR\r
+ ARG B:DWORD, \\r
+ G:DWORD, \\r
+ R:DWORD, \\r
+ Index:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ mov ax, [Index]\r
+ mov dx, 3C7h ; PEL read address register\r
+ out dx, al\r
+ inc dx\r
+ inc dx\r
+\r
+ lds si, [R]\r
+ in al, dx\r
+ mov ds:[si], al\r
+ lds si, [G]\r
+ in al, dx\r
+ mov ds:[si], al\r
+ lds si, [B]\r
+ in al, dx\r
+ mov ds:[si], al\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetColor ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXGI.ASM - Get image\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGetImage\r
+\r
+EXTRN subClipImage : NEAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Copies an image from screen to memory.\r
+;\r
+; Input:\r
+; Image = pointer to buffer for image\r
+; X, Y = coordinates of image on screen\r
+; Width = width of image in pixels\r
+; Height = height of image in pixels\r
+; Output:\r
+; none\r
+;\r
+mxGetImage PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD, \\r
+ Image:DWORD = ARG_SIZE\r
+ LOCAL PlaneWidth:WORD:4, \\r
+ PixelOffset:WORD, \\r
+ MoveFunction:WORD, \\r
+ ReadPlane:BYTE, \\r
+ Count:BYTE = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+; Clip image\r
+ mov bx, [X]\r
+ mov ax, [Y]\r
+ mov cx, [Width]\r
+ mov dx, [Height]\r
+ call subClipImage\r
+ jc @@Exit ; Full clipped\r
+ mov [Height], dx\r
+ add WORD PTR Image[0], si ; Skip clipped pixels\r
+\r
+; Get pixel address\r
+ mul [mx_BytesPerLine]\r
+ mov si, bx\r
+ shr si, 1\r
+ shr si, 1\r
+ add si, ax\r
+ mov [PixelOffset], si\r
+ mov ds, [mx_VideoSegment] ; DS:SI points to pixel\r
+ and bl, 03h\r
+ mov [ReadPlane], bl\r
+\r
+; Compute extra bytes and width count for each plane\r
+ mov bx, cx\r
+ shr bx, 1\r
+ shr bx, 1 ; Width for each plane\r
+ and cl, 03h\r
+ mov al, 00001000b\r
+ shr al, cl\r
+ mov di, 3 SHL 1\r
+@@PatchLoop:\r
+ mov PlaneWidth[di], bx\r
+ shr al, 1\r
+ adc bx, 0\r
+ dec di\r
+ dec di\r
+ jge @@PatchLoop\r
+\r
+; Get image\r
+ cld\r
+ mov [Count], 4 ; Four planes\r
+ lea bx, PlaneWidth ; SS:[BX] = width in bytes for plane\r
+ mov es, WORD PTR Image[2] ; ES:DI will point to image\r
+ mov ah, [ReadPlane]\r
+@@PlaneLoop:\r
+ cmp WORD PTR ss:[bx], 0 ; Exit if nothing more to do\r
+ je @@Exit ; (also, never try to move zero bytes!)\r
+ mov di, WORD PTR Image[0]\r
+ mov al, 04h\r
+ mov dx, GDC\r
+ out dx, ax ; Select read plane\r
+ mov dx, [Height]\r
+ mov si, [PixelOffset] ; DS:SI points to video memory\r
+@@Loop:\r
+ .push si, di\r
+ mov cx, WORD PTR ss:[bx] ; Number of bytes to move\r
+@@MoveLoop:\r
+ movsb\r
+ add di, 3\r
+ dec cx\r
+ jnz @@MoveLoop\r
+ .pop si, di\r
+ add di, [Width] ; Go to next image line\r
+ add si, [mx_BytesPerLine] ; Go to next screen row\r
+ dec dx\r
+ jnz @@Loop ; Repeat for all lines\r
+ inc bx\r
+ inc bx ; Select width for next plane\r
+ inc ah\r
+ test ah, 04h ; Plane wraparound?\r
+ jz @@PlaneOk ; No\r
+ inc [PixelOffset] ; Yes, bump video pointer\r
+ and ah, 03h\r
+@@PlaneOk:\r
+ inc WORD PTR Image[0]\r
+ dec [Count]\r
+ jnz @@PlaneLoop ; Repeat for all planes\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxGetImage ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXGM.ASM - Gamma correction\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGammaCorrect\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+mx_tblGamma LABEL BYTE\r
+ DB 00, 10, 14, 17, 19, 21, 23, 24, 26, 27, 28, 29, 31, 32, 33, 34\r
+ DB 35, 36, 37, 37, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, 46\r
+ DB 47, 48, 48, 49, 49, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55\r
+ DB 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Correct palette colors (gamma is 2.3).\r
+;\r
+; Input:\r
+; CPal = pointer to color palette\r
+; GPal = pointer to destination (gamma corrected) palette\r
+; Count = number of colors to convert\r
+; Output:\r
+; none\r
+;\r
+; Note: CPal and GPal may point to the same buffer.\r
+;\r
+mxGammaCorrect PROC FAR\r
+ ARG Count:WORD, \\r
+ DPal:DWORD, \\r
+ SPal:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+ mov cx, [Count]\r
+ jcxz @@Exit ; Exit now if nothing to do\r
+ lds si, [SPal]\r
+ les di, [DPal]\r
+ mov bx, OFFSET mx_tblGamma ; Setup BX for XLAT instruction\r
+ cld\r
+ mov ax, cx ; AX = Count\r
+ add cx, cx ; CX = Count*2\r
+ add cx, ax ; CX = Count*3\r
+@@Loop:\r
+ lodsb\r
+ xlat mx_tblGamma\r
+ stosb\r
+ loop @@Loop\r
+\r
+@@Exit:\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxGammaCorrect ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXGP.ASM - Get palette function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGetPalette\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current setting of the VGA palette.\r
+;\r
+; Input:\r
+; Buffer = pointer to palette data (R,G,B)\r
+; Start = index of first color to get\r
+; Count = number of color to get\r
+; Output:\r
+; none\r
+;\r
+mxGetPalette PROC FAR\r
+ ARG Count:WORD, \\r
+ Start:WORD, \\r
+ Buffer:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push es, di\r
+\r
+ les di, [Buffer]\r
+ mov cx, [Count]\r
+ mov ax, [Start]\r
+ mov dx, 3C7h ; PEL read address register\r
+ out dx, al\r
+ inc dx\r
+ inc dx\r
+ cld\r
+@@Loop:\r
+ in al, dx\r
+ stosb\r
+ in al, dx\r
+ stosb\r
+ in al, dx\r
+ stosb\r
+ loop @@Loop ; Loop until done\r
+\r
+ .pop es, di\r
+ .leave ARG_SIZE\r
+mxGetPalette ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXGV.ASM - Get version function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGetVersion\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the library version.\r
+;\r
+mxGetVersion PROC FAR\r
+ mov ax, MXVERSION\r
+ ret\r
+mxGetVersion ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXHL.ASM - Horizontal line mask utility\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC subHorizontalLineInfo\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+tblLeftSize DW 00h, 03h, 02h, 01h\r
+tblLeftMask DB 00h, 0Eh, 0Ch, 08h\r
+tblRightMask DB 00h, 01h, 03h, 07h\r
+tblPatchMask DB 02h, 06h\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Prepares register for fast horizontal line drawing.\r
+;\r
+; Input:\r
+; BX, AX = X, Y address of left pixel\r
+; CX = line width\r
+; Output:\r
+; DI = left pixel offset in video memory\r
+; AL = left block write plane mask (0 = none)\r
+; AH = right block write plane mask (0 = none)\r
+; CX = center block width in 4-pixel blocks\r
+;\r
+subHorizontalLineInfo PROC NEAR\r
+ ASSUME ds:NOTHING\r
+\r
+ mul [mx_BytesPerLine]\r
+ mov di, bx\r
+ shr di, 1\r
+ shr di, 1\r
+ add di, ax ; Offset of left pixel\r
+\r
+ and bx, 03h\r
+ mov al, tblLeftMask[bx]\r
+ shl bx, 1\r
+ sub cx, tblLeftSize[bx]\r
+ jge @@1 ; Ok to continue\r
+\r
+; Special case: start and end in the middle of a 4-pixel block.\r
+; There are only three cases:\r
+; Pixels Left mask CX CX+2 Patch mask Result\r
+; 1) ..o. ..xx -1 1 .xx. ..x.\r
+; 2) .oo. .xxx -1 1 .xx. .xx.\r
+; 3) .o.. .xxx -2 0 .x.. .x..\r
+; All other cases are automatically handled with the standard masks.\r
+ mov bx, cx\r
+ inc bx\r
+ inc bx\r
+ and al, tblPatchMask[bx] ; Combine masks\r
+ xor ah, ah ; No right block\r
+ xor cx, cx ; No center block\r
+ jmp @@Exit\r
+\r
+@@1:\r
+ mov bx, cx\r
+ and bx, 03h\r
+ mov ah, tblRightMask[bx]\r
+ shr cx, 2\r
+\r
+@@Exit:\r
+ ret\r
+subHorizontalLineInfo ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXIT.ASM - Initialization/termination functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxInit\r
+PUBLIC mxTerm\r
+\r
+PUBLIC mx_VideoSegment\r
+PUBLIC mx_CodeSegment\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+DB 'MODEX library - Copyright (c) 1992-1994 Alessandro Scotti'\r
+\r
+mx_VideoSegment DW 0A000h\r
+mx_CodeSegment DW SEG MX_TEXT\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Initialization.\r
+;\r
+; Input:\r
+; none\r
+; Output:\r
+; AX = 0 on success\r
+;\r
+mxInit PROC FAR\r
+ LOCAL Result:WORD, \\r
+ VideoSeg:WORD, \\r
+ CStoDSalias:WORD = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+ mov [Result], -1 ; Assume an error\r
+ mov [VideoSeg], 0A000h ; Real mode video segment\r
+ mov [CStoDSalias], cs ; Real mode data alias for CS\r
+\r
+; Check if running in protected mode under DPMI\r
+ mov ax, 1686h\r
+ int 2Fh\r
+ or ax, ax\r
+ jnz @@1 ; DPMI not found, continue in real mode\r
+\r
+; Get a data alias for CS\r
+ mov ax, 000Ah ; DMPI: create data alias\r
+ mov bx, cs\r
+ int 31h\r
+ jc @@Exit ; Exit if service failed\r
+ mov [CStoDSalias], ax ; Save data alias for CS\r
+; Get a protected-mode selector for the video segment\r
+ mov ax, 0002h\r
+ mov bx, 0A000h ; Real mode segment of video\r
+ int 31h ; DPMI: get segment selector\r
+ jc @@Exit ; Exit if service failed\r
+ mov [VideoSeg], ax ; Save protected mode video selector\r
+\r
+; Initialize variables\r
+@@1:\r
+ mov ds, [CStoDSalias]\r
+ ASSUME ds:MX_TEXT\r
+ mov [mx_CodeSegment], ds\r
+ mov ax, [VideoSeg]\r
+ mov [mx_VideoSegment], ax\r
+\r
+; Don't bother with VGA check for now...\r
+\r
+ mov [Result], 0\r
+\r
+@@Exit:\r
+ mov ax, [Result]\r
+ .pop ds, si, es, di\r
+ .leave\r
+mxInit ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Termination.\r
+;\r
+; Input:\r
+; none\r
+; Output:\r
+; always 0.\r
+;\r
+mxTerm PROC FAR\r
+ ASSUME ds:NOTHING\r
+ xor ax, ax\r
+ ret\r
+mxTerm ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXLL.ASM - Load latches\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxLoadLatches\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Loads the specified value into the VGA latches.\r
+;\r
+; Input:\r
+; BL = value to load into latches\r
+; Output:\r
+; none\r
+; Changes:\r
+; bit mask register to FFh;\r
+; function select register to "move";\r
+; write mode to 00h.\r
+; Note:\r
+; this is for internal use only.\r
+;\r
+mxLoadLatches PROC NEAR\r
+ ASSUME ds:NOTHING\r
+\r
+ .push ds, si\r
+ mov dx, GDC\r
+ mov ax, 0FF08h\r
+ out dx, ax ; Set bit mask to FFh\r
+ mov ax, 0003h\r
+ out dx, ax ; Set function to "move"\r
+ mov ax, 0005h\r
+ out dx, ax ; Set write mode\r
+ mov ax, [mx_VideoSegment]\r
+ mov ds, ax\r
+ mov si, 0FFFFh\r
+ mov bh, 8 ; BH = write plane mask\r
+ mov cx, 3 ; CX = count = read plane\r
+; Saves old values and force BL into latches\r
+@@SetLoop:\r
+ mov dx, GDC\r
+ mov al, 04h\r
+ mov ah, cl\r
+ out dx, ax ; Select read plane\r
+ mov dx, TS\r
+ mov al, 02h\r
+ mov ah, bh\r
+ out dx, ax ; Select write plane\r
+ mov al, ds:[si]\r
+ push ax\r
+ mov ds:[si], bl\r
+ mov al, ds:[di] ; Force value into latch\r
+ shr bh, 1 ; Next write plane\r
+ loop @@SetLoop\r
+; Restore previous values\r
+ mov cx, 3\r
+ mov bh, 8\r
+ mov dx, TS\r
+@@ResetLoop:\r
+ mov al, 02h\r
+ mov ah, bh\r
+ out dx, ax ; Select write plane\r
+ pop ax\r
+ mov ds:[si], al\r
+ shr bh, 1 ; Next write plane\r
+ loop @@ResetLoop\r
+; Exit\r
+ .pop ds, si\r
+ ret\r
+mxLoadLatches ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXLN.ASM - Line function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxLine\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+\r
+tblDrawFunc LABEL WORD\r
+ DW subWidthMove\r
+ DW subHeightMove\r
+ DW subWidthOp\r
+ DW subHeightOp\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Draws a line from (X1,Y1) to (X2,Y2) using the Bresenham\r
+; algorithm.\r
+;\r
+; Input:\r
+; X1, Y1 = start point\r
+; X2, Y2 = end point\r
+; Color = line color\r
+; Op = raster operator\r
+; Output:\r
+; none\r
+;\r
+; Note: the end point (X2,Y2) *IS* drawed. I don't like this very much\r
+; but clipping is much simpler.\r
+;\r
+mxLine PROC FAR\r
+ ARG Op:WORD, \\r
+ Color:WORD, \\r
+ Y2:WORD, \\r
+ X2:WORD, \\r
+ Y1:WORD, \\r
+ X1:WORD = ARG_SIZE\r
+ LOCAL Width:WORD, \\r
+ Height:WORD, \\r
+ ErrorAdd:WORD, \\r
+ ErrorSub:WORD, \\r
+ DeltaX:WORD, \\r
+ DeltaY:WORD, \\r
+ P1:BYTE, \\r
+ P2:BYTE, \\r
+ WritePlane:BYTE = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, di\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ax, [X1]\r
+ mov bx, [Y1]\r
+ mov cx, [X2]\r
+ mov dx, [Y2]\r
+ call subClipLine\r
+ jc @@Exit ; Line is full clipped\r
+\r
+; Get width\r
+ mov si, cx\r
+ xchg ax, si ; SI = X1, AX = X2\r
+ sub ax, si\r
+ jge @@1\r
+; Swap points, we want X1 < X2\r
+ xchg si, cx ; Swap X1 and X2\r
+ xchg bx, dx ; Swap Y1 and Y2\r
+ neg ax\r
+@@1:\r
+ mov [Width], ax\r
+\r
+; Get height\r
+ mov cx, [mx_BytesPerLine] ; We don't need X2 anymore\r
+ mov ax, dx\r
+ sub ax, bx\r
+ jge @@2\r
+ neg cx ; Move from bottom to top\r
+ neg ax ; Get absolute value of AX\r
+@@2:\r
+ mov [Height], ax\r
+ mov [DeltaY], cx\r
+\r
+; Get pixel address and write plane\r
+ mov ax, bx\r
+ mul [mx_BytesPerLine]\r
+ mov cx, si ; CX = X1\r
+ shr si, 1\r
+ shr si, 1\r
+ add si, ax ; SI = pixel offset\r
+ and cl, 03h\r
+ mov ax, 1102h\r
+ shl ah, cl\r
+ mov [WritePlane], ah\r
+ mov dx, TS\r
+ out dx, ax ; Set write plane\r
+ mov ax, [mx_VideoSegment]\r
+ mov ds, ax ; DS:SI points to (X1,Y1)\r
+\r
+; Select the function to handle the drawing loop\r
+ xor bx, bx\r
+ mov al, BYTE PTR [Op]\r
+ cmp al, OP_MOVE\r
+ je @@3\r
+ and al, 03h\r
+ shl al, 1\r
+ shl al, 1\r
+ shl al, 1\r
+ mov ah, al\r
+ mov al, 03h\r
+ mov dx, GDC\r
+ out dx, ax ; Set logical function\r
+ inc bx\r
+ inc bx\r
+@@3:\r
+ mov ax, [Width]\r
+ mov cx, [Height]\r
+; Horizontal, vertical and diagonal lines are not optimized yet\r
+ cmp ax, cx\r
+ jae @@4\r
+ inc bx\r
+@@4:\r
+ shl bx, 1\r
+ call tblDrawFunc[bx]\r
+\r
+; Reset logical function if needed\r
+ cmp BYTE PTR [Op], OP_MOVE\r
+ je @@Exit\r
+ mov ax, 0003h\r
+ mov dx, GDC\r
+ out dx, ax\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, di\r
+ .leave ARG_SIZE\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Checks the coordinates of a line against the active\r
+; clip region.\r
+; Uses a variation of the Cohen-Sutherland algorithm developed\r
+; by Victor Duvanenko.\r
+;\r
+; Input:\r
+; AX, BX = X1, Y1\r
+; CX, DX = X2, Y2\r
+; Output:\r
+; CF = set if line is full clipped\r
+; AX, BX = clipped X1, Y1\r
+; CX, DX = clipped X2, Y2\r
+; Note:\r
+; destroys SI, DI\r
+;\r
+subClipLine PROC NEAR\r
+ mov di, ax ; Copy X1 to DI and free AX\r
+ mov si, dx ; Copy Y2 to SI and free DX\r
+; Compute clip codes for point (X2,Y2)=(CX,SI)\r
+ xor al, al\r
+@@P2X1: cmp cx, [mx_ClipX1]\r
+ jge @@P2X2\r
+ or al, 1\r
+@@P2X2: cmp cx, [mx_ClipX2]\r
+ jle @@P2Y1\r
+ or al, 2\r
+@@P2Y1: cmp si, [mx_ClipY1]\r
+ jge @@P2Y2\r
+ or al, 4\r
+@@P2Y2: cmp si, [mx_ClipY2]\r
+ jle @@P2XY\r
+ or al, 8\r
+@@P2XY: mov [P2], al\r
+; Compute clip codes for point (X1,Y1)=(DI,BX)\r
+ xor al, al\r
+@@P1X1: cmp di, [mx_ClipX1]\r
+ jge @@P1X2\r
+ or al, 1\r
+@@P1X2: cmp di, [mx_ClipX2]\r
+ jle @@P1Y1\r
+ or al, 2\r
+@@P1Y1: cmp bx, [mx_ClipY1]\r
+ jge @@P1Y2\r
+ or al, 4\r
+@@P1Y2: cmp bx, [mx_ClipY2]\r
+ jle @@P1XY\r
+ or al, 8\r
+@@P1XY: mov [P1], al\r
+; Check codes for trivial cases\r
+ mov ah, [P2]\r
+ test al, ah ; Is line invisible?\r
+ jnz @@FullClip ; Yes, exit\r
+ or ah, al ; Both points clipped?\r
+ jz @@Done ; Yes, exit\r
+; Calculate deltas\r
+ mov ax, cx\r
+ sub ax, di\r
+ mov [DeltaX], ax\r
+ mov ax, si\r
+ sub ax, bx\r
+ mov [DeltaY], ax\r
+ mov al, [P1] ; Init clipping code\r
+; Clipping loop\r
+@@ClipLoop:\r
+ test al, al ; Is first point clipped?\r
+ jnz @@ClipX1 ; No, continue\r
+ xchg cx, di ; Swap points...\r
+ xchg bx, si\r
+ xchg al, [P2] ; ...and codes\r
+; Clip left: Y1 = Y1 + DeltaY*(mx_ClipX1-X1)/DeltaX\r
+@@ClipX1:\r
+ test al, 1\r
+ jz @@ClipX2\r
+ mov ax, [mx_ClipX1]\r
+ sub ax, di\r
+ mov di, [mx_ClipX1]\r
+ jmp @@ClipX1X2\r
+; Clip right: Y1 = Y1 + DeltaY*(mx_ClipX2-X1)/DeltaX\r
+@@ClipX2:\r
+ test al, 2\r
+ jz @@ClipY1\r
+ mov ax, [mx_ClipX2]\r
+ sub ax, di\r
+ mov di, [mx_ClipX2]\r
+@@ClipX1X2:\r
+ imul [DeltaY]\r
+ idiv [DeltaX]\r
+ add bx, ax\r
+ mov al, 8\r
+ cmp bx, [mx_ClipY2]\r
+ jg @@CheckLoop\r
+ mov al, 4\r
+ cmp bx, [mx_ClipY1]\r
+ jl @@CheckLoop\r
+ xor al, al\r
+ jmp @@CheckLoop\r
+; Clip top: X1 = X1 + DeltaX*(mx_ClipY1-Y1)/DeltaY\r
+@@ClipY1:\r
+ test al, 4\r
+ jz @@ClipY2\r
+ mov ax, [mx_ClipY1]\r
+ sub ax, bx\r
+ mov bx, [mx_ClipY1]\r
+ jmp @@ClipY1Y2\r
+; Clip bottom: X1 = X1 + DeltaX*(mx_ClipY2-Y1)/DeltaY\r
+@@ClipY2:\r
+ mov ax, [mx_ClipY2]\r
+ sub ax, bx\r
+ mov bx, [mx_ClipY2]\r
+@@ClipY1Y2:\r
+ imul [DeltaX]\r
+ idiv [DeltaY]\r
+ add di, ax\r
+ mov al, 1\r
+ cmp di, [mx_ClipX1]\r
+ jl @@CheckLoop\r
+ mov al, 2\r
+ cmp di, [mx_ClipX2]\r
+ jg @@CheckLoop\r
+ xor al, al\r
+@@CheckLoop:\r
+ mov ah, [P2]\r
+ test al, ah\r
+ jnz @@FullClip\r
+ or ah, al\r
+ jnz @@ClipLoop\r
+\r
+@@Done:\r
+ mov ax, di\r
+ mov dx, si\r
+ clc\r
+ ret\r
+@@FullClip:\r
+ stc\r
+ ret\r
+subClipLine ENDP\r
+\r
+; Called when Width >= Height and Op = OP_MOVE\r
+subWidthMove PROC NEAR\r
+ mov di, ax\r
+ neg di ; Initialize error term\r
+ shl cx, 1\r
+ mov [ErrorAdd], cx\r
+ mov cx, ax\r
+ shl ax, 1\r
+ mov [ErrorSub], ax\r
+ mov al, 02h\r
+ mov ah, [WritePlane]\r
+ mov bl, BYTE PTR [Color]\r
+ mov dx, TS\r
+ inc cx\r
+@@Loop:\r
+ mov ds:[si], bl\r
+ dec cx\r
+ jz @@Exit\r
+ rol ah, 1\r
+ adc si, 0\r
+ out dx, ax\r
+ add di, [ErrorAdd]\r
+ jl @@Loop\r
+ add si, [DeltaY]\r
+ sub di, [ErrorSub]\r
+ jmp @@Loop\r
+@@Exit:\r
+ ret\r
+subWidthMove ENDP\r
+\r
+; Called when Width < Height and Op = OP_MOVE\r
+subHeightMove PROC NEAR\r
+ mov di, cx\r
+ neg di ; Initialize error term\r
+ shl ax, 1\r
+ mov [ErrorAdd], ax\r
+ mov ax, cx\r
+ shl ax, 1\r
+ mov [ErrorSub], ax\r
+ mov bl, BYTE PTR [Color]\r
+ mov ah, [WritePlane]\r
+ mov al, 02h\r
+ mov dx, TS\r
+ inc cx\r
+@@Loop:\r
+ mov ds:[si], bl\r
+ dec cx\r
+ jz @@Exit\r
+ add si, [DeltaY]\r
+ add di, [ErrorAdd]\r
+ jl @@Loop\r
+ rol ah, 1 ; Next write plane\r
+ adc si, 0 ; Bump video offset if plane overflows\r
+ out dx, ax\r
+ sub di, [ErrorSub] ; Adjust error down\r
+ jmp @@Loop\r
+@@Exit:\r
+ ret\r
+subHeightMove ENDP\r
+\r
+; Called when Width >= Height and Op <> OP_MOVE\r
+subWidthOp PROC NEAR\r
+ mov di, ax\r
+ neg di ; Initialize error term\r
+ shl cx, 1\r
+ mov [ErrorAdd], cx\r
+ mov cx, ax\r
+ shl ax, 1\r
+ mov [ErrorSub], ax\r
+ mov al, 02h\r
+ mov ah, [WritePlane]\r
+ mov bl, BYTE PTR [Color]\r
+ mov dx, TS\r
+ inc cx\r
+@@Loop:\r
+ mov bh, ds:[si] ; Latch data\r
+ mov ds:[si], bl\r
+ dec cx\r
+ jz @@Exit\r
+ rol ah, 1\r
+ adc si, 0\r
+ out dx, ax\r
+ add di, [ErrorAdd]\r
+ jl @@Loop\r
+ add si, [DeltaY]\r
+ sub di, [ErrorSub]\r
+ jmp @@Loop\r
+@@Exit:\r
+ ret\r
+subWidthOp ENDP\r
+\r
+; Called when Width < Height and Op <> OP_MOVE\r
+subHeightOp PROC NEAR\r
+ mov di, cx\r
+ neg di ; Initialize error term\r
+ shl ax, 1\r
+ mov [ErrorAdd], ax\r
+ mov ax, cx\r
+ shl ax, 1\r
+ mov [ErrorSub], ax\r
+ mov bl, BYTE PTR [Color]\r
+ mov ah, [WritePlane]\r
+ mov al, 02h\r
+ mov dx, TS\r
+ inc cx\r
+@@Loop:\r
+ mov bh, ds:[si]\r
+ mov ds:[si], bl\r
+ dec cx\r
+ jz @@Exit\r
+ add si, [DeltaY]\r
+ add di, [ErrorAdd]\r
+ jl @@Loop\r
+ rol ah, 1 ; Next write plane\r
+ adc si, 0 ; Bump video offset if plane overflows\r
+ out dx, ax\r
+ sub di, [ErrorSub] ; Adjust error down\r
+ jmp @@Loop\r
+@@Exit:\r
+ ret\r
+subHeightOp ENDP\r
+\r
+mxLine ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXOT.ASM - Text functions\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES ; We use the reserved name 'WIDTH'\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxOutChar\r
+PUBLIC mxOutText\r
+PUBLIC mxSetFont\r
+PUBLIC mxSetTextColor\r
+PUBLIC mxGetTextStep\r
+PUBLIC mxSetTextStep\r
+\r
+MAX_WIDTH EQU 16 ; Must be <= 16\r
+MAX_HEIGHT EQU 32\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_CodeSegment : WORD\r
+EXTRN mxPutImage : FAR\r
+\r
+; Default 8x8 font\r
+fnt_Default LABEL\r
+ INCLUDE DEFAULT.FNT\r
+\r
+; Table of system fonts\r
+tbl_SystemFont LABEL WORD\r
+ DW fnt_Default, 8, 8\r
+\r
+MX_MAXSYSFONT EQU ($-OFFSET tbl_SystemFont) SHR 2\r
+\r
+mx_FontPtr DW OFFSET fnt_Default, SEG MX_TEXT\r
+mx_FontWidth DW 8 ; Font width in pixels\r
+mx_FontHeight DW 8 ; Font height in pixels\r
+mx_FontCharSize DW 8 ; Size in bytes of a font character\r
+mx_FontColor DW 00FFh ; Color: foreground + background*256\r
+mx_FontOp DW OP_MOVE ; Raster op\r
+mx_DeltaX DW 8 ; Horizontal step\r
+mx_DeltaY DW 0 ; Vertical step\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the current font.\r
+;\r
+; Input:\r
+; Font = pointer to font data\r
+; Width = width of font character in pixels\r
+; Height = height of font character in pixels\r
+; Output:\r
+; AX = 0 on success, else invalid parameters\r
+;\r
+; Note: when the high word of Font (i.e. the segment) is zero, the low\r
+; word is used to select one of the system fonts.\r
+;\r
+mxSetFont PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD, \\r
+ Font:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, WORD PTR Font[2] ; Get font segment\r
+ test ax, ax ; Null segment?\r
+ jnz @@UserFont ; No, install user font\r
+\r
+; Install system font\r
+ mov ax, WORD PTR Font[0] ; Get font number\r
+ cmp ax, MX_MAXSYSFONT ; Check range\r
+ jb @@SystemFont\r
+ xor ax, ax ; Out of range, use default font\r
+@@SystemFont:\r
+ shl ax, 1\r
+ shl ax, 1\r
+ mov bx, ax\r
+ mov ax, tbl_SystemFont[bx] ; Get font offset\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov WORD PTR mx_FontPtr[2], cs\r
+ mov al, BYTE PTR tbl_SystemFont[bx+2]\r
+ xor ah, ah\r
+ mov [mx_FontWidth], ax\r
+ mov [mx_DeltaX], ax\r
+ mov dl, BYTE PTR tbl_SystemFont[bx+3]\r
+ xor dh, dh\r
+ mov [mx_FontHeight], dx\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov [mx_DeltaX], ax\r
+ xor ax, ax\r
+ mov [mx_DeltaY], ax\r
+ jmp @@Exit\r
+\r
+; Install user font\r
+@@UserFont:\r
+ mov ax, -1 ; Assume an error\r
+ mov bx, [Width]\r
+ cmp bx, MAX_WIDTH\r
+ ja @@Exit ; Invalid character width\r
+ mov dx, [Height]\r
+ cmp dx, MAX_HEIGHT\r
+ ja @@Exit ; Invalid character height\r
+ mov [mx_FontWidth], bx\r
+ mov [mx_FontHeight], dx\r
+ mov ax, bx\r
+ add ax, 7\r
+ .shr ax, 3\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov ax, WORD PTR Font[0]\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov ax, WORD PTR Font[2]\r
+ mov WORD PTR mx_FontPtr[2], ax\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ .leave ARG_SIZE\r
+mxSetFont ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the text color and raster op.\r
+;\r
+; Input:\r
+; Color = text color (foreground + background*256)\r
+; Op = raster op\r
+; Output:\r
+; none\r
+;\r
+mxSetTextColor PROC FAR\r
+ ARG Op:WORD, \\r
+ Color:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [Color]\r
+ mov [mx_FontColor], ax\r
+ mov ax, [Op]\r
+ mov [mx_FontOp], ax\r
+\r
+ xor ax, ax\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ .leave ARG_SIZE\r
+mxSetTextColor ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a character using the current font and attributes.\r
+;\r
+; Input:\r
+; X, Y = video coordinates\r
+; C = character to print\r
+; Output:\r
+; none\r
+;\r
+mxOutChar PROC FAR\r
+ ARG C:BYTE:2, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ LOCAL Image:BYTE:MAX_WIDTH*MAX_HEIGHT, \\r
+ Count:WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Gets the pointer to font data for the selected character\r
+ lds si, DWORD PTR [mx_FontPtr]\r
+ mov al, [C]\r
+ xor ah, ah\r
+ mul [mx_FontCharSize] ; Offset into font\r
+ add si, ax ; DS:SI -> font data for character\r
+\r
+; Converts font data into a 256-color linear image\r
+ mov ax, ss\r
+ mov es, ax\r
+ lea di, [Image]\r
+ mov dx, [mx_FontColor]\r
+ mov ax, [mx_FontHeight]\r
+ mov [Count], ax\r
+@@HeightLoop:\r
+ mov cx, [mx_FontWidth]\r
+ mov bh, ds:[si]\r
+ inc si ; Get a byte from font data\r
+ cmp cx, 8\r
+ jbe @@WidthLoop ; Ok for width <= 8\r
+ mov bl, ds:[si] ; Get another byte\r
+ inc si\r
+@@WidthLoop:\r
+ mov al, dl ; Assume foreground color\r
+ shl bx, 1 ; Is font bit set?\r
+ jc @@1 ; Yes, foreground is just great\r
+ mov al, dh ; Get background color\r
+@@1:\r
+ mov es:[di], al ; Put pixel into image\r
+ inc di\r
+ dec cx\r
+ jnz @@WidthLoop\r
+ dec [Count]\r
+ jnz @@HeightLoop\r
+\r
+; Now pass image to mx_PutImage\r
+ lea ax, [Image]\r
+ push es\r
+ push ax ; Pointer to image\r
+ push [X]\r
+ push [Y] ; Image coordinates\r
+ push [mx_FontWidth]\r
+ push [mx_FontHeight] ; Image size\r
+ push [mx_FontOp] ; Raster op\r
+ call mxPutImage ; Write character\r
+\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxOutChar ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a string at the coordinates specified.\r
+;\r
+; Input:\r
+; X, Y = text coordinates\r
+; S = pointer to ASCIIZ string\r
+; Output:\r
+; none\r
+;\r
+mxOutText PROC FAR\r
+ ARG S:DWORD, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ lds si, [S]\r
+@@Loop:\r
+ mov al, ds:[si]\r
+ test al, al ; End of string?\r
+ jz @@Exit ; Yes, exit\r
+ inc si\r
+ push [X] ; Display character\r
+ push [Y]\r
+ push ax\r
+ call mxOutChar\r
+ mov ax, [mx_DeltaX]\r
+ add [X], ax ; Bump X coordinate\r
+ mov ax, [mx_DeltaY]\r
+ add [Y], ax ; Bump Y coordinate\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+ ret\r
+mxOutText ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = horizontal distance in pixels\r
+; DeltaY = vertical distance in pixels\r
+; Output:\r
+; none\r
+;\r
+; Note: this function may be used to set the text direction.\r
+;\r
+mxSetTextStep PROC FAR\r
+ ARG DeltaY:WORD, \\r
+ DeltaX:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [DeltaX]\r
+ mov [mx_DeltaX], ax\r
+ mov ax, [DeltaY]\r
+ mov [mx_DeltaY], ax\r
+\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetTextStep ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Gets the current distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = pointer to horizontal distance in pixels (integer)\r
+; DeltaY = pointer to vertical distance in pixels (integer)\r
+; Output:\r
+; none\r
+;\r
+mxGetTextStep PROC FAR\r
+ ARG DeltaY:DWORD, \\r
+ DeltaX:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ax, [mx_DeltaX]\r
+ lds si, [DeltaX]\r
+ mov ds:[si], ax\r
+ mov ax, [mx_DeltaY]\r
+ lds si, [DeltaY]\r
+ mov ds:[si], ax\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetTextStep ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPB.ASM - Scan buffer for convex polygon fills\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mx_ScanBuffer\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+ALIGN 4\r
+\r
+mx_ScanBuffer LABEL\r
+ DW POLYSCANBUFSIZE DUP(?)\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPG.ASM - Convex polygon fill\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxFillPoly\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; "Local" definitions\r
+;\r
+TPOINT STRUC\r
+ X DW ?\r
+ Y DW ?\r
+TPOINT ENDS\r
+\r
+; Do NOT change order!\r
+TSCAN STRUC\r
+ Y1 DW ?\r
+ Y2 DW ?\r
+TSCAN ENDS\r
+\r
+MAXSCANCOLUMNS EQU POLYSCANBUFSIZE / SIZE TSCAN\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_CodeSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+EXTRN mx_ScanBuffer : NEAR\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Scans an edge using the DDA (digital differential analyzer) algorithm.\r
+;\r
+; Input:\r
+; DS:BX = pointer to start point (X1, Y1)\r
+; DS:SI = pointer to end point (X2, Y2)\r
+; ES:DI = pointer to edge buffer\r
+; Output:\r
+; ES:DI = updated pointer to edge buffer\r
+; Notes:\r
+; must preserve DS:SI.\r
+;\r
+subScan PROC NEAR\r
+ mov cx, ds:[si].X\r
+ sub cx, ds:[bx].X ; Get width\r
+ jg @@1\r
+ ret\r
+@@1:\r
+ push bp ; Save BP\r
+\r
+ mov ax, ds:[si].Y\r
+ mov bx, ds:[bx].Y\r
+ sub ax, bx ; Get height\r
+ jg @@T2B ; Scan top to bottom\r
+ jl @@B2T ; Scan bottom to top\r
+\r
+; Special case: vertical line\r
+ mov ax, bx\r
+@@V:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ dec cx\r
+ jnz @@V\r
+ jmp @@Exit\r
+\r
+; Scan top to bottom\r
+@@T2B:\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx ; BP:BX = fixed 16:16 step\r
+ mov dx, 8000h\r
+@@T2BLoop:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ add dx, bx\r
+ adc ax, bp\r
+ dec cx\r
+ jnz @@T2BLoop\r
+ jmp @@Exit\r
+\r
+; Scan bottom to top\r
+@@B2T:\r
+ neg ax\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx\r
+ mov dx, 8000h\r
+@@B2TLoop:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ sub dx, bx\r
+ sbb ax, bp\r
+ dec cx\r
+ jnz @@B2TLoop\r
+\r
+@@Exit:\r
+ pop bp ; Restore BP\r
+ ret\r
+subScan ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Fills a convex polygon with the specified color.\r
+;\r
+; Input:\r
+; Count = number of vertexes\r
+; Map = indexes of points and colors (integer)\r
+; Points = array of points (integer X, Y coordinates)\r
+; Color = base color\r
+; Output:\r
+; none\r
+; Notes:\r
+; vertexes must be in counterclockwise order, arrays are 0-based.\r
+;\r
+mxFillPoly PROC FAR\r
+ ARG Color:WORD, \\r
+ Points:DWORD, \\r
+ Map:DWORD, \\r
+ Count:WORD = ARG_SIZE\r
+ LOCAL WritePlane:BYTE:2, \\r
+ ScanOffsetT:WORD, \\r
+ ScanOffsetB:WORD, \\r
+ ScanCount:WORD, \\r
+ Holder:WORD, \\r
+ Height:WORD, \\r
+ MinIdxT:WORD, \\r
+ MinIdxB:WORD, \\r
+ MaxIdx:WORD, \\r
+ Width:WORD, \\r
+ BoxX1:WORD, \\r
+ BoxY1:WORD, \\r
+ BoxX2:WORD, \\r
+ BoxY2::WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Check that at least three vertexes are specified\r
+ mov cx, [Count]\r
+ cmp cx, 3\r
+ jb @@Exit\r
+\r
+;------------------------------\r
+; Find bounding box for polygon\r
+ les di, [Map]\r
+ lds si, [Points] ; Pointer to vertex array\r
+ mov [BoxX1], 32767\r
+ mov [BoxX2], -32768\r
+ mov [BoxY1], 32767\r
+ mov [BoxY2], -32768\r
+\r
+ xor dx, dx\r
+@@MinMaxLoop:\r
+ mov bx, es:[di] ; Get index of vertex\r
+ .shl bx, 2 ; Get offset in point array\r
+ add bx, si\r
+\r
+; Check X range\r
+@@CheckMinX:\r
+ mov ax, ds:[bx].X ; Get X coordinate\r
+ cmp ax, [BoxX1]\r
+ jge @@CheckMaxX\r
+ mov [BoxX1], ax\r
+ mov [MinIdxT], dx\r
+ mov [MinIdxB], dx\r
+@@CheckMaxX:\r
+ cmp ax, [BoxX2]\r
+ jle @@CheckMinY\r
+ mov [BoxX2], ax\r
+ mov [MaxIdx], dx\r
+\r
+; Check Y range\r
+@@CheckMinY:\r
+ mov ax, ds:[bx].Y\r
+ cmp ax, [BoxY1]\r
+ jge @@CheckMaxY\r
+ mov [BoxY1], ax\r
+@@CheckMaxY:\r
+ cmp ax, [BoxY2]\r
+ jle @@CheckDone\r
+ mov [BoxY2], ax\r
+\r
+; Repeat thru all points\r
+@@CheckDone:\r
+ inc di ; Next map entry\r
+ inc dx\r
+ inc di\r
+ inc dx\r
+ dec cx\r
+ jnz @@MinMaxLoop\r
+\r
+;---------------------------------\r
+; Check if polygon is full clipped\r
+ mov ax, [BoxX2]\r
+ cmp ax, [mx_ClipX1] ; Is poly full clipped?\r
+ jl @@Exit\r
+ mov bx, [BoxX1]\r
+ cmp bx, [mx_ClipX2] ; Is poly full clipped?\r
+ jg @@Exit\r
+ sub ax, bx ; Get width\r
+ jle @@Exit ; Exit if not positive\r
+ mov ax, [BoxY2]\r
+ cmp ax, [mx_ClipY1] ; Is poly full clipped?\r
+ jl @@Exit\r
+ mov bx, [BoxY1]\r
+ cmp bx, [mx_ClipY2] ; Is poly full clipped?\r
+ jg @@Exit\r
+ sub ax, bx ; Get height\r
+ jle @@Exit ; Exit if not positive\r
+\r
+ dec [Count]\r
+ shl [Count], 1 ; We'll work with word offsets\r
+ mov es, [mx_CodeSegment]\r
+\r
+;--------------\r
+; Scan top edge\r
+ mov ax, OFFSET mx_ScanBuffer\r
+ mov [ScanOffsetT], ax\r
+ mov si, [MinIdxT] ; Offset of bottom point index\r
+@@STLoop:\r
+ lds bx, [Map] ; DS:BX -> map table\r
+ mov di, ds:[bx+si] ; Index of top point #1\r
+ dec si ; Next point\r
+ dec si\r
+ test si, si\r
+ jnl @@ST1\r
+ mov si, [Count]\r
+@@ST1:\r
+ mov [MinIdxT], si ; Save new index of top point\r
+ mov si, ds:[bx+si] ; Get index of top point #2\r
+ .shl di, 2 ; Convert indexes to offsets\r
+ .shl si, 2\r
+ lds bx, [Points] ; DS:BX -> point array\r
+ add si, bx ; DS:SI -> top point #2\r
+ add bx, di ; DS:BX -> top point #1\r
+ mov di, [ScanOffsetT]\r
+ call subScan ; Scan edge\r
+ mov [ScanOffsetT], di\r
+ mov si, [MinIdxT]\r
+ cmp si, [MaxIdx] ; End of edge?\r
+ jne @@STLoop ; No, continue\r
+\r
+;-----------------\r
+; Scan bottom edge\r
+ mov ax, OFFSET mx_ScanBuffer + OFFSET Y2\r
+ mov [ScanOffsetB], ax\r
+ mov si, [MinIdxB] ; Offset of bottom point index\r
+@@SBLoop:\r
+ lds bx, [Map] ; DS:BX -> map table\r
+ mov di, ds:[bx+si] ; Index of bottom point #1\r
+ inc si ; Next bottom point\r
+ inc si\r
+ cmp si, [Count]\r
+ jbe @@SB1\r
+ xor si, si\r
+@@SB1:\r
+ mov [MinIdxB], si ; Save new index of bottom point\r
+ mov si, ds:[bx+si] ; Get index of bottom point #2\r
+ .shl di, 2 ; Convert indexes to offsets\r
+ .shl si, 2\r
+ lds bx, [Points] ; DS:BX -> point array\r
+ add si, bx ; DS:SI -> top point #2\r
+ add bx, di ; DS:BX -> top point #1\r
+ mov di, [ScanOffsetB]\r
+ call subScan ; Scan edge\r
+ mov [ScanOffsetB], di\r
+ mov si, [MinIdxB]\r
+ cmp si, [MaxIdx] ; End of edge?\r
+ jne @@SBLoop ; No, continue\r
+\r
+;--------------------\r
+; Clip left and right\r
+ mov si, OFFSET mx_ScanBuffer\r
+ mov ax, [BoxX1]\r
+ mov cx, [BoxX2]\r
+ sub cx, ax ; CX = bounding box width\r
+ mov bx, [mx_ClipX1]\r
+ sub bx, ax\r
+ jle @@ClipL1 ; No need to clip left\r
+ sub cx, bx ; Update width\r
+ add ax, bx ; BoxX1 = mx_ClipX1\r
+ mov [BoxX1], ax\r
+ .shl bx, 2 ; Warning!!! This is an hand-coded\r
+ add si, bx ; multiply by the size of TSCAN\r
+@@ClipL1:\r
+ mov bx, ax\r
+ add bx, cx ; Last scan column\r
+ sub bx, [mx_ClipX2]\r
+ jle @@ClipL2 ; No need to clip right\r
+ sub cx, bx ; Clip right\r
+@@ClipL2:\r
+ test cx, cx ; Is clipped width positive?\r
+ jle @@Exit ; No, exit\r
+ mov [ScanCount], cx ; Save number of columns to draw\r
+ mov [ScanOffsetT], si ; Remember offset of (clipped) buffer\r
+ mov ds, [mx_CodeSegment] ; DS:SI -> scan buffer\r
+\r
+;------------------------------\r
+; Check if Y clipping is needed\r
+ mov ax, [BoxY1]\r
+ cmp ax, [mx_ClipY1]\r
+ jl @@ClipTB ; Need to clip top\r
+ mov ax, [BoxY2]\r
+ cmp ax, [mx_ClipY2]\r
+ jg @@ClipTB ; Need to clip bottom\r
+ jmp @@ClipYExit ; Skip Y clipping\r
+\r
+;--------------------\r
+; Clip top and bottom\r
+@@ClipTB:\r
+ mov di, cx ; DI = scan count\r
+ inc di ; Increment count for pre-loop test\r
+ sub si, SIZE TSCAN\r
+@@ClipYLoop:\r
+ dec di ; Any column left?\r
+ jz @@ClipYExit ; No, exit\r
+ add si, SIZE TSCAN\r
+ mov ax, ds:[si].Y1 ; Y1\r
+ mov cx, ds:[si].Y2 ; Y2\r
+ mov dx, [mx_ClipY2]\r
+ cmp ax, dx ; Full clipped?\r
+ jg @@ClipYClip ; Yes, skip this column\r
+ cmp cx, dx ; Need to clip bottom?\r
+ jle @@ClipY1 ; No, continue\r
+; Clip bottom\r
+ mov ds:[si].Y2, dx\r
+ mov bx, cx\r
+ sub bx, dx ; Clip distance\r
+ sub cx, ax ; Height\r
+ jle @@ClipYClip\r
+ mov cx, ds:[si].Y2\r
+@@ClipY1:\r
+ mov dx, [mx_ClipY1]\r
+ cmp cx, dx ; Full top clipped?\r
+ jl @@ClipYClip ; Yes, skip\r
+ sub cx, ax ; Get height\r
+ jle @@ClipYClip ; Skip if not positive\r
+ cmp ax, dx ; Need to clip top?\r
+ jge @@ClipYLoop ; No, continue\r
+; Clip top\r
+ mov ds:[si].Y1, dx ; Y1 = mx_ClipY1\r
+ sub dx, ax ; DX = number of pixels clipped\r
+ cmp cx, dx\r
+ ja @@ClipYLoop ; Not clipped, continue\r
+@@ClipYClip:\r
+ mov ds:[si].Y1, -1 ; Mark column as clipped\r
+ jmp @@ClipYLoop\r
+@@ClipYExit:\r
+\r
+;-------------\r
+; Draw columns\r
+ mov es, [mx_VideoSegment]\r
+ mov si, [ScanOffsetT]\r
+ mov cl, BYTE PTR [BoxX1] ; Init write plane\r
+ and cl, 03h\r
+ mov al, 11h\r
+ shl al, cl\r
+ mov [WritePlane], al\r
+ .shr [BoxX1], 2\r
+@@DrawLoop:\r
+ mov ax, ds:[si].Y1\r
+ test ax, ax ; Was column clipped?\r
+ js @@DrawNext ; Yes, skip\r
+ mov cx, ds:[si].Y2\r
+ sub cx, ax ; CX = height\r
+ jle @@DrawNext\r
+ mul [mx_BytesPerLine] ; Get pixel address\r
+ add ax, [BoxX1]\r
+ mov di, ax\r
+ mov ah, [WritePlane]\r
+ mov dx, TS\r
+ mov al, 02h\r
+ out dx, ax\r
+ mov ax, [Color]\r
+ mov dx, [mx_BytesPerLine]\r
+ shr cx, 1\r
+ jnc @@FillScan\r
+ mov es:[di], al\r
+ add di, dx\r
+ jcxz @@DrawNext\r
+@@FillScan:\r
+ mov es:[di], al\r
+ add di, dx\r
+ mov es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jnz @@FillScan\r
+@@DrawNext:\r
+ rol [WritePlane], 1\r
+ adc [BoxX1], 0 ; Bump pointer to video memory if needed\r
+ add si, SIZE TSCAN\r
+ dec [ScanCount]\r
+ jnz @@DrawLoop\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxFillPoly ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPG.ASM - Convex polygon fill with Gouraud shading\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGouraudPoly\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; "Local" definitions\r
+;\r
+TPOINT STRUC\r
+ X DW ?\r
+ Y DW ?\r
+TPOINT ENDS\r
+\r
+; Do NOT change order!\r
+TSCAN STRUC\r
+ Y1 DW ?\r
+ E1 DB ?\r
+ C1 DB ?\r
+ Y2 DW ?\r
+ E2 DB ?\r
+ C2 DB ?\r
+TSCAN ENDS\r
+\r
+MAXSCANCOLUMNS EQU POLYSCANBUFSIZE / SIZE TSCAN\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_CodeSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+EXTRN mx_ScanBuffer : NEAR\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Scans an edge using the DDA (digital differential analyzer) algorithm.\r
+; Also interpolates color for shading.\r
+;\r
+; Input:\r
+; DS:BX = pointer to start point (X1, Y1)\r
+; DS:SI = pointer to end point (X2, Y2)\r
+; ES:DI = pointer to edge buffer\r
+; DX = start color\r
+; AX = end color\r
+; Output:\r
+; ES:DI = updated pointer to edge buffer\r
+; Notes:\r
+; must preserve DS:SI.\r
+;\r
+subScan PROC NEAR\r
+ mov cx, ds:[si].X\r
+ sub cx, ds:[bx].X ; Get width\r
+ jg @@1\r
+ ret\r
+@@1:\r
+ push bp ; Save BP\r
+ push di ; Save scan info offset\r
+ push cx ; Save height\r
+ push ax ; Save colors\r
+ push dx\r
+\r
+ mov ax, ds:[si].Y\r
+ mov bx, ds:[bx].Y\r
+ sub ax, bx ; Get height\r
+ jg @@T2B ; Scan top to bottom\r
+ jl @@B2T ; Scan bottom to top\r
+\r
+; Special case: vertical line\r
+ mov ax, bx\r
+@@V:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ dec cx\r
+ jnz @@V\r
+ jmp @@GetColorInfo\r
+\r
+; Scan top to bottom\r
+@@T2B:\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx ; BP:BX = fixed 16:16 step\r
+ mov dx, 8000h\r
+@@T2BLoop:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ add dx, bx\r
+ adc ax, bp\r
+ dec cx\r
+ jnz @@T2BLoop\r
+ jmp @@GetColorInfo\r
+\r
+; Scan bottom to top\r
+@@B2T:\r
+ neg ax\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx\r
+ mov dx, 8000h\r
+@@B2TLoop:\r
+ mov es:[di].Y1, ax\r
+ add di, SIZE TSCAN\r
+ sub dx, bx\r
+ sbb ax, bp\r
+ dec cx\r
+ jnz @@B2TLoop\r
+\r
+; Now get the color info\r
+@@GetColorInfo:\r
+ pop bx ; Restore colors\r
+ pop ax\r
+ pop cx ; Height\r
+ pop di ; ES:DI -> scan info\r
+\r
+ sub ax, bx ; Get color range\r
+ jg @@CL2R\r
+ jl @@CR2L\r
+\r
+; Special case: same color\r
+ mov ah, bl\r
+ mov al, 80h\r
+@@CV:\r
+ mov WORD PTR es:[di].E1, ax\r
+ add di, SIZE TSCAN\r
+ dec cx\r
+ jnz @@CV\r
+ jmp @@Exit\r
+\r
+; Scan left to right\r
+@@CL2R:\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx ; BP:BX = fixed 16:16 step\r
+ mov dx, 8000h\r
+@@CL2RLoop:\r
+ mov es:[di].C1, al\r
+ mov es:[di].E1, dh\r
+ add di, SIZE TSCAN\r
+ add dx, bx\r
+ adc ax, bp\r
+ dec cx\r
+ jnz @@CL2RLoop\r
+ jmp @@Exit\r
+\r
+; Scan right to left\r
+@@CR2L:\r
+ neg ax\r
+ cwd\r
+ div cx\r
+ mov bp, ax\r
+ xor ax, ax\r
+ div cx\r
+ xchg ax, bx\r
+ mov dx, 8000h\r
+\r
+@@CR2LLoop:\r
+ mov es:[di].C1, al\r
+ mov es:[di].E1, dh\r
+ add di, SIZE TSCAN\r
+ sub dx, bx\r
+ sbb ax, bp\r
+ dec cx\r
+ jnz @@CR2LLoop\r
+\r
+@@Exit:\r
+ pop bp\r
+ ret\r
+subScan ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Fills a scan column.\r
+;\r
+; Input:\r
+; DS:SI = current TSCAN\r
+; ES:DI = address of top pixel\r
+; CX = number of pixels to write\r
+; DX = base color\r
+; Output:\r
+; none\r
+;\r
+subFillScan PROC NEAR\r
+ mov ax, WORD PTR ds:[si].E2\r
+ mov bx, WORD PTR ds:[si].E1\r
+ cmp ah, bh\r
+ jg @@L2R ; Color increases\r
+ jl @@R2L ; Color decreases\r
+\r
+; Special case: color doesn't change\r
+ add ax, dx\r
+ mov dx, [mx_BytesPerLine]\r
+@@V:\r
+ mov es:[di], ah\r
+ add di, dx\r
+ dec cx\r
+ jnz @@V\r
+ ret\r
+\r
+; Color increases\r
+@@L2R:\r
+ .push bp, si\r
+ mov si, bx\r
+ add si, dx ; Relocate color\r
+ sub ax, bx\r
+ xor dx, dx\r
+ div cx\r
+ mov bp, ax ; BP = color step, integer part\r
+ xor ax, ax\r
+ div cx\r
+ mov bx, ax ; BX = color step, fractional part\r
+ mov dx, 8000h\r
+ mov ax, [mx_BytesPerLine]\r
+ xchg si, ax\r
+@@L2RLoop:\r
+ mov es:[di], ah\r
+ add dx, bx\r
+ adc ax, bp\r
+ add di, si\r
+ dec cx\r
+ jnz @@L2RLoop\r
+ .pop bp, si\r
+ ret\r
+\r
+; Color decreases\r
+@@R2L:\r
+ .push bp, si\r
+ mov si, bx\r
+ add si, dx ; Relocate color\r
+ sub ax, bx\r
+ neg ax\r
+ xor dx, dx\r
+ div cx\r
+ mov bp, ax ; BP = color step, integer part\r
+ xor ax, ax\r
+ div cx\r
+ mov bx, ax ; BX = color step, fractional part\r
+ mov dx, 8000h\r
+ mov ax, [mx_BytesPerLine]\r
+ xchg si, ax\r
+@@R2LLoop:\r
+ mov es:[di], ah\r
+ sub dx, bx\r
+ sbb ax, bp\r
+ add di, si\r
+ dec cx\r
+ jnz @@R2LLoop\r
+ .pop bp, si\r
+ ret\r
+subFillScan ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Fills a convex polygon with the specified color.\r
+; Interpolates pixel colors using the Gouraud algorithm.\r
+;\r
+; Input:\r
+; Count = number of vertexes\r
+; Map = indexes of points and colors (integer)\r
+; Points = array of points (integer X, Y coordinates)\r
+; Colors = array of colors (integer)\r
+; Color = base color\r
+; Output:\r
+; none\r
+; Notes:\r
+; vertexes must be in counterclockwise order, arrays are 0-based.\r
+;\r
+mxGouraudPoly PROC FAR\r
+ ARG Color:WORD, \\r
+ Colors:DWORD, \\r
+ Points:DWORD, \\r
+ Map:DWORD, \\r
+ Count:WORD = ARG_SIZE\r
+ LOCAL WritePlane:BYTE:2, \\r
+ ScanOffsetT:WORD, \\r
+ ScanOffsetB:WORD, \\r
+ ScanCount:WORD, \\r
+ Holder:WORD, \\r
+ Height:WORD, \\r
+ MinIdxT:WORD, \\r
+ MinIdxB:WORD, \\r
+ MaxIdx:WORD, \\r
+ Width:WORD, \\r
+ BoxX1:WORD, \\r
+ BoxY1:WORD, \\r
+ BoxX2:WORD, \\r
+ BoxY2::WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Check that at least three vertexes are specified\r
+ mov cx, [Count]\r
+ cmp cx, 3\r
+ jb @@Exit\r
+\r
+;------------------------------\r
+; Find bounding box for polygon\r
+ les di, [Map]\r
+ lds si, [Points] ; Pointer to vertex array\r
+ mov [BoxX1], 32767\r
+ mov [BoxX2], -32768\r
+ mov [BoxY1], 32767\r
+ mov [BoxY2], -32768\r
+\r
+ xor dx, dx\r
+@@MinMaxLoop:\r
+ mov bx, es:[di] ; Get index of vertex\r
+ .shl bx, 2 ; Get offset in point array\r
+ add bx, si\r
+\r
+; Check X range\r
+@@CheckMinX:\r
+ mov ax, ds:[bx].X ; Get X coordinate\r
+ cmp ax, [BoxX1]\r
+ jge @@CheckMaxX\r
+ mov [BoxX1], ax\r
+ mov [MinIdxT], dx\r
+ mov [MinIdxB], dx\r
+@@CheckMaxX:\r
+ cmp ax, [BoxX2]\r
+ jle @@CheckMinY\r
+ mov [BoxX2], ax\r
+ mov [MaxIdx], dx\r
+\r
+; Check Y range\r
+@@CheckMinY:\r
+ mov ax, ds:[bx].Y\r
+ cmp ax, [BoxY1]\r
+ jge @@CheckMaxY\r
+ mov [BoxY1], ax\r
+@@CheckMaxY:\r
+ cmp ax, [BoxY2]\r
+ jle @@CheckDone\r
+ mov [BoxY2], ax\r
+\r
+; Repeat thru all points\r
+@@CheckDone:\r
+ inc di ; Next map entry\r
+ inc di\r
+ inc dx\r
+ inc dx\r
+ dec cx\r
+ jnz @@MinMaxLoop\r
+\r
+;---------------------------------\r
+; Check if polygon is full clipped\r
+ mov ax, [BoxX2]\r
+ cmp ax, [mx_ClipX1] ; Is poly full clipped?\r
+ jl @@Exit\r
+ mov bx, [BoxX1]\r
+ cmp bx, [mx_ClipX2] ; Is poly full clipped?\r
+ jg @@Exit\r
+ sub ax, bx ; Get width\r
+ jle @@Exit ; Exit if not positive\r
+ mov ax, [BoxY2]\r
+ cmp ax, [mx_ClipY1] ; Is poly full clipped?\r
+ jl @@Exit\r
+ mov bx, [BoxY1]\r
+ cmp bx, [mx_ClipY2] ; Is poly full clipped?\r
+ jg @@Exit\r
+ sub ax, bx ; Get height\r
+ jle @@Exit ; Exit if not positive\r
+\r
+ dec [Count]\r
+ shl [Count], 1 ; We'll work with word offsets\r
+ mov es, [mx_CodeSegment]\r
+\r
+;--------------\r
+; Scan top edge\r
+ mov ax, OFFSET mx_ScanBuffer\r
+ mov [ScanOffsetT], ax\r
+ mov si, [MinIdxT] ; Offset of bottom point index\r
+@@STLoop:\r
+ lds bx, [Map] ; DS:BX -> map table\r
+ mov di, ds:[bx+si] ; Index of top point #1\r
+ dec si ; Next point\r
+ dec si\r
+ test si, si\r
+ jnl @@ST1\r
+ mov si, [Count]\r
+@@ST1:\r
+ mov [MinIdxT], si ; Save new index of top point\r
+ mov si, ds:[bx+si] ; Get index of top point #2\r
+ lds bx, [Colors] ; Get pointer to color array\r
+ shl di, 1 ; Convert indexes to offsets\r
+ shl si, 1\r
+ mov ax, ds:[bx+si] ; Get colors\r
+ mov dx, ds:[bx+di]\r
+ lds bx, [Points] ; DS:BX -> point array\r
+ shl si, 1\r
+ shl di, 1\r
+ add si, bx ; DS:SI -> top point #2\r
+ add bx, di ; DS:BX -> top point #1\r
+ mov di, [ScanOffsetT]\r
+ call subScan ; Scan edge\r
+ mov [ScanOffsetT], di\r
+ mov si, [MinIdxT]\r
+ cmp si, [MaxIdx] ; End of edge?\r
+ jne @@STLoop ; No, continue\r
+\r
+;-----------------\r
+; Scan bottom edge\r
+ mov ax, OFFSET mx_ScanBuffer + OFFSET Y2\r
+ mov [ScanOffsetB], ax\r
+ mov si, [MinIdxB] ; Offset of bottom point index\r
+@@SBLoop:\r
+ lds bx, [Map] ; DS:BX -> map table\r
+ mov di, ds:[bx+si] ; Index of bottom point #1\r
+ inc si ; Next bottom point\r
+ inc si\r
+ cmp si, [Count]\r
+ jbe @@SB1\r
+ xor si, si\r
+@@SB1:\r
+ mov [MinIdxB], si ; Save new index of bottom point\r
+ mov si, ds:[bx+si] ; Get index of bottom point #2\r
+ lds bx, [Colors] ; Get pointer to color array\r
+ shl di, 1 ; Convert indexes to offsets\r
+ shl si, 1\r
+ mov ax, ds:[bx+si] ; Get colors\r
+ mov dx, ds:[bx+di]\r
+ lds bx, [Points] ; DS:BX -> point array\r
+ shl si, 1\r
+ shl di, 1\r
+ add si, bx ; DS:SI -> top point #2\r
+ add bx, di ; DS:BX -> top point #1\r
+ mov di, [ScanOffsetB]\r
+ call subScan ; Scan edge\r
+ mov [ScanOffsetB], di\r
+ mov si, [MinIdxB]\r
+ cmp si, [MaxIdx] ; End of edge?\r
+ jne @@SBLoop ; No, continue\r
+\r
+;--------------------\r
+; Clip left and right\r
+ mov si, OFFSET mx_ScanBuffer\r
+ mov ax, [BoxX1]\r
+ mov cx, [BoxX2]\r
+ sub cx, ax ; CX = bounding box width\r
+ mov bx, [mx_ClipX1]\r
+ sub bx, ax\r
+ jle @@ClipL1 ; No need to clip left\r
+ sub cx, bx ; Update width\r
+ add ax, bx ; BoxX1 = mx_ClipX1\r
+ mov [BoxX1], ax\r
+ .shl bx, 3 ; Warning!!! This is an hand-coded\r
+ add si, bx ; multiply by the size of TSCAN\r
+@@ClipL1:\r
+ mov bx, ax\r
+ add bx, cx ; Last scan column\r
+ sub bx, [mx_ClipX2]\r
+ jle @@ClipL2 ; No need to clip right\r
+ sub cx, bx ; Clip right\r
+@@ClipL2:\r
+ test cx, cx ; Is clipped width positive?\r
+ jle @@Exit ; No, exit\r
+ mov [ScanCount], cx ; Save number of columns to draw\r
+ mov [ScanOffsetT], si ; Remember offset of (clipped) buffer\r
+ mov ds, [mx_CodeSegment] ; DS:SI -> scan buffer\r
+\r
+;------------------------------\r
+; Check if Y clipping is needed\r
+ mov ax, [BoxY1]\r
+ cmp ax, [mx_ClipY1]\r
+ jl @@ClipTB ; Need to clip top\r
+ mov ax, [BoxY2]\r
+ cmp ax, [mx_ClipY2]\r
+ jg @@ClipTB ; Need to clip bottom\r
+ jmp @@ClipYExit ; Skip Y clipping\r
+\r
+;--------------------\r
+; Clip top and bottom\r
+@@ClipTB:\r
+ mov di, cx ; DI = scan count\r
+ inc di ; Increment count for pre-loop test\r
+ sub si, SIZE TSCAN\r
+@@ClipYLoop:\r
+ dec di ; Any column left?\r
+ jz @@ClipYExit ; No, exit\r
+ add si, SIZE TSCAN\r
+ mov ax, ds:[si].Y1 ; Y1\r
+ mov cx, ds:[si].Y2 ; Y2\r
+ mov dx, [mx_ClipY2]\r
+ cmp ax, dx ; Full clipped?\r
+ jg @@ClipYClip ; Yes, skip this column\r
+ cmp cx, dx ; Need to clip bottom?\r
+ jle @@ClipY1 ; No, continue\r
+; Clip bottom, need to scale colors too\r
+ mov ds:[si].Y2, dx\r
+ mov bx, cx\r
+ sub bx, dx ; Clip distance\r
+ sub cx, ax ; Height\r
+ jle @@ClipYClip\r
+ mov ax, WORD PTR ds:[si].E1\r
+ sub ax, WORD PTR ds:[si].E2\r
+ imul bx\r
+ idiv cx\r
+ add WORD PTR ds:[si].E2, ax\r
+ mov ax, ds:[si].Y1 ; Restore AX and CX\r
+ mov cx, ds:[si].Y2\r
+@@ClipY1:\r
+ mov dx, [mx_ClipY1]\r
+ cmp cx, dx ; Full top clipped?\r
+ jl @@ClipYClip ; Yes, skip\r
+ sub cx, ax ; Get height\r
+ jle @@ClipYClip ; Skip if not positive\r
+ cmp ax, dx ; Need to clip top?\r
+ jge @@ClipYLoop ; No, continue\r
+; Clip top, need to scale colors too\r
+ mov ds:[si].Y1, dx ; Y1 = mx_ClipY1\r
+ sub dx, ax ; DX = number of pixels clipped\r
+ cmp cx, dx\r
+ jbe @@ClipYClip ; Full clipped, skip\r
+ mov ax, WORD PTR ds:[si].E2\r
+ sub ax, WORD PTR ds:[si].E1 ; AX = color distance\r
+ imul dx\r
+ idiv cx\r
+ add WORD PTR ds:[si].E1, ax ; Update starting color\r
+ jmp @@ClipYLoop\r
+@@ClipYClip:\r
+ mov ds:[si].Y1, -1 ; Mark column as clipped\r
+ jmp @@ClipYLoop\r
+@@ClipYExit:\r
+\r
+;-------------\r
+; Draw columns\r
+ mov es, [mx_VideoSegment]\r
+ mov si, [ScanOffsetT]\r
+ mov cl, BYTE PTR [BoxX1] ; Init write plane\r
+ and cl, 03h\r
+ mov al, 11h\r
+ shl al, cl\r
+ mov [WritePlane], al\r
+ .shr [BoxX1], 2\r
+ mov ax, [Color] ; Make 8:8 fixed color\r
+ mov ah, al\r
+ xor al, al\r
+ mov [Color], ax\r
+@@DrawLoop:\r
+ mov ax, ds:[si].Y1\r
+ test ax, ax ; Was column clipped?\r
+ js @@DrawNext ; Yes, skip\r
+ mov cx, ds:[si].Y2\r
+ sub cx, ax ; CX = height\r
+ jle @@DrawNext\r
+ mul [mx_BytesPerLine] ; Get pixel address\r
+ add ax, [BoxX1]\r
+ mov di, ax\r
+ mov ah, [WritePlane]\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax\r
+ mov dx, [Color]\r
+ call subFillScan\r
+@@DrawNext:\r
+ rol [WritePlane], 1\r
+ adc [BoxX1], 0 ; Bump pointer to video memory if needed\r
+ add si, SIZE TSCAN\r
+ dec [ScanCount]\r
+ jnz @@DrawLoop\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxGouraudPoly ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPI.ASM - Put image\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxPutImage\r
+\r
+EXTRN subClipImage : NEAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+mxTable LABEL WORD ; Raster ops\r
+ DW subMove\r
+ DW subAnd\r
+ DW subOr\r
+ DW subXor\r
+ DW subTrans\r
+ DW subAdd\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Move functions.\r
+; Note: loops unrolled and optimized for CX even, no check for CX = 0.\r
+;\r
+subMove PROC NEAR\r
+ shr cx, 1 ; Make CX even\r
+ jc @@Odd ; Special case if odd byte\r
+@@Loop: movsb\r
+ add si, 3\r
+ movsb\r
+ add si, 3\r
+ dec cx\r
+ jnz @@Loop\r
+@@Exit: ret\r
+@@Odd: movsb\r
+ add si, 3\r
+ jcxz @@Exit\r
+ jmp @@Loop\r
+subMove ENDP\r
+;\r
+subAnd PROC NEAR\r
+ shr cx, 1\r
+ jc @@Odd\r
+@@Loop: mov al, ds:[si]\r
+ mov ah, ds:[si+4]\r
+ and es:[di], ax\r
+ inc di\r
+ inc di\r
+ add si, 8\r
+ dec cx\r
+ jnz @@Loop\r
+@@Exit: ret\r
+@@Odd: lodsb\r
+ and es:[di], al\r
+ inc di\r
+ add si, 3\r
+ jcxz @@Exit\r
+ jmp @@Loop\r
+subAnd ENDP\r
+;\r
+subOr PROC NEAR\r
+ shr cx, 1\r
+ jc @@Odd\r
+@@Loop: mov al, ds:[si]\r
+ mov ah, ds:[si+4]\r
+ or es:[di], ax\r
+ inc di\r
+ inc di\r
+ add si, 8\r
+ dec cx\r
+ jnz @@Loop\r
+@@Exit: ret\r
+@@Odd: lodsb\r
+ or es:[di], al\r
+ inc di\r
+ add si, 3\r
+ jcxz @@Exit\r
+ jmp @@Loop\r
+subOr ENDP\r
+;\r
+subXor PROC NEAR\r
+ shr cx, 1\r
+ jc @@Odd\r
+@@Loop: mov al, ds:[si]\r
+ mov ah, ds:[si+4]\r
+ xor es:[di], ax\r
+ inc di\r
+ inc di\r
+ add si, 8\r
+ dec cx\r
+ jnz @@Loop\r
+@@Exit: ret\r
+@@Odd: lodsb\r
+ xor es:[di], al\r
+ inc di\r
+ add si, 3\r
+ jcxz @@Exit\r
+ jmp @@Loop\r
+subXor ENDP\r
+;\r
+subTrans PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ cmp al, ah\r
+ je @@Skip\r
+ mov es:[di], al\r
+@@Skip: inc di\r
+ add si, 4\r
+ dec cx\r
+ jnz @@Loop\r
+@@Exit: ret\r
+subTrans ENDP\r
+;\r
+subAdd PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ add es:[di], al\r
+ inc di\r
+ add si, 4\r
+ dec cx\r
+ jnz @@Loop\r
+ ret\r
+subAdd ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Copies a "raw" image from memory to screen.\r
+;\r
+; Input:\r
+; Image = pointer to image\r
+; X, Y = coordinates of destination\r
+; Width = width of image in pixels\r
+; Height = height of image in pixels\r
+; Op = raster op (OP_xxx)\r
+; Output:\r
+; none\r
+;\r
+mxPutImage PROC FAR\r
+ ARG Op:WORD, \\r
+ Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD, \\r
+ Image:DWORD = ARG_SIZE\r
+ LOCAL PlaneWidth:WORD:4, \\r
+ PixelOffset:WORD, \\r
+ MoveFunction:WORD, \\r
+ Count:BYTE, \\r
+ ReadPlane:BYTE, \\r
+ OpInfo:BYTE, \\r
+ WritePlane:BYTE = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+; Clip image\r
+ mov bx, [X]\r
+ mov ax, [Y]\r
+ mov cx, [Width]\r
+ mov dx, [Height]\r
+ call subClipImage\r
+ jc @@Exit ; Full clipped\r
+ mov [Height], dx\r
+ add WORD PTR Image[0], si ; Skip clipped pixels\r
+\r
+; Get pixel address\r
+ mul [mx_BytesPerLine]\r
+ mov di, bx\r
+ shr di, 1\r
+ shr di, 1\r
+ add di, ax\r
+ mov [PixelOffset], di\r
+ mov es, [mx_VideoSegment] ; ES:DI points to pixel\r
+ and bl, 03h\r
+ mov [ReadPlane], bl\r
+\r
+; Compute extra bytes and width count for each plane\r
+ mov bx, cx\r
+ shr bx, 1\r
+ shr bx, 1 ; Width for each plane\r
+ and cl, 03h\r
+ mov al, 00001000b\r
+ shr al, cl\r
+ mov si, 3 SHL 1\r
+@@PatchLoop:\r
+ mov PlaneWidth[si], bx\r
+ shr al, 1\r
+ adc bx, 0\r
+ dec si\r
+ dec si\r
+ jge @@PatchLoop\r
+\r
+; Setup planes for output to VGA registers\r
+ mov cl, [ReadPlane]\r
+ mov al, 00010001b\r
+ shl al, cl\r
+ mov [WritePlane], al\r
+\r
+; Install move function\r
+ mov bx, [Op]\r
+ mov [OpInfo], bh ; Remember additional info if needed\r
+ xor bh, bh\r
+ cmp bl, OP_ADD\r
+ jbe @@SetMoveFunction\r
+ xor bl, bl\r
+@@SetMoveFunction:\r
+ shl bx, 1\r
+ mov ax, mxTable[bx]\r
+ mov [MoveFunction], ax\r
+\r
+; Put image\r
+ cld\r
+ mov [Count], 4 ; Four planes\r
+ lea bx, PlaneWidth ; SS:[BX] = width in bytes for plane\r
+ mov ds, WORD PTR Image[2]\r
+@@PlaneLoop:\r
+ cmp WORD PTR ss:[bx], 0 ; Exit if nothing more to do\r
+ je @@Exit ; (also, never try to move zero bytes!)\r
+ mov si, WORD PTR Image[0]\r
+ mov ah, [WritePlane]\r
+ and ah, 0Fh\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax ; Select write plane\r
+ mov ah, [ReadPlane]\r
+ and ah, 03h\r
+ mov al, 04h\r
+ mov dx, GDC\r
+ out dx, ax ; Select read plane\r
+ mov dx, [Height]\r
+ mov di, [PixelOffset]\r
+@@Loop:\r
+ push si\r
+ push di\r
+ mov cx, WORD PTR ss:[bx] ; Number of bytes to move\r
+ mov ah, [OpInfo] ; Transparent color for subTrans\r
+ call [MoveFunction]\r
+ pop di\r
+ pop si\r
+ add si, [Width] ; Go to next image line\r
+ add di, [mx_BytesPerLine] ; Go to next screen row\r
+ dec dx\r
+ jnz @@Loop ; Repeat for all lines\r
+ inc bx\r
+ inc bx ; Select width for next plane\r
+ inc [ReadPlane]\r
+ rol [WritePlane], 1\r
+ adc [PixelOffset], 0\r
+ inc WORD PTR Image[0]\r
+ dec [Count]\r
+ jnz @@PlaneLoop ; Repeat for all planes\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxPutImage ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPN.ASM - Panning function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxPan\r
+\r
+EXTRN mxWaitDisplay : FAR\r
+EXTRN mxStartAddress : FAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Moves the screen.\r
+;\r
+; Input:\r
+; X, Y = new X, Y coordinates of view screen\r
+; Output:\r
+; none\r
+;\r
+mxPan PROC FAR\r
+ ARG Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+\r
+ mov ax, [Y]\r
+ mul [mx_BytesPerLine]\r
+ mov dx, [X]\r
+ shr dx, 1\r
+ shr dx, 1\r
+ add ax, dx\r
+ push ax ; Push the start address\r
+ call mxWaitDisplay\r
+ call mxStartAddress\r
+\r
+ mov dx, 03DAh ; Set the pixel pan register\r
+ in al, dx\r
+ mov dx, 03C0h\r
+ mov al, 33h\r
+ out dx, al\r
+ mov al, BYTE PTR [X]\r
+ and al, 3\r
+ shl al, 1\r
+ out dx, al\r
+\r
+ xor ax, ax\r
+ .leave ARG_SIZE\r
+mxPan ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPP.ASM - Get/put pixel functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxGetPixel\r
+PUBLIC mxPutPixel\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_ClipX1 : WORD\r
+EXTRN mx_ClipY1 : WORD\r
+EXTRN mx_ClipX2 : WORD\r
+EXTRN mx_ClipY2 : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Gets a pixel.\r
+;\r
+; Input:\r
+; X, Y = pixel coordinates\r
+; Output:\r
+; pixel color\r
+;\r
+mxGetPixel PROC FAR\r
+ ARG Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ xor ax, ax\r
+ mov si, [X]\r
+ cmp si, [mx_ClipX1]\r
+ jl @@Exit\r
+ cmp si, [mx_ClipX2]\r
+ jg @@Exit\r
+ mov bx, [Y]\r
+ cmp bx, [mx_ClipY1]\r
+ jl @@Exit\r
+ cmp bx, [mx_ClipY2]\r
+ jg @@Exit\r
+\r
+ mov al, 04h ; Set read plane\r
+ mov ah, BYTE PTR [X]\r
+ and ah, 3\r
+ mov dx, GDC\r
+ out dx, ax\r
+\r
+ mov ds, [mx_VideoSegment]\r
+ mov ax, bx\r
+ mul [mx_BytesPerLine]\r
+ .shr si, 2\r
+ add si, ax\r
+\r
+ mov al, ds:[si] ; Get pixel value\r
+ xor ah, ah\r
+\r
+@@Exit:\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetPixel ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Puts a pixel of the specified color.\r
+;\r
+; Input:\r
+; X, Y = pixel coordinates\r
+; Color = pixel color\r
+; Output:\r
+; none\r
+;\r
+mxPutPixel PROC FAR\r
+ ARG Color:BYTE:2, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ mov si, [X]\r
+ cmp si, [mx_ClipX1]\r
+ jl @@Exit\r
+ cmp si, [mx_ClipX2]\r
+ jg @@Exit\r
+ mov ax, [Y]\r
+ cmp ax, [mx_ClipY1]\r
+ jl @@Exit\r
+ cmp ax, [mx_ClipY2]\r
+ jg @@Exit\r
+\r
+ mov ds, [mx_VideoSegment]\r
+ mul [mx_BytesPerLine]\r
+ .shr si, 2\r
+ add si, ax\r
+\r
+ mov cl, BYTE PTR [X] ; Set write plane\r
+ and cl, 3\r
+ mov ax, 0102h\r
+ shl ah, cl\r
+ mov dx, TS\r
+ out dx, ax\r
+\r
+ mov al, [Color] ; Write pixel\r
+ mov ds:[si], al\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxPutPixel ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXRA.ASM - Row address\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxRowAddress\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the row address register.\r
+;\r
+; Input:\r
+; RowAddress = row size in words\r
+; Output:\r
+; none\r
+;\r
+mxRowAddress PROC FAR\r
+ ARG RowAddress:BYTE:2 = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ mov dx, CRTC\r
+ mov al, 13h\r
+ mov ah, [RowAddress]\r
+ out dx, ax\r
+ xor ax, ax\r
+ .leave ARG_SIZE\r
+mxRowAddress ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXRP.ASM - Rotate palette function\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxRotatePalette\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Rotates the palette of the specified number of colors.\r
+;\r
+; Input:\r
+; Palette = pointer to palette\r
+; Count = number of colors to rotate\r
+; Step = step size\r
+; Output:\r
+; none\r
+;\r
+; Note: if Step is positive palette is rotated left to right, otherwise\r
+; right to left.\r
+;\r
+mxRotatePalette PROC FAR\r
+ ARG Step:WORD, \\r
+ Count:WORD, \\r
+ Palette:DWORD = ARG_SIZE\r
+ LOCAL Holder:BYTE:768 = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+ mov bx, [Count]\r
+ add bx, bx\r
+ add bx, [Count] ; BX = Count*3\r
+\r
+ lds si, [Palette] ; DS:SI -> palette\r
+ push ss\r
+ pop es\r
+ lea di, Holder ; ES:DI -> local space\r
+ cld\r
+\r
+ mov ax, [Step]\r
+ mov dx, ax\r
+ test ax, ax\r
+ jz @@Exit ; Nothing to do, exit\r
+ jl @@RightToLeft\r
+\r
+@@LeftToRight:\r
+ add ax, ax\r
+ add dx, ax ; DX = Step*3\r
+ sub bx, dx ; BX = (Count-Step)*3\r
+ add si, bx\r
+ push si\r
+ mov cx, dx\r
+ rep movsb\r
+ mov es, WORD PTR Palette[2]\r
+ mov di, si\r
+ dec di ; ES:DI -> last byte of palette\r
+ pop si\r
+ dec si\r
+ mov cx, bx\r
+ std\r
+ rep movsb\r
+ push ss\r
+ pop ds\r
+ lea si, Holder\r
+ les di, [Palette]\r
+ mov cx, dx\r
+ cld\r
+ rep movsb\r
+ jmp @@Exit\r
+\r
+@@RightToLeft:\r
+ add ax, ax\r
+ add dx, ax\r
+ neg dx ; DX = Step*3\r
+ sub bx, dx ; BX = (Count-Step)*3\r
+ mov cx, dx\r
+ rep movsb\r
+ les di, [Palette]\r
+ mov cx, bx\r
+ rep movsb\r
+ push ss\r
+ pop ds\r
+ lea si, Holder\r
+ mov cx, dx\r
+ rep movsb\r
+\r
+@@Exit:\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxRotatePalette ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXSA.ASM - Start address function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxStartAddress\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Modifies the starting address of video memory.\r
+;\r
+; Input:\r
+; StartAddr = new start address of video memory\r
+; Output:\r
+; none\r
+;\r
+mxStartAddress PROC FAR\r
+ ARG StartAddr:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+\r
+ mov bx, [StartAddr]\r
+ mov dx, CRTC\r
+ mov al, 0Ch ; Linear Starting Address high\r
+ mov ah, bh\r
+ cli\r
+ out dx, ax\r
+ mov al, 0Dh ; Linear Starting Address low\r
+ mov ah, bl\r
+ out dx, ax\r
+ sti\r
+\r
+ .leave ARG_SIZE\r
+mxStartAddress ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXSC.ASM - Set color function\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxSetColor\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Updates the selected DAC register.\r
+;\r
+; Input:\r
+; Index = index of color to set\r
+; R, G, B = color components\r
+; Output:\r
+; none\r
+;\r
+mxSetColor PROC FAR\r
+ ARG B:BYTE:2, \\r
+ G:BYTE:2, \\r
+ R:BYTE:2, \\r
+ Index:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ mov ax, [Index]\r
+ mov dx, 3C8h ; PEL write address register\r
+ out dx, al\r
+ inc dx\r
+\r
+ mov al, [R]\r
+ out dx, al\r
+ mov al, [G]\r
+ out dx, al\r
+ mov al, [B]\r
+ out dx, al\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxSetColor ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXPI.ASM - Stretch image\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxStretchImage\r
+\r
+EXTRN subClipBox : NEAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+mxTable LABEL WORD ; Raster ops\r
+ DW subMove\r
+ DW subAnd\r
+ DW subOr\r
+ DW subXor\r
+ DW subTrans\r
+ DW subAdd\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Stretches and copies a "raw" image from memory to screen.\r
+;\r
+; Input:\r
+; Image = pointer to image\r
+; X, Y = coordinates of destination\r
+; Width = width of image in pixels\r
+; Height = height of image in pixels\r
+; NewWidth = new width of image in pixels\r
+; NewHeight = new height of image in pixels\r
+; Op = raster op (OP_xxx)\r
+; Output:\r
+; none\r
+;\r
+mxStretchImage PROC FAR\r
+ ARG Op:WORD, \\r
+ NewHeight:WORD, \\r
+ NewWidth:WORD, \\r
+ Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD, \\r
+ Image:DWORD = ARG_SIZE\r
+ LOCAL PixelOffset:WORD, \\r
+ MoveFunction:WORD, \\r
+ ReadPlane:BYTE, \\r
+ OpInfo:BYTE, \\r
+ WidthStep:DWORD, \\r
+ HeightStep:DWORD, \\r
+ ImageLo:WORD, \\r
+ WritePlane:BYTE = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+; Get width stretch factor\r
+ IF USE386 EQ TRUE\r
+ movzx edx, [Width]\r
+ xor eax, eax\r
+ movzx ebx, [NewWidth]\r
+ shl ebx, 16\r
+ idiv ebx\r
+ mov [WidthStep], eax\r
+ ELSE\r
+ xor dx, dx ; Width stretch factor\r
+ mov ax, [Width]\r
+ mov bx, [NewWidth]\r
+ div bx\r
+ mov WORD PTR WidthStep[2], ax\r
+ xor ax, ax\r
+ div bx\r
+ mov WORD PTR WidthStep[0], ax\r
+ ENDIF\r
+; Get height stretch factor\r
+ IF USE386 EQ TRUE\r
+ movzx edx, [Height]\r
+ xor eax, eax\r
+ movzx ebx, [NewHeight]\r
+ shl ebx, 16\r
+ idiv ebx\r
+ mov [HeightStep], eax\r
+ ELSE\r
+ xor dx, dx\r
+ mov ax, [Height]\r
+ mov bx, [NewHeight]\r
+ div bx\r
+ mov WORD PTR HeightStep[2], ax\r
+ xor ax, ax\r
+ div bx\r
+ mov WORD PTR HeightStep[0], ax\r
+ ENDIF\r
+\r
+; Clip image\r
+ mov bx, [X]\r
+ mov ax, [Y]\r
+ mov cx, [NewWidth]\r
+ mov dx, [NewHeight]\r
+ call subClipBox\r
+ jc @@Exit ; Full clipped\r
+ mov [NewWidth], cx\r
+ mov [NewHeight], dx\r
+ sub [X], bx\r
+ sub [Y], ax\r
+\r
+; Get pixel address\r
+ mul [mx_BytesPerLine]\r
+ mov di, bx\r
+ shr di, 1\r
+ shr di, 1\r
+ add di, ax\r
+ mov [PixelOffset], di\r
+ mov es, [mx_VideoSegment] ; ES:DI points to pixel\r
+ and bl, 03h\r
+ mov [ReadPlane], bl ; Set read plane\r
+ mov cl, bl\r
+ mov al, 00010001b\r
+ shl al, cl\r
+ mov [WritePlane], al ; Set write plane\r
+\r
+; Relocate image origin if previously clipped\r
+ mov ax, [Y]\r
+ test ax, ax\r
+ jz @@OriginYDone\r
+ IF USE386 EQ TRUE\r
+ shl eax, 16\r
+ imul [HeightStep]\r
+ mov ax, [Width]\r
+ mul dx\r
+ ELSE\r
+ mov bx, ax\r
+ mul WORD PTR HeightStep[0]\r
+ mov cx, dx\r
+ mov ax, bx\r
+ mul WORD PTR HeightStep[2]\r
+ add ax, cx\r
+ mul [Width]\r
+ ENDIF\r
+ add WORD PTR [Image], ax\r
+@@OriginYDone:\r
+ mov ax, [X]\r
+ test ax, ax\r
+ jz @@OriginXDone\r
+ IF USE386 EQ TRUE\r
+ shl eax, 16\r
+ imul [WidthStep]\r
+ add WORD PTR [Image], dx\r
+ ELSE\r
+ mov bx, ax\r
+ mul WORD PTR WidthStep[0]\r
+ mov cx, dx\r
+ mov ax, bx\r
+ mul WORD PTR WidthStep[2]\r
+ add ax, cx\r
+ add WORD PTR [Image], ax\r
+ ENDIF\r
+@@OriginXDone:\r
+ mov ax, WORD PTR HeightStep[2]\r
+ mul [Width]\r
+ mov WORD PTR HeightStep[2], ax\r
+\r
+; Install move function\r
+ mov bx, [Op]\r
+ mov [OpInfo], bh ; Remember additional info if needed\r
+ xor bh, bh\r
+ cmp bl, OP_ADD\r
+ jbe @@SetMoveFunction\r
+ xor bl, bl\r
+@@SetMoveFunction:\r
+ shl bx, 1\r
+ mov ax, mxTable[bx]\r
+ mov [MoveFunction], ax\r
+\r
+; Put image\r
+ mov ds, WORD PTR Image[2]\r
+ xor ax, ax\r
+ mov [ImageLo], ax\r
+@@Loop:\r
+ mov si, WORD PTR Image[0] ; Get pointer to image\r
+ mov ah, [WritePlane]\r
+ and ah, 0Fh\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax ; Select write plane\r
+ mov ah, [ReadPlane]\r
+ and ah, 03h\r
+ mov al, 04h\r
+ mov dx, GDC\r
+ out dx, ax ; Select read plane\r
+ mov cx, [NewHeight]\r
+ mov di, [PixelOffset] ; ES:DI points to video memory\r
+ mov ah, [OpInfo] ; Additional raster op info\r
+ xor bx, bx\r
+ mov dx, [mx_BytesPerLine]\r
+ call [MoveFunction] ; Draw column\r
+ inc [ReadPlane] ; Next read plane\r
+ rol [WritePlane], 1 ; Next write plane\r
+ adc [PixelOffset], 0 ; Update video offset if needed\r
+ mov dx, WORD PTR WidthStep[0]\r
+ mov ax, WORD PTR WidthStep[2]\r
+ add [ImageLo], dx\r
+ adc WORD PTR Image[0], ax ; Next image column\r
+ dec [NewWidth]\r
+ jnz @@Loop ; Repeat for all columns\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Move functions, on entry:\r
+; AH = additional raster op info (e.g. transparent color)\r
+; BX = 0,\r
+; CX = pixel count,\r
+; DX = mx_BytesPerLine.\r
+;\r
+subMove PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ mov es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subMove ENDP\r
+;\r
+subAnd PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ and es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subAnd ENDP\r
+;\r
+subOr PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ or es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subOr ENDP\r
+;\r
+subXor PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ xor es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subXor ENDP\r
+;\r
+subTrans PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ cmp al, ah\r
+ je @@Skip\r
+ mov es:[di], al\r
+@@Skip:\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subTrans ENDP\r
+;\r
+subAdd PROC NEAR\r
+@@Loop: mov al, ds:[si]\r
+ add es:[di], al\r
+ add di, dx\r
+ dec cx\r
+ jz @@Exit\r
+ add si, WORD PTR HeightStep[2]\r
+ add bx, WORD PTR HeightStep[0]\r
+ jnc @@Loop\r
+ add si, [Width]\r
+ jmp @@Loop\r
+@@Exit: ret\r
+subAdd ENDP\r
+\r
+mxStretchImage ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXLN.ASM - Start line function\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxStartLine\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Changes the video start address to the specified line.\r
+;\r
+; Input:\r
+; Line = new start line\r
+; Output:\r
+; none\r
+;\r
+mxStartLine PROC FAR\r
+ ARG Line:WORD = ARG_SIZE\r
+ .enter 0\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ax, [Line] ; Get video offset\r
+ mul [mx_BytesPerLine]\r
+ xchg ax, bx ; Copy it into BX\r
+\r
+; Wait display\r
+ mov dx, STATUS\r
+@@1: in al, dx\r
+ test al, 08h\r
+ jnz @@1\r
+\r
+; Set starting address\r
+ mov dx, CRTC\r
+ mov al, 0Ch ; Linear Starting Address high\r
+ mov ah, bh\r
+ cli\r
+ out dx, ax\r
+ mov al, 0Dh ; Linear Starting Address low\r
+ mov ah, bl\r
+ out dx, ax\r
+ sti\r
+\r
+; Wait retrace\r
+ mov dx, STATUS\r
+@@2: in al,dx\r
+ test al, 08h\r
+ jz @@2\r
+\r
+ xor ax, ax\r
+ .leave ARG_SIZE\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXSM.ASM - Set/change mode functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxChangeMode\r
+PUBLIC mxGetAspect\r
+PUBLIC mxGetScreenSize\r
+PUBLIC mxSetMode\r
+\r
+PUBLIC mx_ScreenWidth\r
+PUBLIC mx_ScreenHeight\r
+PUBLIC mx_BytesPerLine\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mxSetSysClipRegion : FAR\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_CodeSegment : WORD\r
+\r
+mx_ScreenWidth DW ? ; Current screen width\r
+mx_ScreenHeight DW ?\r
+mx_AspectX DW ? ; Aspect ratio for current mode\r
+mx_AspectY DW ?\r
+mx_BytesPerLine DW 0 ; Bytes per line\r
+\r
+;\r
+; Tables for setting video modes, sources:\r
+; - MODEX.ASM, Matt Pritchard\r
+; - Dr. Dobb's Journal, Michael Abrash\r
+; - Fractint VIDEO.ASM module\r
+;\r
+TBL_SingleLine LABEL WORD ; CRTC\r
+ DW 04009h ; Cell height: 1 scan line\r
+ DW 00014h ; Double word mode off\r
+ DW 0E317h ; Byte mode on\r
+ DW 0\r
+TBL_DoubleLine LABEL WORD ; CRTC\r
+ DW 04109h ; Cell height: 2 scan lines\r
+ DW 00014h\r
+ DW 0E317h\r
+ DW 0\r
+TBL_Width320 LABEL WORD ; CRTC\r
+ DW 05F00h ; Horizontal total\r
+ DW 04F01h ; Horizontal displayed\r
+ DW 05002h ; Start horizontal blanking\r
+ DW 08203h ; End horizontal blanking\r
+ DW 05404h ; Start horizontal sync\r
+ DW 08005h ; End horizontal sync\r
+ DW 02813h ; Row address\r
+ DW 0\r
+TBL_Width360 LABEL WORD ; CRTC\r
+ DW 06B00h ; Horizontal total\r
+ DW 05901h ; Horizontal displayed\r
+ DW 05A02h ; Start horizontal blanking\r
+ DW 08E03h ; End horizontal blanking\r
+ DW 05E04h ; Start horizontal sync\r
+ DW 08A05h ; End horizontal sync\r
+ DW 02D13h ; Row address\r
+ DW 0\r
+TBL_Height175 LABEL WORD ; CRTC\r
+ DW 0BF06h ; Vertical total\r
+ DW 01F07h ; Overflow\r
+ DW 08310h ; Start vertical sync\r
+ DW 08511h ; End vertical sync\r
+ DW 05D12h ; Vertical displayed\r
+ DW 06315h ; Start vertical blanking\r
+ DW 0BA16h ; End vertical blanking\r
+ DW 0\r
+TBL_Height200 LABEL WORD ; CRTC\r
+ DW 0BF06h ; Vertical total\r
+ DW 01F07h ; Overflow\r
+ DW 09C10h ; Start vertical sync\r
+ DW 08E11h ; End vertical sync\r
+ DW 08F12h ; Vertical displayed\r
+ DW 09615h ; Start vertical blanking\r
+ DW 0B916h ; End vertical blanking\r
+ DW 0\r
+TBL_Height240 LABEL WORD ; CRTC\r
+ DW 00D06h ; Vertical total\r
+ DW 03E07h ; Overflow\r
+ DW 0EA10h ; Start vertical sync\r
+ DW 08C11h ; End vertical sync\r
+ DW 0DF12h ; Vertical displayed\r
+ DW 0E715h ; Start vertical blanking\r
+ DW 00616h ; End vertical blanking\r
+ DW 0\r
+TBL_Tweak400x600:\r
+ DW 07400h\r
+ DW 06301h\r
+ DW 06402h\r
+ DW 09703h\r
+ DW 06804h\r
+ DW 09505h\r
+ DW 08606h\r
+ DW 0F007h\r
+ DW 06009h\r
+ DW 0310Fh\r
+ DW 05B10h\r
+ DW 08D11h\r
+ DW 05712h\r
+ DW 03213h\r
+ DW 00014h\r
+ DW 06015h\r
+ DW 08016h\r
+ DW 0E317h\r
+ DW 0\r
+\r
+TBL_320x200:\r
+ DB 63h ; 400 scan lines, 25 MHz clock\r
+ DW 6, 5 ; Aspect: 6/5 = 1.2:1\r
+ DW 320, 200 ; Size\r
+ DW TBL_Width320, TBL_Height200, TBL_DoubleLine, 0\r
+ DW 819 ; Max height\r
+TBL_320x240:\r
+ DB 0E3h ; 400 scan lines, 25 MHz clock\r
+ DW 1, 1 ; Aspect: 1/1 = 1:1\r
+ DW 320, 240 ; Size\r
+ DW TBL_Width320, TBL_Height240, TBL_DoubleLine, 0\r
+ DW 819 ; Max height\r
+TBL_320x400:\r
+ DB 63h ; 480 scan lines, 25 MHz clock\r
+ DW 6, 10 ; Aspect: 6/10 = 0.6:1\r
+ DW 320, 400 ; Size\r
+ DW TBL_Width320, TBL_Height200, TBL_SingleLine, 0\r
+ DW 819 ; Max height\r
+TBL_320x480:\r
+ DB 0E3h ; 480 scan lines, 25 MHz clock\r
+ DW 1, 2 ; Aspect: 1/2 = 0.5:1\r
+ DW 320, 480 ; Size\r
+ DW TBL_Width320, TBL_Height240, TBL_SingleLine, 0\r
+ DW 819 ; Max height\r
+TBL_360x200:\r
+ DB 067h ; 400 scan lines, 28 MHz clock\r
+ DW 27, 20 ; Aspect: 27/20 = 1.35:1\r
+ DW 360, 200 ; Size\r
+ DW TBL_Width360, TBL_Height200, TBL_DoubleLine, 0\r
+ DW 728 ; Max height\r
+TBL_360x240:\r
+ DB 0E7h ; 480 scan lines, 28 MHz clock\r
+ DW 9, 8 ; Aspect: 9/8 = 1.125:1\r
+ DW 360, 240 ; Size\r
+ DW TBL_Width360, TBL_Height240, TBL_DoubleLine, 0\r
+ DW 728 ; Max height\r
+TBL_360x400:\r
+ DB 067h ; 400 scan lines, 28 MHz clock\r
+ DW 27, 40 ; Aspect: 27/40 = 0.675:1\r
+ DW 360, 400 ; Size\r
+ DW TBL_Width360, TBL_Height200, TBL_SingleLine, 0\r
+ DW 728 ; Max height\r
+TBL_360x480:\r
+ DB 0E7h ; 480 scan lines, 28 MHz clock\r
+ DW 9, 16 ; Aspect: 9/16 = 0.5625:1\r
+ DW 360, 480 ; Size\r
+ DW TBL_Width360, TBL_Height240, TBL_SingleLine, 0\r
+ DW 728 ; Max height\r
+TBL_320x175:\r
+ DB 0A3h\r
+ DW 0, 0 ; Aspect:\r
+ DW 320, 175\r
+ DW TBL_Width320, TBL_Height175, TBL_DoubleLine, 0\r
+ DW 819\r
+TBL_320x350:\r
+ DB 0A3h\r
+ DW 0, 0 ; Aspect:\r
+ DW 320, 175\r
+ DW TBL_Width320, TBL_Height175, TBL_SingleLine, 0\r
+ DW 819\r
+TBL_360x175:\r
+ DB 0A7h\r
+ DW 0, 0 ; Aspect:\r
+ DW 360, 480 ; Size\r
+ DW TBL_Width360, TBL_Height175, TBL_DoubleLine, 0\r
+ DW 728 ; Max height\r
+TBL_360x350:\r
+ DB 0A7h\r
+ DW 0, 0 ; Aspect:\r
+ DW 360, 480 ; Size\r
+ DW TBL_Width360, TBL_Height175, TBL_SingleLine, 0\r
+ DW 728 ; Max height\r
+TBL_400x600:\r
+ DB 0E7h ; 28 MHz clock\r
+ DW 1, 2 ; Aspect: 1/2 = 0.5:1\r
+ DW 400, 600 ; Size\r
+ DW TBL_Tweak400x600, 0\r
+ DW 655 ; Max height\r
+\r
+TBL_Mode LABEL WORD\r
+ DW TBL_320x175\r
+ DW TBL_320x200\r
+ DW TBL_320x240\r
+ DW TBL_320x350\r
+ DW TBL_320x400\r
+ DW TBL_320x480\r
+ DW TBL_360x175\r
+ DW TBL_360x200\r
+ DW TBL_360x240\r
+ DW TBL_360x350\r
+ DW TBL_360x400\r
+ DW TBL_360x480\r
+ DW TBL_400x600\r
+\r
+MAXVMODE EQU ($-OFFSET TBL_Mode) / 2\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Enables 80x25 color text mode\r
+;\r
+subText PROC NEAR\r
+ ASSUME ds:MX_TEXT\r
+ mov ax, 0003h\r
+ int 10h ; Call BIOS set mode\r
+\r
+ mov [mx_ScreenHeight], 0\r
+ mov [mx_BytesPerLine], 0\r
+ ret\r
+subText ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Enables the selected graphics mode.\r
+;\r
+; Input:\r
+; Mode = mode to select (MX_???x???)\r
+; Output:\r
+; none\r
+;\r
+mxSetMode PROC FAR\r
+ ARG Mode:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+; Set DS to code segment alias\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov si, [Mode]\r
+ cmp si, MAXVMODE ; Is it a valid mode?\r
+ ja @@Exit ; No, exit\r
+ test si, si ; Text mode?\r
+ jnz @@Set ; No, handle it\r
+\r
+ call subText ; Back to text mode\r
+ jmp @@Exit ; Exit now\r
+\r
+; Set video mode\r
+@@Set:\r
+ dec si ; Skip text mode\r
+ shl si, 1\r
+ mov si, TBL_Mode[si]\r
+ cld\r
+\r
+; Use BIOS to set 320x200x256 linear mode\r
+ push si ; Save SI\r
+ mov ax, 0013h\r
+ int 10h ; Use BIOS to set 320x200 linear mode\r
+ pop si ; Restore SI\r
+\r
+ mov dx, TS\r
+ mov ax, 0604h\r
+ out dx, ax ; Disable chain-4 mode\r
+ mov ax, 0100h\r
+ out dx, ax ; Reset\r
+ mov dx, MISC\r
+ lodsb\r
+ out dx, al ; New timing/size\r
+ mov dx, TS\r
+ mov ax, 0300h\r
+ out dx, ax ; Restart sequencer\r
+\r
+; Unlock CRTC registers 0-7\r
+ mov dx, CRTC\r
+ mov al, 11h\r
+ out dx, al ; Vertical sync end register\r
+ inc dx\r
+ in al, dx\r
+ and al, 7Fh ; Clear write protect bit\r
+ out dx, al\r
+\r
+ lodsw ; Get X aspect\r
+ mov [mx_AspectX], ax\r
+ lodsw ; Get Y aspect\r
+ mov [mx_AspectY], ax\r
+ lodsw ; Get screen width\r
+ mov [mx_ScreenWidth], ax\r
+ shr ax, 1\r
+ shr ax, 1 ; Divide by four to get bytes per line\r
+ mov [mx_BytesPerLine], ax\r
+ lodsw ; Get screen height\r
+ mov [mx_ScreenHeight], ax\r
+\r
+; Set CRTC registers\r
+ mov bx, si\r
+ mov dx, CRTC\r
+@@TableLoop:\r
+ mov si, ds:[bx] ; DS:SI -> table of CRTC registers\r
+ inc bx\r
+ inc bx ; DS:BX -> offset of next table\r
+ test si, si ; Last table?\r
+ jz @@EndLoop ; Yes, exit loop\r
+@@Loop:\r
+ lodsw ; Get CRTC register index and value\r
+ test ax, ax ; End of table?\r
+ jz @@TableLoop ; Yes, go to next table\r
+ out dx, ax ; Set register AL to value AH\r
+ jmp @@Loop ; Get next register/value\r
+@@EndLoop:\r
+\r
+; Set virtual screen and system clip region\r
+ push [mx_ScreenWidth]\r
+ push WORD PTR ds:[bx]\r
+ call mxSetSysClipRegion\r
+\r
+; Clear video memory\r
+ mov dx, TS\r
+ mov ax, 0F02h\r
+ out dx, ax ; Enable all planes\r
+ mov es, [mx_VideoSegment]\r
+ xor di, di\r
+ mov cx, 8000h\r
+ xor ax, ax\r
+ rep stosw\r
+\r
+@@Done:\r
+; Lock CRTC registers 0-7 (some cards need this)\r
+ mov dx, CRTC\r
+ mov al, 11h\r
+ out dx, al ; Vertical sync end register\r
+ inc dx\r
+ in al, dx\r
+ or al, 80h ; Set write protect bit\r
+ out dx, al\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ mov ax, [mx_ScreenWidth]\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxSetMode ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Changes from the current mode the selected graphics mode.\r
+;\r
+; Input:\r
+; Mode = mode to select (MX_???x???)\r
+; Output:\r
+; none\r
+; Notes:\r
+; this function assumes that mxSetMode and mxSetVirtualScreen\r
+; have been called first. View size is rearranged to match the\r
+; specified mode, but video memory is not cleared.\r
+; Differences from mxSetMode:\r
+; - video BIOS is not called to initialize graphics;\r
+; - row address register is not modified;\r
+; - video memory is not cleared;\r
+; - mx_BytesPerLine is not modified;\r
+; - system clip region is not modified.\r
+;\r
+mxChangeMode PROC FAR\r
+ ARG Mode:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+; Set DS to code segment alias\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov si, [Mode]\r
+ cmp si, MAXVMODE ; Is it a valid mode?\r
+ ja @@Exit ; No, exit\r
+ test si, si ; Text mode?\r
+ jz @@Exit ; Yes, exit\r
+\r
+ dec si ; Skip text mode\r
+ shl si, 1\r
+ mov si, TBL_Mode[si]\r
+ cld\r
+\r
+ mov dx, TS\r
+ mov ax, 0604h\r
+ out dx, ax ; Disable chain-4 mode\r
+ mov ax, 0100h\r
+ out dx, ax ; Reset\r
+ mov dx, MISC\r
+ lodsb\r
+ out dx, al ; New timing/size\r
+ mov dx, TS\r
+ mov ax, 0300h\r
+ out dx, ax ; Restart sequencer\r
+\r
+; Unlock CRTC registers 0-7\r
+ mov dx, CRTC\r
+ mov al, 11h\r
+ out dx, al ; Vertical sync end register\r
+ inc dx\r
+ in al, dx\r
+ and al, 7Fh ; Clear write protect bit\r
+ out dx, al\r
+\r
+ lodsw ; Get X aspect\r
+ mov [mx_AspectX], ax\r
+ lodsw ; Get Y aspect\r
+ mov [mx_AspectY], ax\r
+ lodsw ; Get screen width\r
+ mov [mx_ScreenWidth], ax\r
+ lodsw ; Get screen height\r
+ mov [mx_ScreenHeight], ax\r
+\r
+; Set CRTC registers\r
+ mov bx, si\r
+ mov dx, CRTC\r
+@@TableLoop:\r
+ mov si, ds:[bx] ; DS:SI -> table of CRTC registers\r
+ inc bx\r
+ inc bx ; DS:BX -> offset of next table\r
+ test si, si ; Last table?\r
+ jz @@EndLoop ; Yes, exit loop\r
+@@Loop:\r
+ lodsw ; Get CRTC register index and value\r
+ test ax, ax ; End of table?\r
+ jz @@TableLoop ; Yes, go to next table\r
+ cmp al, 13h ; Row address register?\r
+ je @@Loop ; Yes, ignore it\r
+ out dx, ax ; Set register AL to value AH\r
+ jmp @@Loop ; Get next register/value\r
+@@EndLoop:\r
+\r
+; Lock CRTC registers 0-7 (some cards need this)\r
+ mov dx, CRTC\r
+ mov al, 11h\r
+ out dx, al ; Vertical sync end register\r
+ inc dx\r
+ in al, dx\r
+ or al, 80h ; Set write protect bit\r
+ out dx, al\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ mov ax, [mx_ScreenWidth]\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxChangeMode ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the aspect ratio for the current mode.\r
+;\r
+; Input:\r
+; AspectX = pointer to aspect X\r
+; AspectY = pointer to aspect Y\r
+;\r
+; A rectangle of width AspectX and height AspectY looks like a square.\r
+;\r
+mxGetAspect PROC FAR\r
+ ARG AspectY:DWORD, \\r
+ AspectX:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ lds si, [AspectX]\r
+ mov ax, [mx_AspectX]\r
+ mov ds:[si], ax\r
+ lds si, [AspectY]\r
+ mov ax, [mx_AspectY]\r
+ mov ds:[si], ax\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetAspect ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current screen size.\r
+;\r
+; Input:\r
+; Width = pointer to screen width\r
+; Height = pointer to screen height\r
+;\r
+mxGetScreenSize PROC FAR\r
+ ARG SizeY:DWORD, \\r
+ SizeX:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ lds si, [SizeX]\r
+ mov ax, [mx_ScreenWidth]\r
+ mov ds:[si], ax\r
+ lds si, [SizeY]\r
+ mov ax, [mx_ScreenHeight]\r
+ mov ds:[si], ax\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetScreenSize ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXSP.ASM - Set palette function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxSetPalette\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Updates the VGA palette.\r
+;\r
+; Input:\r
+; Buffer = pointer to palette data (R,G,B)\r
+; Start = index of first color to set\r
+; Count = number of color to set\r
+; Output:\r
+; none\r
+;\r
+mxSetPalette PROC FAR\r
+ ARG Count:WORD, \\r
+ Start:WORD, \\r
+ Buffer:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ lds si, [Buffer]\r
+ mov cx, [Count]\r
+ mov ax, [Start]\r
+ mov dx, 3C8h ; PEL write address register\r
+ out dx, al\r
+ inc dx\r
+ cld\r
+ cli ; Disable interrupts\r
+@@Loop:\r
+ lodsb\r
+ out dx, al ; Red\r
+ lodsb\r
+ out dx, al ; Green\r
+ lodsb\r
+ out dx, al ; Blue\r
+ loop @@Loop ; Loop until done\r
+ sti ; Enable interrupts\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxSetPalette ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXSS.ASM - Split screen function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxSplitScreen\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Splits the screen.\r
+;\r
+; Input:\r
+; Line = scan line at which screen has to be splitted\r
+; Output:\r
+; none\r
+;\r
+mxSplitScreen PROC FAR\r
+ ARG Line:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+\r
+; Modify the line compare value: bits 0-7 are in the Line Compare\r
+; register (CRTC #18), bit 8 is in the Overflow Low register (CRTC #7)\r
+; and bit 9 is in the Maximum Row Address register (CRTC #9)\r
+ mov ax, [Line]\r
+ shl ax, 1 ; Adjust line for mode "X"\r
+ mov bh, ah\r
+ mov bl, ah\r
+ and bx, 0201h\r
+ mov cl, 4\r
+ shl bx, cl\r
+ shl bh, 1\r
+ mov dx, CRTC\r
+; Write bits 0-7 to line compare register\r
+ mov ah, al\r
+ mov al, 18h\r
+ out dx, ax\r
+; Write bit 8 to overflow register\r
+ mov al, 07h\r
+ out dx, al\r
+ inc dx\r
+ in al, dx\r
+ dec dx\r
+ mov ah, al\r
+ and ah, 11101111b\r
+ or ah, bl\r
+ mov al, 07h\r
+ out dx, ax\r
+; Write bit 9 to maximum row address register\r
+ mov al, 09h\r
+ out dx, al\r
+ inc dx\r
+ in al, dx\r
+ dec dx\r
+ mov ah, al\r
+ and ah, 10111111b\r
+ or ah, bh\r
+ mov al, 09h\r
+ out dx, ax\r
+\r
+ .leave ARG_SIZE\r
+mxSplitScreen ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXTL.ASM - Put tile\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxPutTile\r
+PUBLIC mxTransPutTile\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_VideoSegment : WORD\r
+EXTRN mx_BytesPerLine : WORD\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Copies a "mode-x" tile from memory to screen.\r
+;\r
+; Input:\r
+; Image = pointer to tile\r
+; X, Y = coordinates of destination\r
+; Width = width of image in pixels (Width and 3 = 0)\r
+; Height = height of image in pixels\r
+; Output:\r
+; none\r
+; Note:\r
+; no clipping is performed on tiles!\r
+;\r
+mxPutTile PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD, \\r
+ Image:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+ mov ax, [Y] ; Get pixel address\r
+ mul [mx_BytesPerLine]\r
+ mov di, [X]\r
+ .shr di, 2\r
+ add di, ax\r
+ mov es, [mx_VideoSegment]\r
+\r
+ lds si, [Image] ; Get tile address\r
+ .shr [Width], 2 ; Number of bytes per plane\r
+ mov cl, BYTE PTR [X]\r
+ and cl, 3\r
+ mov ah, 11h ; AH = plane mask\r
+ shl ah, cl ; Align mask to first plane\r
+\r
+ mov [Y], 4 ; Number of planes\r
+ mov bx, [mx_BytesPerLine]\r
+ sub bx, [Width] ; Extra bytes per line\r
+@@Loop:\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax ; Set write plane\r
+ mov [X], di ; Save video offset\r
+ mov dx, [Height]\r
+@@Loop2:\r
+ mov cx, [Width] ; Number of bytes to move\r
+\r
+ shr cx, 1 ; Move line\r
+ rep movsw\r
+ rcl cx, 1\r
+ rep movsb\r
+\r
+ add di, bx ; Move video offset to next line\r
+ dec dx ; Done all lines?\r
+ jnz @@Loop2 ; No, continue\r
+ mov di, [X] ; Restore video offset\r
+ rol ah, 1 ; Next plane\r
+ adc di, 0 ; Bump video offset if needed\r
+ dec [Y] ; Any plane left?\r
+ jnz @@Loop ; Yes, keep looping\r
+\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxPutTile ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Copies a "mode-x" tile from memory to screen.\r
+; Skips over color 0.\r
+;\r
+; Input:\r
+; Image = pointer to tile\r
+; X, Y = coordinates of destination\r
+; Width = width of image in pixels (Width and 3 = 0)\r
+; Height = height of image in pixels\r
+; Output:\r
+; none\r
+; Note:\r
+; no clipping is performed on tiles!\r
+;\r
+mxTransPutTile PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD, \\r
+ Y:WORD, \\r
+ X:WORD, \\r
+ Image:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si, es, di\r
+\r
+ mov ax, [Y] ; Get pixel address\r
+ mul [mx_BytesPerLine]\r
+ mov di, [X]\r
+ .shr di, 2\r
+ add di, ax\r
+ mov es, [mx_VideoSegment]\r
+\r
+ lds si, [Image] ; Get tile address\r
+ .shr [Width], 2 ; Number of bytes per plane\r
+ mov cl, BYTE PTR [X]\r
+ and cl, 3\r
+ mov ah, 11h ; AH = plane mask\r
+ shl ah, cl ; Align mask to first plane\r
+\r
+ mov [Y], 4 ; Number of planes\r
+ mov bx, [mx_BytesPerLine]\r
+ sub bx, [Width] ; Extra bytes per line\r
+@@Loop:\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax ; Set write plane\r
+ mov [X], di ; Save video offset\r
+ mov dx, [Height]\r
+@@Loop2:\r
+ mov cx, [Width] ; Number of bytes to move\r
+\r
+; Move one line\r
+ jcxz @@MoveLineDone\r
+@@MoveLineLoop:\r
+ mov al, ds:[si]\r
+ test al, al\r
+ jz @@MoveLineNext\r
+ mov es:[di], al\r
+@@MoveLineNext:\r
+ inc si\r
+ inc di\r
+ dec cx\r
+ jnz @@MoveLineLoop\r
+@@MoveLineDone:\r
+\r
+ add di, bx ; Move video offset to next line\r
+ dec dx ; Done all lines?\r
+ jnz @@Loop2 ; No, continue\r
+ mov di, [X] ; Restore video offset\r
+ rol ah, 1 ; Next plane\r
+ adc di, 0 ; Bump video offset if needed\r
+ dec [Y] ; Any plane left?\r
+ jnz @@Loop ; Yes, keep looping\r
+\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxTransPutTile ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXVS.ASM - Set/get virtual screen\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+NOWARN RES\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxSetVirtualScreen\r
+PUBLIC mxGetVirtualScreen\r
+\r
+EXTRN mxRowAddress : FAR\r
+EXTRN mxSetSysClipRegion : FAR\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_BytesPerLine : WORD\r
+EXTRN mx_CodeSegment : WORD\r
+\r
+mx_VirtualWidth DW ? ; Virtual screen size\r
+mx_VirtualHeight DW ?\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the virtual screen.\r
+;\r
+; Input:\r
+; Width = virtual screen width\r
+; Height = virtual screen height\r
+; Output:\r
+; 0 on success, else invalid parameters\r
+;\r
+mxSetVirtualScreen PROC FAR\r
+ ARG Height:WORD, \\r
+ Width:WORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds\r
+\r
+; Set DS to code segment\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, 1 ; Assume an error\r
+ cmp [Width], 320 ; Check width\r
+ jb @@Exit\r
+ push ax ; Save return code\r
+ mov dx, 0004h\r
+ xor ax, ax ; DX:AX = 256K\r
+ div [Width] ; Max height in AX\r
+ cmp [Height], ax\r
+ pop ax ; Restore return code\r
+ ja @@Exit ; Exit if bad heigth\r
+\r
+ mov ax, [Width]\r
+ and ax, 0FFF8h ; Align to byte\r
+ mov [mx_VirtualWidth], ax\r
+ shr ax, 1\r
+ shr ax, 1\r
+ mov [mx_BytesPerLine], ax\r
+ shr ax, 1\r
+ push ax\r
+ call mxRowAddress ; Set row address\r
+ mov ax, [Height]\r
+ mov [mx_VirtualHeight], ax\r
+\r
+ push [Width]\r
+ push [Height]\r
+ call mxSetSysClipRegion\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetVirtualScreen ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the current virtual screen size.\r
+;\r
+; Input:\r
+; Width = pointer to virtual screen width\r
+; Height = pointer to virtual screen height\r
+; Output:\r
+; none\r
+;\r
+mxGetVirtualScreen PROC FAR\r
+ ARG Height:DWORD, \\r
+ Width:DWORD = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ .push ds, si\r
+\r
+ mov ax, [mx_VirtualWidth]\r
+ lds si, [Width]\r
+ mov ds:[si], ax\r
+ mov ax, [mx_VirtualHeight]\r
+ lds si, [Height]\r
+ mov ds:[si], ax\r
+\r
+ xor ax, ax\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetVirtualScreen ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXWD.ASM - Wait display function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxWaitDisplay\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Waits for display start.\r
+;\r
+mxWaitDisplay PROC FAR\r
+ mov dx, STATUS\r
+@@1: in al, dx\r
+ test al, 08h\r
+ jnz @@1\r
+ ret\r
+mxWaitDisplay ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXWM.ASM - Set write mode function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxWriteMode\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the write mode.\r
+;\r
+; Input:\r
+; Mode = write mode (0,1,2,3)\r
+; Output:\r
+; none\r
+;\r
+mxWriteMode PROC FAR\r
+ ARG Mode:BYTE:2 = ARG_SIZE\r
+ .enter 0\r
+\r
+ mov dx, GDC\r
+ mov ah, [Mode]\r
+ and ah, 00000011b\r
+ or ah, 01000000b\r
+ mov al, 05h\r
+ out dx, ax\r
+\r
+ .leave ARG_SIZE\r
+mxWriteMode ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXWP.ASM - Set write/read plane functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxWritePlane\r
+PUBLIC mxReadPlane\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the write plane(s).\r
+;\r
+; Input:\r
+; Plane = write plane(s) to set (bit 0 enables plane 0,\r
+; bit 1 enables plane 1 and so on, different planes\r
+; may be selected at the same time)\r
+; Output:\r
+; none\r
+;\r
+mxWritePlane PROC FAR\r
+ ARG Plane:BYTE:2 = ARG_SIZE\r
+ .enter 0\r
+\r
+ mov ah, [Plane]\r
+ and ah, 00001111b ; Mask off unused bits\r
+ mov al, 02h\r
+ mov dx, TS\r
+ out dx, ax\r
+\r
+ .leave ARG_SIZE\r
+mxWritePlane ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the read plane.\r
+;\r
+; Input:\r
+; Plane = read plane to set (0,1,2,3)\r
+; Output:\r
+; none\r
+;\r
+mxReadPlane PROC FAR\r
+ ARG Plane:BYTE:2 = ARG_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter 0\r
+ mov al, 04h\r
+ mov ah, [Plane]\r
+ and ah, 0000011b ; Mask off unused bits\r
+ mov dx, GDC\r
+ out dx, ax\r
+ .leave ARG_SIZE\r
+mxReadPlane ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXWR.ASM - Wait vertical retrace function\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxWaitRetrace\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Waits for vertical retrace start.\r
+;\r
+mxWaitRetrace PROC FAR\r
+ mov dx, STATUS\r
+@@1: in al,dx\r
+ test al, 08h\r
+ jz @@1\r
+ ret\r
+mxWaitRetrace ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+ModeX - A graphical library for DOS programs\r
+Copyright (c) 1993-1994 Alessandro Scotti\r
+http://www.ascotti.org/\r
+\r
+Please look at the above site in the "Art of..." and\r
+then in the "Old programs" section for more information.\r
+\r
+\r
!endif\r
LIBINCS = modex.def\r
\r
-LIBOBJS = mxbb.$(OBJ) mxcc.$(OBJ) mxcg.$(OBJ) mxcl.$(OBJ) mxcr.$(OBJ) mxel.$(OBJ) mxfb.$(OBJ) mxfp.$(OBJ) mxgc.$(OBJ) mxgi.$(OBJ) mxgm.$(OBJ) mxgp.$(OBJ) mxgv.$(OBJ) mxhl.$(OBJ) mxit.$(OBJ) mxll.$(OBJ) mxln.$(OBJ) mxot.$(OBJ) mxpb.$(OBJ) mxpf.$(OBJ) mxpg.$(OBJ) mxpi.$(OBJ) mxpn.$(OBJ) mxpp.$(OBJ) mxra.$(OBJ) mxrp.$(OBJ) mxsa.$(OBJ) mxsc.$(OBJ) mxsi.$(OBJ) mxsl.$(OBJ) mxsm.$(OBJ) mxsp.$(OBJ) mxss.$(OBJ) mxtl.$(OBJ) mxvs.$(OBJ) mxwd.$(OBJ) mxwm.$(OBJ) mxwp.$(OBJ) mxwr.$(OBJ)\r
+LIBOBJS = mxbb.$(OBJ) mxcc.$(OBJ) mxcg.$(OBJ) mxcl.$(OBJ) mxcr.$(OBJ) mxfb.$(OBJ) mxfp.$(OBJ) mxgc.$(OBJ) mxgi.$(OBJ) mxgm.$(OBJ) mxgp.$(OBJ) mxgv.$(OBJ) mxhl.$(OBJ) mxit.$(OBJ) mxll.$(OBJ) mxln.$(OBJ) mxot.$(OBJ) mxpb.$(OBJ) mxpf.$(OBJ) mxpg.$(OBJ) mxpi.$(OBJ) mxpn.$(OBJ) mxpp.$(OBJ) mxra.$(OBJ) mxrp.$(OBJ) mxsa.$(OBJ) mxsc.$(OBJ) mxsi.$(OBJ) mxsl.$(OBJ) mxsm.$(OBJ) mxsp.$(OBJ) mxss.$(OBJ) mxtl.$(OBJ) mxvs.$(OBJ) mxwd.$(OBJ) mxwm.$(OBJ) mxwp.$(OBJ) mxwr.$(OBJ)\r
\r
#\r
# ASM compiler\r
$(ASMC) $(ASMO) mxcl.asm\r
mxcr.$(OBJ): mxcr.asm\r
$(ASMC) $(ASMO) mxcr.asm\r
-mxel.$(OBJ): mxel.asm\r
- $(ASMC) $(ASMO) mxel.asm\r
mxfb.$(OBJ): mxfb.asm\r
$(ASMC) $(ASMO) mxfb.asm\r
mxfp.$(OBJ): mxfp.asm\r
!endif\r
LIBINCS = modex.def\r
\r
-LIBOBJS = mxbb.$(OBJ) mxcc.$(OBJ) mxcg.$(OBJ) mxcl.$(OBJ) mxcr.$(OBJ) mxel.$(OBJ) mxfb.$(OBJ) mxfp.$(OBJ) mxgc.$(OBJ) mxgi.$(OBJ) mxgm.$(OBJ) mxgp.$(OBJ) mxgv.$(OBJ) mxhl.$(OBJ) mxit.$(OBJ) mxll.$(OBJ) mxln.$(OBJ) mxot.$(OBJ) mxpb.$(OBJ) mxpf.$(OBJ) mxpg.$(OBJ) mxpi.$(OBJ) mxpn.$(OBJ) mxpp.$(OBJ) mxra.$(OBJ) mxrp.$(OBJ) mxsa.$(OBJ) mxsc.$(OBJ) mxsi.$(OBJ) mxsl.$(OBJ) mxsm.$(OBJ) mxsp.$(OBJ) mxss.$(OBJ) mxtl.$(OBJ) mxvs.$(OBJ) mxwd.$(OBJ) mxwm.$(OBJ) mxwp.$(OBJ) mxwr.$(OBJ)\r
-\r
+LIBOBJS = mxbb.$(OBJ) mxcc.$(OBJ) mxcg.$(OBJ) mxcl.$(OBJ) mxcr.$(OBJ) mxfb.$(OBJ) mxgc.$(OBJ) mxgi.$(OBJ) mxgm.$(OBJ) mxgp.$(OBJ) mxgv.$(OBJ) mxhl.$(OBJ) mxit.$(OBJ) mxll.$(OBJ) mxln.$(OBJ) mxot.$(OBJ) mxpb.$(OBJ) mxpf.$(OBJ) mxpg.$(OBJ) mxpi.$(OBJ) mxpn.$(OBJ) mxpp.$(OBJ) mxra.$(OBJ) mxrp.$(OBJ) mxsa.$(OBJ) mxsc.$(OBJ) mxsi.$(OBJ) mxsl.$(OBJ) mxsm.$(OBJ) mxsp.$(OBJ) mxss.$(OBJ) mxtl.$(OBJ) mxvs.$(OBJ) mxwd.$(OBJ) mxwm.$(OBJ) mxwp.$(OBJ) mxwr.$(OBJ)\r
+#mxfp.$(OBJ) \r
#\r
# ASM compiler\r
#\r
$(ASMC) $(ASMO) mxcl.asm\r
mxcr.$(OBJ): mxcr.asm\r
$(ASMC) $(ASMO) mxcr.asm\r
-mxel.$(OBJ): mxel.asm\r
- $(ASMC) $(ASMO) mxel.asm\r
mxfb.$(OBJ): mxfb.asm\r
$(ASMC) $(ASMO) mxfb.asm\r
mxfp.$(OBJ): mxfp.asm\r
--- /dev/null
+ PUBLIC MXBITBLT
+ EXTRN SUBHORIZONTALLINEINFO:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXBITBLT:
+ push bp
+ mov bp,sp
+ sub sp,16H
+ push ds
+ push si
+ push es
+ push di
+ cmp word ptr 0cH[bp],0
+ je L$2
+ mov ax,word ptr 10H[bp]
+ and al,3
+ mov dx,word ptr 8[bp]
+ and dl,3
+ mov bx,offset L$10
+ cmp al,dl
+ jne L$1
+ mov bx,offset L$3
+L$1:
+ call bx
+L$2:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+L$3:
+ mov bx,word ptr 8[bp]
+ mov ax,word ptr 6[bp]
+ mov cx,word ptr 0cH[bp]
+ call near ptr MX_TEXT:SUBHORIZONTALLINEINFO
+ mov byte ptr -14H[bp],al
+ mov byte ptr -16H[bp],ah
+ mov word ptr 0cH[bp],cx
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ mov es,ax
+ mov ax,word ptr 0eH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov si,word ptr 10H[bp]
+ shr si,1
+ shr si,1
+ add si,ax
+ mov dx,3ceH
+ mov ax,4105H
+ out dx,ax
+ cld
+ mov ah,byte ptr -14H[bp]
+ or ah,ah
+ je L$5
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ dec ax
+ mov cx,word ptr 0aH[bp]
+ push si
+ push di
+L$4:
+ movsb
+ add si,ax
+ add di,ax
+ dec cx
+ jne L$4
+ pop di
+ pop si
+ inc si
+ inc di
+L$5:
+ mov bx,word ptr 0cH[bp]
+ test bx,bx
+ je L$7
+ mov dx,3c4H
+ mov ax,0f02H
+ out dx,ax
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ sub ax,bx
+ mov dx,word ptr 0aH[bp]
+ push si
+ push di
+L$6:
+ mov cx,bx
+ rep movsb
+ add si,ax
+ add di,ax
+ dec dx
+ jne L$6
+ pop di
+ pop si
+ add si,bx
+ add di,bx
+L$7:
+ mov ah,byte ptr -16H[bp]
+ or ah,ah
+ je L$9
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ dec ax
+ mov cx,word ptr 0aH[bp]
+L$8:
+ movsb
+ add si,ax
+ add di,ax
+ dec cx
+ jne L$8
+L$9:
+ mov dx,3ceH
+ mov ax,4005H
+ out dx,ax
+ ret
+L$10:
+ mov cx,word ptr 0cH[bp]
+ mov bx,cx
+ shr bx,1
+ shr bx,1
+ and cl,3
+ mov al,8
+ shr al,cl
+ mov si,6
+L$11:
+ mov word ptr -8[bp+si],bx
+ shr al,1
+ adc bx,0
+ dec si
+ dec si
+ jge L$11
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ mov es,ax
+ mov ax,word ptr 0eH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov si,word ptr 10H[bp]
+ shr si,1
+ shr si,1
+ add si,ax
+ mov word ptr -0aH[bp],si
+ mov ax,word ptr 6[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,word ptr 8[bp]
+ shr di,1
+ shr di,1
+ add di,ax
+ mov word ptr -0cH[bp],di
+ mov ax,word ptr 10H[bp]
+ and al,3
+ mov byte ptr -10H[bp],al
+ mov cx,word ptr 8[bp]
+ and cl,3
+ mov al,11H
+ shl al,cl
+ mov byte ptr -12H[bp],al
+ cld
+ mov byte ptr -0eH[bp],4
+ lea bx,-8[bp]
+L$12:
+ cmp word ptr ss:[bx],0
+ je L$15
+ mov ah,byte ptr -12H[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov ah,byte ptr -10H[bp]
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov dx,word ptr 0aH[bp]
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ sub ax,word ptr ss:[bx]
+L$13:
+ mov cx,word ptr ss:[bx]
+ shr cx,1
+ rep movsw
+ rcl cx,1
+ rep movsb
+ add si,ax
+ add di,ax
+ dec dx
+ jne L$13
+ inc bx
+ inc bx
+ inc byte ptr -10H[bp]
+ and byte ptr -10H[bp],3
+ jne L$14
+ inc word ptr -0aH[bp]
+L$14:
+ rol byte ptr -12H[bp],1
+ adc word ptr -0cH[bp],0
+ mov si,word ptr -0aH[bp]
+ mov di,word ptr -0cH[bp]
+ dec byte ptr -0eH[bp]
+ jne L$12
+L$15:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC XSUBCLIPLINE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ or al,byte ptr [bx+si]
+L$2:
+ DW offset L$3
+ or al,byte ptr [bx+si]
+ DW offset L$4
+ or word ptr [bx+si],ax
+ DW offset L$5
+; ????
+ inc word ptr [bx+si]
+ add byte ptr [bp+si],cl
+ add byte ptr 0a00H[bx+si],al
+ add byte ptr 900H[bp],dl
+ add byte ptr -100H[si],ch
+ inc word ptr [bx+si]
+ add byte ptr ds:[0c000H],al
+ add byte ptr ds:[0ce00H],al
+ add byte ptr [di],al
+ add ah,bl
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ DB 0
+L$3:
+ DW offset MX_TEXT+0ecH
+ DW offset MX_TEXT+0eeH
+ DW offset MX_TEXT+0f1H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+0f4H
+ DW offset MX_TEXT+0f7H
+ DW offset MX_TEXT+104H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+111H
+ DW offset MX_TEXT+114H
+ DW offset MX_TEXT+121H
+L$4:
+ DW offset MX_TEXT+132H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+135H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+13bH
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+148H
+ DW offset L$7
+ DW offset L$10
+ DW offset L$7
+ DW offset L$11
+L$5:
+ DW offset L$14
+ DW offset L$15
+ DW offset L$7
+ DW offset L$7
+ DW offset L$16
+ DW offset L$17
+ DW offset L$7
+ DW offset L$7
+ DW offset L$18
+ DW offset L$19
+ DW offset L$22
+ DW offset L$23
+ DW offset L$24
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$25
+ DW offset L$26
+ DW offset L$27
+ DW offset L$30
+ DW offset L$7
+ DW offset L$31
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$32
+ DW offset L$7
+ DW offset L$33
+ DW offset L$36
+ DW offset L$37
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$38
+ DW offset L$39
+ DW offset L$43
+ DW offset L$44
+ DW offset L$45
+ DW offset L$7
+ DW offset L$46
+ DW offset L$47
+ DW offset L$48
+ DW offset L$51
+ DW offset L$7
+ DW offset L$52
+ DW offset L$7
+ DW offset L$53
+ DW offset L$7
+ DW offset L$54
+ DW offset L$58
+ DW offset L$59
+ DW offset L$7
+ DW offset L$7
+ DW offset L$60
+ DW offset L$61
+L$6:
+ clc
+ ret
+L$7:
+ stc
+ ret
+ clc
+ ret
+ jmp near ptr L$67
+ jmp near ptr L$68
+ jmp near ptr L$70
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$6
+ jmp near ptr L$70
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$6
+ jmp near ptr L$70
+ jmp near ptr L$69
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$6
+ jmp near ptr L$69
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$6
+ jmp near ptr L$69
+L$8:
+ stc
+ ret
+L$9:
+ clc
+ ret
+ jmp near ptr L$63
+ call near ptr L$63
+ jmp near ptr L$68
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$8
+ jmp near ptr L$70
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$8
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$9
+ jmp near ptr L$68
+L$10:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$8
+ jmp near ptr L$69
+L$11:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$8
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$9
+ jmp near ptr L$68
+L$12:
+ clc
+ ret
+L$13:
+ stc
+ ret
+L$14:
+ jmp near ptr L$64
+L$15:
+ call near ptr L$64
+ jmp near ptr L$67
+L$16:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$13
+ jmp near ptr L$70
+L$17:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$13
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$12
+ jmp near ptr L$67
+L$18:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$13
+ jmp near ptr L$69
+L$19:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$13
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$12
+ jmp near ptr L$67
+L$20:
+ clc
+ ret
+L$21:
+ stc
+ ret
+L$22:
+ jmp near ptr L$66
+L$23:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$21
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$20
+ jmp near ptr L$70
+L$24:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$21
+ jmp near ptr L$68
+L$25:
+ call near ptr L$66
+ jmp near ptr L$69
+L$26:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$21
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$20
+ jmp near ptr L$69
+L$27:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$21
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$20
+ jmp near ptr L$69
+L$28:
+ clc
+ ret
+L$29:
+ stc
+ ret
+L$30:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$28
+ jmp near ptr L$66
+L$31:
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jl L$29
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$28
+ jmp near ptr L$63
+L$32:
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX1
+ jl L$29
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$28
+ jmp near ptr L$63
+L$33:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$29
+ call near ptr L$68
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$29
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$28
+ jmp near ptr L$69
+L$34:
+ clc
+ ret
+L$35:
+ stc
+ ret
+L$36:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$37:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jl L$35
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$34
+ jmp near ptr L$64
+L$38:
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX2
+ jg L$35
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$39:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jl L$35
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$35
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$40
+ call near ptr L$69
+L$40:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$41:
+ clc
+ ret
+L$42:
+ stc
+ ret
+L$43:
+ jmp near ptr L$65
+L$44:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$42
+ jmp near ptr L$67
+L$45:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$42
+ jmp near ptr L$68
+L$46:
+ call near ptr L$65
+ jmp near ptr L$70
+L$47:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$42
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$42
+ jmp near ptr L$70
+L$48:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$42
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$41
+ jmp near ptr L$70
+L$49:
+ clc
+ ret
+L$50:
+ stc
+ ret
+L$51:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$49
+ jmp near ptr L$65
+L$52:
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$50
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$49
+ jmp near ptr L$63
+L$53:
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX1
+ jl L$50
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$49
+ jmp near ptr L$65
+L$54:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$50
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$50
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$55
+ call near ptr L$65
+L$55:
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$49
+ jmp near ptr L$70
+L$56:
+ clc
+ ret
+L$57:
+ stc
+ ret
+L$58:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp near ptr L$65
+L$59:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$57
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$56
+ jmp L$64
+L$60:
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX2
+ jg L$57
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp L$65
+L$61:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$57
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$57
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$62
+ call near ptr L$70
+L$62:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp L$65
+L$63:
+ mov ax,si
+ sub ax,bx
+ mov dx,word ptr cs:MX_CLIPX1
+ sub dx,di
+ imul dx
+ mov bp,cx
+ sub bp,di
+ idiv bp
+ add bx,ax
+ mov di,word ptr cs:MX_CLIPX1
+ clc
+ ret
+L$64:
+ mov ax,si
+ sub ax,bx
+ mov dx,word ptr cs:MX_CLIPX2
+ sub dx,di
+ imul dx
+ mov bp,cx
+ sub bp,di
+ idiv bp
+ add bx,ax
+ mov di,word ptr cs:MX_CLIPX2
+ clc
+ ret
+L$65:
+ mov ax,cx
+ sub ax,di
+ mov dx,word ptr cs:MX_CLIPY2
+ sub dx,bx
+ imul dx
+ mov bp,si
+ sub bp,bx
+ idiv bp
+ add di,ax
+ mov bx,word ptr cs:MX_CLIPY2
+ clc
+ ret
+L$66:
+ mov ax,cx
+ sub ax,di
+ mov dx,word ptr cs:MX_CLIPY1
+ sub dx,bx
+ imul dx
+ mov bp,si
+ sub bp,bx
+ idiv bp
+ add di,ax
+ mov bx,word ptr cs:MX_CLIPY1
+ clc
+ ret
+L$67:
+ mov ax,bx
+ sub ax,si
+ mov dx,word ptr cs:MX_CLIPX1
+ sub dx,cx
+ imul dx
+ mov bp,di
+ sub bp,cx
+ idiv bp
+ add si,ax
+ mov cx,word ptr cs:MX_CLIPX1
+ clc
+ ret
+L$68:
+ mov ax,bx
+ sub ax,si
+ mov dx,word ptr cs:MX_CLIPX2
+ sub dx,cx
+ imul dx
+ mov bp,di
+ sub bp,cx
+ idiv bp
+ add si,ax
+ mov cx,word ptr cs:MX_CLIPX2
+ clc
+ ret
+L$69:
+ mov ax,di
+ sub ax,cx
+ mov dx,word ptr cs:MX_CLIPY2
+ sub dx,si
+ imul dx
+ mov bp,bx
+ sub bp,si
+ idiv bp
+ add cx,ax
+ mov si,word ptr cs:MX_CLIPY2
+ clc
+ ret
+L$70:
+ mov ax,di
+ sub ax,cx
+ mov dx,word ptr cs:MX_CLIPY1
+ sub dx,si
+ imul dx
+ mov bp,bx
+ sub bp,si
+ idiv bp
+ add cx,ax
+ mov si,word ptr cs:MX_CLIPY1
+ clc
+ ret
+XSUBCLIPLINE:
+ push bp
+ xor si,si
+ cmp dx,word ptr cs:MX_CLIPY2
+ jle L$71
+ or si,8
+ jmp L$72
+L$71:
+ cmp dx,word ptr cs:MX_CLIPY1
+ jge L$72
+ or si,4
+L$72:
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$73
+ or si,2
+ jmp L$74
+L$73:
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$74
+ or si,1
+L$74:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$75
+ or si,80H
+ jmp L$76
+L$75:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$76
+ or si,40H
+L$76:
+ cmp ax,word ptr cs:MX_CLIPX2
+ jle L$77
+ or si,20H
+ jmp L$78
+L$77:
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$78
+ or si,10H
+L$78:
+ mov di,si
+ and di,0fH
+ and si,0f0H
+ shr si,1
+ shr si,1
+ cmp di,word ptr cs:L$1[si]
+ jg L$79
+ mov si,word ptr cs:L$2[si]
+ shl di,1
+ add si,di
+ mov di,ax
+ mov si,word ptr cs:[si]
+ xchg si,dx
+ call dx
+ mov ax,di
+ mov dx,si
+ pop bp
+ ret
+L$79:
+ pop bp
+ stc
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXCOLORTOGRAY
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXCOLORTOGRAY:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 6[bp]
+ jcxz L$2
+ lds si,dword ptr 0cH[bp]
+ les di,dword ptr 8[bp]
+ cld
+ mov bx,4d97H
+L$1:
+ lodsb
+ mul bh
+ mov dx,ax
+ lodsb
+ mul bl
+ add dx,ax
+ lodsb
+ mov ah,1cH
+ mul ah
+ add ax,dx
+ mov al,ah
+ stosw
+ stosb
+ loop L$1
+L$2:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0aH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXCIRCLE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXCIRCLE:
+ push bp
+ mov bp,sp
+ sub sp,2
+ push ds
+ push si
+ push di
+ xor si,si
+ mov di,word ptr 8[bp]
+ mov ax,3
+ sub ax,di
+ sub ax,di
+ mov word ptr -2[bp],ax
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+L$1:
+ cmp si,di
+ jg L$3
+ mov ax,si
+ mov bx,di
+ call near ptr L$4
+ mov ax,si
+ neg ax
+ mov bx,di
+ call near ptr L$4
+ mov ax,si
+ mov bx,di
+ neg bx
+ call near ptr L$4
+ mov ax,si
+ neg ax
+ mov bx,di
+ neg bx
+ call near ptr L$4
+ mov ax,di
+ mov bx,si
+ call near ptr L$4
+ mov ax,di
+ neg ax
+ mov bx,si
+ call near ptr L$4
+ mov ax,di
+ mov bx,si
+ neg bx
+ call near ptr L$4
+ mov ax,di
+ neg ax
+ mov bx,si
+ neg bx
+ call near ptr L$4
+ mov ax,word ptr -2[bp]
+ test ax,ax
+ jl L$2
+ mov ax,di
+ shl ax,1
+ shl ax,1
+ sub ax,4
+ sub word ptr -2[bp],ax
+ dec di
+L$2:
+ mov ax,si
+ shl ax,1
+ shl ax,1
+ add ax,6
+ add word ptr -2[bp],ax
+ inc si
+ jmp L$1
+L$3:
+ xor ax,ax
+ pop di
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+L$4:
+ add bx,word ptr 0cH[bp]
+ add ax,word ptr 0aH[bp]
+ cmp bx,word ptr cs:MX_CLIPX1
+ jl L$5
+ cmp bx,word ptr cs:MX_CLIPX2
+ jg L$5
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$5
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$5
+ mul word ptr cs:MX_BYTESPERLINE
+ mov cx,bx
+ shr bx,1
+ shr bx,1
+ add bx,ax
+ and cl,3
+ mov ax,102H
+ shl ah,cl
+ mov dx,3c4H
+ out dx,ax
+ mov al,byte ptr 6[bp]
+ mov byte ptr [bx],al
+L$5:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MX_CLIPX1
+ PUBLIC MX_CLIPY1
+ PUBLIC MX_CLIPX2
+ PUBLIC MX_CLIPY2
+ PUBLIC MXSETCLIP
+ PUBLIC MXGETCLIP
+ PUBLIC MXSETSYSCLIPREGION
+ PUBLIC MXSETCLIPREGION
+ PUBLIC MXGETCLIPREGION
+ PUBLIC SUBCLIPIMAGE
+ PUBLIC SUBCLIPBOX
+ EXTRN MX_CODESEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_CLIPX1:
+ add byte ptr [bx+si],al
+MX_CLIPY1:
+ add byte ptr [bx+si],al
+MX_CLIPX2:
+ add byte ptr [bx+si],al
+MX_CLIPY2:
+ add byte ptr [bx+si],al
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+L$3:
+ add byte ptr [bx+si],al
+L$4:
+ add byte ptr [bx+si],al
+L$5:
+ add byte ptr [bx+si],al
+L$6:
+ add byte ptr [bx+si],al
+L$7:
+ add byte ptr [bx+si],al
+L$8:
+ add byte ptr [bx+si],al
+L$9:
+ DB 0
+MXSETCLIP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr L$5
+ mov bx,word ptr L$6
+ mov cx,word ptr L$7
+ mov dx,word ptr L$8
+ cmp byte ptr 6[bp],1
+ je L$10
+ mov ax,word ptr L$1
+ mov bx,word ptr L$2
+ mov cx,word ptr L$3
+ mov dx,word ptr L$4
+L$10:
+ mov word ptr MX_CLIPX1,ax
+ mov word ptr MX_CLIPY1,bx
+ mov word ptr MX_CLIPX2,cx
+ mov word ptr MX_CLIPY2,dx
+ mov al,byte ptr 6[bp]
+ xchg byte ptr L$9,al
+ xor ah,ah
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXGETCLIP:
+ mov al,byte ptr cs:L$9
+ xor ah,ah
+ retf
+MXSETSYSCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ xor ax,ax
+ mov word ptr L$1,ax
+ mov word ptr L$2,ax
+ mov ax,word ptr 8[bp]
+ dec ax
+ mov word ptr L$3,ax
+ mov ax,word ptr 6[bp]
+ dec ax
+ mov word ptr L$4,ax
+ mov ax,0
+ push ax
+ push cs
+ call near ptr MXSETCLIP
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXSETCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 0cH[bp]
+ mov word ptr L$5,ax
+ mov ax,word ptr 0aH[bp]
+ mov word ptr L$6,ax
+ mov ax,word ptr 8[bp]
+ add ax,word ptr 0cH[bp]
+ dec ax
+ mov word ptr L$7,ax
+ mov ax,word ptr 6[bp]
+ add ax,word ptr 0aH[bp]
+ dec ax
+ mov word ptr L$8,ax
+ mov al,byte ptr L$9
+ cmp al,1
+ jne L$11
+ push ax
+ push cs
+ call near ptr MXSETCLIP
+L$11:
+ xor ax,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXGETCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push es
+ push di
+ mov ax,word ptr cs:L$5
+ les di,dword ptr 12H[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$6
+ les di,dword ptr 0eH[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$7
+ sub ax,word ptr cs:L$5
+ inc ax
+ les di,dword ptr 0aH[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$8
+ sub ax,word ptr cs:L$6
+ inc ax
+ les di,dword ptr 6[bp]
+ mov word ptr es:[di],ax
+ mov al,byte ptr cs:L$9
+ xor ah,ah
+ pop di
+ pop es
+ mov sp,bp
+ pop bp
+ retf 10H
+SUBCLIPIMAGE:
+ xor si,si
+ mov di,word ptr cs:MX_CLIPY1
+ cmp ax,di
+ jge L$12
+ sub di,ax
+ sub dx,di
+ jle L$16
+ mov ax,di
+ mov di,dx
+ mul cx
+ mov si,ax
+ mov dx,di
+ mov ax,word ptr cs:MX_CLIPY1
+L$12:
+ mov di,word ptr cs:MX_CLIPY2
+ cmp ax,di
+ jg L$16
+ inc di
+ sub di,dx
+ sub di,ax
+ jge L$13
+ add dx,di
+L$13:
+ mov di,word ptr cs:MX_CLIPX1
+ cmp bx,di
+ jge L$14
+ sub di,bx
+ sub cx,di
+ jle L$16
+ add si,di
+ mov bx,word ptr cs:MX_CLIPX1
+L$14:
+ mov di,word ptr cs:MX_CLIPX2
+ cmp bx,di
+ jg L$16
+ inc di
+ sub di,bx
+ sub di,cx
+ jge L$15
+ add cx,di
+L$15:
+ clc
+ ret
+L$16:
+ stc
+ ret
+SUBCLIPBOX:
+ mov di,word ptr cs:MX_CLIPY1
+ cmp ax,di
+ jge L$17
+ sub di,ax
+ sub dx,di
+ jle L$21
+ mov ax,word ptr cs:MX_CLIPY1
+L$17:
+ mov di,word ptr cs:MX_CLIPY2
+ cmp ax,di
+ jg L$21
+ inc di
+ sub di,dx
+ sub di,ax
+ jge L$18
+ add dx,di
+L$18:
+ mov di,word ptr cs:MX_CLIPX1
+ cmp bx,di
+ jge L$19
+ sub di,bx
+ sub cx,di
+ jle L$21
+ mov bx,word ptr cs:MX_CLIPX1
+L$19:
+ mov di,word ptr cs:MX_CLIPX2
+ cmp bx,di
+ jg L$21
+ inc di
+ sub di,bx
+ sub di,cx
+ jge L$20
+ add cx,di
+L$20:
+ clc
+ ret
+L$21:
+ stc
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXFILLBOX
+ EXTRN SUBCLIPBOX:BYTE
+ EXTRN SUBHORIZONTALLINEINFO:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov ah,al
+ shr cx,1
+ rep stosw
+ rcl cx,1
+ rep stosb
+ ret
+L$2:
+ mov byte ptr [bx],al
+ add bx,dx
+ loop L$2
+ ret
+L$3:
+ mov si,di
+L$4:
+ mov ah,byte ptr [si]
+ mov byte ptr [si],al
+ inc si
+ loop L$4
+ ret
+L$5:
+ mov ah,byte ptr [bx]
+ mov byte ptr [bx],al
+ add bx,dx
+ loop L$5
+ ret
+MXFILLBOX:
+ push bp
+ mov bp,sp
+ sub sp,8
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 10H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ mov dx,word ptr 0aH[bp]
+ call near ptr MX_TEXT:SUBCLIPBOX
+ jae L$6
+ jmp near ptr L$12
+L$6:
+ mov word ptr 0aH[bp],dx
+ call near ptr MX_TEXT:SUBHORIZONTALLINEINFO
+ mov word ptr 0cH[bp],cx
+ mov byte ptr -2[bp],al
+ mov byte ptr -4[bp],ah
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov es,ax
+ mov ds,ax
+ cld
+ mov word ptr -6[bp],offset L$2
+ mov word ptr -8[bp],offset L$1
+ mov ax,word ptr 6[bp]
+ cmp al,3
+ ja L$7
+ cmp al,0
+ je L$7
+ shl al,1
+ shl al,1
+ shl al,1
+ mov ah,al
+ mov al,3
+ mov dx,3ceH
+ out dx,ax
+ mov word ptr -6[bp],offset L$5
+ mov word ptr -8[bp],offset L$3
+L$7:
+ mov ah,byte ptr -2[bp]
+ or ah,ah
+ je L$8
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ mov cx,word ptr 0aH[bp]
+ mov bx,di
+ mov al,byte ptr 8[bp]
+ call word ptr -6[bp]
+ inc di
+L$8:
+ mov cx,word ptr 0cH[bp]
+ jcxz L$10
+ mov dx,3c4H
+ mov ax,0f02H
+ out dx,ax
+ mov al,byte ptr 8[bp]
+ mov bx,di
+ mov dx,word ptr 0aH[bp]
+ push di
+L$9:
+ mov di,bx
+ call word ptr -8[bp]
+ mov cx,word ptr 0cH[bp]
+ add bx,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$9
+ pop di
+ add di,word ptr 0cH[bp]
+L$10:
+ mov ah,byte ptr -4[bp]
+ or ah,ah
+ je L$11
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ mov cx,word ptr 0aH[bp]
+ mov bx,di
+ mov al,byte ptr 8[bp]
+ call word ptr -6[bp]
+L$11:
+ mov dx,3ceH
+ mov ax,3
+ out dx,ax
+L$12:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXFADEPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+ inc bx
+ outsw
+ jo L$5
+ jb L$4
+ push 2074H
+ sub byte ptr 29H[bp+di],ah
+ and byte ptr [bx+di],dh
+ cmp word ptr [bx+di],di
+ xor ch,byte ptr [di]
+ xor word ptr [bx+di],di
+ cmp word ptr [si],si
+ and byte ptr 52H[bx+di],al
+ push sp
+ dec cx
+ push bx
+ and byte ptr 2eH[bp+di],dh
+ jb L$1
+ insb
+ and byte ptr cs:6cH[bx+di],al
+ insb
+ and byte ptr 69H[bp+si],dh
+ push 7374H
+ and byte ptr 65H[bp+si],dh
+ jae L$7
+ jb L$9
+ DB 65H, 64H, 2eH
+MXFADEPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,60aH
+ push si
+ push di
+ push ds
+ push es
+ mov word ptr -608H[bp],1
+ mov ax,word ptr 10H[bp]
+ and ax,0ff00H
+L$1:
+ je L$2
+ mov cl,8
+ shr ax,cl
+ mov word ptr -608H[bp],ax
+L$2:
+ mov ax,word ptr 10H[bp]
+ and ax,0feH
+ mov cl,1
+ shr ax,cl
+ or ax,ax
+ jne L$3
+ mov ax,30H
+L$3:
+ mov word ptr -60aH[bp],ax
+L$4:
+ inc ax
+ mov byte ptr -606H[bp],al
+ mov byte ptr -604H[bp],1
+ DB 0c6H, 86H, 0feH, 0f9H
+L$5:
+ add byte ptr 0e46H[bp+di],cl
+ cmp ax,100H
+ jb L$6
+ jmp near ptr L$12
+L$6:
+ add ax,word ptr 0cH[bp]
+ cmp ax,100H
+ jbe L$8
+ mov ax,100H
+ sub ax,word ptr 0eH[bp]
+ DB 89H, 46H
+L$7:
+ or al,0bH
+ ????
+ jne L$8
+ jmp near ptr L$12
+L$8:
+ mov cx,word ptr 0cH[bp]
+ mov ax,cx
+ shl ax,1
+ add cx,ax
+ mov ax,ss
+L$9:
+ mov es,ax
+ lea di,-300H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov si,ax
+ shl ax,1
+ add ax,si
+ lds si,dword ptr 12H[bp]
+ add si,ax
+ cld
+ shr cx,1
+ rep movsw
+ rcl cx,1
+ rep movsb
+ test word ptr 10H[bp],1
+ je L$10
+ mov ax,word ptr -60aH[bp]
+ mov byte ptr -602H[bp],al
+ mov byte ptr -604H[bp],0ffH
+ mov ax,ss
+ mov ds,ax
+ mov es,ax
+ lea di,-300H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ call near ptr L$19
+L$10:
+ mov bh,byte ptr 0aH[bp]
+ and bh,3fH
+ mov bl,byte ptr 8[bp]
+ and bl,3fH
+ mov dh,byte ptr 6[bp]
+ and dh,3fH
+ mov dl,byte ptr -602H[bp]
+ mov ax,ss
+ mov ds,ax
+ mov es,ax
+L$11:
+ mov ax,word ptr 0cH[bp]
+ mov cx,word ptr -60aH[bp]
+ lea si,-300H[bp]
+ lea di,-600H[bp]
+ call near ptr L$13
+ push bx
+ push dx
+ lea si,-600H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov bx,word ptr 0cH[bp]
+ mov cx,word ptr -608H[bp]
+ call near ptr L$15
+ pop dx
+ pop bx
+ add dl,byte ptr -604H[bp]
+ dec byte ptr -606H[bp]
+ jne L$11
+L$12:
+ pop es
+ pop ds
+ pop di
+ pop si
+ mov sp,bp
+ pop bp
+ retf 10H
+L$13:
+ cld
+ push bp
+ mov bp,ax
+L$14:
+ lodsb
+ sub al,bh
+ imul dl
+ idiv cl
+ add al,bh
+ stosb
+ lodsb
+ sub al,bl
+ imul dl
+ idiv cl
+ add al,bl
+ stosb
+ lodsb
+ sub al,dh
+ imul dl
+ idiv cl
+ add al,dh
+ stosb
+ dec bp
+ jne L$14
+ pop bp
+ ret
+L$15:
+ mov ah,al
+ mov dx,3daH
+L$16:
+ in al,dx
+ test al,8
+ jne L$16
+L$17:
+ in al,dx
+ test al,8
+ je L$17
+ loop L$16
+ mov cx,bx
+ mov dx,3c8H
+ mov al,ah
+ out dx,al
+ inc dx
+ cld
+ cli
+L$18:
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ loop L$18
+ sti
+ ret
+L$19:
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ cld
+L$20:
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ loop L$20
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGETCOLOR
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr 12H[bp]
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ lds si,dword ptr 0eH[bp]
+ in al,dx
+ mov byte ptr [si],al
+ lds si,dword ptr 0aH[bp]
+ in al,dx
+ mov byte ptr [si],al
+ lds si,dword ptr 6[bp]
+ in al,dx
+ mov byte ptr [si],al
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0eH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGETIMAGE
+ EXTRN SUBCLIPIMAGE:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,10H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 0cH[bp]
+ mov ax,word ptr 0aH[bp]
+ mov cx,word ptr 8[bp]
+ mov dx,word ptr 6[bp]
+ call near ptr MX_TEXT:SUBCLIPIMAGE
+ jae L$1
+ jmp near ptr L$7
+L$1:
+ mov word ptr 6[bp],dx
+ add word ptr 0eH[bp],si
+ mul word ptr cs:MX_BYTESPERLINE
+ mov si,bx
+ shr si,1
+ shr si,1
+ add si,ax
+ mov word ptr -0aH[bp],si
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -0eH[bp],bl
+ mov bx,cx
+ shr bx,1
+ shr bx,1
+ and cl,3
+ mov al,8
+ shr al,cl
+ mov di,6
+L$2:
+ mov word ptr -8[bp+di],bx
+ shr al,1
+ adc bx,0
+ dec di
+ dec di
+ jge L$2
+ cld
+ mov byte ptr -10H[bp],4
+ lea bx,-8[bp]
+ mov es,word ptr 10H[bp]
+ mov ah,byte ptr -0eH[bp]
+L$3:
+ cmp word ptr ss:[bx],0
+ je L$7
+ mov di,word ptr 0eH[bp]
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov dx,word ptr 6[bp]
+ mov si,word ptr -0aH[bp]
+L$4:
+ push si
+ push di
+ mov cx,word ptr ss:[bx]
+L$5:
+ movsb
+ add di,3
+ dec cx
+ jne L$5
+ pop di
+ pop si
+ add di,word ptr 8[bp]
+ add si,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$4
+ inc bx
+ inc bx
+ inc ah
+ test ah,4
+ je L$6
+ inc word ptr -0aH[bp]
+ and ah,3
+L$6:
+ inc word ptr 0eH[bp]
+ dec byte ptr -10H[bp]
+ jne L$3
+L$7:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGAMMACORRECT
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bp+si],cl
+ push cs
+ adc word ptr [bp+di],dx
+ adc ax,1817H
+ sbb bl,byte ptr [bp+di]
+ sbb al,1dH
+ pop ds
+ and byte ptr [bx+di],ah
+ and ah,byte ptr [bp+di]
+ and al,25H
+ and ax,2726H
+ sub byte ptr [bx+di],ch
+ sub word ptr [bp+si],bp
+ sub bp,word ptr [si]
+ sub al,2dH
+ das
+ xor byte ptr [bx+si],dh
+ xor word ptr [bx+di],si
+ xor dh,byte ptr [bp+di]
+ xor si,word ptr [si]
+ xor al,35H
+ xor ax,3636H
+ aaa
+ aaa
+ cmp byte ptr [bx+si],bh
+ cmp word ptr [bx+di],di
+ cmp bh,byte ptr [bp+si]
+ cmp di,word ptr [bp+di]
+ cmp al,3cH
+ cmp ax,3e3dH
+ aas
+ aas
+MXGAMMACORRECT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 6[bp]
+ jcxz L$3
+ lds si,dword ptr 0cH[bp]
+ les di,dword ptr 8[bp]
+ mov bx,offset L$1
+ cld
+ mov ax,cx
+ add cx,cx
+ add cx,ax
+L$2:
+ lodsb
+ xlat word ptr cs:[bx]
+ stosb
+ loop L$2
+L$3:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0aH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGETPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push es
+ push di
+ les di,dword ptr 0aH[bp]
+ mov cx,word ptr 6[bp]
+ mov ax,word ptr 8[bp]
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ cld
+L$1:
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ loop L$1
+ pop di
+ pop es
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGETVERSION
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETVERSION:
+ mov ax,128H
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC SUBHORIZONTALLINEINFO
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bx+si],al
+ add ax,word ptr [bx+si]
+ add al,byte ptr [bx+si]
+ add word ptr [bx+si],ax
+L$2:
+ add byte ptr ds:[80cH],cl
+L$3:
+ add byte ptr [bx+di],al
+ add ax,word ptr [bx]
+L$4:
+ DB 2, 6
+SUBHORIZONTALLINEINFO:
+ ;DD ds:[63278]
+ ASSUME ds:NOTHING
+ add byte ptr -2e05H[bp+di],cl
+ out dx,ax
+ shr di,1
+ add di,ax
+ and bx,3
+ mov al,byte ptr cs:L$2[bx]
+ shl bx,1
+ sub cx,word ptr cs:L$1[bx]
+ jge L$5
+ mov bx,cx
+ inc bx
+ inc bx
+ and al,byte ptr cs:L$4[bx]
+ xor ah,ah
+ xor cx,cx
+ jmp L$6
+L$5:
+ mov bx,cx
+ and bx,3
+ mov ah,byte ptr cs:L$3[bx]
+ shr cx,1
+ shr cx,1
+L$6:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXIT.ASM - Initialization/termination functions\r
+; Copyright (c) 1993,1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+;WARN PRO\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxInit\r
+PUBLIC mxTerm\r
+\r
+PUBLIC mx_VideoSegment\r
+PUBLIC mx_CodeSegment\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+DB 'MODEX library - Copyright (c) 1992-1994 Alessandro Scotti'\r
+\r
+mx_VideoSegment DW 0A000h\r
+mx_CodeSegment DW SEG MX_TEXT\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Initialization.\r
+;\r
+; Input:\r
+; none\r
+; Output:\r
+; AX = 0 on success\r
+;\r
+mxInit PROC FAR\r
+ LOCAL Result:WORD, \\r
+ VideoSeg:WORD, \\r
+ CStoDSalias:WORD = AUTO_SIZE\r
+ ASSUME ds:NOTHING\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+\r
+ mov [Result], -1 ; Assume an error\r
+ mov [VideoSeg], 0A000h ; Real mode video segment\r
+ mov [CStoDSalias], cs ; Real mode data alias for CS\r
+\r
+; Check if running in protected mode under DPMI\r
+ mov ax, 1686h\r
+ int 2Fh\r
+ or ax, ax\r
+ jnz @@1 ; DPMI not found, continue in real mode\r
+\r
+; Get a data alias for CS\r
+ mov ax, 000Ah ; DMPI: create data alias\r
+ mov bx, cs\r
+ int 31h\r
+ jc @@Exit ; Exit if service failed\r
+ mov [CStoDSalias], ax ; Save data alias for CS\r
+; Get a protected-mode selector for the video segment\r
+ mov ax, 0002h\r
+ mov bx, 0A000h ; Real mode segment of video\r
+ int 31h ; DPMI: get segment selector\r
+ jc @@Exit ; Exit if service failed\r
+ mov [VideoSeg], ax ; Save protected mode video selector\r
+\r
+; Initialize variables\r
+@@1:\r
+ mov ds, [CStoDSalias]\r
+ ASSUME ds:MX_TEXT\r
+ mov [mx_CodeSegment], ds\r
+ mov ax, [VideoSeg]\r
+ mov [mx_VideoSegment], ax\r
+\r
+; Don't bother with VGA check for now...\r
+\r
+ mov [Result], 0\r
+\r
+@@Exit:\r
+ mov ax, [Result]\r
+ .pop ds, si, es, di\r
+; .leave\r
+mxInit ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Termination.\r
+;\r
+; Input:\r
+; none\r
+; Output:\r
+; always 0.\r
+;\r
+mxTerm PROC FAR\r
+ ASSUME ds:NOTHING\r
+ xor ax, ax\r
+ ret\r
+mxTerm ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+ PUBLIC MXLOADLATCHES
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXLOADLATCHES:
+ push ds
+ push si
+ mov dx,3ceH
+ mov ax,0ff08H
+ out dx,ax
+ mov ax,3
+ out dx,ax
+ mov ax,5
+ out dx,ax
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ mov si,0ffffH
+ mov bh,8
+ mov cx,3
+L$1:
+ mov dx,3ceH
+ mov al,4
+ mov ah,cl
+ out dx,ax
+ mov dx,3c4H
+ mov al,2
+ mov ah,bh
+ out dx,ax
+ mov al,byte ptr [si]
+ push ax
+ mov byte ptr [si],bl
+ mov al,byte ptr [di]
+ shr bh,1
+ loop L$1
+ mov cx,3
+ mov bh,8
+ mov dx,3c4H
+L$2:
+ mov al,2
+ mov ah,bh
+ out dx,ax
+ pop ax
+ mov byte ptr [si],al
+ shr bh,1
+ loop L$2
+ pop si
+ pop ds
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXLINE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$29
+ DW offset L$32
+ DW offset L$35
+ DW offset L$38
+MXLINE:
+ push bp
+ mov bp,sp
+ sub sp,12H
+ push ds
+ push si
+ push di
+ mov ax,word ptr 10H[bp]
+ mov bx,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ mov dx,word ptr 0aH[bp]
+ call near ptr L$8
+ jae L$2
+ jmp near ptr L$7
+L$2:
+ mov si,cx
+ xchg ax,si
+ sub ax,si
+ jge L$3
+ xchg cx,si
+ xchg dx,bx
+ neg ax
+L$3:
+ mov word ptr -2[bp],ax
+ mov cx,word ptr cs:MX_BYTESPERLINE
+ mov ax,dx
+ sub ax,bx
+ jge L$4
+ neg cx
+ neg ax
+L$4:
+ mov word ptr -4[bp],ax
+ mov word ptr -0cH[bp],cx
+ mov ax,bx
+ mul word ptr cs:MX_BYTESPERLINE
+ mov cx,si
+ shr si,1
+ shr si,1
+ add si,ax
+ and cl,3
+ mov ax,1102H
+ shl ah,cl
+ mov byte ptr -12H[bp],ah
+ mov dx,3c4H
+ out dx,ax
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ xor bx,bx
+ mov al,byte ptr 6[bp]
+ cmp al,0
+ je L$5
+ and al,3
+ shl al,1
+ shl al,1
+ shl al,1
+ mov ah,al
+ mov al,3
+ mov dx,3ceH
+ out dx,ax
+ inc bx
+ inc bx
+L$5:
+ mov ax,word ptr -2[bp]
+ mov cx,word ptr -4[bp]
+ cmp ax,cx
+ jae L$6
+ inc bx
+L$6:
+ shl bx,1
+ call word ptr cs:L$1[bx]
+ cmp byte ptr 6[bp],0
+ je L$7
+ mov ax,3
+ mov dx,3ceH
+ out dx,ax
+L$7:
+ xor ax,ax
+ pop di
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+L$8:
+ mov di,ax
+ mov si,dx
+ xor al,al
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$9
+ or al,1
+L$9:
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$10
+ or al,2
+L$10:
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$11
+ or al,4
+L$11:
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$12
+ or al,8
+L$12:
+ mov byte ptr -10H[bp],al
+ xor al,al
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$13
+ or al,1
+L$13:
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$14
+ or al,2
+L$14:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$15
+ or al,4
+L$15:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$16
+ or al,8
+L$16:
+ mov byte ptr -0eH[bp],al
+ mov ah,byte ptr -10H[bp]
+ test ah,al
+ je L$17
+ jmp near ptr L$28
+L$17:
+ or ah,al
+ jne L$18
+ jmp near ptr L$27
+L$18:
+ mov ax,cx
+ sub ax,di
+ mov word ptr -0aH[bp],ax
+ mov ax,si
+ sub ax,bx
+ mov word ptr -0cH[bp],ax
+ mov al,byte ptr -0eH[bp]
+L$19:
+ test al,al
+ jne L$20
+ xchg di,cx
+ xchg si,bx
+ xchg byte ptr -10H[bp],al
+L$20:
+ test al,1
+ je L$21
+ mov ax,word ptr cs:MX_CLIPX1
+ sub ax,di
+ mov di,word ptr cs:MX_CLIPX1
+ jmp L$22
+L$21:
+ test al,2
+ je L$23
+ mov ax,word ptr cs:MX_CLIPX2
+ sub ax,di
+ mov di,word ptr cs:MX_CLIPX2
+L$22:
+ imul word ptr -0cH[bp]
+ idiv word ptr -0aH[bp]
+ add bx,ax
+ mov al,8
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$26
+ mov al,4
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$26
+ xor al,al
+ jmp L$26
+L$23:
+ test al,4
+ je L$24
+ mov ax,word ptr cs:MX_CLIPY1
+ sub ax,bx
+ mov bx,word ptr cs:MX_CLIPY1
+ jmp L$25
+L$24:
+ mov ax,word ptr cs:MX_CLIPY2
+ sub ax,bx
+ mov bx,word ptr cs:MX_CLIPY2
+L$25:
+ imul word ptr -0aH[bp]
+ idiv word ptr -0cH[bp]
+ add di,ax
+ mov al,1
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$26
+ mov al,2
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$26
+ xor al,al
+L$26:
+ mov ah,byte ptr -10H[bp]
+ test ah,al
+ jne L$28
+ or ah,al
+ je L$27
+ jmp near ptr L$19
+L$27:
+ mov ax,di
+ mov dx,si
+ clc
+ ret
+L$28:
+ stc
+ ret
+L$29:
+ mov di,ax
+ neg di
+ shl cx,1
+ mov word ptr -6[bp],cx
+ mov cx,ax
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov al,2
+ mov ah,byte ptr -12H[bp]
+ mov bl,byte ptr 8[bp]
+ mov dx,3c4H
+ inc cx
+L$30:
+ mov byte ptr [si],bl
+ dec cx
+ je L$31
+ rol ah,1
+ adc si,0
+ out dx,ax
+ add di,word ptr -6[bp]
+ jl L$30
+ add si,word ptr -0cH[bp]
+ sub di,word ptr -8[bp]
+ jmp L$30
+L$31:
+ ret
+L$32:
+ mov di,cx
+ neg di
+ shl ax,1
+ mov word ptr -6[bp],ax
+ mov ax,cx
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov bl,byte ptr 8[bp]
+ mov ah,byte ptr -12H[bp]
+ mov al,2
+ mov dx,3c4H
+ inc cx
+L$33:
+ mov byte ptr [si],bl
+ dec cx
+ je L$34
+ add si,word ptr -0cH[bp]
+ add di,word ptr -6[bp]
+ jl L$33
+ rol ah,1
+ adc si,0
+ out dx,ax
+ sub di,word ptr -8[bp]
+ jmp L$33
+L$34:
+ ret
+L$35:
+ mov di,ax
+ neg di
+ shl cx,1
+ mov word ptr -6[bp],cx
+ mov cx,ax
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov al,2
+ mov ah,byte ptr -12H[bp]
+ mov bl,byte ptr 8[bp]
+ mov dx,3c4H
+ inc cx
+L$36:
+ mov bh,byte ptr [si]
+ mov byte ptr [si],bl
+ dec cx
+ je L$37
+ rol ah,1
+ adc si,0
+ out dx,ax
+ add di,word ptr -6[bp]
+ jl L$36
+ add si,word ptr -0cH[bp]
+ sub di,word ptr -8[bp]
+ jmp L$36
+L$37:
+ ret
+L$38:
+ mov di,cx
+ neg di
+ shl ax,1
+ mov word ptr -6[bp],ax
+ mov ax,cx
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov bl,byte ptr 8[bp]
+ mov ah,byte ptr -12H[bp]
+ mov al,2
+ mov dx,3c4H
+ inc cx
+L$39:
+ mov bh,byte ptr [si]
+ mov byte ptr [si],bl
+ dec cx
+ je L$40
+ add si,word ptr -0cH[bp]
+ add di,word ptr -6[bp]
+ jl L$39
+ rol ah,1
+ adc si,0
+ out dx,ax
+ sub di,word ptr -8[bp]
+ jmp L$39
+L$40:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSETFONT
+ PUBLIC MXSETTEXTCOLOR
+ PUBLIC MXOUTCHAR
+ PUBLIC MXOUTTEXT
+ PUBLIC MXSETTEXTSTEP
+ PUBLIC MXGETTEXTSTEP
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MXPUTIMAGE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+; Default 8x8 font
+fnt_Default LABEL BYTE
+ INCLUDE DEFAULT.FNT
+
+; Table of system fonts
+tbl_SystemFont LABEL WORD
+ DW fnt_Default, 8, 8
+
+MX_MAXSYSFONT EQU ($-OFFSET tbl_SystemFont) SHR 2
+
+mx_FontPtr DW OFFSET fnt_Default, SEG MX_TEXT
+mx_FontWidth DW 8 ; Font width in pixels
+mx_FontHeight DW 8 ; Font height in pixels
+mx_FontCharSize DW 8 ; Size in bytes of a font character
+mx_FontColor DW 00FFh ; Color: foreground + background*256
+mx_FontOp DW 0 ; Raster op
+mx_DeltaX DW 8 ; Horizontal step
+mx_DeltaY DW 0 ; Vertical step
+
+L$1:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ; The label referred to here is an undefined location
+ ;;;;ffff
+ ;jle 0xff8bh
+ movsw
+ and word ptr -7e67H[di],7e7eH
+ call bx
+ call bx
+ out 0ffH,ax
+ jle L$9
+; ;????
+; ;????
+; ;????
+ jl L$7
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+L$2:
+ jl L$2
+ jl L$8
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+ adc byte ptr -2[si],dl
+ push sp
+ adc dh,bh
+ adc byte ptr [bx+si],bh
+L$3:
+ jl L$3
+L$4:
+ ;????
+ jl L$5
+ inc byte ptr [bx+si]
+ sbb byte ptr [si],bh
+ jle L$11
+ cmp al,18H
+ add bh,bh
+ out 0c3H,ax
+ DB 81H, 81H, 0c3H, 0e7H
+L$5:
+ inc word ptr [bx+si]
+ cmp al,66H
+ inc dx
+ inc dx
+ DB 66H, 3cH
+L$6:
+ add bh,bh
+ ret
+ cwd
+ mov bp,99bdH
+L$7:
+ ret
+ inc word ptr [bx]
+ add ax,word ptr [di]
+ ; The label referred to here is an undefined location
+ ;;;;;0ffff
+ ;;;;;js 0ffffffe1H
+ DB 84H
+L$8:
+ test byte ptr 7cH[bx+si],bh
+ add byte ptr 7c82H[bp+si],10H
+ cmp byte ptr [bx+si],dl
+ sbb al,10H
+ sbb al,10H
+ adc byte ptr [bx+si],dl
+ xor byte ptr [bx+si],dh
+ and bh,byte ptr ds:[2222H]
+ ;;;;;pushad
+ cwd
+ pop dx
+ cmp al,0e7H
+ out 3cH,ax
+ pop dx
+ cwd
+ add byte ptr [bx+si],dl
+ xor byte ptr -10H[bx+si],dh
+L$9:
+ jo L$10
+ adc byte ptr [bx+si],al
+ add al,0e0H
+ ;;;;lock loopnz L$6
+ adc byte ptr [bx+si],38H
+ push sp
+ adc byte ptr [bx+si],dl
+ push sp
+ cmp byte ptr [bx+si],dl
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ add byte ptr [bx+si],cl
+ jle L$4
+ xchg ax,dx
+ jb L$10
+ adc dl,byte ptr [bp+si]
+ add byte ptr [si],bh
+ and bl,byte ptr [bx+si]
+ and al,24H
+ sbb byte ptr 3cH[si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ DB 0, 3eH
+ ;;;;DD ds:[03eh]
+L$10:
+ add byte ptr [bx+si],bh
+ push sp
+ DB 10H
+L$11:
+ adc byte ptr [bx+si],dl
+ push sp
+ cmp dh,bh
+ add byte ptr [bx+si],dl
+ cmp byte ptr 10H[si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr 38H[si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],cl
+ add al,0feH
+ add al,8
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],ah
+ inc ax
+ inc byte ptr 20H[bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr -380H[bx+si],0
+ add byte ptr [bx+si],al
+ and al,42H
+ inc word ptr 24H[bp+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+L$12:
+ jl L$12
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ;????
+ jl L$15
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ and al,24H
+ add byte ptr [bx+si],al
+ DB 0
+L$13:
+ add byte ptr [bx+si],al
+ and al,24H
+ ;;;;jle 140H
+ ;;;;jle 142H
+L$14:
+ and al,0
+ cmp byte ptr 50H[si],dl
+ cmp byte ptr [si],dl
+ push sp
+ cmp byte ptr [bx+si],dl
+ add byte ptr [bp+si],al
+ inc sp
+ or byte ptr [bx+si],dl
+ and byte ptr [bp+si],al
+ cmp byte ptr 38H[si],al
+ ;;;;pusha
+ xchg ax,sp
+L$15:
+ DB 88H
+L$16:
+ ;;;;je 138H
+ and byte ptr [bx+si],ah
+ inc ax
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ and byte ptr 40H[bx+si],al
+ inc ax
+ and byte ptr [bx+si],dl
+ add byte ptr 20H[bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],ah
+L$17:
+ inc ax
+ add byte ptr [bx+si],al
+ and al,18H
+ jle L$18
+ and al,0
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ jl L$18
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ and byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cld
+ DB 0
+L$18:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add al,8
+ adc byte ptr [bx+si],ah
+ inc ax
+L$19:
+ add byte ptr [bx+si],7cH
+ ;????
+ DB 8aH, 92H
+L$20:
+ mov byte ptr tbl_SystemFont[bx+2],al
+ DD L$21
+L$21:
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],bh
+ add byte ptr L$13[bx+si],bh
+ add al,18H
+ ;;;;pusha
+ cmp ah,0
+ js L$14
+ add al,38H
+ add al,84H
+ js L$22
+L$22:
+ sbb al,24H
+ inc sp
+ test dh,bh
+ add al,0eH
+ add ah,bh
+ cmp al,4
+ add al,84H
+ js L$23
+L$23:
+ js L$16
+ cmp al,84H
+ test byte ptr [bx+si],bh
+ cld
+ add al,4
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],ah
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr -7cH[bx+si],bh
+ test byte ptr [bx+si],bh
+ js L$17
+ test byte ptr 4[si],bh
+ test byte ptr [bx+si],bh
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],ah
+ or byte ptr [bx+si],dl
+ and byte ptr 20H[bx+si],al
+ adc byte ptr [bx+si],cl
+ add byte ptr [bx+si],al
+ add ah,bh
+ add byte ptr [bx+si],al
+ cld
+ add byte ptr [bx+si],al
+ inc ax
+ and byte ptr [bx+si],dl
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],al
+ js L$19
+ add al,8
+ adc byte ptr [bx+si],al
+L$24:
+ adc byte ptr [bx+si],al
+ jl L$20
+ mov dx,0bea6H
+ cmp byte ptr [si],78H
+ test byte ptr -7b04H[si],al
+ test byte ptr -800H[si],al
+ test byte ptr -7b08H[si],al
+ test al,bh
+ add byte ptr -7cH[bx+si],bh
+ add byte ptr -7b80H[bx+si],78H
+ add al,dh
+ mov byte ptr -7b7cH[si],al
+ mov al,dh
+ add ah,bh
+ add byte ptr -7f10H[bx+si],80H
+ cld
+ add ah,bh
+ add byte ptr -7f10H[bx+si],80H
+ add byte ptr [bx+si],78H
+ test byte ptr -7b64H[bx+si],al
+ test byte ptr [bx+si],bh
+ test byte ptr -37cH[si],al
+ test byte ptr 84H[si],al
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ cmp byte ptr [bx+si],al
+ sbb al,8
+ or byte ptr [bx+si],cl
+ mov byte ptr 70H[bx+si],cl
+ test byte ptr -1f70H[bx+si],cl
+ nop
+ mov byte ptr -8000H[si],al
+ add byte ptr -7f80H[bx+si],80H
+ cld
+ add dh,al
+ stosb
+ xchg ax,dx
+ add byte ptr -7d7eH[bp+si],0
+ add dl,0a2H
+ xchg ax,dx
+ mov al,byte ptr 82H[bp]
+ js L$24
+ test byte ptr -7b7cH[si],al
+ js L$25
+L$25:
+ clc
+ test byte ptr -7f08H[si],al
+ add byte ptr 7800H[bx+si],84H
+ test byte ptr -776cH[si],al
+ jbe L$26
+L$26:
+ clc
+ test byte ptr -6f08H[si],al
+ mov byte ptr 7800H[si],al
+ test byte ptr 478H[bx+si],al
+ test byte ptr [bx+si],bh
+ ;????
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr -7b7cH[si],al
+ test byte ptr 7884H[si],al
+ add byte ptr -7b7cH[si],al
+ test byte ptr 3048H[si],al
+ add byte ptr -7d7eH[bp+si],al
+ adc byte ptr -3956H[bp+si],0
+ add byte ptr 28H[si],10H
+ sub byte ptr -7eH[si],al
+ add byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add dh,bh
+ add al,8
+ adc byte ptr [bx+si],ah
+ inc ax
+ inc byte ptr [bx+si]
+ js L$32
+ inc ax
+ inc ax
+ inc ax
+ inc ax
+ js L$27
+L$27:
+ add byte ptr 2040H[bx+si],al
+ adc byte ptr [bx+si],cl
+ add al,0
+ js L$29
+ or byte ptr [bx+si],cl
+ or byte ptr [bx+si],cl
+ js L$28
+L$28:
+ adc byte ptr [bx+si],ch
+L$29:
+ inc sp
+ add byte ptr [bx+si],0
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ and byte ptr [bx+si],ah
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$30
+L$30:
+ add byte ptr 40H[bx+si],al
+ js L$33
+ inc sp
+ js L$31
+L$31:
+ add byte ptr [bx+si],al
+L$32:
+ cmp al,40H
+ inc ax
+ inc ax
+ cmp al,0
+ add byte ptr [si],al
+ add al,3cH
+ inc sp
+ inc sp
+ cmp al,0
+ add byte ptr [bx+si],al
+ cmp byte ptr 7cH[si],al
+ inc ax
+ cmp al,0
+ add byte ptr [si],cl
+ adc byte ptr [si],bh
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,44H
+ inc sp
+ cmp al,4
+ cmp byte ptr [bx+si],al
+ inc ax
+ inc ax
+ js L$35
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add al,0
+ add al,4
+ add al,44H
+ cmp byte ptr [bx+si],al
+L$33:
+ inc ax
+ inc ax
+ push ax
+ ;;;;pusha
+ push ax
+ dec ax
+ add byte ptr [bx+si],al
+ xor byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr 54H[bx+si],ch
+ push sp
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ add byte ptr 44H[bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+L$34:
+ js L$42
+ inc sp
+ js L$41
+ inc ax
+ DB 0
+L$35:
+ add byte ptr [si],bh
+ inc sp
+ inc sp
+ cmp al,4
+ add al,0
+ add byte ptr 60H[si],bl
+ inc ax
+ inc ax
+ inc ax
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bh
+L$36:
+ inc ax
+ jl L$38
+ jl L$37
+L$37:
+ add byte ptr [bx+si],dl
+L$38:
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ sub byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr 44H[si],al
+L$39:
+ push sp
+ push sp
+ ;;;;insb
+ add byte ptr [bx+si],al
+ add byte ptr 28H[si],al
+L$40:
+ adc byte ptr [bx+si],ch
+ inc sp
+L$41:
+ DB 0
+L$42:
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp al,4
+ jl L$43
+L$43:
+ add byte ptr 4[si],bh
+ cmp byte ptr 7cH[bx+si],al
+ add byte ptr [bx+si],al
+ or byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dh
+ adc byte ptr [bx+si],dl
+ or byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ and byte ptr [bx+si],dl
+ adc byte ptr [bx+si],bl
+ adc byte ptr [bx+si],dl
+ and byte ptr -68H[si],ah
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ sub byte ptr -7eH[si],al
+ cmp dh,0
+ jl L$34
+ add byte ptr 7c80H[bx+si],4
+ jl L$44
+L$44:
+ sub byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ cmp al,0
+ jl L$54
+ jl L$53
+ jl L$45
+L$45:
+ jle L$36
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$46
+L$46:
+ and al,0
+L$47:
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$48
+L$48:
+ js L$49
+L$49:
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$50
+L$50:
+ sbb byte ptr [bx+si],bl
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$51
+L$51:
+ add byte ptr [bx+si],al
+ js L$39
+ cmp byte ptr 8[bx+si],38H
+ jl L$40
+ cmp byte ptr 7cH[si],al
+ inc ax
+ cmp al,0
+ dec ax
+ add byte ptr [bx+si],bh
+ inc sp
+ jl L$55
+ cmp al,0
+ js L$52
+L$52:
+ cmp byte ptr 7cH[si],al
+ inc ax
+L$53:
+ cmp al,0
+L$54:
+ add byte ptr [bx+si],ch
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],ch
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],dh
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ dec ax
+ add byte ptr -7cH[bx+si],bh
+ cld
+ test byte ptr 3000H[si],al
+ xor byte ptr -7cH[bx+si],bh
+ cld
+ test byte ptr 3800H[si],al
+ add ah,bh
+ xor al,80H
+ cld
+ add byte ptr [bx+si],al
+ add byte ptr 8[bp],bh
+ jle L$59
+L$55:
+ jle L$56
+L$56:
+ jle L$47
+ nop
+ cld
+ nop
+ nop
+ sahf
+ add byte ptr -7eH[si],bh
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ sub byte ptr [bx+si],al
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ jo L$57
+L$57:
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ cmp byte ptr [si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ jo L$58
+L$58:
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ sub byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp al,4
+ jl L$64
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr 78H[si],al
+ dec ax
+ add byte ptr -7b7cH[si],al
+ DB 84H
+L$59:
+ ;;;;js 4d8H
+ add byte ptr [bx+si],dl
+ cmp byte ptr 40H[bx+si],al
+ inc ax
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr 40H[si],al
+ loopnz L$66
+ inc ax
+ cmp ah,44H
+ jl L$60
+ jl L$61
+ jl L$62
+ add al,dh
+ mov byte ptr -7d09H[bp+si],cl
+ add byte ptr 0c00H[bp+si],12H
+ DB 10H
+L$60:
+ sbb byte ptr [bx+si],dh
+L$61:
+ DB 10H, 90H
+L$62:
+ ;;;;pusha
+ cmp al,0
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$63
+L$63:
+ add byte ptr [bx+si],bl
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ DB 1cH
+L$64:
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ sbb al,0
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ jl L$65
+L$65:
+ js L$67
+ inc sp
+L$66:
+ inc sp
+ inc sp
+ add byte ptr [si],bh
+ inc sp
+ push sp
+ dec sp
+ inc sp
+ add byte ptr [bx+si],bl
+ and al,24H
+ push ds
+ add byte ptr ds:[0],bh
+ sbb al,22H
+ and bl,byte ptr [si]
+ add byte ptr ds:[0],bh
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],ah
+ inc ax
+ inc dx
+ cmp al,0
+ add byte ptr [bx+si],al
+ add ah,bh
+ add byte ptr [bx+si],0
+ add byte ptr [bx+si],al
+ cld
+ add al,4
+ add byte ptr [bx+si],al
+ inc ax
+ inc sp
+ dec ax
+ push di
+ and word ptr 4[bx],ax
+ pop es
+ inc ax
+ inc sp
+ dec ax
+ push dx
+ dec dx
+ pop ds
+ DB 2
+L$67:
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+L$68:
+ adc byte ptr [bx+si],al
+ add byte ptr [si],ah
+L$69:
+ dec ax
+ nop
+ dec ax
+ and al,0
+ add byte ptr [bx+si],al
+ dec ax
+ and al,12H
+ and al,48H
+ add byte ptr [bx+si],al
+ and cl,byte ptr -77deH[bx+si]
+ and cl,byte ptr -77deH[bx+si]
+ push bp
+ stosb
+ push bp
+ stosb
+ push bp
+ stosb
+ push bp
+ stosb
+ ;????
+ ja L$68
+ out dx,al
+ ;????
+ ja L$69
+ out dx,al
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ clc
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb al,bh
+ sbb al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[3636H],dh
+ div byte ptr ss:[3636H]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ;????
+ add byte ptr ss:[bx+si],al
+ clc
+ sbb al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[0f636H],dh
+ push es
+ div byte ptr ds:[3636H]
+ add byte ptr ss:[bx+si],al
+ inc byte ptr ds:[36f6H]
+ test byte ptr ss:[0feH],0
+ add byte ptr ds:[3636H],dh
+ inc byte ptr ss:[bx+si]
+ add byte ptr [bx+si],al
+ sbb byte ptr [bx+si],bl
+ clc
+ sbb al,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb bh,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb bh,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[3636H],dh
+ aaa
+ aaa
+ xor byte ptr [bx],bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bh
+ xor byte ptr [bx],dh
+ test word ptr ss:[bx+si],0ffH
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc word ptr [bx+si]
+ div word ptr ds:[3636H]
+ aaa
+ xor byte ptr [bx],dh
+ add byte ptr ss:[bx+si],al
+ inc word ptr [bx+si]
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ test word ptr ss:[bx+si],36f7H
+ sbb byte ptr ss:[bx+si],bl
+ inc word ptr [bx+si]
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ inc word ptr ss:[bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc word ptr [bx+si]
+ call dword ptr [bx+si]
+ sbb byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push word ptr ds:[3636H]
+ aas
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bh
+ push word ptr ss:[3636H]
+ sbb byte ptr [bx+si],bl
+ call dword ptr [bx+si]
+ call dword ptr [bx+si]
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ clc
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bl
+ DB 18H
+L$70:
+ sbb byte ptr [bx+si],bl
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ add bh,bh
+ ;????
+ ;????
+ push ax
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ ;????
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr -6cH[bp+si],ah
+ mov byte ptr 62H[si],dl
+ add al,dh
+ mov al,dh
+ mov byte ptr -7f10H[bx+si],cl
+ add al,bh
+ mov byte ptr -7f80H[bx+si],al
+ add byte ptr [bx+si],0
+ cld
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ add ah,bh
+ test byte ptr 20H[bx+si],al
+ inc ax
+ test ah,bh
+ add byte ptr [si],bh
+ inc ax
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ js L$71
+ inc ax
+ add byte ptr ds:[848H],dh
+ or byte ptr [bx+si],cl
+ or byte ptr [bx+si],al
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr 44H[si],al
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr -7cH[bx+si],bh
+ test ah,bh
+ test byte ptr 78H[si],al
+ js L$70
+ test byte ptr 4848H[si],al
+ int 3
+ add byte ptr 4[bx+si],bh
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ;;;;insb
+ xchg ax,dx
+ xchg ax,dx
+ ;;;;insb
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,byte ptr 5aH[si]
+ and bl,byte ptr [si]
+ sbb byte ptr [bx+si],ah
+ inc ax
+ js L$73
+ and byte ptr [bx+si],bl
+L$71:
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr -7b7cH[si],al
+ test byte ptr [bx+si],al
+ add ah,bh
+ add ah,bh
+ add ah,bh
+ add byte ptr [bx+si],al
+ and byte ptr [bx+si],ah
+ clc
+ and byte ptr [bx+si],ah
+ add al,bh
+ add byte ptr [bx+si],ah
+ adc byte ptr [bx+si],cl
+ adc byte ptr [bx+si],ah
+ add byte ptr [si],bh
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],dl
+ or byte ptr [bx+si],al
+ jl L$72
+L$72:
+ or al,12H
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ nop
+ ;;;;pusha
+ add byte ptr [bx+si],dl
+ add byte ptr [si],bh
+L$73:
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ xor cl,byte ptr [si]
+ xor cl,byte ptr [si]
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ sbb byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr ds:[808H],cl
+ or byte ptr 28H[bx+si],cl
+ sbb byte ptr [bx+si],cl
+ cmp byte ptr [si],ah
+ and al,24H
+ and al,0
+ add byte ptr [bx+si],al
+ cmp al,4
+ cmp al,20H
+ cmp al,0
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,3cH
+ cmp al,3cH
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+L$74:
+ DW offset L$1
+L$75:
+ DB 8
+L$76:
+ add byte ptr [bx+si],cl
+ DB 0
+L$77:
+ DW offset L$1
+L$78:
+ DW seg L$1
+L$79:
+ or byte ptr [bx+si],al
+L$80:
+ or byte ptr [bx+si],al
+L$81:
+ or byte ptr [bx+si],al
+L$82:
+ inc word ptr [bx+si]
+L$83:
+ add byte ptr [bx+si],al
+L$84:
+ or byte ptr [bx+si],al
+L$85:
+ add byte ptr [bx+si],al
+MXSETFONT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 0cH[bp]
+ test ax,ax
+ jne L$87
+ mov ax,word ptr 0aH[bp]
+ cmp ax,1
+ jb L$86
+ xor ax,ax
+L$86:
+ shl ax,1
+ shl ax,1
+ mov bx,ax
+ mov ax,word ptr L$74[bx]
+ mov word ptr L$77,ax
+ mov word ptr L$78,cs
+ mov al,byte ptr L$75[bx]
+ xor ah,ah
+ mov word ptr L$79,ax
+ mov word ptr L$84,ax
+ mov dl,byte ptr L$76[bx]
+ xor dh,dh
+ mov word ptr L$80,dx
+ mul dx
+ mov word ptr L$81,ax
+ mov word ptr L$84,ax
+ xor ax,ax
+ mov word ptr L$85,ax
+ jmp L$88
+L$87:
+ mov ax,0ffffH
+ mov bx,word ptr 8[bp]
+ cmp bx,10H
+ ja L$88
+ mov dx,word ptr 6[bp]
+ cmp dx,20H
+ ja L$88
+ mov word ptr L$79,bx
+ mov word ptr L$80,dx
+ mov ax,bx
+ add ax,7
+ shr ax,1
+ shr ax,1
+ shr ax,1
+ mul dx
+ mov word ptr L$81,ax
+ mov ax,word ptr 0aH[bp]
+ mov word ptr L$77,ax
+ mov ax,word ptr 0cH[bp]
+ mov word ptr L$78,ax
+ xor ax,ax
+L$88:
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXSETTEXTCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 8[bp]
+ mov word ptr L$82,ax
+ mov ax,word ptr 6[bp]
+ mov word ptr L$83,ax
+ xor ax,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXOUTCHAR:
+ push bp
+ mov bp,sp
+ sub sp,202H
+ push ds
+ push si
+ push es
+ push di
+ lds si,dword ptr cs:L$77
+ mov al,byte ptr 6[bp]
+ xor ah,ah
+ mul word ptr cs:L$81
+ add si,ax
+ mov ax,ss
+ mov es,ax
+ lea di,-200H[bp]
+ mov dx,word ptr cs:L$82
+ mov ax,word ptr cs:L$80
+ mov word ptr -202H[bp],ax
+L$89:
+ mov cx,word ptr cs:L$79
+ mov bh,byte ptr [si]
+ inc si
+ cmp cx,8
+ jbe L$90
+ mov bl,byte ptr [si]
+ inc si
+L$90:
+ mov al,dl
+ shl bx,1
+ jb L$91
+ mov al,dh
+L$91:
+ mov byte ptr es:[di],al
+ inc di
+ dec cx
+ jne L$90
+ dec word ptr -202H[bp]
+ jne L$89
+ lea ax,-200H[bp]
+ push es
+ push ax
+ push word ptr 0aH[bp]
+ push word ptr 8[bp]
+ push word ptr cs:L$79
+ push word ptr cs:L$80
+ push word ptr cs:L$83
+ push cs
+ call near ptr MX_TEXT:MXPUTIMAGE
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 6
+MXOUTTEXT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 6[bp]
+L$92:
+ mov al,byte ptr [si]
+ test al,al
+ je L$93
+ inc si
+ push word ptr 0cH[bp]
+ push word ptr 0aH[bp]
+ push ax
+ push cs
+ call near ptr MXOUTCHAR
+ mov ax,word ptr cs:L$84
+ add word ptr 0cH[bp],ax
+ mov ax,word ptr cs:L$85
+ add word ptr 0aH[bp],ax
+ dec word ptr -202H[bp]
+ jne L$92
+L$93:
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+ retf
+MXSETTEXTSTEP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 8[bp]
+ mov word ptr L$84,ax
+ mov ax,word ptr 6[bp]
+ mov word ptr L$85,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXGETTEXTSTEP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr cs:L$84
+ lds si,dword ptr 0aH[bp]
+ mov word ptr [si],ax
+ mov ax,word ptr cs:L$85
+ lds si,dword ptr 6[bp]
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXOT.ASM - Text functions\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+;WARN PRO\r
+;NOWARN RES ; We use the reserved name 'WIDTH'\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxOutChar\r
+PUBLIC mxOutText\r
+PUBLIC mxSetFont\r
+PUBLIC mxSetTextColor\r
+PUBLIC mxGetTextStep\r
+PUBLIC mxSetTextStep\r
+\r
+MAX_WIDTH EQU 16 ; Must be <= 16\r
+MAX_HEIGHT EQU 32\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_CodeSegment : WORD\r
+EXTRN mxPutImage : FAR\r
+\r
+; Default 8x8 font\r
+fnt_Default LABEL BYTE\r
+ INCLUDE DEFAULT.FNT\r
+\r
+; Table of system fonts\r
+tbl_SystemFont LABEL WORD\r
+ DW fnt_Default, 8, 8\r
+\r
+MX_MAXSYSFONT EQU ($-OFFSET tbl_SystemFont) SHR 2\r
+\r
+mx_FontPtr DW OFFSET fnt_Default, SEG MX_TEXT\r
+mx_FontWidth DW 8 ; Font width in pixels\r
+mx_FontHeight DW 8 ; Font height in pixels\r
+mx_FontCharSize DW 8 ; Size in bytes of a font character\r
+mx_FontColor DW 00FFh ; Color: foreground + background*256\r
+mx_FontOp DW OP_MOVE ; Raster op\r
+mx_DeltaX DW 8 ; Horizontal step\r
+mx_DeltaY DW 0 ; Vertical step\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the current font.\r
+;\r
+; Input:\r
+; Font = pointer to font data\r
+; Width = width of font character in pixels\r
+; Height = height of font character in pixels\r
+; Output:\r
+; AX = 0 on success, else invalid parameters\r
+;\r
+; Note: when the high word of Font (i.e. the segment) is zero, the low\r
+; word is used to select one of the system fonts.\r
+;\r
+mxSetFont PROC FAR\r
+ push bp\r
+ mov bp,sp\r
+ sub sp,0\r
+ push ds\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, WORD PTR Font[2] ; Get font segment\r
+ test ax, ax ; Null segment?\r
+ jnz @@UserFont ; No, install user font\r
+\r
+; Install system font\r
+ mov ax, WORD PTR Font[0] ; Get font number\r
+ cmp ax, MX_MAXSYSFONT ; Check range\r
+ jb @@SystemFont\r
+ xor ax, ax ; Out of range, use default font\r
+@@SystemFont:\r
+ shl ax, 1\r
+ shl ax, 1\r
+ mov bx, ax\r
+ mov ax, tbl_SystemFont[bx] ; Get font offset\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov WORD PTR mx_FontPtr[2], cs\r
+ mov al, BYTE PTR tbl_SystemFont[bx+2]\r
+ xor ah, ah\r
+ mov [mx_FontWidth], ax\r
+ mov [mx_DeltaX], ax\r
+ mov dl, BYTE PTR tbl_SystemFont[bx+3]\r
+ xor dh, dh\r
+ mov [mx_FontHeight], dx\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov [mx_DeltaX], ax\r
+ xor ax, ax\r
+ mov [mx_DeltaY], ax\r
+ jmp @@Exit\r
+\r
+; Install user font\r
+@@UserFont:\r
+ mov ax, -1 ; Assume an error\r
+ mov bx, [bp+8]\r
+ cmp bx, MAX_WIDTH\r
+ ja @@Exit ; Invalid character width\r
+ mov dx, [bp+4]\r
+ cmp dx, MAX_HEIGHT\r
+ ja @@Exit ; Invalid character height\r
+ mov [mx_FontWidth], bx\r
+ mov [mx_FontHeight], dx\r
+ mov ax, bx\r
+ add ax, 7\r
+ shr ax, 1\r
+ shr ax, 1\r
+ shr ax, 1\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov ax, WORD PTR Font[0]\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov ax, WORD PTR Font[2]\r
+ mov WORD PTR mx_FontPtr[2], ax\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ ;.leave ARG_SIZE\r
+mxSetFont ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the text color and raster op.\r
+;\r
+; Input:\r
+; Color = text color (foreground + background*256)\r
+; Op = raster op\r
+; Output:\r
+; none\r
+;\r
+mxSetTextColor PROC FAR\r
+ ARG Op:WORD, \\r
+ Color:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [Color]\r
+ mov [mx_FontColor], ax\r
+ mov ax, [Op]\r
+ mov [mx_FontOp], ax\r
+\r
+ xor ax, ax\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ .leave ARG_SIZE\r
+mxSetTextColor ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a character using the current font and attributes.\r
+;\r
+; Input:\r
+; X, Y = video coordinates\r
+; C = character to print\r
+; Output:\r
+; none\r
+;\r
+mxOutChar PROC FAR\r
+ ARG C:BYTE:2, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ LOCAL Image:BYTE:MAX_WIDTH*MAX_HEIGHT, \\r
+ Count:WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Gets the pointer to font data for the selected character\r
+ lds si, DWORD PTR [mx_FontPtr]\r
+ mov al, [C]\r
+ xor ah, ah\r
+ mul [mx_FontCharSize] ; Offset into font\r
+ add si, ax ; DS:SI -> font data for character\r
+\r
+; Converts font data into a 256-color linear image\r
+ mov ax, ss\r
+ mov es, ax\r
+ lea di, [Image]\r
+ mov dx, [mx_FontColor]\r
+ mov ax, [mx_FontHeight]\r
+ mov [Count], ax\r
+@@HeightLoop:\r
+ mov cx, [mx_FontWidth]\r
+ mov bh, ds:[si]\r
+ inc si ; Get a byte from font data\r
+ cmp cx, 8\r
+ jbe @@WidthLoop ; Ok for width <= 8\r
+ mov bl, ds:[si] ; Get another byte\r
+ inc si\r
+@@WidthLoop:\r
+ mov al, dl ; Assume foreground color\r
+ shl bx, 1 ; Is font bit set?\r
+ jc @@1 ; Yes, foreground is just great\r
+ mov al, dh ; Get background color\r
+@@1:\r
+ mov es:[di], al ; Put pixel into image\r
+ inc di\r
+ dec cx\r
+ jnz @@WidthLoop\r
+ dec [Count]\r
+ jnz @@HeightLoop\r
+\r
+; Now pass image to mx_PutImage\r
+ lea ax, [Image]\r
+ push es\r
+ push ax ; Pointer to image\r
+ push [X]\r
+ push [Y] ; Image coordinates\r
+ push [mx_FontWidth]\r
+ push [mx_FontHeight] ; Image size\r
+ push [mx_FontOp] ; Raster op\r
+ call mxPutImage ; Write character\r
+\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxOutChar ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a string at the coordinates specified.\r
+;\r
+; Input:\r
+; X, Y = text coordinates\r
+; S = pointer to ASCIIZ string\r
+; Output:\r
+; none\r
+;\r
+mxOutText PROC FAR\r
+ ARG S:DWORD, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ lds si, [S]\r
+@@Loop:\r
+ mov al, ds:[si]\r
+ test al, al ; End of string?\r
+ jz @@Exit ; Yes, exit\r
+ inc si\r
+ push [X] ; Display character\r
+ push [Y]\r
+ push ax\r
+ call mxOutChar\r
+ mov ax, [mx_DeltaX]\r
+ add [X], ax ; Bump X coordinate\r
+ mov ax, [mx_DeltaY]\r
+ add [Y], ax ; Bump Y coordinate\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+ ret\r
+mxOutText ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = horizontal distance in pixels\r
+; DeltaY = vertical distance in pixels\r
+; Output:\r
+; none\r
+;\r
+; Note: this function may be used to set the text direction.\r
+;\r
+mxSetTextStep PROC FAR\r
+ ARG DeltaY:WORD, \\r
+ DeltaX:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [DeltaX]\r
+ mov [mx_DeltaX], ax\r
+ mov ax, [DeltaY]\r
+ mov [mx_DeltaY], ax\r
+\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetTextStep ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Gets the current distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = pointer to horizontal distance in pixels (integer)\r
+; DeltaY = pointer to vertical distance in pixels (integer)\r
+; Output:\r
+; none\r
+;\r
+mxGetTextStep PROC FAR\r
+ ARG DeltaY:DWORD, \\r
+ DeltaX:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ax, [mx_DeltaX]\r
+ lds si, [DeltaX]\r
+ mov ds:[si], ax\r
+ mov ax, [mx_DeltaY]\r
+ lds si, [DeltaY]\r
+ mov ds:[si], ax\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetTextStep ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+ PUBLIC MX_SCANBUFFER
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_SCANBUFFER:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXFILLPOLY
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_SCANBUFFER:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov cx,word ptr [si]
+ sub cx,word ptr [bx]
+ jg L$2
+ ret
+L$2:
+ push bp
+ mov ax,word ptr 2[si]
+ mov bx,word ptr 2[bx]
+ sub ax,bx
+ jg L$4
+ jl L$6
+ mov ax,bx
+L$3:
+ mov word ptr es:[di],ax
+ add di,4
+ dec cx
+ jne L$3
+ jmp L$8
+L$4:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$5:
+ mov word ptr es:[di],ax
+ add di,4
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$5
+ jmp L$8
+L$6:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$7:
+ mov word ptr es:[di],ax
+ add di,4
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$7
+L$8:
+ pop bp
+ ret
+MXFILLPOLY:
+ push bp
+ mov bp,sp
+ sub sp,1eH
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 10H[bp]
+ cmp cx,3
+ jae L$9
+ jmp near ptr L$36
+L$9:
+ les di,dword ptr 0cH[bp]
+ lds si,dword ptr 8[bp]
+ mov word ptr -16H[bp],7fffH
+ mov word ptr -1aH[bp],8000H
+ mov word ptr -18H[bp],7fffH
+ mov word ptr -1eH[bp],8000H
+ xor dx,dx
+L$10:
+ mov bx,word ptr es:[di]
+ shl bx,1
+ shl bx,1
+ add bx,si
+ mov ax,word ptr [bx]
+ cmp ax,word ptr -16H[bp]
+ jge L$11
+ mov word ptr -16H[bp],ax
+ mov word ptr -0eH[bp],dx
+ mov word ptr -10H[bp],dx
+L$11:
+ cmp ax,word ptr -1aH[bp]
+ jle L$12
+ mov word ptr -1aH[bp],ax
+ mov word ptr -12H[bp],dx
+L$12:
+ mov ax,word ptr 2[bx]
+ cmp ax,word ptr -18H[bp]
+ jge L$13
+ mov word ptr -18H[bp],ax
+L$13:
+ cmp ax,word ptr -1eH[bp]
+ jle L$14
+ mov word ptr -1eH[bp],ax
+L$14:
+ inc di
+ inc dx
+ inc di
+ inc dx
+ dec cx
+ jne L$10
+ mov ax,word ptr -1aH[bp]
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$15
+ jmp near ptr L$36
+L$15:
+ mov bx,word ptr -16H[bp]
+ cmp bx,word ptr cs:MX_CLIPX2
+ jle L$16
+ jmp near ptr L$36
+L$16:
+ sub ax,bx
+ jg L$17
+ jmp near ptr L$36
+L$17:
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jge L$18
+ jmp near ptr L$36
+L$18:
+ mov bx,word ptr -18H[bp]
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$19
+ jmp near ptr L$36
+L$19:
+ sub ax,bx
+ jg L$20
+ jmp near ptr L$36
+L$20:
+ dec word ptr 10H[bp]
+ shl word ptr 10H[bp],1
+ mov es,word ptr cs:MX_CODESEGMENT
+ mov ax,offset MX_TEXT:MX_SCANBUFFER
+ mov word ptr -4[bp],ax
+ mov si,word ptr -0eH[bp]
+L$21:
+ lds bx,dword ptr 0cH[bp]
+ mov di,word ptr [bx+si]
+ dec si
+ dec si
+ test si,si
+ jge L$22
+ mov si,word ptr 10H[bp]
+L$22:
+ mov word ptr -0eH[bp],si
+ mov si,word ptr [bx+si]
+ shl di,1
+ shl di,1
+ shl si,1
+ shl si,1
+ lds bx,dword ptr 8[bp]
+ add si,bx
+ add bx,di
+ mov di,word ptr -4[bp]
+ call near ptr L$1
+ mov word ptr -4[bp],di
+ mov si,word ptr -0eH[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$21
+ mov ax,offset MX_TEXT:MX_SCANBUFFER+2
+ mov word ptr -6[bp],ax
+ mov si,word ptr -10H[bp]
+L$23:
+ lds bx,dword ptr 0cH[bp]
+ mov di,word ptr [bx+si]
+ inc si
+ inc si
+ cmp si,word ptr 10H[bp]
+ jbe L$24
+ xor si,si
+L$24:
+ mov word ptr -10H[bp],si
+ mov si,word ptr [bx+si]
+ shl di,1
+ shl di,1
+ shl si,1
+ shl si,1
+ lds bx,dword ptr 8[bp]
+ add si,bx
+ add bx,di
+ mov di,word ptr -6[bp]
+ call near ptr L$1
+ mov word ptr -6[bp],di
+ mov si,word ptr -10H[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$23
+ mov si,offset MX_TEXT:MX_SCANBUFFER
+ mov ax,word ptr -16H[bp]
+ mov cx,word ptr -1aH[bp]
+ sub cx,ax
+ mov bx,word ptr cs:MX_CLIPX1
+ sub bx,ax
+ jle L$25
+ sub cx,bx
+ add ax,bx
+ mov word ptr -16H[bp],ax
+ shl bx,1
+ shl bx,1
+ add si,bx
+L$25:
+ mov bx,ax
+ add bx,cx
+ sub bx,word ptr cs:MX_CLIPX2
+ jle L$26
+ sub cx,bx
+L$26:
+ test cx,cx
+ jg L$27
+ jmp near ptr L$36
+L$27:
+ mov word ptr -8[bp],cx
+ mov word ptr -4[bp],si
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr -18H[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$28
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$28
+ jmp L$32
+L$28:
+ mov di,cx
+ inc di
+ sub si,4
+L$29:
+ dec di
+ je L$32
+ add si,4
+ mov ax,word ptr [si]
+ mov cx,word ptr 2[si]
+ mov dx,word ptr cs:MX_CLIPY2
+ cmp ax,dx
+ jg L$31
+ cmp cx,dx
+ jle L$30
+ mov word ptr 2[si],dx
+ mov bx,cx
+ sub bx,dx
+ sub cx,ax
+ jle L$31
+ mov cx,word ptr 2[si]
+L$30:
+ mov dx,word ptr cs:MX_CLIPY1
+ cmp cx,dx
+ jl L$31
+ sub cx,ax
+ jle L$31
+ cmp ax,dx
+ jge L$29
+ mov word ptr [si],dx
+ sub dx,ax
+ cmp cx,dx
+ ja L$29
+L$31:
+ mov word ptr [si],0ffffH
+ jmp L$29
+L$32:
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ mov si,word ptr -4[bp]
+ mov cl,byte ptr -16H[bp]
+ and cl,3
+ mov al,11H
+ shl al,cl
+ mov byte ptr -2[bp],al
+ shr word ptr -16H[bp],1
+ shr word ptr -16H[bp],1
+L$33:
+ mov ax,word ptr [si]
+ test ax,ax
+ js L$35
+ mov cx,word ptr 2[si]
+ sub cx,ax
+ jle L$35
+ mul word ptr cs:MX_BYTESPERLINE
+ add ax,word ptr -16H[bp]
+ mov di,ax
+ mov ah,byte ptr -2[bp]
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov ax,word ptr 6[bp]
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ shr cx,1
+ jae L$34
+ mov byte ptr es:[di],al
+ add di,dx
+ jcxz L$35
+L$34:
+ mov byte ptr es:[di],al
+ add di,dx
+ mov byte ptr es:[di],al
+ add di,dx
+ dec cx
+ jne L$34
+L$35:
+ rol byte ptr -2[bp],1
+ adc word ptr -16H[bp],0
+ add si,4
+ dec word ptr -8[bp]
+ jne L$33
+L$36:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGOURAUDPOLY
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_SCANBUFFER:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov cx,word ptr [si]
+ sub cx,word ptr [bx]
+ jg L$2
+ ret
+L$2:
+ push bp
+ push di
+ push cx
+ push ax
+ push dx
+ mov ax,word ptr 2[si]
+ mov bx,word ptr 2[bx]
+ sub ax,bx
+ jg L$4
+ jl L$6
+ mov ax,bx
+L$3:
+ mov word ptr es:[di],ax
+ add di,8
+ dec cx
+ jne L$3
+ jmp L$8
+L$4:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$5:
+ mov word ptr es:[di],ax
+ add di,8
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$5
+ jmp L$8
+L$6:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$7:
+ mov word ptr es:[di],ax
+ add di,8
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$7
+L$8:
+ pop bx
+ pop ax
+ pop cx
+ pop di
+ sub ax,bx
+ jg L$10
+ jl L$12
+ mov ah,bl
+ mov al,80H
+L$9:
+ mov word ptr es:2[di],ax
+ add di,8
+ dec cx
+ jne L$9
+ jmp L$14
+L$10:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$11:
+ mov byte ptr es:3[di],al
+ mov byte ptr es:2[di],dh
+ add di,8
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$11
+ jmp L$14
+L$12:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$13:
+ mov byte ptr es:3[di],al
+ mov byte ptr es:2[di],dh
+ add di,8
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$13
+L$14:
+ pop bp
+ ret
+L$15:
+ mov ax,word ptr 6[si]
+ mov bx,word ptr 2[si]
+ cmp ah,bh
+ jg L$17
+ jl L$19
+ add ax,dx
+ mov dx,word ptr cs:MX_BYTESPERLINE
+L$16:
+ mov byte ptr es:[di],ah
+ add di,dx
+ dec cx
+ jne L$16
+ ret
+L$17:
+ push bp
+ push si
+ mov si,bx
+ add si,dx
+ sub ax,bx
+ xor dx,dx
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ mov bx,ax
+ mov dx,8000H
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ xchg ax,si
+L$18:
+ mov byte ptr es:[di],ah
+ add dx,bx
+ adc ax,bp
+ add di,si
+ dec cx
+ jne L$18
+ pop si
+ pop bp
+ ret
+L$19:
+ push bp
+ push si
+ mov si,bx
+ add si,dx
+ sub ax,bx
+ neg ax
+ xor dx,dx
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ mov bx,ax
+ mov dx,8000H
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ xchg ax,si
+L$20:
+ mov byte ptr es:[di],ah
+ sub dx,bx
+ sbb ax,bp
+ add di,si
+ dec cx
+ jne L$20
+ pop si
+ pop bp
+ ret
+MXGOURAUDPOLY:
+ push bp
+ mov bp,sp
+ sub sp,1eH
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 14H[bp]
+ cmp cx,3
+ jae L$21
+ jmp near ptr L$47
+L$21:
+ les di,dword ptr 10H[bp]
+ lds si,dword ptr 0cH[bp]
+ mov word ptr -16H[bp],7fffH
+ mov word ptr -1aH[bp],8000H
+ mov word ptr -18H[bp],7fffH
+ mov word ptr -1eH[bp],8000H
+ xor dx,dx
+L$22:
+ mov bx,word ptr es:[di]
+ shl bx,1
+ shl bx,1
+ add bx,si
+ mov ax,word ptr [bx]
+ cmp ax,word ptr -16H[bp]
+ jge L$23
+ mov word ptr -16H[bp],ax
+ mov word ptr -0eH[bp],dx
+ mov word ptr -10H[bp],dx
+L$23:
+ cmp ax,word ptr -1aH[bp]
+ jle L$24
+ mov word ptr -1aH[bp],ax
+ mov word ptr -12H[bp],dx
+L$24:
+ mov ax,word ptr 2[bx]
+ cmp ax,word ptr -18H[bp]
+ jge L$25
+ mov word ptr -18H[bp],ax
+L$25:
+ cmp ax,word ptr -1eH[bp]
+ jle L$26
+ mov word ptr -1eH[bp],ax
+L$26:
+ inc di
+ inc di
+ inc dx
+ inc dx
+ dec cx
+ jne L$22
+ mov ax,word ptr -1aH[bp]
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$27
+ jmp near ptr L$47
+L$27:
+ mov bx,word ptr -16H[bp]
+ cmp bx,word ptr cs:MX_CLIPX2
+ jle L$28
+ jmp near ptr L$47
+L$28:
+ sub ax,bx
+ jg L$29
+ jmp near ptr L$47
+L$29:
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jge L$30
+ jmp near ptr L$47
+L$30:
+ mov bx,word ptr -18H[bp]
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$31
+ jmp near ptr L$47
+L$31:
+ sub ax,bx
+ jg L$32
+ jmp near ptr L$47
+L$32:
+ dec word ptr 14H[bp]
+ shl word ptr 14H[bp],1
+ mov es,word ptr cs:MX_CODESEGMENT
+ mov ax,offset MX_TEXT:MX_SCANBUFFER
+ mov word ptr -4[bp],ax
+ mov si,word ptr -0eH[bp]
+L$33:
+ lds bx,dword ptr 10H[bp]
+ mov di,word ptr [bx+si]
+ dec si
+ dec si
+ test si,si
+ jge L$34
+ mov si,word ptr 14H[bp]
+L$34:
+ mov word ptr -0eH[bp],si
+ mov si,word ptr [bx+si]
+ lds bx,dword ptr 8[bp]
+ shl di,1
+ shl si,1
+ mov ax,word ptr [bx+si]
+ mov dx,word ptr [bx+di]
+ lds bx,dword ptr 0cH[bp]
+ shl si,1
+ shl di,1
+ add si,bx
+ add bx,di
+ mov di,word ptr -4[bp]
+ call near ptr L$1
+ mov word ptr -4[bp],di
+ mov si,word ptr -0eH[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$33
+ mov ax,offset MX_TEXT:MX_SCANBUFFER+4
+ mov word ptr -6[bp],ax
+ mov si,word ptr -10H[bp]
+L$35:
+ lds bx,dword ptr 10H[bp]
+ mov di,word ptr [bx+si]
+ inc si
+ inc si
+ cmp si,word ptr 14H[bp]
+ jbe L$36
+ xor si,si
+L$36:
+ mov word ptr -10H[bp],si
+ mov si,word ptr [bx+si]
+ lds bx,dword ptr 8[bp]
+ shl di,1
+ shl si,1
+ mov ax,word ptr [bx+si]
+ mov dx,word ptr [bx+di]
+ lds bx,dword ptr 0cH[bp]
+ shl si,1
+ shl di,1
+ add si,bx
+ add bx,di
+ mov di,word ptr -6[bp]
+ call near ptr L$1
+ mov word ptr -6[bp],di
+ mov si,word ptr -10H[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$35
+ mov si,offset MX_TEXT:MX_SCANBUFFER
+ mov ax,word ptr -16H[bp]
+ mov cx,word ptr -1aH[bp]
+ sub cx,ax
+ mov bx,word ptr cs:MX_CLIPX1
+ sub bx,ax
+ jle L$37
+ sub cx,bx
+ add ax,bx
+ mov word ptr -16H[bp],ax
+ shl bx,1
+ shl bx,1
+ shl bx,1
+ add si,bx
+L$37:
+ mov bx,ax
+ add bx,cx
+ sub bx,word ptr cs:MX_CLIPX2
+ jle L$38
+ sub cx,bx
+L$38:
+ test cx,cx
+ jg L$39
+ jmp near ptr L$47
+L$39:
+ mov word ptr -8[bp],cx
+ mov word ptr -4[bp],si
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr -18H[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$40
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$40
+ jmp L$44
+L$40:
+ mov di,cx
+ inc di
+ sub si,8
+L$41:
+ dec di
+ je L$44
+ add si,8
+ mov ax,word ptr [si]
+ mov cx,word ptr 4[si]
+ mov dx,word ptr cs:MX_CLIPY2
+ cmp ax,dx
+ jg L$43
+ cmp cx,dx
+ jle L$42
+ mov word ptr 4[si],dx
+ mov bx,cx
+ sub bx,dx
+ sub cx,ax
+ jle L$43
+ mov ax,word ptr 2[si]
+ sub ax,word ptr 6[si]
+ imul bx
+ idiv cx
+ add word ptr 6[si],ax
+ mov ax,word ptr [si]
+ mov cx,word ptr 4[si]
+L$42:
+ mov dx,word ptr cs:MX_CLIPY1
+ cmp cx,dx
+ jl L$43
+ sub cx,ax
+ jle L$43
+ cmp ax,dx
+ jge L$41
+ mov word ptr [si],dx
+ sub dx,ax
+ cmp cx,dx
+ jbe L$43
+ mov ax,word ptr 6[si]
+ sub ax,word ptr 2[si]
+ imul dx
+ idiv cx
+ add word ptr 2[si],ax
+ jmp L$41
+L$43:
+ mov word ptr [si],0ffffH
+ jmp L$41
+L$44:
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ mov si,word ptr -4[bp]
+ mov cl,byte ptr -16H[bp]
+ and cl,3
+ mov al,11H
+ shl al,cl
+ mov byte ptr -2[bp],al
+ shr word ptr -16H[bp],1
+ shr word ptr -16H[bp],1
+ mov ax,word ptr 6[bp]
+ mov ah,al
+ xor al,al
+ mov word ptr 6[bp],ax
+L$45:
+ mov ax,word ptr [si]
+ test ax,ax
+ js L$46
+ mov cx,word ptr 4[si]
+ sub cx,ax
+ jle L$46
+ mul word ptr cs:MX_BYTESPERLINE
+ add ax,word ptr -16H[bp]
+ mov di,ax
+ mov ah,byte ptr -2[bp]
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov dx,word ptr 6[bp]
+ call near ptr L$15
+L$46:
+ rol byte ptr -2[bp],1
+ adc word ptr -16H[bp],0
+ add si,8
+ dec word ptr -8[bp]
+ jne L$45
+L$47:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 10H
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXPUTIMAGE
+ EXTRN SUBCLIPIMAGE:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$2
+ DW offset L$6
+ DW offset L$10
+ DW offset L$14
+ DW offset L$18
+ DW offset L$20
+L$2:
+ shr cx,1
+ jb L$5
+L$3:
+ movsb
+ add si,3
+ movsb
+ add si,3
+ dec cx
+ jne L$3
+L$4:
+ ret
+L$5:
+ movsb
+ add si,3
+ jcxz L$4
+ jmp L$3
+L$6:
+ shr cx,1
+ jb L$9
+L$7:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ and word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$7
+L$8:
+ ret
+L$9:
+ lodsb
+ and byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$8
+ jmp L$7
+L$10:
+ shr cx,1
+ jb L$13
+L$11:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ or word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$11
+L$12:
+ ret
+L$13:
+ lodsb
+ or byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$12
+ jmp L$11
+L$14:
+ shr cx,1
+ jb L$17
+L$15:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ xor word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$15
+L$16:
+ ret
+L$17:
+ lodsb
+ xor byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$16
+ jmp L$15
+L$18:
+ mov al,byte ptr [si]
+ cmp al,ah
+ je L$19
+ mov byte ptr es:[di],al
+L$19:
+ inc di
+ add si,4
+ dec cx
+ jne L$18
+ ret
+L$20:
+ mov al,byte ptr [si]
+ add byte ptr es:[di],al
+ inc di
+ add si,4
+ dec cx
+ jne L$20
+ ret
+MXPUTIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,14H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 0eH[bp]
+ mov ax,word ptr 0cH[bp]
+ mov cx,word ptr 0aH[bp]
+ mov dx,word ptr 8[bp]
+ call near ptr MX_TEXT:SUBCLIPIMAGE
+ jae L$21
+ jmp near ptr L$26
+L$21:
+ mov word ptr 8[bp],dx
+ add word ptr 10H[bp],si
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,bx
+ shr di,1
+ shr di,1
+ add di,ax
+ mov word ptr -0aH[bp],di
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -10H[bp],bl
+ mov bx,cx
+ shr bx,1
+ shr bx,1
+ and cl,3
+ mov al,8
+ shr al,cl
+ mov si,6
+L$22:
+ mov word ptr -8[bp+si],bx
+ shr al,1
+ adc bx,0
+ dec si
+ dec si
+ jge L$22
+ mov cl,byte ptr -10H[bp]
+ mov al,11H
+ shl al,cl
+ mov byte ptr -14H[bp],al
+ mov bx,word ptr 6[bp]
+ mov byte ptr -12H[bp],bh
+ xor bh,bh
+ cmp bl,5
+ jbe L$23
+ xor bl,bl
+L$23:
+ shl bx,1
+ mov ax,word ptr cs:L$1[bx]
+ mov word ptr -0cH[bp],ax
+ cld
+ mov byte ptr -0eH[bp],4
+ lea bx,-8[bp]
+ mov ds,word ptr 12H[bp]
+L$24:
+ cmp word ptr ss:[bx],0
+ je L$26
+ mov si,word ptr 10H[bp]
+ mov ah,byte ptr -14H[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov ah,byte ptr -10H[bp]
+ and ah,3
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov dx,word ptr 8[bp]
+ mov di,word ptr -0aH[bp]
+L$25:
+ push si
+ push di
+ mov cx,word ptr ss:[bx]
+ mov ah,byte ptr -12H[bp]
+ call word ptr -0cH[bp]
+ pop di
+ pop si
+ add si,word ptr 0aH[bp]
+ add di,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$25
+ inc bx
+ inc bx
+ inc byte ptr -10H[bp]
+ rol byte ptr -14H[bp],1
+ adc word ptr -0aH[bp],0
+ inc word ptr 10H[bp]
+ dec byte ptr -0eH[bp]
+ jne L$24
+L$26:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0eH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXPAN
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MXWAITDISPLAY:BYTE
+ EXTRN MXSTARTADDRESS:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXPAN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov dx,word ptr 8[bp]
+ shr dx,1
+ shr dx,1
+ add ax,dx
+ push ax
+ call far ptr MXWAITDISPLAY
+ call far ptr MXSTARTADDRESS
+ mov dx,3daH
+ in al,dx
+ mov dx,3c0H
+ mov al,33H
+ out dx,al
+ mov al,byte ptr 8[bp]
+ and al,3
+ shl al,1
+ out dx,al
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 4
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXGETPIXEL
+ PUBLIC MXPUTPIXEL
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETPIXEL:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ xor ax,ax
+ mov si,word ptr 8[bp]
+ cmp si,word ptr cs:MX_CLIPX1
+ jl L$1
+ cmp si,word ptr cs:MX_CLIPX2
+ jg L$1
+ mov bx,word ptr 6[bp]
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$1
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$1
+ mov al,4
+ mov ah,byte ptr 8[bp]
+ and ah,3
+ mov dx,3ceH
+ out dx,ax
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ mov ax,bx
+ mul word ptr cs:MX_BYTESPERLINE
+ shr si,1
+ shr si,1
+ add si,ax
+ mov al,byte ptr [si]
+ xor ah,ah
+L$1:
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXPUTPIXEL:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov si,word ptr 0aH[bp]
+ cmp si,word ptr cs:MX_CLIPX1
+ jl L$2
+ cmp si,word ptr cs:MX_CLIPX2
+ jg L$2
+ mov ax,word ptr 8[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$2
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$2
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ mul word ptr cs:MX_BYTESPERLINE
+ shr si,1
+ shr si,1
+ add si,ax
+ mov cl,byte ptr 0aH[bp]
+ and cl,3
+ mov ax,102H
+ shl ah,cl
+ mov dx,3c4H
+ out dx,ax
+ mov al,byte ptr 6[bp]
+ mov byte ptr [si],al
+L$2:
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 6
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXROWADDRESS
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXROWADDRESS:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov dx,3d4H
+ mov al,13H
+ mov ah,byte ptr 6[bp]
+ out dx,ax
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXROTATEPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXROTATEPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,300H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 8[bp]
+ add bx,bx
+ add bx,word ptr 8[bp]
+ lds si,dword ptr 0aH[bp]
+ push ss
+ pop es
+ lea di,-300H[bp]
+ cld
+ mov ax,word ptr 6[bp]
+ mov dx,ax
+ test ax,ax
+ je L$2
+ jl L$1
+ add ax,ax
+ add dx,ax
+ sub bx,dx
+ add si,bx
+ push si
+ mov cx,dx
+ rep movsb
+ mov es,word ptr 0cH[bp]
+ mov di,si
+ dec di
+ pop si
+ dec si
+ mov cx,bx
+ std
+ rep movsb
+ push ss
+ pop ds
+ lea si,-300H[bp]
+ les di,dword ptr 0aH[bp]
+ mov cx,dx
+ cld
+ rep movsb
+ jmp L$2
+L$1:
+ add ax,ax
+ add dx,ax
+ neg dx
+ sub bx,dx
+ mov cx,dx
+ rep movsb
+ les di,dword ptr 0aH[bp]
+ mov cx,bx
+ rep movsb
+ push ss
+ pop ds
+ lea si,-300H[bp]
+ mov cx,dx
+ rep movsb
+L$2:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSTARTADDRESS
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSTARTADDRESS:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov bx,word ptr 6[bp]
+ mov dx,3d4H
+ mov al,0cH
+ mov ah,bh
+ cli
+ out dx,ax
+ mov al,0dH
+ mov ah,bl
+ out dx,ax
+ sti
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSETCOLOR
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSETCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr 0cH[bp]
+ mov dx,3c8H
+ out dx,al
+ inc dx
+ mov al,byte ptr 0aH[bp]
+ out dx,al
+ mov al,byte ptr 8[bp]
+ out dx,al
+ mov al,byte ptr 6[bp]
+ out dx,al
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSTRETCHIMAGE
+ EXTRN SUBCLIPBOX:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$8
+ DW offset L$10
+ DW offset L$12
+ DW offset L$14
+ DW offset L$16
+ DW offset L$19
+MXSTRETCHIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,14H
+ push ds
+ push si
+ push es
+ push di
+ xor dx,dx
+ mov ax,word ptr 0eH[bp]
+ mov bx,word ptr 0aH[bp]
+ div bx
+ mov word ptr -0aH[bp],ax
+ xor ax,ax
+ div bx
+ mov word ptr -0cH[bp],ax
+ xor dx,dx
+ mov ax,word ptr 0cH[bp]
+ mov bx,word ptr 8[bp]
+ div bx
+ mov word ptr -0eH[bp],ax
+ xor ax,ax
+ div bx
+ mov word ptr -10H[bp],ax
+ mov bx,word ptr 12H[bp]
+ mov ax,word ptr 10H[bp]
+ mov cx,word ptr 0aH[bp]
+ mov dx,word ptr 8[bp]
+ call near ptr MX_TEXT:SUBCLIPBOX
+ jae L$2
+ jmp near ptr L$7
+L$2:
+ mov word ptr 0aH[bp],cx
+ mov word ptr 8[bp],dx
+ sub word ptr 12H[bp],bx
+ sub word ptr 10H[bp],ax
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,bx
+ shr di,1
+ shr di,1
+ add di,ax
+ mov word ptr -2[bp],di
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -6[bp],bl
+ mov cl,bl
+ mov al,11H
+ shl al,cl
+ mov byte ptr -14H[bp],al
+ mov ax,word ptr 10H[bp]
+ test ax,ax
+ je L$3
+ mov bx,ax
+ mul word ptr -10H[bp]
+ mov cx,dx
+ mov ax,bx
+ mul word ptr -0eH[bp]
+ add ax,cx
+ mul word ptr 0eH[bp]
+ add word ptr 14H[bp],ax
+L$3:
+ mov ax,word ptr 12H[bp]
+ test ax,ax
+ je L$4
+ mov bx,ax
+ mul word ptr -0cH[bp]
+ mov cx,dx
+ mov ax,bx
+ mul word ptr -0aH[bp]
+ add ax,cx
+ add word ptr 14H[bp],ax
+L$4:
+ mov ax,word ptr -0eH[bp]
+ mul word ptr 0eH[bp]
+ mov word ptr -0eH[bp],ax
+ mov bx,word ptr 6[bp]
+ mov byte ptr -8[bp],bh
+ xor bh,bh
+ cmp bl,5
+ jbe L$5
+ xor bl,bl
+L$5:
+ shl bx,1
+ mov ax,word ptr cs:L$1[bx]
+ mov word ptr -4[bp],ax
+ mov ds,word ptr 16H[bp]
+ xor ax,ax
+ mov word ptr -12H[bp],ax
+L$6:
+ mov si,word ptr 14H[bp]
+ mov ah,byte ptr -14H[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov ah,byte ptr -6[bp]
+ and ah,3
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov cx,word ptr 8[bp]
+ mov di,word ptr -2[bp]
+ mov ah,byte ptr -8[bp]
+ xor bx,bx
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ call word ptr -4[bp]
+ inc byte ptr -6[bp]
+ rol byte ptr -14H[bp],1
+ adc word ptr -2[bp],0
+ mov dx,word ptr -0cH[bp]
+ mov ax,word ptr -0aH[bp]
+ add word ptr -12H[bp],dx
+ adc word ptr 14H[bp],ax
+ dec word ptr 0aH[bp]
+ jne L$6
+L$7:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 12H
+L$8:
+ mov al,byte ptr [si]
+ mov byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$9
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$8
+ add si,word ptr 0eH[bp]
+ jmp L$8
+L$9:
+ ret
+L$10:
+ mov al,byte ptr [si]
+ and byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$11
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$10
+ add si,word ptr 0eH[bp]
+ jmp L$10
+L$11:
+ ret
+L$12:
+ mov al,byte ptr [si]
+ or byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$13
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$12
+ add si,word ptr 0eH[bp]
+ jmp L$12
+L$13:
+ ret
+L$14:
+ mov al,byte ptr [si]
+ xor byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$15
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$14
+ add si,word ptr 0eH[bp]
+ jmp L$14
+L$15:
+ ret
+L$16:
+ mov al,byte ptr [si]
+ cmp al,ah
+ je L$17
+ mov byte ptr es:[di],al
+L$17:
+ add di,dx
+ dec cx
+ je L$18
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$16
+ add si,word ptr 0eH[bp]
+ jmp L$16
+L$18:
+ ret
+L$19:
+ mov al,byte ptr [si]
+ add byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$20
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$19
+ add si,word ptr 0eH[bp]
+ jmp L$19
+L$20:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSTARTLINE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSTARTLINE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ xchg ax,bx
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ jne L$1
+ mov dx,3d4H
+ mov al,0cH
+ mov ah,bh
+ cli
+ out dx,ax
+ mov al,0dH
+ mov ah,bl
+ out dx,ax
+ sti
+ mov dx,3daH
+L$2:
+ in al,dx
+ test al,8
+ je L$2
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MX_SCREENWIDTH
+ PUBLIC MX_SCREENHEIGHT
+ PUBLIC MX_BYTESPERLINE
+ PUBLIC MXSETMODE
+ PUBLIC MXCHANGEMODE
+ PUBLIC MXGETASPECT
+ PUBLIC MXGETSCREENSIZE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MXSETSYSCLIPREGION:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_SCREENWIDTH:
+ add byte ptr [bx+si],al
+MX_SCREENHEIGHT:
+ add byte ptr [bx+si],al
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+MX_BYTESPERLINE:
+ add byte ptr [bx+si],al
+L$3:
+ or word ptr 14H[bx+si],ax
+ add byte ptr [bx],dl
+ jcxz L$4
+L$4:
+ DB 0
+L$5:
+ or word ptr 14H[bx+di],ax
+ add byte ptr [bx],dl
+ jcxz L$6
+L$6:
+ DB 0
+L$7:
+ add byte ptr 1[bx],bl
+ dec di
+ add dl,byte ptr 3[bx+si]
+ add byte ptr [si],54H
+ add ax,1380H
+ sub byte ptr [bx+si],al
+ DB 0
+L$8:
+ add byte ptr 1[bp+di],ch
+ pop cx
+ add bl,byte ptr 3[bp+si]
+ mov es,word ptr [si]
+ pop si
+ add ax,138aH
+ sub ax,0
+ push es
+ mov di,1f07H
+ adc byte ptr -7aefH[bp+di],al
+ adc bl,byte ptr 15H[di]
+ arpl word ptr ds:[0baH],dx
+ DB 0
+L$9:
+ push es
+ DD ds:[7bfH]
+ pushf
+ adc word ptr -70eeH[bp],cx
+ adc ax,1696H
+ mov cx,0
+L$10:
+ push es
+ or ax,3e07H
+ adc dl,ch
+ adc word ptr -20eeH[si],cx
+ adc ax,16e7H
+ push es
+ add byte ptr [bx+si],al
+L$11:
+ add byte ptr 1[si],dh
+ arpl word ptr [bp+si],ax
+ add dx,word ptr fs:6804H[bx]
+ add ax,695H
+ xchg byte ptr [bx],al
+ lock or word ptr 0fH[bx+si],sp
+ xor word ptr [bx+si],dx
+ pop bx
+ adc word ptr 5712H[di],cx
+ adc si,word ptr [bp+si]
+ adc al,0
+ adc ax,1660H
+ adc byte ptr [bx],0e3H
+ add byte ptr [bx+si],al
+L$12:
+ arpl word ptr ds:[500H],ax
+ add byte ptr 1[bx+si],al
+ enter 1a00H,0
+ DW offset L$9
+ DW offset L$5
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$13:
+ jcxz L$14
+ DB 0
+L$14:
+ add word ptr [bx+si],ax
+ inc ax
+ add ax,si
+ add byte ptr [bp+si],bl
+ add byte ptr [bp+si],bl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$15:
+ arpl word ptr ds:[0a00H],ax
+ add byte ptr 1[bx+si],al
+ nop
+ add word ptr [bp+si],bx
+ add byte ptr [bp+si],cl
+ DW offset L$3
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$16:
+ jcxz L$17
+ DB 0
+L$17:
+ add al,byte ptr [bx+si]
+ inc ax
+ add ax,sp
+ DD L$18
+L$18:
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$19:
+ sbb ax,word ptr [eax]
+ adc al,0
+ push 0c801H
+ add byte ptr [bp+si],ch
+ add byte ptr [bp+si],cl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$20:
+ out 9,ax
+ add byte ptr [bx+si],cl
+ add byte ptr 1[bx+si],ch
+ lock add byte ptr [bp+si],ch
+ add byte ptr [bp+si],bl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$21:
+ sbb ax,word ptr [eax]
+ sub byte ptr [bx+si],al
+ push 9001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],cl
+ DW offset L$3
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$22:
+ out 9,ax
+ add byte ptr [bx+si],dl
+ add byte ptr 1[bx+si],ch
+ loopnz L$23
+ DW offset L$8
+L$23 equ $-1
+ DW offset L$10
+ DW offset L$3
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$24:
+ mov word ptr ds:[0],ax
+ add byte ptr [bx+si],al
+ inc ax
+ add word ptr 1a00H[bx],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$25:
+ mov word ptr 0,ax
+ add byte ptr [bx+si],al
+ inc ax
+ add word ptr 1a00H[bx],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$26:
+ cmpsw
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push 0e001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],dl
+ add byte ptr [bx+si],al
+ add al,bl
+ DB 2
+L$27:
+ cmpsw
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push 0e001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add al,bl
+ DB 2
+L$28:
+ out 1,ax
+ add byte ptr [bp+si],al
+ add byte ptr 5801H[bx+si],dl
+ add ch,byte ptr [bp+si]
+ add byte ptr [bx+si],al
+ pop word ptr [bp+si]
+L$29:
+ DW offset L$24
+ DW offset L$12
+ DW offset L$13
+ DW offset L$25
+ DW offset L$15
+ DW offset L$16
+ DW offset L$26
+ DW offset L$19
+ DW offset L$20
+ DW offset L$27
+ DW offset L$21
+ DW offset L$22
+ DW offset L$28
+L$30:
+ mov ax,3
+ int 10H
+ mov word ptr MX_SCREENHEIGHT,0
+ mov word ptr MX_BYTESPERLINE,0
+ ret
+MXSETMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov si,word ptr 6[bp]
+ cmp si,0dH
+ jbe L$31
+ jmp near ptr L$36
+L$31:
+ test si,si
+ jne L$32
+ call near ptr L$30
+ jmp near ptr L$36
+L$32:
+ dec si
+ shl si,1
+ mov si,word ptr L$29[si]
+ cld
+ push si
+ mov ax,13H
+ int 10H
+ pop si
+ mov dx,3c4H
+ mov ax,604H
+ out dx,ax
+ mov ax,100H
+ out dx,ax
+ mov dx,3c2H
+ lodsb
+ out dx,al
+ mov dx,3c4H
+ mov ax,300H
+ out dx,ax
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ and al,7fH
+ out dx,al
+ lodsw
+ mov word ptr L$1,ax
+ lodsw
+ mov word ptr L$2,ax
+ lodsw
+ mov word ptr MX_SCREENWIDTH,ax
+ shr ax,1
+ shr ax,1
+ mov word ptr MX_BYTESPERLINE,ax
+ lodsw
+ mov word ptr MX_SCREENHEIGHT,ax
+ mov bx,si
+ mov dx,3d4H
+L$33:
+ mov si,word ptr [bx]
+ inc bx
+ inc bx
+ test si,si
+ je L$35
+L$34:
+ lodsw
+ test ax,ax
+ je L$33
+ out dx,ax
+ jmp L$34
+L$35:
+ push word ptr MX_SCREENWIDTH
+ push word ptr [bx]
+ push cs
+ call near ptr MX_TEXT:MXSETSYSCLIPREGION
+ mov dx,3c4H
+ mov ax,0f02H
+ out dx,ax
+ mov es,word ptr MX_TEXT:MX_VIDEOSEGMENT
+ xor di,di
+ mov cx,8000H
+ xor ax,ax
+ rep stosw
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ or al,80H
+ out dx,al
+L$36:
+ xor ax,ax
+ mov ax,word ptr MX_SCREENWIDTH
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXCHANGEMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov si,word ptr 6[bp]
+ cmp si,0dH
+ ja L$40
+ test si,si
+ je L$40
+ dec si
+ shl si,1
+ mov si,word ptr L$29[si]
+ cld
+ mov dx,3c4H
+ mov ax,604H
+ out dx,ax
+ mov ax,100H
+ out dx,ax
+ mov dx,3c2H
+ lodsb
+ out dx,al
+ mov dx,3c4H
+ mov ax,300H
+ out dx,ax
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ and al,7fH
+ out dx,al
+ lodsw
+ mov word ptr L$1,ax
+ lodsw
+ mov word ptr L$2,ax
+ lodsw
+ mov word ptr MX_SCREENWIDTH,ax
+ lodsw
+ mov word ptr MX_SCREENHEIGHT,ax
+ mov bx,si
+ mov dx,3d4H
+L$37:
+ mov si,word ptr [bx]
+ inc bx
+ inc bx
+ test si,si
+ je L$39
+L$38:
+ lodsw
+ test ax,ax
+ je L$37
+ cmp al,13H
+ je L$38
+ out dx,ax
+ jmp L$38
+L$39:
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ or al,80H
+ out dx,al
+L$40:
+ xor ax,ax
+ mov ax,word ptr MX_SCREENWIDTH
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXGETASPECT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov ax,word ptr cs:L$1
+ mov word ptr [si],ax
+ lds si,dword ptr 6[bp]
+ mov ax,word ptr cs:L$2
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXGETSCREENSIZE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov ax,word ptr cs:MX_SCREENWIDTH
+ mov word ptr [si],ax
+ lds si,dword ptr 6[bp]
+ mov ax,word ptr cs:MX_SCREENHEIGHT
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSETPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSETPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov cx,word ptr 6[bp]
+ mov ax,word ptr 8[bp]
+ mov dx,3c8H
+ out dx,al
+ inc dx
+ cld
+ cli
+L$1:
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ loop L$1
+ sti
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSPLITSCREEN
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSPLITSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ shl ax,1
+ mov bh,ah
+ mov bl,ah
+ and bx,201H
+ mov cl,4
+ shl bx,cl
+ shl bh,1
+ mov dx,3d4H
+ mov ah,al
+ mov al,18H
+ out dx,ax
+ mov al,7
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ mov ah,al
+ and ah,0efH
+ or ah,bl
+ mov al,7
+ out dx,ax
+ mov al,9
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ mov ah,al
+ and ah,0bfH
+ or ah,bh
+ mov al,9
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXPUTTILE
+ PUBLIC MXTRANSPUTTILE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXPUTTILE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ax,word ptr 0aH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,word ptr 0cH[bp]
+ shr di,1
+ shr di,1
+ add di,ax
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ lds si,dword ptr 0eH[bp]
+ shr word ptr 8[bp],1
+ shr word ptr 8[bp],1
+ mov cl,byte ptr 0cH[bp]
+ and cl,3
+ mov ah,11H
+ shl ah,cl
+ mov word ptr 0aH[bp],4
+ mov bx,word ptr cs:MX_BYTESPERLINE
+ sub bx,word ptr 8[bp]
+L$1:
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov word ptr 0cH[bp],di
+ mov dx,word ptr 6[bp]
+L$2:
+ mov cx,word ptr 8[bp]
+ shr cx,1
+ rep movsw
+ rcl cx,1
+ rep movsb
+ add di,bx
+ dec dx
+ jne L$2
+ mov di,word ptr 0cH[bp]
+ rol ah,1
+ adc di,0
+ dec word ptr 0aH[bp]
+ jne L$1
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MXTRANSPUTTILE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ax,word ptr 0aH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,word ptr 0cH[bp]
+ shr di,1
+ shr di,1
+ add di,ax
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ lds si,dword ptr 0eH[bp]
+ shr word ptr 8[bp],1
+ shr word ptr 8[bp],1
+ mov cl,byte ptr 0cH[bp]
+ and cl,3
+ mov ah,11H
+ shl ah,cl
+ mov word ptr 0aH[bp],4
+ mov bx,word ptr cs:MX_BYTESPERLINE
+ sub bx,word ptr 8[bp]
+L$3:
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov word ptr 0cH[bp],di
+ mov dx,word ptr 6[bp]
+L$4:
+ mov cx,word ptr 8[bp]
+ jcxz L$7
+L$5:
+ mov al,byte ptr [si]
+ test al,al
+ je L$6
+ mov byte ptr es:[di],al
+L$6:
+ inc si
+ inc di
+ dec cx
+ jne L$5
+L$7:
+ add di,bx
+ dec dx
+ jne L$4
+ mov di,word ptr 0cH[bp]
+ rol ah,1
+ adc di,0
+ dec word ptr 0aH[bp]
+ jne L$3
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXSETVIRTUALSCREEN
+ PUBLIC MXGETVIRTUALSCREEN
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MXROWADDRESS:BYTE
+ EXTRN MXSETSYSCLIPREGION:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+MXSETVIRTUALSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,1
+ cmp word ptr 8[bp],140H
+ jb L$3
+ push ax
+ mov dx,4
+ xor ax,ax
+ div word ptr 8[bp]
+ cmp word ptr 6[bp],ax
+ pop ax
+ ja L$3
+ mov ax,word ptr 8[bp]
+ and ax,0fff8H
+ mov word ptr L$1,ax
+ shr ax,1
+ shr ax,1
+ mov word ptr MX_TEXT:MX_BYTESPERLINE,ax
+ shr ax,1
+ push ax
+ call far ptr MXROWADDRESS
+ mov ax,word ptr 6[bp]
+ mov word ptr L$2,ax
+ push word ptr 8[bp]
+ push word ptr 6[bp]
+ call far ptr MXSETSYSCLIPREGION
+ xor ax,ax
+L$3:
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXGETVIRTUALSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr cs:L$1
+ lds si,dword ptr 0aH[bp]
+ mov word ptr [si],ax
+ mov ax,word ptr cs:L$2
+ lds si,dword ptr 6[bp]
+ mov word ptr [si],ax
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXWAITDISPLAY
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWAITDISPLAY:
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ jne L$1
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXWRITEMODE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWRITEMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov dx,3ceH
+ mov ah,byte ptr 6[bp]
+ and ah,3
+ or ah,40H
+ mov al,5
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXWRITEPLANE
+ PUBLIC MXREADPLANE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWRITEPLANE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ah,byte ptr 6[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MXREADPLANE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov al,4
+ mov ah,byte ptr 6[bp]
+ and ah,3
+ mov dx,3ceH
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+ PUBLIC MXWAITRETRACE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWAITRETRACE:
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ je L$1
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+@echo off\r
+wdis -a MXBB.OBJ > mxbb.asm\r
+wdis -a MXCC.OBJ > mxcc.asm\r
+wdis -a MXCG.OBJ > mxcg.asm\r
+wdis -a MXCL.OBJ > mxcl.asm\r
+wdis -a MXCR.OBJ > mxcl.asm\r
+wdis -a MXFB.OBJ > mxfb.asm\r
+wdis -a MXFP.OBJ > mxfp.asm\r
+wdis -a MXGC.OBJ > mxgc.asm\r
+wdis -a MXGI.OBJ > mxgi.asm\r
+wdis -a MXGM.OBJ > mxgm.asm\r
+wdis -a MXGP.OBJ > mxgp.asm\r
+wdis -a MXGV.OBJ > mxgv.asm\r
+wdis -a MXHL.OBJ > mxhl.asm\r
+wdis -a MXIT.OBJ > mxit.asm\r
+wdis -a MXLL.OBJ > mxll.asm\r
+wdis -a MXLN.OBJ > mxln.asm\r
+wdis -a MXOT.OBJ > mxot.asm\r
+wdis -a MXPB.OBJ > mxpb.asm\r
+wdis -a MXPF.OBJ > mxpf.asm\r
+wdis -a MXPG.OBJ > mxpg.asm\r
+wdis -a MXPI.OBJ > mxpi.asm\r
+wdis -a MXPN.OBJ > mxpn.asm\r
+wdis -a MXPP.OBJ > mxpp.asm\r
+wdis -a MXRA.OBJ > mxra.asm\r
+wdis -a MXRP.OBJ > mxrp.asm\r
+wdis -a MXSA.OBJ > mxsa.asm\r
+wdis -a MXSC.OBJ > mxsc.asm\r
+wdis -a MXSI.OBJ > mxsi.asm\r
+wdis -a MXSL.OBJ > mxsl.asm\r
+wdis -a MXSM.OBJ > mxsm.asm\r
+wdis -a MXSP.OBJ > mxsp.asm\r
+wdis -a MXSS.OBJ > mxss.asm\r
+wdis -a MXTL.OBJ > mxtl.asm\r
+wdis -a MXVS.OBJ > mxvs.asm\r
+wdis -a MXWD.OBJ > mxwd.asm\r
+wdis -a MXWM.OBJ > mxwm.asm\r
+wdis -a MXWP.OBJ > mxwp.asm\r
+wdis -a MXWR.OBJ > mxwr.asm\r
--- /dev/null
+;\r
+; MODEX library default font\r
+; Copyright (c) 1993-1994 by Alessandro Scotti\r
+;\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; #0\r
+ DB 07Eh, 081h, 0A5h, 081h, 0A5h, 099h, 081h, 07Eh ; #1\r
+ DB 07Eh, 0FFh, 0DBh, 0FFh, 0DBh, 0E7h, 0FFh, 07Eh ; #2\r
+ DB 06Ch, 0FEh, 0FEh, 0FEh, 07Ch, 038h, 010h, 000h ; #3\r
+ DB 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 010h, 000h ; #4\r
+ DB 010h, 038h, 010h, 054h, 0FEh, 054h, 010h, 0FEh ; #5\r
+ DB 010h, 038h, 07Ch, 0FEh, 0FEh, 07Ch, 010h, 0FEh ; #6\r
+ DB 000h, 018h, 03Ch, 07Eh, 07Eh, 03Ch, 018h, 000h ; #7\r
+ DB 0FFh, 0E7h, 0C3h, 081h, 081h, 0C3h, 0E7h, 0FFh ; #8\r
+ DB 000h, 03Ch, 066h, 042h, 042h, 066h, 03Ch, 000h ; #9\r
+ DB 0FFh, 0C3h, 099h, 0BDh, 0BDh, 099h, 0C3h, 0FFh ; #10\r
+ DB 007h, 003h, 005h, 078h, 084h, 084h, 084h, 078h ; #11\r
+ DB 07Ch, 082h, 082h, 082h, 07Ch, 010h, 038h, 010h ; #12\r
+ DB 01Ch, 010h, 01Ch, 010h, 010h, 010h, 030h, 030h ; #13\r
+ DB 03Eh, 022h, 03Eh, 022h, 022h, 026h, 066h, 060h ; #14\r
+ DB 099h, 05Ah, 03Ch, 0E7h, 0E7h, 03Ch, 05Ah, 099h ; #15\r
+ DB 000h, 010h, 030h, 070h, 0F0h, 070h, 030h, 010h ; #16\r
+ DB 000h, 080h, 0C0h, 0E0h, 0F0h, 0E0h, 0C0h, 080h ; #17\r
+ DB 010h, 038h, 054h, 010h, 010h, 054h, 038h, 010h ; #18\r
+ DB 048h, 048h, 048h, 048h, 048h, 000h, 048h, 000h ; #19\r
+ DB 07Eh, 092h, 092h, 072h, 012h, 012h, 012h, 000h ; #20\r
+ DB 03Ch, 022h, 018h, 024h, 024h, 018h, 044h, 03Ch ; #21\r
+ DB 000h, 000h, 000h, 000h, 000h, 03Eh, 03Eh, 000h ; #22\r
+ DB 038h, 054h, 010h, 010h, 010h, 054h, 038h, 0FEh ; #23\r
+ DB 000h, 010h, 038h, 054h, 010h, 010h, 010h, 000h ; #24\r
+ DB 000h, 010h, 010h, 010h, 054h, 038h, 010h, 000h ; #25\r
+ DB 000h, 008h, 004h, 0FEh, 004h, 008h, 000h, 000h ; #26\r
+ DB 000h, 020h, 040h, 0FEh, 040h, 020h, 000h, 000h ; #27\r
+ DB 000h, 000h, 080h, 080h, 080h, 0FCh, 000h, 000h ; #28\r
+ DB 000h, 024h, 042h, 0FFh, 042h, 024h, 000h, 000h ; #29\r
+ DB 000h, 000h, 010h, 038h, 07Ch, 0FEh, 000h, 000h ; #30\r
+ DB 000h, 000h, 0FEh, 07Ch, 038h, 010h, 000h, 000h ; #31\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; \r
+ DB 010h, 010h, 010h, 010h, 010h, 000h, 010h, 000h ; !\r
+ DB 000h, 024h, 024h, 000h, 000h, 000h, 000h, 000h ; "\r
+ DB 024h, 024h, 07Eh, 024h, 07Eh, 024h, 024h, 000h ; #\r
+ DB 038h, 054h, 050h, 038h, 014h, 054h, 038h, 010h ; $\r
+ DB 000h, 002h, 044h, 008h, 010h, 020h, 042h, 000h ; %\r
+ DB 038h, 044h, 038h, 060h, 094h, 088h, 074h, 000h ; &\r
+ DB 020h, 020h, 040h, 000h, 000h, 000h, 000h, 000h ; '\r
+ DB 010h, 020h, 040h, 040h, 040h, 020h, 010h, 000h ; (\r
+ DB 040h, 020h, 010h, 010h, 010h, 020h, 040h, 000h ; )\r
+ DB 000h, 024h, 018h, 07Eh, 018h, 024h, 000h, 000h ; *\r
+ DB 000h, 010h, 010h, 07Ch, 010h, 010h, 000h, 000h ; +\r
+ DB 000h, 000h, 000h, 000h, 000h, 010h, 010h, 020h ; ,\r
+ DB 000h, 000h, 000h, 0FCh, 000h, 000h, 000h, 000h ; -\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 010h, 000h ; .\r
+ DB 000h, 004h, 008h, 010h, 020h, 040h, 080h, 000h ; /\r
+ DB 07Ch, 0C6h, 08Ah, 092h, 0A2h, 0C6h, 07Ch, 000h ; 0\r
+ DB 010h, 030h, 010h, 010h, 010h, 010h, 038h, 000h ; 1\r
+ DB 078h, 084h, 004h, 018h, 060h, 080h, 0FCh, 000h ; 2\r
+ DB 078h, 084h, 004h, 038h, 004h, 084h, 078h, 000h ; 3\r
+ DB 01Ch, 024h, 044h, 084h, 0FEh, 004h, 00Eh, 000h ; 4\r
+ DB 0FCh, 080h, 0F8h, 004h, 004h, 084h, 078h, 000h ; 5\r
+ DB 078h, 084h, 080h, 0F8h, 084h, 084h, 078h, 000h ; 6\r
+ DB 0FCh, 004h, 004h, 008h, 010h, 020h, 020h, 000h ; 7\r
+ DB 078h, 084h, 084h, 078h, 084h, 084h, 078h, 000h ; 8\r
+ DB 078h, 084h, 084h, 07Ch, 004h, 084h, 078h, 000h ; 9\r
+ DB 000h, 000h, 010h, 000h, 000h, 000h, 010h, 000h ; :\r
+ DB 000h, 000h, 010h, 000h, 000h, 010h, 010h, 020h ; ;\r
+ DB 008h, 010h, 020h, 040h, 020h, 010h, 008h, 000h ; <\r
+ DB 000h, 000h, 0FCh, 000h, 000h, 0FCh, 000h, 000h ; =\r
+ DB 040h, 020h, 010h, 008h, 010h, 020h, 040h, 000h ; >\r
+ DB 078h, 084h, 004h, 008h, 010h, 000h, 010h, 000h ; ?\r
+ DB 07Ch, 082h, 0BAh, 0A6h, 0BEh, 080h, 07Ch, 000h ; @\r
+ DB 078h, 084h, 084h, 0FCh, 084h, 084h, 084h, 000h ; A\r
+ DB 0F8h, 084h, 084h, 0F8h, 084h, 084h, 0F8h, 000h ; B\r
+ DB 078h, 084h, 080h, 080h, 080h, 084h, 078h, 000h ; C\r
+ DB 0F0h, 088h, 084h, 084h, 084h, 088h, 0F0h, 000h ; D\r
+ DB 0FCh, 080h, 080h, 0F0h, 080h, 080h, 0FCh, 000h ; E\r
+ DB 0FCh, 080h, 080h, 0F0h, 080h, 080h, 080h, 000h ; F\r
+ DB 078h, 084h, 080h, 09Ch, 084h, 084h, 078h, 000h ; G\r
+ DB 084h, 084h, 084h, 0FCh, 084h, 084h, 084h, 000h ; H\r
+ DB 038h, 010h, 010h, 010h, 010h, 010h, 038h, 000h ; I\r
+ DB 01Ch, 008h, 008h, 008h, 088h, 088h, 070h, 000h ; J\r
+ DB 084h, 088h, 090h, 0E0h, 090h, 088h, 084h, 000h ; K\r
+ DB 080h, 080h, 080h, 080h, 080h, 080h, 0FCh, 000h ; L\r
+ DB 0C6h, 0AAh, 092h, 082h, 082h, 082h, 082h, 000h ; M\r
+ DB 082h, 0C2h, 0A2h, 092h, 08Ah, 086h, 082h, 000h ; N\r
+ DB 078h, 084h, 084h, 084h, 084h, 084h, 078h, 000h ; O\r
+ DB 0F8h, 084h, 084h, 0F8h, 080h, 080h, 080h, 000h ; P\r
+ DB 078h, 084h, 084h, 084h, 094h, 088h, 076h, 000h ; Q\r
+ DB 0F8h, 084h, 084h, 0F8h, 090h, 088h, 084h, 000h ; R\r
+ DB 078h, 084h, 080h, 078h, 004h, 084h, 078h, 000h ; S\r
+ DB 0FEh, 010h, 010h, 010h, 010h, 010h, 010h, 000h ; T\r
+ DB 084h, 084h, 084h, 084h, 084h, 084h, 078h, 000h ; U\r
+ DB 084h, 084h, 084h, 084h, 084h, 048h, 030h, 000h ; V\r
+ DB 082h, 082h, 082h, 082h, 092h, 0AAh, 0C6h, 000h ; W\r
+ DB 082h, 044h, 028h, 010h, 028h, 044h, 082h, 000h ; X\r
+ DB 044h, 044h, 044h, 038h, 010h, 010h, 010h, 000h ; Y\r
+ DB 0FEh, 004h, 008h, 010h, 020h, 040h, 0FEh, 000h ; Z\r
+ DB 078h, 040h, 040h, 040h, 040h, 040h, 078h, 000h ; [\r
+ DB 000h, 080h, 040h, 020h, 010h, 008h, 004h, 000h ; \\r
+ DB 078h, 008h, 008h, 008h, 008h, 008h, 078h, 000h ; ]\r
+ DB 010h, 028h, 044h, 082h, 000h, 000h, 000h, 000h ; ^\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh ; _\r
+ DB 020h, 020h, 010h, 000h, 000h, 000h, 000h, 000h ; `\r
+ DB 000h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; a\r
+ DB 000h, 040h, 040h, 078h, 044h, 044h, 078h, 000h ; b\r
+ DB 000h, 000h, 03Ch, 040h, 040h, 040h, 03Ch, 000h ; c\r
+ DB 000h, 004h, 004h, 03Ch, 044h, 044h, 03Ch, 000h ; d\r
+ DB 000h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; e\r
+ DB 000h, 00Ch, 010h, 03Ch, 010h, 010h, 010h, 000h ; f\r
+ DB 000h, 000h, 03Ch, 044h, 044h, 03Ch, 004h, 038h ; g\r
+ DB 000h, 040h, 040h, 078h, 044h, 044h, 044h, 000h ; h\r
+ DB 000h, 010h, 000h, 010h, 010h, 010h, 010h, 000h ; i\r
+ DB 000h, 004h, 000h, 004h, 004h, 004h, 044h, 038h ; j\r
+ DB 000h, 040h, 040h, 050h, 060h, 050h, 048h, 000h ; k\r
+ DB 000h, 030h, 010h, 010h, 010h, 010h, 010h, 000h ; l\r
+ DB 000h, 000h, 068h, 054h, 054h, 044h, 044h, 000h ; m\r
+ DB 000h, 000h, 078h, 044h, 044h, 044h, 044h, 000h ; n\r
+ DB 000h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; o\r
+ DB 000h, 000h, 078h, 044h, 044h, 078h, 040h, 040h ; p\r
+ DB 000h, 000h, 03Ch, 044h, 044h, 03Ch, 004h, 004h ; q\r
+ DB 000h, 000h, 05Ch, 060h, 040h, 040h, 040h, 000h ; r\r
+ DB 000h, 000h, 038h, 040h, 07Ch, 004h, 07Ch, 000h ; s\r
+ DB 000h, 010h, 038h, 010h, 010h, 010h, 018h, 000h ; t\r
+ DB 000h, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; u\r
+ DB 000h, 000h, 044h, 044h, 044h, 028h, 010h, 000h ; v\r
+ DB 000h, 000h, 044h, 044h, 054h, 054h, 06Ch, 000h ; w\r
+ DB 000h, 000h, 044h, 028h, 010h, 028h, 044h, 000h ; x\r
+ DB 000h, 000h, 044h, 044h, 044h, 03Ch, 004h, 07Ch ; y\r
+ DB 000h, 000h, 07Ch, 004h, 038h, 040h, 07Ch, 000h ; z\r
+ DB 000h, 008h, 010h, 010h, 030h, 010h, 010h, 008h ; {\r
+ DB 000h, 010h, 010h, 010h, 000h, 010h, 010h, 010h ; |\r
+ DB 000h, 020h, 010h, 010h, 018h, 010h, 010h, 020h ; }\r
+ DB 064h, 098h, 000h, 000h, 000h, 000h, 000h, 000h ; ~\r
+ DB 000h, 010h, 028h, 044h, 082h, 082h, 0FEh, 000h ; \7f\r
+ DB 07Ch, 080h, 080h, 080h, 080h, 07Ch, 004h, 07Ch ; #128\r
+ DB 000h, 028h, 000h, 044h, 044h, 044h, 038h, 000h ; #129\r
+ DB 03Ch, 000h, 07Ch, 044h, 07Ch, 040h, 07Ch, 000h ; #130\r
+ DB 07Eh, 081h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #131\r
+ DB 024h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #132\r
+ DB 078h, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #133\r
+ DB 018h, 018h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #134\r
+ DB 000h, 000h, 078h, 080h, 080h, 078h, 008h, 038h ; #135\r
+ DB 07Ch, 082h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #136\r
+ DB 048h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #137\r
+ DB 078h, 000h, 038h, 044h, 07Ch, 040h, 03Ch, 000h ; #138\r
+ DB 000h, 028h, 000h, 010h, 010h, 010h, 010h, 000h ; #139\r
+ DB 010h, 028h, 000h, 010h, 010h, 010h, 010h, 000h ; #140\r
+ DB 000h, 030h, 000h, 010h, 010h, 010h, 010h, 000h ; #141\r
+ DB 048h, 000h, 078h, 084h, 0FCh, 084h, 084h, 000h ; #142\r
+ DB 030h, 030h, 078h, 084h, 0FCh, 084h, 084h, 000h ; #143\r
+ DB 038h, 000h, 0FCh, 080h, 0F0h, 080h, 0FCh, 000h ; #144\r
+ DB 000h, 000h, 07Eh, 008h, 07Eh, 048h, 07Eh, 000h ; #145\r
+ DB 07Eh, 090h, 090h, 0FCh, 090h, 090h, 09Eh, 000h ; #146\r
+ DB 07Ch, 082h, 038h, 044h, 044h, 044h, 038h, 000h ; #147\r
+ DB 028h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #148\r
+ DB 070h, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #149\r
+ DB 038h, 044h, 000h, 044h, 044h, 044h, 038h, 000h ; #150\r
+ DB 070h, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; #151\r
+ DB 028h, 000h, 044h, 044h, 044h, 03Ch, 004h, 07Ch ; #152\r
+ DB 048h, 000h, 078h, 084h, 084h, 084h, 078h, 000h ; #153\r
+ DB 048h, 000h, 084h, 084h, 084h, 084h, 078h, 000h ; #154\r
+ DB 000h, 010h, 038h, 040h, 040h, 040h, 038h, 010h ; #155\r
+ DB 038h, 044h, 040h, 0E0h, 040h, 040h, 082h, 0FCh ; #156\r
+ DB 044h, 07Ch, 010h, 07Ch, 010h, 07Ch, 010h, 000h ; #157\r
+ DB 0F0h, 088h, 08Ah, 0F7h, 082h, 082h, 082h, 000h ; #158\r
+ DB 00Ch, 012h, 010h, 018h, 030h, 010h, 090h, 060h ; #159\r
+ DB 03Ch, 000h, 038h, 004h, 03Ch, 044h, 07Ch, 000h ; #160\r
+ DB 000h, 018h, 000h, 010h, 010h, 010h, 010h, 000h ; #161\r
+ DB 01Ch, 000h, 038h, 044h, 044h, 044h, 038h, 000h ; #162\r
+ DB 01Ch, 000h, 044h, 044h, 044h, 044h, 038h, 000h ; #163\r
+ DB 07Ch, 000h, 078h, 044h, 044h, 044h, 044h, 000h ; #164\r
+ DB 07Ch, 000h, 044h, 064h, 054h, 04Ch, 044h, 000h ; #165\r
+ DB 018h, 024h, 024h, 01Eh, 000h, 03Eh, 000h, 000h ; #166\r
+ DB 01Ch, 022h, 022h, 01Ch, 000h, 03Eh, 000h, 000h ; #167\r
+ DB 010h, 000h, 010h, 020h, 040h, 042h, 03Ch, 000h ; #168\r
+ DB 000h, 000h, 000h, 0FCh, 080h, 080h, 000h, 000h ; #169\r
+ DB 000h, 000h, 000h, 0FCh, 004h, 004h, 000h, 000h ; #170\r
+ DB 040h, 044h, 048h, 057h, 021h, 047h, 004h, 007h ; #171\r
+ DB 040h, 044h, 048h, 052h, 026h, 04Ah, 01Fh, 002h ; #172\r
+ DB 010h, 000h, 010h, 010h, 010h, 010h, 010h, 000h ; #173\r
+ DB 000h, 024h, 048h, 090h, 048h, 024h, 000h, 000h ; #174\r
+ DB 000h, 048h, 024h, 012h, 024h, 048h, 000h, 000h ; #175\r
+ DB 022h, 088h, 022h, 088h, 022h, 088h, 022h, 088h ; #176\r
+ DB 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh ; #177\r
+ DB 0DBh, 077h, 0DBh, 0EEh, 0DBh, 077h, 0DBh, 0EEh ; #178\r
+ DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h ; #179\r
+ DB 018h, 018h, 018h, 018h, 0F8h, 018h, 018h, 018h ; #180\r
+ DB 018h, 018h, 0F8h, 018h, 0F8h, 018h, 018h, 018h ; #181\r
+ DB 036h, 036h, 036h, 036h, 0F6h, 036h, 036h, 036h ; #182\r
+ DB 000h, 000h, 000h, 000h, 0FEh, 036h, 036h, 036h ; #183\r
+ DB 000h, 000h, 0F8h, 018h, 0F8h, 018h, 018h, 018h ; #184\r
+ DB 036h, 036h, 0F6h, 006h, 0F6h, 036h, 036h, 036h ; #185\r
+ DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h ; #186\r
+ DB 000h, 000h, 0FEh, 006h, 0F6h, 036h, 036h, 036h ; #187\r
+ DB 036h, 036h, 0F6h, 006h, 0FEh, 000h, 000h, 000h ; #188\r
+ DB 036h, 036h, 036h, 036h, 0FEh, 000h, 000h, 000h ; #189\r
+ DB 018h, 018h, 0F8h, 018h, 0F8h, 000h, 000h, 000h ; #190\r
+ DB 000h, 000h, 000h, 000h, 0F8h, 018h, 018h, 018h ; #191\r
+ DB 018h, 018h, 018h, 018h, 01Fh, 000h, 000h, 000h ; #192\r
+ DB 018h, 018h, 018h, 018h, 0FFh, 000h, 000h, 000h ; #193\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 018h, 018h, 018h ; #194\r
+ DB 018h, 018h, 018h, 018h, 01Fh, 018h, 018h, 018h ; #195\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 000h, 000h, 000h ; #196\r
+ DB 018h, 018h, 018h, 018h, 0FFh, 018h, 018h, 018h ; #197\r
+ DB 018h, 018h, 01Fh, 018h, 01Fh, 018h, 018h, 018h ; #198\r
+ DB 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h ; #199\r
+ DB 036h, 036h, 037h, 030h, 03Fh, 000h, 000h, 000h ; #200\r
+ DB 000h, 000h, 03Fh, 030h, 037h, 036h, 036h, 036h ; #201\r
+ DB 036h, 036h, 0F7h, 000h, 0FFh, 000h, 000h, 000h ; #202\r
+ DB 000h, 000h, 0FFh, 000h, 0F7h, 036h, 036h, 036h ; #203\r
+ DB 036h, 036h, 037h, 030h, 037h, 036h, 036h, 036h ; #204\r
+ DB 000h, 000h, 0FFh, 000h, 0FFh, 000h, 000h, 000h ; #205\r
+ DB 036h, 036h, 0F7h, 000h, 0F7h, 036h, 036h, 036h ; #206\r
+ DB 018h, 018h, 0FFh, 000h, 0FFh, 000h, 000h, 000h ; #207\r
+ DB 036h, 036h, 036h, 036h, 0FFh, 000h, 000h, 000h ; #208\r
+ DB 000h, 000h, 0FFh, 000h, 0FFh, 018h, 018h, 018h ; #209\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 036h, 036h, 036h ; #210\r
+ DB 036h, 036h, 036h, 036h, 03Fh, 000h, 000h, 000h ; #211\r
+ DB 018h, 018h, 01Fh, 018h, 01Fh, 000h, 000h, 000h ; #212\r
+ DB 000h, 000h, 01Fh, 018h, 01Fh, 018h, 018h, 018h ; #213\r
+ DB 000h, 000h, 000h, 000h, 03Fh, 036h, 036h, 036h ; #214\r
+ DB 036h, 036h, 036h, 036h, 0FFh, 036h, 036h, 036h ; #215\r
+ DB 018h, 018h, 0FFh, 018h, 0FFh, 018h, 018h, 018h ; #216\r
+ DB 018h, 018h, 018h, 018h, 0F8h, 000h, 000h, 000h ; #217\r
+ DB 000h, 000h, 000h, 000h, 01Fh, 018h, 018h, 018h ; #218\r
+ DB 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh ; #219\r
+ DB 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh ; #220\r
+ DB 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h ; #221\r
+ DB 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh ; #222\r
+ DB 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h, 000h, 000h ; #223\r
+ DB 000h, 000h, 062h, 094h, 088h, 094h, 062h, 000h ; #224\r
+ DB 000h, 0F0h, 088h, 0F0h, 088h, 088h, 0F0h, 080h ; #225\r
+ DB 000h, 0F8h, 088h, 080h, 080h, 080h, 080h, 000h ; #226\r
+ DB 000h, 0FCh, 048h, 048h, 048h, 048h, 048h, 000h ; #227\r
+ DB 0FCh, 084h, 040h, 020h, 040h, 084h, 0FCh, 000h ; #228\r
+ DB 03Ch, 040h, 038h, 044h, 044h, 044h, 038h, 000h ; #229\r
+ DB 000h, 000h, 044h, 044h, 044h, 078h, 040h, 040h ; #230\r
+ DB 000h, 036h, 048h, 008h, 008h, 008h, 008h, 000h ; #231\r
+ DB 038h, 010h, 038h, 044h, 044h, 038h, 010h, 038h ; #232\r
+ DB 078h, 084h, 084h, 0FCh, 084h, 084h, 078h, 000h ; #233\r
+ DB 078h, 084h, 084h, 084h, 048h, 048h, 0CCh, 000h ; #234\r
+ DB 078h, 004h, 038h, 044h, 044h, 044h, 038h, 000h ; #235\r
+ DB 000h, 000h, 06Ch, 092h, 092h, 06Ch, 000h, 000h ; #236\r
+ DB 000h, 000h, 03Ah, 044h, 05Ah, 022h, 05Ch, 000h ; #237\r
+ DB 018h, 020h, 040h, 078h, 040h, 020h, 018h, 000h ; #238\r
+ DB 078h, 084h, 084h, 084h, 084h, 084h, 084h, 000h ; #239\r
+ DB 000h, 0FCh, 000h, 0FCh, 000h, 0FCh, 000h, 000h ; #240\r
+ DB 020h, 020h, 0F8h, 020h, 020h, 000h, 0F8h, 000h ; #241\r
+ DB 020h, 010h, 008h, 010h, 020h, 000h, 07Ch, 000h ; #242\r
+ DB 008h, 010h, 020h, 010h, 008h, 000h, 07Ch, 000h ; #243\r
+ DB 00Ch, 012h, 010h, 010h, 010h, 010h, 010h, 010h ; #244\r
+ DB 010h, 010h, 010h, 010h, 010h, 010h, 090h, 060h ; #245\r
+ DB 000h, 010h, 000h, 07Ch, 000h, 010h, 000h, 000h ; #246\r
+ DB 000h, 032h, 04Ch, 000h, 032h, 04Ch, 000h, 000h ; #247\r
+ DB 038h, 044h, 044h, 038h, 000h, 000h, 000h, 000h ; #248\r
+ DB 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h ; #249\r
+ DB 000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h ; #250\r
+ DB 00Eh, 008h, 008h, 008h, 048h, 028h, 018h, 008h ; #251\r
+ DB 038h, 024h, 024h, 024h, 024h, 000h, 000h, 000h ; #252\r
+ DB 03Ch, 004h, 03Ch, 020h, 03Ch, 000h, 000h, 000h ; #253\r
+ DB 000h, 000h, 03Ch, 03Ch, 03Ch, 03Ch, 000h, 000h ; #254\r
+ DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; #255\r
--- /dev/null
+#\r
+# MODEX library makefile (for Borland MAKE)\r
+# Copyright (c) 1993,1994 by Alessandro Scotti\r
+#\r
+!ifdef __LINUX__\r
+REMOVECOMMAND=rm -f\r
+COPYCOMMAND=cp -f\r
+DIRSEP=/\r
+OBJ=o\r
+!else\r
+REMOVECOMMAND=del\r
+COPYCOMMAND=copy /y\r
+DIRSEP=\\r
+OBJ=obj\r
+!endif\r
+LIBINCS = modex.def\r
+\r
+LIBOBJS = mxbb.$(OBJ) mxcc.$(OBJ) mxcg.$(OBJ) mxcl.$(OBJ) mxcr.$(OBJ) mxfb.$(OBJ) mxgc.$(OBJ) mxgi.$(OBJ) mxgm.$(OBJ) mxgp.$(OBJ) mxgv.$(OBJ) mxhl.$(OBJ) mxit.$(OBJ) mxll.$(OBJ) mxln.$(OBJ) mxot.$(OBJ) mxpb.$(OBJ) mxpf.$(OBJ) mxpg.$(OBJ) mxpi.$(OBJ) mxpn.$(OBJ) mxpp.$(OBJ) mxra.$(OBJ) mxrp.$(OBJ) mxsa.$(OBJ) mxsc.$(OBJ) mxsi.$(OBJ) mxsl.$(OBJ) mxsm.$(OBJ) mxsp.$(OBJ) mxss.$(OBJ) mxtl.$(OBJ) mxvs.$(OBJ) mxwd.$(OBJ) mxwm.$(OBJ) mxwp.$(OBJ) mxwr.$(OBJ)\r
+#mxfp.$(OBJ) \r
+#\r
+# ASM compiler\r
+#\r
+ASMC =wasm\r
+ASMO =-mh -0\r
+\r
+#\r
+# PAS compiler\r
+#\r
+#PASC = tpc\r
+#PASO = /m -$D- -$L- -$S-\r
+\r
+#\r
+# LIB maker, uses response file\r
+#\r
+LIBC = wlib\r
+\r
+# .asm.obj:\r
+# $(ASMC) $(ASMO) $<\r
+\r
+mxbb.$(OBJ): mxbb.asm\r
+ $(ASMC) $(ASMO) mxbb.asm\r
+mxcc.$(OBJ): mxcc.asm\r
+ $(ASMC) $(ASMO) mxcc.asm\r
+mxcg.$(OBJ): mxcg.asm\r
+ $(ASMC) $(ASMO) mxcg.asm\r
+mxcl.$(OBJ): mxcl.asm\r
+ $(ASMC) $(ASMO) mxcl.asm\r
+mxcr.$(OBJ): mxcr.asm\r
+ $(ASMC) $(ASMO) mxcr.asm\r
+mxfb.$(OBJ): mxfb.asm\r
+ $(ASMC) $(ASMO) mxfb.asm\r
+mxfp.$(OBJ): mxfp.asm\r
+ $(ASMC) $(ASMO) mxfp.asm\r
+mxgc.$(OBJ): mxgc.asm\r
+ $(ASMC) $(ASMO) mxgc.asm\r
+mxgi.$(OBJ): mxgi.asm\r
+ $(ASMC) $(ASMO) mxgi.asm\r
+mxgm.$(OBJ): mxgm.asm\r
+ $(ASMC) $(ASMO) mxgm.asm\r
+mxgp.$(OBJ): mxgp.asm\r
+ $(ASMC) $(ASMO) mxgp.asm\r
+mxgv.$(OBJ): mxgv.asm\r
+ $(ASMC) $(ASMO) mxgv.asm\r
+mxhl.$(OBJ): mxhl.asm\r
+ $(ASMC) $(ASMO) mxhl.asm\r
+mxit.$(OBJ): mxit.asm\r
+ $(ASMC) $(ASMO) mxit.asm\r
+mxll.$(OBJ): mxll.asm\r
+ $(ASMC) $(ASMO) mxll.asm\r
+mxln.$(OBJ): mxln.asm\r
+ $(ASMC) $(ASMO) mxln.asm\r
+mxot.$(OBJ): mxot.asm\r
+ $(ASMC) $(ASMO) mxot.asm\r
+mxpb.$(OBJ): mxpb.asm\r
+ $(ASMC) $(ASMO) mxpb.asm\r
+mxpf.$(OBJ): mxpf.asm\r
+ $(ASMC) $(ASMO) mxpf.asm\r
+mxpg.$(OBJ): mxpg.asm\r
+ $(ASMC) $(ASMO) mxpg.asm\r
+mxpi.$(OBJ): mxpi.asm\r
+ $(ASMC) $(ASMO) mxpi.asm\r
+mxpn.$(OBJ): mxpn.asm\r
+ $(ASMC) $(ASMO) mxpn.asm\r
+mxpp.$(OBJ): mxpp.asm\r
+ $(ASMC) $(ASMO) mxpp.asm\r
+mxra.$(OBJ): mxra.asm\r
+ $(ASMC) $(ASMO) mxra.asm\r
+mxrp.$(OBJ): mxrp.asm\r
+ $(ASMC) $(ASMO) mxrp.asm\r
+mxsa.$(OBJ): mxsa.asm\r
+ $(ASMC) $(ASMO) mxsa.asm\r
+mxsc.$(OBJ): mxsc.asm\r
+ $(ASMC) $(ASMO) mxsc.asm\r
+mxsi.$(OBJ): mxsi.asm\r
+ $(ASMC) $(ASMO) mxsi.asm\r
+mxsl.$(OBJ): mxsl.asm\r
+ $(ASMC) $(ASMO) mxsl.asm\r
+mxsm.$(OBJ): mxsm.asm\r
+ $(ASMC) $(ASMO) mxsm.asm\r
+mxsp.$(OBJ): mxsp.asm\r
+ $(ASMC) $(ASMO) mxsp.asm\r
+mxss.$(OBJ): mxss.asm\r
+ $(ASMC) $(ASMO) mxss.asm\r
+mxtl.$(OBJ): mxtl.asm\r
+ $(ASMC) $(ASMO) mxtl.asm\r
+mxvs.$(OBJ): mxvs.asm\r
+ $(ASMC) $(ASMO) mxvs.asm\r
+mxwd.$(OBJ): mxwd.asm\r
+ $(ASMC) $(ASMO) mxwd.asm\r
+mxwm.$(OBJ): mxwm.asm\r
+ $(ASMC) $(ASMO) mxwm.asm\r
+mxwp.$(OBJ): mxwp.asm\r
+ $(ASMC) $(ASMO) mxwp.asm\r
+mxwr.$(OBJ): mxwr.asm\r
+ $(ASMC) $(ASMO) mxwr.asm\r
+\r
+all: $(LIBOBJS) modex.lib\r
+# modex.tpu modex.tpp\r
+\r
+#modex.tpu: $(LIBOBJS) modex.pas\r
+# $(PASC) $(PASO) modex\r
+# copy modex.tpu ..\r
+# copy modex.pas ..\r
+\r
+#modex.tpp: $(LIBOBJS) modex.pas\r
+# $(PASC) /cp $(PASO) modex\r
+# copy modex.tpp ..\r
+\r
+modex.lib: modex.lbr $(LIBOBJS)\r
+ $(LIBC) modex.lib @modex.lbr\r
+\r
+$(LIBOBJS): modex.def\r
--- /dev/null
+#\r
+# MODEX library makefile (for Borland MAKE)\r
+# Copyright (c) 1993,1994 by Alessandro Scotti\r
+#\r
+LIBINCS = MODEX.DEF\r
+\r
+LIBOBJS = MXBB.OBJ \\r
+ MXCC.OBJ \\r
+ MXCG.OBJ \\r
+ MXCL.OBJ \\r
+ MXCR.OBJ \\r
+ MXFB.OBJ \\r
+ MXFP.OBJ \\r
+ MXGC.OBJ \\r
+ MXGI.OBJ \\r
+ MXGM.OBJ \\r
+ MXGP.OBJ \\r
+ MXGV.OBJ \\r
+ MXHL.OBJ \\r
+ MXIT.OBJ \\r
+ MXLL.OBJ \\r
+ MXLN.OBJ \\r
+ MXOT.OBJ \\r
+ MXPB.OBJ \\r
+ MXPF.OBJ \\r
+ MXPG.OBJ \\r
+ MXPI.OBJ \\r
+ MXPN.OBJ \\r
+ MXPP.OBJ \\r
+ MXRA.OBJ \\r
+ MXRP.OBJ \\r
+ MXSA.OBJ \\r
+ MXSC.OBJ \\r
+ MXSI.OBJ \\r
+ MXSL.OBJ \\r
+ MXSM.OBJ \\r
+ MXSP.OBJ \\r
+ MXSS.OBJ \\r
+ MXTL.OBJ \\r
+ MXVS.OBJ \\r
+ MXWD.OBJ \\r
+ MXWM.OBJ \\r
+ MXWP.OBJ \\r
+ MXWR.OBJ\r
+\r
+#\r
+# ASM compiler\r
+#\r
+ASMC = tasm\r
+ASMO = /m5 /p\r
+\r
+#\r
+# PAS compiler\r
+#\r
+PASC = tpc\r
+PASO = /m -$D- -$L- -$S-\r
+\r
+#\r
+# LIB maker, uses response file\r
+#\r
+LIBC = tlib\r
+\r
+.asm.obj:\r
+ $(ASMC) $(ASMO) $<\r
+\r
+target: modex.lib
+# modex.tpu modex.tpp\r
+\r
+#modex.tpu: $(LIBOBJS) modex.pas\r
+# $(PASC) $(PASO) modex\r
+# copy modex.tpu ..\r
+# copy modex.pas ..\r
+\r
+#modex.tpp: $(LIBOBJS) modex.pas\r
+# $(PASC) /cp $(PASO) modex\r
+# copy modex.tpp ..\r
+\r
+modex.lib: modex.lbr $(LIBOBJS)\r
+ $(LIBC) modex.lib @modex.lbr\r
+\r
+$(LIBOBJS): modex.def\r
--- /dev/null
+;------------------------------------------------------------\r
+;\r
+; MODEX.DEF - Include file\r
+; Copyright (c) 1993-1994 by Alessandro Scotti\r
+;\r
+;JUMPS\r
+;LOCALS\r
+\r
+TRUE EQU 1 ; Boolean constants\r
+FALSE EQU 0\r
+\r
+USE286 = FALSE ; TRUE enables 80286 instructions\r
+USE386 = FALSE ; TRUE enables 80386 (and 80286) instructions\r
+\r
+IF USE286 EQ TRUE\r
+ P286\r
+ENDIF\r
+\r
+IF USE386 EQ TRUE\r
+ P386\r
+ USE286 = TRUE\r
+ENDIF\r
+\r
+MXVERSION EQU 0128h ; Library version (1.40)\r
+\r
+;------------------------------------------------------------\r
+;\r
+; VGA definitions\r
+;\r
+MISC EQU 3C2h ; Miscellaneous output\r
+TS EQU 3C4h ; Timing Sequencer index register\r
+GDC EQU 3CEh ; Graphics Data Controller index register\r
+CRTC EQU 3D4h ; CRTC index register\r
+STATUS EQU 3DAh ; Input Status register one\r
+\r
+;------------------------------------------------------------\r
+;\r
+; Raster operators\r
+;\r
+OP_SET EQU 0\r
+OP_MOVE EQU 0 ; Same as OP_SET\r
+OP_AND EQU 1\r
+OP_OR EQU 2\r
+OP_XOR EQU 3\r
+OP_TRANS EQU 4\r
+OP_ADD EQU 5 ; Must be last op\r
+\r
+;------------------------------------------------------------\r
+;\r
+; Polygon fill functions\r
+;\r
+POLYSCANBUFSIZE EQU 4*1024\r
+\r
+;------------------------------------------------------------\r
+; Macro to push registers, variables or flags onto the stack\r
+; Usage: .push "loc16"[,"loc16"...]\r
+; where "loc16" is a 16-bit register, a word-sized variable or the\r
+; keyword "FLAGS".\r
+; Exmpl: .push ax, flags, var1\r
+; .pop ax, flags, var1\r
+;\r
+.push MACRO r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10\r
+ IFNB <r10>\r
+ .ERROR <.PUSH has more than 10 arguments>\r
+ ENDIF\r
+ IRP $reg, <r0, r1, r2, r3, r4, r5, r6, r7, r8, r9>\r
+ IFB <$reg> ;; Is argument blank?\r
+ EXITM ;; Yes, exit\r
+ ELSEIFIDNI <$reg>, <FLAGS> ;; Is argument the keyword "FLAGS"?\r
+ pushf ;; Yes, push flags\r
+ ELSE\r
+ push $reg ;; Push argument\r
+ ENDIF\r
+ ENDM\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+; Macro to pop registers, variables or flags from the stack\r
+; Usage: .pop "loc16"[,"loc16"...]\r
+; where "loc16" is a 16-bit register, a word-sized variable or the\r
+; keyword "FLAGS".\r
+; Exmpl: .push ax, flags, var1\r
+; .pop ax, flags, var1\r
+;\r
+.pop MACRO r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10\r
+ IFNB <r10>\r
+ .ERROR <.POP has more than 10 arguments>\r
+ ENDIF\r
+ IRP $reg, <r9, r8, r7, r6, r5, r4, r3, r2, r1, r0>\r
+ IFNB <$reg> ;; Is argument non-blank?\r
+ IFIDNI <$reg>, <FLAGS> ;; Yes, is it the keyword "FLAGS"?\r
+ popf ;; Yes, pop flags\r
+ ELSE\r
+ pop $reg ;; Pop argument\r
+ ENDIF\r
+ ENDIF\r
+ ENDM\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+.enter MACRO localsize\r
+ IF USE286 EQ TRUE\r
+ enter localsize, 0\r
+ ELSE\r
+ push bp\r
+ mov bp, sp\r
+ sub sp, localsize\r
+ ENDIF\r
+ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+;.leave MACRO argsize\r
+; IF USE286 EQ TRUE\r
+; leave\r
+; ELSE\r
+; mov sp, bp\r
+; pop bp\r
+; ENDIF\r
+; IFNB <argspace>\r
+; ret argsize\r
+; ELSE\r
+; ret\r
+; ENDIF\r
+;ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+;.shr MACRO arg, count\r
+; IF USE286 EQ TRUE\r
+; shr arg, count\r
+; ELSE\r
+; $temp = count\r
+; WHILE $temp GT 0\r
+; shr arg, 1\r
+; $temp = $temp-1\r
+; ENDM\r
+; ENDIF\r
+;ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+;.shl MACRO arg, count\r
+; IF USE286 EQ TRUE\r
+; shl arg, count\r
+; ELSE\r
+; $temp = count\r
+; WHILE $temp GT 0\r
+; shl arg, 1\r
+; $temp = $temp-1\r
+; ENDM\r
+; ENDIF\r
+;ENDM\r
+\r
+;------------------------------------------------------------\r
+;\r
+;.chk386 MACRO name, jump\r
+; IF USE386 EQ FALSE\r
+; .OUT "Warning: ", <name>, " needs a 386 or better to run!"\r
+; jmp @@jump\r
+; ENDIF\r
+;ENDM\r
--- /dev/null
+/*\r
+ MODEX.H - C/C++ include file for the MODEX library\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*/\r
+\r
+#ifndef _MODEX_H_ // Avoid nested inclusions\r
+#define _MODEX_H_\r
+\r
+//\r
+// Video modes\r
+//\r
+#define MX_TEXT 0 // 80x25 text\r
+#define MX_320x175 1 // 320x175x256\r
+#define MX_320x200 2 // 320x200x256, 4 pages, aspect 6:5\r
+#define MX_320x240 3 // 320x240x256, 3 pages, aspect 1:1\r
+#define MX_320x350 4 // 320x350x256\r
+#define MX_320x400 5 // 320x400x256, 2 pages\r
+#define MX_320x480 6 // 320x480x256, 1 page\r
+#define MX_360x175 7 // 360x175x256\r
+#define MX_360x200 8 // 360x200x256, 3 pages\r
+#define MX_360x240 9 // 360x240x256, 2 pages\r
+#define MX_360x350 10 // 360x350x256\r
+#define MX_360x400 11 // 360x400x256, 1 page\r
+#define MX_360x480 12 // 360x480x256, 1 page\r
+#define MX_400x600 13 // 400x600x256, 1 page\r
+\r
+//\r
+// Fade effects\r
+//\r
+#define MX_FADEIN 0\r
+#define MX_FADEOUT 1\r
+\r
+//\r
+// Raster ops\r
+//\r
+#define OP_SET 0 // No operator\r
+#define OP_AND 1 // And\r
+#define OP_OR 2 // Or\r
+#define OP_XOR 3 // Xor\r
+#define OP_TRANS 4 // Transparent\r
+#define OP_ADD 5 // Additive\r
+#define OP_MOVE 0 // Alias for OP_SET\r
+\r
+//\r
+// Temporary definitions\r
+//\r
+#define MXBYTE unsigned char\r
+#define MXBOOL short int\r
+#define MXSINT short int\r
+#define MXUINT unsigned short int\r
+#define MXAPI far pascal\r
+#define MXPTR void far *\r
+\r
+// Functions\r
+\r
+#ifdef __cplusplus // Avoid C++ name mangling\r
+extern "C" {\r
+#endif\r
+\r
+//\r
+// Initialization\r
+//\r
+MXSINT MXAPI mxInit( void ); // Returns 0 if successful\r
+void MXAPI mxTerm( void );\r
+MXUINT MXAPI mxGetVersion( void );\r
+//\r
+// Mode setting\r
+//\r
+void MXAPI mxChangeMode( MXUINT mode );\r
+void MXAPI mxSetMode( MXUINT mode );\r
+void MXAPI mxGetAspect( MXUINT far *aspectx, MXUINT far *aspecty );\r
+void MXAPI mxGetScreenSize( MXUINT far *width, MXUINT far *height );\r
+//\r
+// Hardware support\r
+//\r
+void MXAPI mxWriteMode( MXBYTE wm );\r
+void MXAPI mxSplitScreen( MXUINT line );\r
+void MXAPI mxStartAddress( MXUINT sa );\r
+void MXAPI mxStartLine( MXUINT sl );\r
+void MXAPI mxWaitDisplay( void );\r
+void MXAPI mxWaitRetrace( void );\r
+void MXAPI mxWritePlane( MXBYTE wp );\r
+void MXAPI mxReadPlane( MXBYTE rp );\r
+void MXAPI mxRowAddress( MXBYTE ra );\r
+//\r
+// Virtual screen\r
+//\r
+void MXAPI mxGetVirtualScreen( MXUINT far *width, MXUINT far *height );\r
+void MXAPI mxSetVirtualScreen( MXUINT width, MXUINT height );\r
+void MXAPI mxPan( MXUINT x, MXUINT y );\r
+//\r
+// Clipping\r
+//\r
+MXBOOL MXAPI mxGetClip( void );\r
+MXBOOL MXAPI mxGetClipRegion( MXSINT far *x, MXSINT far *y, MXSINT far *w, MXSINT far *h );\r
+MXBOOL MXAPI mxSetClip( MXBOOL );\r
+void MXAPI mxSetClipRegion( MXUINT x, MXUINT y, MXUINT width, MXUINT height );\r
+//\r
+// Graphics\r
+//\r
+void MXAPI mxBitBlt( MXSINT sx, MXSINT sy, MXUINT width, MXUINT height, MXSINT dx, MXSINT dy );\r
+void MXAPI mxFillBox( MXSINT x, MXSINT y, MXUINT width, MXUINT height, MXUINT color, MXUINT op );\r
+MXBYTE MXAPI mxGetPixel( MXSINT x, MXSINT y );\r
+void MXAPI mxPutPixel( MXSINT x, MXSINT y, MXBYTE color );\r
+void MXAPI mxLine( MXSINT x1, MXSINT y1, MXSINT x2, MXSINT y2, MXUINT color, MXUINT op );\r
+void MXAPI mxGetImage( MXPTR img, MXSINT x, MXSINT y, MXUINT width, MXUINT height );\r
+void MXAPI mxPutImage( MXPTR img, MXSINT x, MXSINT y, MXUINT w, MXUINT h, MXUINT op );\r
+void MXAPI mxPutTile( MXPTR tile, MXSINT x, MXSINT y, MXUINT width, MXUINT height );\r
+void MXAPI mxTransPutTile( MXPTR tile, MXSINT x, MXSINT y, MXUINT w, MXUINT h );\r
+void MXAPI mxCircle( MXSINT x, MXSINT y, MXUINT radius, MXBYTE color );\r
+void MXAPI mxStretchImage( MXPTR img, MXSINT x, MXSINT y, MXUINT w, MXUINT h, MXUINT neww, MXUINT newh, MXUINT op );\r
+//\r
+// Palette\r
+//\r
+void MXAPI mxColorToGray( MXPTR source, MXPTR dest, MXUINT count );\r
+void MXAPI mxGammaCorrect( MXPTR source, MXPTR dest, MXUINT count );\r
+void MXAPI mxGetColor( MXUINT index, MXSINT far *r, MXSINT far *g, MXSINT far *b );\r
+void MXAPI mxSetColor( MXUINT index, MXSINT red, MXSINT green, MXSINT blue );\r
+void MXAPI mxGetPalette( MXPTR palette, MXUINT index, MXUINT count );\r
+void MXAPI mxSetPalette( MXPTR palette, MXUINT index, MXUINT count );\r
+void MXAPI mxFadePalette( MXPTR, MXUINT, MXUINT, MXUINT, MXUINT, MXUINT, MXUINT );\r
+void MXAPI mxRotatePalette( MXPTR palette, MXUINT count, MXSINT step );\r
+//\r
+// Text\r
+//\r
+MXSINT MXAPI mxSetFont( MXPTR font, MXUINT charwidth, MXUINT charheight );\r
+void MXAPI mxSetTextColor( MXUINT color, MXUINT op );\r
+void MXAPI mxGetTextStep( MXSINT far *deltax, MXSINT far *deltay );\r
+void MXAPI mxSetTextStep( MXSINT deltax, MXSINT deltay );\r
+void MXAPI mxOutChar( MXSINT x, MXSINT y, char c );\r
+void MXAPI mxOutText( MXSINT x, MXSINT y, char far *sz );\r
+//\r
+// Convex polygons\r
+//\r
+void MXAPI mxFillPoly( MXUINT, MXPTR, MXPTR, MXUINT, MXUINT );\r
+void MXAPI mxGouraudPoly( MXUINT, MXPTR, MXPTR, MXPTR, MXUINT, MXUINT );\r
+void MXAPI mxTexturePoly( MXUINT, MXPTR, MXPTR, MXPTR, MXPTR, MXUINT, MXUINT );\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+//\r
+// Remove temporary defines\r
+//\r
+#undef MXBYTE\r
+#undef MXBOOL\r
+#undef MXSINT\r
+#undef MXUINT\r
+#undef MXPTR\r
+#undef MXAPI\r
+\r
+#endif // _MODEX_H_\r
--- /dev/null
++-MXBB.OBJ &\r
++-MXCC.OBJ &\r
++-MXCG.OBJ &\r
++-MXCL.OBJ &\r
++-MXCR.OBJ &\r
++-MXFB.OBJ &\r
++-MXFP.OBJ &\r
++-MXGC.OBJ &\r
++-MXGI.OBJ &\r
++-MXGM.OBJ &\r
++-MXGP.OBJ &\r
++-MXGV.OBJ &\r
++-MXHL.OBJ &\r
++-MXIT.OBJ &\r
++-MXLL.OBJ &\r
++-MXLN.OBJ &\r
++-MXOT.OBJ &\r
++-MXPB.OBJ &\r
++-MXPF.OBJ &\r
++-MXPG.OBJ &\r
++-MXPI.OBJ &\r
++-MXPN.OBJ &\r
++-MXPP.OBJ &\r
++-MXPT.OBJ &\r
++-MXRA.OBJ &\r
++-MXRP.OBJ &\r
++-MXSA.OBJ &\r
++-MXSC.OBJ &\r
++-MXSI.OBJ &\r
++-MXSL.OBJ &\r
++-MXSM.OBJ &\r
++-MXSP.OBJ &\r
++-MXSS.OBJ &\r
++-MXTL.OBJ &\r
++-MXVS.OBJ &\r
++-MXWD.OBJ &\r
++-MXWM.OBJ &\r
++-MXWP.OBJ &\r
++-MXWR.OBJ\r
--- /dev/null
+(*\r
+ Turbo Pascal interface to the MODEX library\r
+ Copyright (c) 1993,1994 by Alessandro Scotti\r
+*)\r
+unit ModeX;\r
+interface\r
+\r
+const\r
+ (* Video modes *)\r
+ MX_TEXT = 0;\r
+ MX_320x175 = 1;\r
+ MX_320x200 = 2;\r
+ MX_320x240 = 3;\r
+ MX_320x350 = 4;\r
+ MX_320x400 = 5;\r
+ MX_320x480 = 6;\r
+ MX_360x175 = 7;\r
+ MX_360x200 = 8;\r
+ MX_360x240 = 9;\r
+ MX_360x350 = 10;\r
+ MX_360x400 = 11;\r
+ MX_360x480 = 12;\r
+ MX_400x600 = 13;\r
+\r
+ (* Fade effects *)\r
+ MX_FADEIN = 0;\r
+ MX_FADEOUT = 1;\r
+\r
+ (* Raster ops *)\r
+ OP_SET = 0;\r
+ OP_AND = 1;\r
+ OP_OR = 2;\r
+ OP_XOR = 3;\r
+ OP_TRANS = 4;\r
+ OP_ADD = 5;\r
+ OP_MOVE = 0; (* Alias for OP_SET *)\r
+\r
+procedure mxBitBlt( SX, SY: integer; Width, Height: word; DX, DY: integer );\r
+procedure mxCircle( CX, CY: integer; Radius: word; Color: byte );\r
+procedure mxChangeMode( Mode: word );\r
+procedure mxColorToGray( ColorPalette, GrayPalette: pointer; Count: word );\r
+procedure mxFadePalette( Palette: pointer; Cmd, Start, Count, R, G, B: word );\r
+procedure mxFillBox( X, Y: integer; Width, Height: word; Color: byte; Op: word );\r
+procedure mxGammaCorrect( ColorPalette, GammaPalette: pointer; Count: word );\r
+procedure mxGetAspect( var AspectX, AspectY: word );\r
+function mxGetClipRegion( var X1, Y1, Width, Height: word ): boolean;\r
+function mxGetClip: boolean;\r
+procedure mxGetImage( Image: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxGetPalette( Palette: pointer; Start, Count: word );\r
+function mxGetPixel( X, Y: word ): byte;\r
+procedure mxGetScreenSize( var Width, Height: word );\r
+procedure mxGetTextStep( var DeltaX, DeltaY: integer );\r
+function mxGetVersion: word;\r
+procedure mxGetVirtualScreen( var Width, Height: word );\r
+procedure mxInit;\r
+procedure mxLine( X1, Y1, X2, Y2: integer; Color, Op: word );\r
+procedure mxOutChar( X, Y: integer; C: char );\r
+procedure mxOutText( X, Y: integer; S: pointer );\r
+procedure mxPan( X, Y: word );\r
+procedure mxPutImage( Image: pointer; X, Y: integer; Width, Height, Op: word );\r
+procedure mxPutPixel( X, Y: word; C: byte );\r
+procedure mxPutTile( Tile: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxReadPlane( Plane: byte );\r
+procedure mxRotatePalette( Palette: pointer; Count: word; Step: integer );\r
+procedure mxRowAddress( RowAddress: byte );\r
+function mxSetClip( Clip: boolean ): boolean;\r
+procedure mxSetClipRegion( X1, Y1, Width, Height: word );\r
+procedure mxSetColor( Index, R, G, B: word );\r
+procedure mxSetFont( Font: pointer; Width, Height: word );\r
+procedure mxSetMode( Mode: word );\r
+procedure mxSetPalette( Palette: pointer; Start, Count: word );\r
+procedure mxSetTextColor( Color, Op: word );\r
+procedure mxSetTextStep( DeltaX, DeltaY: integer );\r
+procedure mxSetVirtualScreen( Width, Height: word );\r
+procedure mxStretchImage( Image: pointer; X, Y: integer; Width, Height, NewWidth, NewHeight, Op: word );\r
+procedure mxSplitScreen( Line: word );\r
+procedure mxStartAddress( StartAddress: word );\r
+procedure mxStartLine( Line: word );\r
+procedure mxTerm;\r
+procedure mxTransPutTile( Tile: pointer; X, Y: integer; Width, Height: word );\r
+procedure mxWaitDisplay;\r
+procedure mxWaitRetrace;\r
+procedure mxWriteMode( Mode: byte );\r
+procedure mxWritePlane( Plane: byte );\r
+\r
+procedure mxFillPoly( Count: word; var Map, Points; Color: word );\r
+procedure mxGouraudPoly( Count: word; var Map, Points, Colors; BaseColor: word );\r
+procedure mxTexturePoly( Count: word; var Map, Points, ImgPoints, Texture; Width: word );\r
+\r
+procedure mxOutStr( X, Y: integer; S: string );\r
+\r
+implementation\r
+\r
+procedure mxBitBlt; external;\r
+procedure mxChangeMode( Mode: word ); external;\r
+procedure mxCircle; external;\r
+procedure mxColorToGray; external;\r
+procedure mxFadePalette; external;\r
+procedure mxFillBox; external;\r
+procedure mxGammaCorrect; external;\r
+procedure mxGetAspect( var AspectX, AspectY: word ); external;\r
+function mxGetClipRegion; external;\r
+function mxGetClip: boolean; external;\r
+procedure mxGetImage; external;\r
+procedure mxGetPalette( Palette: pointer; Start, Count: word ); external;\r
+function mxGetPixel( X, Y: word ): byte; external;\r
+procedure mxGetScreenSize( var Width, Height: word ); external;\r
+procedure mxGetTextStep( var DeltaX, DeltaY: integer ); external;\r
+function mxGetVersion: word; external;\r
+procedure mxGetVirtualScreen( var Width, Height: word ); external;\r
+procedure mxInit; external;\r
+procedure mxLine( X1, Y1, X2, Y2: integer; Color, Op: word ); external;\r
+procedure mxOutChar( X, Y: integer; C: char ); external;\r
+procedure mxOutText( X, Y: integer; S: pointer ); external;\r
+procedure mxPan( X, Y: word ); external;\r
+procedure mxPutImage; external;\r
+procedure mxPutPixel( X, Y: word; C: byte ); external;\r
+procedure mxPutTile; external;\r
+procedure mxReadPlane( Plane: byte ); external;\r
+procedure mxRotatePalette; external;\r
+procedure mxRowAddress( RowAddress: byte ); external;\r
+function mxSetClip( Clip: boolean ): boolean; external;\r
+procedure mxSetClipRegion( X1, Y1, Width, Height: word ); external;\r
+procedure mxSetColor( Index, R, G, B: word ); external;\r
+procedure mxSetFont( Font: pointer; Width, Height: word ); external;\r
+procedure mxSetMode( Mode: word ); external;\r
+procedure mxSetPalette( Palette: pointer; Start, Count: word ); external;\r
+procedure mxSetTextColor( Color, Op: word ); external;\r
+procedure mxSetTextStep( DeltaX, DeltaY: integer ); external;\r
+procedure mxSetVirtualScreen( Width, Height: word ); external;\r
+procedure mxSplitScreen( Line: word ); external;\r
+procedure mxStartAddress( StartAddress: word ); external;\r
+procedure mxStartLine; external;\r
+procedure mxStretchImage; external;\r
+procedure mxTerm; external;\r
+procedure mxTransPutTile; external;\r
+procedure mxWaitDisplay; external;\r
+procedure mxWaitRetrace; external;\r
+procedure mxWriteMode( Mode: byte ); external;\r
+procedure mxWritePlane( Plane: byte ); external;\r
+\r
+procedure mxFillPoly; external;\r
+procedure mxGouraudPoly; external;\r
+procedure mxTexturePoly; external;\r
+{$L MXPB}\r
+{$L MXPF}\r
+{$L MXPG}\r
+{$L MXPT}\r
+\r
+{$L MXBB}\r
+{$L MXCC}\r
+{$L MXCG}\r
+{$L MXCL}\r
+{$L MXCR}\r
+{$L MXFB}\r
+{$L MXFP}\r
+{$L MXGI}\r
+{$L MXGM}\r
+{$L MXGP}\r
+{$L MXGV}\r
+{$L MXHL}\r
+{$L MXIT}\r
+{$L MXLN}\r
+{$L MXOT}\r
+{$L MXPI}\r
+{$L MXPN}\r
+{$L MXPP}\r
+{$L MXRA}\r
+{$L MXRP}\r
+{$L MXSA}\r
+{$L MXSC}\r
+{$L MXSI}\r
+{$L MXSL}\r
+{$L MXSM}\r
+{$L MXSP}\r
+{$L MXSS}\r
+{$L MXTL}\r
+{$L MXVS}\r
+{$L MXWD}\r
+{$L MXWM}\r
+{$L MXWP}\r
+{$L MXWR}\r
+\r
+(*\r
+ Prints a Turbo Pascal string.\r
+ Note: BP 7.0 supports ASCIIZ strings (PChar type).\r
+*)\r
+procedure mxOutStr;\r
+begin\r
+ S := S + #0;\r
+ mxOutText( X, Y, @S[1] );\r
+end;\r
+\r
+end.\r
--- /dev/null
+(*\r
+ DEMO01 - Sprites, page flipping and palette rotation\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ MAX_SPRITE = 100;\r
+type\r
+ (* Sprite structure *)\r
+ TSprite = record\r
+ X, Y : integer; (* Sprite coordinates *)\r
+ DX,DY: integer; (* Deltas for sprite movement *)\r
+ W, H : integer; (* Sprite width and height *)\r
+ Image: array[ 1..16, 1..16 ] of byte; (* Sprite image data *)\r
+ end;\r
+ (* RGB color structure *)\r
+ TRgb = record\r
+ R, G, B: byte;\r
+ end;\r
+var\r
+ S : array[ 1..MAX_SPRITE ] of TSprite; (* An array of sprites *)\r
+ Palette: array[ byte ] of TRgb; (* Palette *)\r
+ Page : word; (* Page offset *)\r
+ I : word;\r
+\r
+(* Initializes a sprite structure *)\r
+procedure sxInit( var S: TSprite );\r
+var\r
+ I: word;\r
+begin\r
+ S.X := Random( 320 ); (* Initialize position with random values *)\r
+ S.Y := Random( 240 );\r
+ S.DX := Random( 7 )-3; (* Initialize speed with random values *)\r
+ S.DY := Random( 7 )-3;\r
+ S.W := 16; (* Size is fixed in this program *)\r
+ S.H := 16;\r
+ (* The image is a square with a hole inside *)\r
+ FillChar( S.Image, SizeOf(S.Image), Random(15)+1 );\r
+ for I:=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 );\r
+end;\r
+\r
+(* Moves a sprite *)\r
+procedure sxMove( var S: TSprite );\r
+begin\r
+ Inc( S.X, S.DX ); (* Get new position *)\r
+ Inc( S.Y, S.DY );\r
+ (* Check sprite position, change delta if needed *)\r
+ if( S.X > 320 ) then begin\r
+ S.X := 320;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.X < -16 ) then begin\r
+ S.X := -16;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.Y > 240 ) then begin\r
+ S.Y := 240;\r
+ S.DY := -S.DY;\r
+ end;\r
+ if( S.Y < -16 ) then begin\r
+ S.Y := -16;\r
+ S.DY := -S.DY;\r
+ end;\r
+ (* Draw the sprite, note the Page offset added to the *)\r
+ (* Y coordinate of the image *)\r
+ mxPutImage( @S.Image, S.X, Page+S.Y, S.W, S.H, OP_TRANS );\r
+end;\r
+\r
+begin\r
+ (* Initialize library *)\r
+ mxInit;\r
+\r
+ (* Enter graphics mode *)\r
+ mxSetMode( MX_320x240 );\r
+\r
+ (* Print initialization message *)\r
+ mxSetTextColor( 15, OP_TRANS );\r
+ mxOutStr( 4, 4, 'Initializing...' );\r
+\r
+ (* Initialize sprites *)\r
+ for I:=1 to MAX_SPRITE do sxInit( S[I] );\r
+\r
+ (* Draw background *)\r
+ for I:=1 to 192 do begin\r
+ mxCircle( 160, 480+120, I, I+63 );\r
+ mxCircle( 161, 480+120, I, I+63 );\r
+ end;\r
+\r
+ (* Compute and set palette *)\r
+ for I:=1 to 192 do with Palette[I+63] do begin\r
+ R := 0;\r
+ G := 0;\r
+ B := 0;\r
+ if( I < 64 ) then\r
+ R := I shr 1+31\r
+ else if( I < 128 ) then\r
+ G := (I-64) shr 1+31\r
+ else\r
+ B := (I-128) shr 1+31;\r
+ end;\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+\r
+ (* Main loop *)\r
+ Page := 240;\r
+ while( not KeyPressed ) do begin\r
+ (* Set clip region to current page *)\r
+ mxSetClipRegion( 0, Page, 320, 240 );\r
+ mxSetClip( TRUE );\r
+ (* Restore background *)\r
+ mxBitBlt( 0, 480, 320, 240, 0, Page );\r
+ (* Draw sprites *)\r
+ for I:=1 to MAX_SPRITE do sxMove( S[I] );\r
+ (* Print message *)\r
+ mxOutStr( 4, Page+4, 'Some sprites moving...' );\r
+ (* Flip page *)\r
+ mxStartLine( Page );\r
+ Page := 240-Page;\r
+ (* Animate palette *)\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+ mxRotatePalette( @Palette[64], 192, 3 );\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO02 - Texture mapping and palette rotation\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Plasma, Threed;\r
+\r
+const\r
+ LSIZE = 85;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ TTexture = record\r
+ Desc : array[ 0..3 ] of T2DPoint;\r
+ Width : word;\r
+ Data : array[ 1..64*64 ] of byte;\r
+ end;\r
+ TQuad = record\r
+ VtxCnt : word;\r
+ Vtx : array[ 0..3 ] of word;\r
+ Texture: word;\r
+ end;\r
+var\r
+ Vtx : array[ 0..7 ] of TPoint;\r
+ XVtx : array[ 0..7 ] of TPoint;\r
+ VVtx : array[ 0..7 ] of T2DPoint;\r
+ Face : array[ 0..5 ] of TQuad;\r
+ Txts : array[ 0..5 ] of TTexture;\r
+ Nrm : array[ 0..5 ] of TPoint;\r
+ XNrm : array[ 0..5 ] of TPoint;\r
+ Page : word;\r
+ Palette: array[ byte ] of record R, G, B: byte; end;\r
+\r
+(* Make a 64x64 plasma to be used as texture *)\r
+procedure MakeTexture( Idx: word );\r
+var\r
+ I: word;\r
+begin\r
+ mxFillBox( 0, 0, 64, 64, 0, OP_SET );\r
+ MakePlasma( 0, 0, 64, 64, 96, Random(192)+1, Random(192)+1, Random(192)+1 );\r
+ mxGetImage( @Txts[Idx].Data, 0, 0, 64, 64 );\r
+ (* Texture vertexes are 8:8 fixed, add $80 (0.5) for best results *)\r
+ with Txts[Idx] do begin\r
+ Desc[0].X := $80; Desc[0].Y := $80;\r
+ Desc[1].X := $80; Desc[1].Y := $3F80;\r
+ Desc[2].X := $3F80; Desc[2].Y := $3F80;\r
+ Desc[3].X := $3F80; Desc[3].Y := $80;\r
+ Width := 64;\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ I: integer;\r
+begin\r
+ (* Build vertexes for a cube *)\r
+ with Vtx[0] do begin X:=-LSIZE; Y:=-LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[1] do begin X:=+LSIZE; Y:=-LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[2] do begin X:=-LSIZE; Y:=+LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[3] do begin X:=+LSIZE; Y:=+LSIZE; Z:=-LSIZE; end;\r
+ with Vtx[4] do begin X:=-LSIZE; Y:=-LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[5] do begin X:=+LSIZE; Y:=-LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[6] do begin X:=-LSIZE; Y:=+LSIZE; Z:=+LSIZE; end;\r
+ with Vtx[7] do begin X:=+LSIZE; Y:=+LSIZE; Z:=+LSIZE; end;\r
+ for I:=0 to 7 do begin (* Make points 16:16 fixed *)\r
+ Vtx[I].X := Vtx[I].X*$10000;\r
+ Vtx[I].Y := Vtx[I].Y*$10000;\r
+ Vtx[I].Z := Vtx[I].Z*$10000;\r
+ end;\r
+ (* Build faces *)\r
+ with Face[0] do begin Vtx[0]:=0; Vtx[1]:=2; Vtx[2]:=3; Vtx[3]:=1; end;\r
+ with Face[1] do begin Vtx[0]:=4; Vtx[1]:=5; Vtx[2]:=7; Vtx[3]:=6; end;\r
+ with Face[2] do begin Vtx[0]:=0; Vtx[1]:=1; Vtx[2]:=5; Vtx[3]:=4; end;\r
+ with Face[3] do begin Vtx[0]:=1; Vtx[1]:=3; Vtx[2]:=7; Vtx[3]:=5; end;\r
+ with Face[4] do begin Vtx[0]:=2; Vtx[1]:=0; Vtx[2]:=4; Vtx[3]:=6; end;\r
+ with Face[5] do begin Vtx[0]:=7; Vtx[1]:=3; Vtx[2]:=2; Vtx[3]:=6; end;\r
+ for I:=0 to 5 do Face[I].Texture := I;\r
+ (* Build textures and palette *)\r
+ Randomize;\r
+ FillChar( Palette, SizeOf(Palette), 0 );\r
+ MakePlasmaPalette( Palette, PAL_RGB );\r
+ mxSetPalette( @Palette, 0, 193 );\r
+ for I:=0 to 5 do MakeTexture( I );\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, 8 ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, 8, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 1 );\r
+ Inc( AZ, 2 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ mxRotatePalette( @Palette[1], 192, 3 ); (* Rotate palette *)\r
+ (* Draw cube: backface culling is straighforward in this case, so *)\r
+ (* it can be handled by the polygon filling procedure *)\r
+ for I:=0 to 5 do\r
+ mxTexturePoly( 4, Face[I].Vtx, VVtx, Txts[I].Desc, Txts[I].Data, Txts[I].Width );\r
+ mxStartLine( Page ); (* Flip pages *)\r
+ mxSetPalette( @Palette[1], 1, 192 ); (* Set new palette *)\r
+ Page := 240-Page;\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO03 - Simple star animation, morphs between a cube and a sphere\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+const\r
+ MAXVTX = 1000; (* Number of points *)\r
+ EDGE = 70; (* Length of cube edge *)\r
+ RADIUS = 90; (* Radius of sphere *)\r
+ WAITCOUNT = 192; (* Frames to wait for non-morphing shapes *)\r
+ MS = 32; (* Number of steps for morphing *)\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+ InitMorph1: array[ 0..3 ] of integer = ( 0, MS, 0, 0 );\r
+ InitMorph2: array[ 0..3 ] of integer = ( 0, 0, 0, MS );\r
+ InitDelta1: array[ 0..3 ] of integer = ( 0, -1, 0, +1 );\r
+ InitDelta2: array[ 0..3 ] of integer = ( 0, +1, 0, -1 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ T3DPointArray = array[ 0..MAXVTX-1 ] of TPoint;\r
+ P3DPointArray = ^T3DPointArray;\r
+var\r
+ CubeVtx, SphereVtx, Vtx, XVtx: P3DPointArray;\r
+ VVtx : array[ 0..MAXVTX-1 ] of T2DPoint;\r
+ Page : word;\r
+ Status, Count, Delta1, Delta2, Morph1, Morph2: integer;\r
+\r
+procedure Swap( var A, B: longint );\r
+var\r
+ L: longint;\r
+begin\r
+ L := A; A := B; B := L;\r
+end;\r
+\r
+function Toggle( A: longint ): longint;\r
+begin\r
+ Toggle := A;\r
+ if( Random(2) = 0 ) then Toggle := -A;\r
+end;\r
+\r
+procedure Init;\r
+label Retry;\r
+var\r
+ I: integer;\r
+begin\r
+ New( CubeVtx );\r
+ New( SphereVtx );\r
+ New( Vtx );\r
+ New( XVtx );\r
+ (* Build vertexes (yes, I know this piece of code is terrible) *)\r
+ Randomize;\r
+ for I:=0 to MAXVTX-1 do begin\r
+ with CubeVtx^[I] do begin\r
+ (* Build cube *)\r
+ X := (longint(Random(2*EDGE))-EDGE)*$10000;\r
+ Y := (longint(Random(2*EDGE))-EDGE)*$10000;\r
+ Z := Toggle( EDGE*$10000 );\r
+ case Random(3) of\r
+ 0: Swap( X, Z );\r
+ 1: Swap( Y, Z );\r
+ end;\r
+ end;\r
+ with SphereVtx^[I] do begin\r
+ (* Build sphere *)\r
+Retry:\r
+ X := (longint(Random(2*RADIUS))-RADIUS);\r
+ Y := (longint(Random(2*RADIUS))-RADIUS);\r
+ if( X*X+Y*Y > RADIUS*RADIUS ) then goto Retry;\r
+ Z := Toggle( Round( Sqrt( Abs( RADIUS*RADIUS-X*X-Y*Y ) ) ) );\r
+ case Random(3) of\r
+ 0: Swap( X, Z );\r
+ 1: Swap( Y, Z );\r
+ end;\r
+ X := X * $10000; Y := Y * $10000; Z := Z * $10000;\r
+ end;\r
+ end;\r
+ (* Initialize morphing *)\r
+ Move( CubeVtx^, Vtx^, SizeOf(Vtx^) );\r
+ Status := 0;\r
+ Count := WAITCOUNT;\r
+end;\r
+\r
+procedure Morph;\r
+var\r
+ I: integer;\r
+begin\r
+ (* Fully unoptimized, slowest loop I could think of! *)\r
+ for I:=0 to MAXVTX-1 do begin\r
+ Vtx^[I].X := ((CubeVtx^[I].X * Morph1)+(SphereVtx^[I].X * Morph2)) div MS;\r
+ Vtx^[I].Y := ((CubeVtx^[I].Y * Morph1)+(SphereVtx^[I].Y * Morph2)) div MS;\r
+ Vtx^[I].Z := ((CubeVtx^[I].Z * Morph1)+(SphereVtx^[I].Z * Morph2)) div MS;\r
+ end;\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+ C: char;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ C := #0;\r
+ repeat\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx^, XVtx^, MAXVTX ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx^, VVtx, MAXVTX, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 1 );\r
+ Inc( AZ, 2 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw points *)\r
+ for I:=0 to MAXVTX-1 do\r
+ mxPutPixel( VVtx[I].X, VVtx[I].Y, 128 + XVtx^[I].Z shr 18 );\r
+ mxStartLine( Page ); (* Flip pages *)\r
+ Page := 240-Page;\r
+ (* Morph *)\r
+ if( Odd(Status) ) then begin\r
+ Morph;\r
+ Inc( Morph1, Delta1 );\r
+ Inc( Morph2, Delta2 );\r
+ if( Morph1 < 0 )or( Morph2 < 0 ) then Inc( Status );\r
+ if( Status = 4 ) then Status := 0;\r
+ end\r
+ else begin\r
+ Dec( Count );\r
+ if( Count < 0 ) then begin\r
+ Inc( Status );\r
+ Count := WAITCOUNT;\r
+ Morph1 := InitMorph1[Status];\r
+ Morph2 := InitMorph2[Status];\r
+ Delta1 := InitDelta1[Status];\r
+ Delta2 := InitDelta2[Status];\r
+ end;\r
+ end;\r
+ until( KeyPressed );\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO04 - Multiple textures and triple buffering (3 pages)\r
+ (c) 1994 by Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+const\r
+ MAXVTX = 256;\r
+ MAXCUB = 2;\r
+ MAXTXT = 2;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 );\r
+ TxtSunDial: array[ 0..7 ] of word = (\r
+ $7F80,$0080, $0080,$0080, $0080,$7E80, $7F80,$7E80 );\r
+ TxtSapphire : array[ 0..7 ] of word = (\r
+ $0080,$0080, $0080,$1F80, $1F80,$1F80, $1F80,$0080 );\r
+ TxtMarble: array[ 0..7 ] of word = (\r
+ $0080,$8080, $0080,$FD80, $7F80,$FD80, $7F80,$8080 );\r
+type\r
+ T2DPoint = record\r
+ X, Y: integer;\r
+ end;\r
+ TTexture = record\r
+ Desc : array[ 0..3 ] of record X, Y: word end;\r
+ Width : word;\r
+ Data : pointer;\r
+ end;\r
+ TQuad = record\r
+ Vtx : array[ 0..3 ] of word;\r
+ Texture: word;\r
+ end;\r
+ TCube = record\r
+ Face : array[ 0..5 ] of TQuad;\r
+ Base : integer;\r
+ end;\r
+var\r
+ Vtx, XVtx: array[ 0..MAXVTX ] of TPoint;\r
+ VVtx : array[ 0..MAXVTX ] of T2DPoint;\r
+ Cube : array[ 0..MAXCUB ] of TCube;\r
+ ZList : array[ 0..MAXCUB ] of integer;\r
+ VtxCnt : word;\r
+ Txts : array[ 0..MAXTXT ] of TTexture;\r
+ Page : word;\r
+ Palette : array[ byte ] of record R, G, B: byte; end;\r
+ TxtDat1, TxtDat2: pointer;\r
+\r
+(* Add a new entry to the vertex array *)\r
+procedure AddVtx( PX, PY, PZ: longint );\r
+begin\r
+ with Vtx[VtxCnt] do begin X:=PX*$10000; Y:=PY*$10000; Z:=PZ*$10000; end;\r
+ Inc( VtxCnt );\r
+end;\r
+\r
+procedure MakeCube( var C: TCube; X1,Y1,Z1, X2,Y2,Z2, TX,TY,TZ, Texture: integer );\r
+const\r
+ FaceIdx: array[ 0..23 ] of integer = (\r
+ 0,1,2,3, 0,4,5,1, 1,5,6,2, 2,6,7,3, 3,7,4,0, 6,5,4,7 );\r
+var\r
+ I, VC: integer;\r
+begin\r
+ VC := VtxCnt;\r
+ C.Base := VC;\r
+ AddVtx( X1+TX, Y1+TY, Z1+TZ );\r
+ AddVtx( X2+TX, Y1+TY, Z1+TZ );\r
+ AddVtx( X2+TX, Y2+TY, Z1+TZ );\r
+ AddVtx( X1+TX, Y2+TY, Z1+TZ );\r
+ AddVtx( X1+TX, Y1+TY, Z2+TZ );\r
+ AddVtx( X2+TX, Y1+TY, Z2+TZ );\r
+ AddVtx( X2+TX, Y2+TY, Z2+TZ );\r
+ AddVtx( X1+TX, Y2+TY, Z2+TZ );\r
+ for I:=0 to 23 do C.Face[I shr 2].Vtx[I and 3] := VC+FaceIdx[I];\r
+ for I:=0 to 5 do C.Face[I].Texture := Texture;\r
+end;\r
+\r
+procedure MakeTexture( Idx: integer; var VtxData );\r
+var\r
+ P: ^word;\r
+ I: integer;\r
+begin\r
+ P := @VtxData;\r
+ with Txts[Idx] do begin\r
+ for I:=0 to 3 do begin\r
+ Desc[I].X := P^; Inc( P );\r
+ Desc[I].Y := P^; Inc( P );\r
+ end;\r
+ Width := 129;\r
+ Data := TxtDat1;\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ I: integer;\r
+ V: integer;\r
+ F: file;\r
+ P: array[ 1..768 ] of byte;\r
+begin\r
+ (* Initialize objects *)\r
+ VtxCnt := 0;\r
+ MakeCube( Cube[0], -64,-64,8, 64,64,-8, 0,0,0, 1 ); (* Sundial *)\r
+ Cube[0].Face[0].Texture := 0;\r
+ V := VtxCnt;\r
+ MakeCube( Cube[1], -16,-16,16, 16,16,-16, 0,0,0, 2 ); (* Sapphire *)\r
+ tdSetTranslation( Trans );\r
+ tdSetRotation( 32, 32, 00 );\r
+ tdRotate( Vtx[V], XVtx[V], 8 ); (* Got to rotate this cube *)\r
+ for I:=V to V+7 do begin\r
+ Vtx[I].X := XVtx[I].X;\r
+ Vtx[I].Y := XVtx[I].Y;\r
+ Vtx[I].Z := XVtx[I].Z + 100*$10000;\r
+ end;\r
+ MakeCube( Cube[2], -64,-4,48, 64,4,-48, 0,68,56, 1 ); (* Marble *)\r
+ (* Load texture and palette *)\r
+ Assign( F, 'DEMO04.DAT' );\r
+ Reset( F, 1 );\r
+ BlockRead( F, P, SizeOf(P) );\r
+ mxSetPalette( @P, 0, 256 );\r
+ GetMem( TxtDat1, 63*1024 );\r
+ BlockRead( F, TxtDat1^, 129*286 );\r
+ Close( F );\r
+ TxtDat2 := Ptr( Seg(TxtDat1^), Ofs(TxtDat1^)+129*254 );\r
+ (* Init textures *)\r
+ MakeTexture( 0, TxtSundial );\r
+ MakeTexture( 1, TxtMarble );\r
+ MakeTexture( 2, TxtSapphire );\r
+ Txts[2].Data := TxtDat2;\r
+end;\r
+\r
+(* Sort procedure, not worth optimizing with only a few objects *)\r
+procedure SortObjects;\r
+var\r
+ I, J, K: integer;\r
+ ZMax: array[ 0..MAXCUB ] of longint;\r
+ ZI: integer;\r
+ L: longint;\r
+begin\r
+ for I:=0 to MAXCUB do begin\r
+ L := XVtx[Cube[I].Base].Z;\r
+ for J:=1 to 7 do\r
+ if( L > XVtx[Cube[I].Base+J].Z ) then L := XVtx[Cube[I].Base+J].Z;\r
+ ZMax[I] := L;\r
+ ZList[I] := I;\r
+ end;\r
+ for I:=0 to MAXCUB-1 do begin\r
+ ZI := I;\r
+ for J:=I+1 to MAXCUB do\r
+ if( ZMax[ZList[J]] > ZMax[ZList[ZI]] ) then ZI := J;\r
+ if( ZI <> I ) then begin\r
+ K := ZList[I];\r
+ ZList[I] := ZList[ZI];\r
+ ZList[ZI] := K;\r
+ end;\r
+ end;\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I, J, K: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ AX := 0; AY := 0; AZ := 0;\r
+ tdSetTranslation( Trans );\r
+ tdSetPerspective( 600*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, VtxCnt ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, VtxCnt, 160, 120+Page );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 2 );\r
+ Inc( AZ, 1 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw objects *)\r
+ SortObjects;\r
+ for I:=0 to MAXCUB do with Cube[ZList[I]] do begin\r
+ for J:=0 to 5 do begin\r
+ K := Face[J].Texture;\r
+ mxTexturePoly( 4, Face[J].Vtx, VVtx, Txts[K].Desc, Txts[K].Data^, Txts[K].Width );\r
+ end;\r
+ end;\r
+ (* Flip page: at 320x240 the Start Address Register Low is always zero *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 480; end;\r
+ 480: begin PortW[$3D4] := $960C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* If the frame rate seems low, try to remove this line *)\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO05 - A Gouraud-shaded rotating torus\r
+ (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex, Threed;\r
+\r
+(* Define ALTPAL for alternate palette *)\r
+{$define ALTPAL}\r
+\r
+const\r
+ MAXVTX1 = 15; RADIUS1 = 70; (* MAXVTX1+1 must be multiple of 4 *)\r
+ MAXVTX2 = 15; RADIUS2 = 30;\r
+ MAXVTX = (MAXVTX1+1)*(MAXVTX2+1)-1;\r
+ MAXFACE = MAXVTX;\r
+ Trans : TPoint = ( X:0; Y:0; Z:0 ); (* Object translation *)\r
+ Light : TPoint = ( X:0; Y:0; Z:-63*$10000 ); (* Light direction *)\r
+type\r
+ TQuad = record\r
+ QVtx : array[ 0..3 ] of integer;\r
+ end;\r
+var\r
+ Vtx, XVtx : array[ 0..MAXVTX ] of TPoint; (* Points *)\r
+ VVtx : array[ 0..MAXVTX ] of record X, Y: integer end;\r
+ Face : array[ 0..MAXFACE ] of TQuad; (* Polys *)\r
+ Culled : array[ 0..MAXFACE ] of integer;\r
+ GNrm,XGNrm: array[ 0..MAXVTX ] of TVector; (* Gouraud normals *)\r
+ VtxLight : array[ 0..MAXVTX ] of integer; (* Points brightness *)\r
+ Page : word;\r
+\r
+function GetVtx( I1, I2: integer ): integer;\r
+begin\r
+ GetVtx := (I1 mod (MAXVTX1+1))*(MAXVTX2+1) + I2 mod (MAXVTX2+1);\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ R, N, X, Y, Z: real;\r
+ I, J, K, V: integer;\r
+begin\r
+ (* Build vertexes *)\r
+ for I:=0 to MAXVTX1 do begin\r
+ K := (I + (MAXVTX1+1) shr 2) mod (MAXVTX1+1);\r
+ R := RADIUS1 + RADIUS2*Cos( 2*K*Pi / (MAXVTX1+1) );\r
+ for J:=0 to MAXVTX2 do begin\r
+ V := I*(MAXVTX2+1)+J; (* Index of current vertex *)\r
+ (* Compute coordinates of current vertex *)\r
+ X := R*Cos(2*J*Pi / (MAXVTX2+1)); (* Get coordinates *)\r
+ Y := R*Sin(2*J*Pi / (MAXVTX2+1));\r
+ Z := RADIUS2*Sin(2*K*Pi / (MAXVTX1+1));\r
+ Vtx[V].X := Round( X )*$10000; (* Save coordinates *)\r
+ Vtx[V].Y := Round( Y )*$10000;\r
+ Vtx[V].Z := Round( Z )*$10000;\r
+ (* Compute direction of Gouraud normal thru current vertex *)\r
+ X := X - RADIUS1*Cos(2*J*Pi / (MAXVTX2+1));\r
+ Y := Y - RADIUS1*Sin(2*J*Pi / (MAXVTX2+1));\r
+ N := Sqrt( X*X + Y*Y + Z*Z ); (* Get vector length *)\r
+ GNrm[V].X := Trunc( X*$10000/N ); (* Save normal vector *)\r
+ GNrm[V].Y := Trunc( Y*$10000/N );\r
+ GNrm[V].Z := Trunc( Z*$10000/N );\r
+ end;\r
+ end;\r
+ (* Generate faces so that depth-sorting is not needed: there are still *)\r
+ (* some *very* little errors, but this is the best I could devise *)\r
+ J := 0;\r
+ K := 0;\r
+ for I:=0 to MAXFACE do with Face[I] do begin\r
+ QVtx[0] := GetVtx( J, K );\r
+ QVtx[1] := GetVtx( J, K+1 );\r
+ QVtx[2] := GetVtx( J+1, K+1 );\r
+ QVtx[3] := GetVtx( J+1, K );\r
+ Inc( K );\r
+ if( K > MAXVTX2 ) then begin\r
+ K := 0;\r
+ Inc( J );\r
+ end;\r
+ end;\r
+{$ifndef ALTPAL}\r
+ for I:=0 to 63 do mxSetColor( I+64, 0, 0, I ); (* Blue palette *)\r
+{$else}\r
+ for I:=0 to 31 do mxSetColor(I+64, 0, I shl 1, 0); (* Green neon palette *)\r
+ for I:=32 to 63 do mxSetColor ( I+64, (I-32) shl 1, 63, (I-32) shl 1 );\r
+{$endif}\r
+end;\r
+\r
+var\r
+ AX, AY, AZ: byte;\r
+ I: word;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240; (* Start with hidden page *)\r
+\r
+ AX := 0;\r
+ AY := 0;\r
+ AZ := 0;\r
+ (* Init 3D transforms, perspective is intentionally exaggerated *)\r
+ tdSetTranslation( Trans );\r
+ tdSetLight( Light );\r
+ tdSetPerspective( 400*$10000, $10000, $10000 );\r
+ (* Main loop, all magic here! *)\r
+ while( not KeyPressed ) do begin\r
+ tdSetRotation( AX, AY, AZ ); (* Set new angles *)\r
+ tdTransform( Vtx, XVtx, MAXVTX+1 ); (* 3D transform points *)\r
+ tdTransformToImage( XVtx, VVtx, MAXVTX+1, 160, 120+Page );\r
+ tdRotate( GNrm, XGNrm, MAXVTX+1 ); (* Rotate Gouraud normals *)\r
+ tdTransformLight( XGNrm, VtxLight, MAXVTX+1 );\r
+ (* Backplane culling is not really needed here! *)\r
+ FillChar( Culled, SizeOf(Culled), 0 );\r
+ tdBackPlaneCull( Face, XVtx, Culled, MAXFACE+1, SizeOf(TQuad) );\r
+ Inc( AX, 1 ); (* Bump angles *)\r
+ Inc( AY, 2 );\r
+ Inc( AZ, 3 );\r
+ mxSetClipRegion( 0, Page, 320, 240 ); (* Set clip to new page *)\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, 320, 240, 0, OP_MOVE ); (* Clear screen *)\r
+ (* Draw polygons *)\r
+ for I:=0 to MAXFACE do with Face[I] do\r
+ if( Culled[I] >= 0 ) then mxGouraudPoly( 4, QVtx, VVtx, VtxLight, 64 );\r
+ (* Flip page: at 320x240 the Start Address Register Low is always zero *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 480; end;\r
+ 480: begin PortW[$3D4] := $960C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* Uncomment this instruction if screen flickers *)\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO06 - Magnifying glass\r
+ (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ R = 40; (* Lens radius *)\r
+ K : real = 1.8; (* Magnifying factor, less makes a stronger lens *)\r
+type\r
+ TLine = array[ 0..319 ] of byte;\r
+ PLine = ^TLine;\r
+ TScreen = array[ 0..239 ] of PLine;\r
+var\r
+ VScreen: TScreen; (* Virtual screen *)\r
+ BallX : array[ 0..R, 0..R ] of integer;\r
+ BallY : array[ 0..R, 0..R ] of integer;\r
+ Sprite : array[ -R..R, -R..R ] of byte;\r
+ Page : word;\r
+\r
+(* Returns "lens-view" coordinates of X,Y *)\r
+procedure GetCoords( var X, Y: integer );\r
+var\r
+ LR, Z, SinA, SinB, TgB, Q: real;\r
+begin\r
+ LR := Sqrt( X*X + Y*Y );\r
+ if( LR = 0 ) then Exit;\r
+ if( LR < R ) then begin\r
+ Z := Sqrt( R*R - LR*LR );\r
+ SinA := LR / R;\r
+ SinB := SinA / K;\r
+ TgB := SinB / Sqrt( 1-SinB*SinB );\r
+ Q := LR - TgB*Z;\r
+ X := Round( X * ( Q/LR ) );\r
+ Y := Round( Y * ( Q/LR ) );\r
+ end;\r
+end;\r
+\r
+procedure Init;\r
+var\r
+ F : file;\r
+ Palette: array[ 0..767 ] of record R, G, B: byte; end;\r
+ X, Y,\r
+ X2, Y2 : integer;\r
+begin\r
+ (* Load background image *)\r
+ Assign( F, 'demo06.dat' );\r
+ Reset( F, 1 );\r
+ BlockRead( F, Palette, 768 );\r
+ mxSetPalette( @Palette, 0, 256 );\r
+ for Y:=0 to 239 do begin\r
+ New( VScreen[Y] );\r
+ BlockRead( F, VScreen[Y]^, 320 );\r
+ mxPutImage( VScreen[Y], 0, 480+Y, 320, 1, OP_MOVE );\r
+ end;\r
+ Close( F );\r
+ (* Build lens *)\r
+ for X:=0 to R do begin\r
+ for Y:=0 to R do begin\r
+ X2 := X;\r
+ Y2 := Y;\r
+ GetCoords( X2, Y2 );\r
+ BallX[X, Y] := X2;\r
+ BallY[X, Y] := Y2;\r
+ end;\r
+ end;\r
+end;\r
+\r
+procedure PutLens( OX, OY: integer );\r
+var\r
+ X, Y: integer;\r
+begin\r
+ for X:=0 to R do begin\r
+ for Y:=0 to R do begin\r
+ Sprite[Y][X] := VScreen[ OY+BallY[X,Y] ]^[ OX+BallX[X,Y] ];\r
+ Sprite[Y][-X] := VScreen[ OY+BallY[X,Y] ]^[ OX-BallX[X,Y] ];\r
+ Sprite[-Y][X] := VScreen[ OY-BallY[X,Y] ]^[ OX+BallX[X,Y] ];\r
+ Sprite[-Y][-X] := VScreen[ OY-BallY[X,Y] ]^[ OX-BallX[X,Y] ];\r
+ end;\r
+ end;\r
+ (* Draw the sprite *)\r
+ mxPutImage( @Sprite, OX-R, OY-R+Page, 2*R+1, 2*R+1, OP_MOVE );\r
+end;\r
+\r
+function Delta: integer;\r
+begin\r
+ Delta := Random(3)+2;\r
+end;\r
+\r
+procedure Check( Cond: boolean; var Coord, DeltaC: integer; NewCoord, Sign: integer );\r
+begin\r
+ if( Cond ) then begin\r
+ Coord := NewCoord;\r
+ DeltaC := Sign*Delta;\r
+ end;\r
+end;\r
+\r
+var\r
+ X, Y, DX, DY: integer;\r
+ C: char;\r
+begin\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ Init;\r
+ Page := 240;\r
+ X := R;\r
+ Y := R;\r
+ Randomize;\r
+ DX := Delta;\r
+ DY := Delta;\r
+\r
+ (* Main loop *)\r
+ repeat\r
+ (* Update video *)\r
+ mxBitBlt( 0, 480, 320, 240, 0, Page );\r
+ PutLens( X, Y );\r
+ mxCircle( X, Page+Y, R, 0 );\r
+ (* Update lens coordinates *)\r
+ Inc( X, DX );\r
+ Check( X+R >= 319, X, DX, 319-R, -1 );\r
+ Check( X <= R, X, DX, R, +1 );\r
+ Inc( Y, DY );\r
+ Check( Y+R >= 239, Y, DY, 239-R, -1 );\r
+ Check( Y <= R, Y, DY, R, +1 );\r
+ (* Flip pages: double buffering, avoid wait for display *)\r
+ case Page of\r
+ 0 : begin PortW[$3D4] := $000C; Page := 240; end;\r
+ 240: begin PortW[$3D4] := $4B0C; Page := 0; end;\r
+ end;\r
+ mxWaitRetrace; (* Wait for hidden page to show *)\r
+ until( KeyPressed );\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+(*\r
+ DEMO07 - Hardware scrolling\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*)\r
+uses Crt, Modex;\r
+\r
+const\r
+ (* Change this if scrolling seems jerky (this simple program does *)\r
+ (* not handle vertical retrace/display very well) *)\r
+ STEPS = 5;\r
+\r
+procedure Check( Cond: boolean; var Coord, DeltaC: integer; NewCoord, Sign: integer );\r
+begin\r
+ if( Cond ) then begin\r
+ Coord := NewCoord;\r
+ DeltaC := Sign*(Random(3)+2);\r
+ end;\r
+end;\r
+\r
+var\r
+ I, X, Y, DX, DY: integer;\r
+begin\r
+ (* Initialize library and graphics mode *)\r
+ mxInit;\r
+ mxSetMode( MX_320x200 );\r
+ (* Set a 640x400 virtual screen *)\r
+ mxSetVirtualScreen( 640, 400 );\r
+ mxSetClip( TRUE );\r
+\r
+ X := 0;\r
+ Y := 0;\r
+ DX := 1;\r
+ DY := 1;\r
+\r
+ (* Main loop: draw lines, circles, points and rectangles in separate *)\r
+ (* 320x200 windows, while smoothly panning virtual screen *)\r
+ while( not KeyPressed ) do begin\r
+ (* Points *)\r
+ mxSetClipRegion( 0, 0, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxPutPixel( Random(320), Random(200), Random(16) );\r
+ (* Lines *)\r
+ mxSetClipRegion( 0, 200, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxLine( Random(320), Random(200)+200, Random(320), Random(200)+200, Random(16), OP_SET );\r
+ (* Circles *)\r
+ mxSetClipRegion( 320, 0, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxCircle( Random(320)+320, Random(200), Random(100), Random(16) );\r
+ (* Boxes *)\r
+ mxSetClipRegion( 320, 200, 320, 200 );\r
+ for I:=1 to STEPS do\r
+ mxFillBox( Random(320)+320, Random(200)+200, Random(100)+1, Random(100)+1, Random(16), OP_SET );\r
+ (* Pan *)\r
+ Inc( X, DX );\r
+ Check( X+320 >= 639, X, DX, 319, -1 );\r
+ Check( X < 0, X, DX, 0, +1 );\r
+ Inc( Y, DY );\r
+ Check( Y+200 >= 399, Y, DY, 199, -1 );\r
+ Check( Y < 0, Y, DY, 0, +1 );\r
+ mxPan( X, Y );\r
+ mxWaitRetrace;\r
+ end;\r
+\r
+ (* Shutdown *)\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+;\r
+; MATH.INC - Include file for THREED.ASM\r
+;\r
+\r
+; 3-dimensional point, coordinates in fixed format (16:16)\r
+;\r
+TPOINT STRUC\r
+ X DD ?\r
+ Y DD ?\r
+ Z DD ?\r
+TPOINT ENDS\r
+\r
+; 2-dimensional point, coordinates in integer format\r
+;\r
+TIMAGEPOINT STRUC\r
+ IX DW ?\r
+ IY DW ?\r
+TIMAGEPOINT ENDS\r
+\r
+; Fixed-point divide: EAX = EAX / arg\r
+;\r
+.xdiv MACRO arg\r
+ xor edx, edx\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv arg\r
+ENDM\r
+\r
+; Fixed-point multiply: EAX = EAX * arg\r
+;\r
+.xmul MACRO arg\r
+ imul arg\r
+ shrd eax, edx, 16\r
+ENDM\r
--- /dev/null
+unit Plasma;\r
+interface\r
+\r
+const\r
+ PAL_RGB = 0;\r
+ PAL_CLOUDS = 1;\r
+ PAL_LANDSCAPE = 2;\r
+\r
+procedure MakePlasma( X, Y: integer; W, H: word; C1, C2, C3, C4: byte );\r
+procedure MakePlasmaPalette( var Palette; What: word );\r
+\r
+implementation uses Modex;\r
+\r
+procedure NewColor( XA, YA, X, Y, XB, YB: integer );\r
+var\r
+ Color: longint;\r
+begin\r
+ Color := Abs( XA-XB )+Abs( YA-YB );\r
+ Color := Random( Color shl 1 )-Color;\r
+ Color := (Color+mxGetPixel( XA, YA )+mxGetPixel( XB, YB )+1) shr 1;\r
+ if( Color < 1 ) then Color := 1;\r
+ if( Color > 192 ) then Color := 192;\r
+ if( mxGetPixel( X, Y ) = 0 ) then\r
+ mxPutPixel( X, Y, Lo(Color) );\r
+end;\r
+\r
+procedure Divide( X1, Y1, X2, Y2: integer );\r
+var\r
+ X, Y, Color: integer;\r
+begin\r
+ if not( (X2-X1<2)and(Y2-Y1<2) ) then begin\r
+ X := (X1+X2) shr 1;\r
+ Y := (Y1+Y2) shr 1;\r
+ NewColor( X1, Y1, X, Y1, X2, Y1 );\r
+ NewColor( X2, Y1, X2, Y, X2, Y2 );\r
+ NewColor( X1, Y2, X, Y2, X2, Y2 );\r
+ NewColor( X1, Y1, X1, Y, X1, Y2 );\r
+ Color := (mxGetPixel( X1, Y1 )+mxGetPixel( X2, Y1 )+\r
+ mxGetPixel( X2, Y2 )+mxGetPixel( X1, Y2 )) shr 2;\r
+ mxPutPixel( X, Y, Color );\r
+ Divide( X1, Y1, X, Y );\r
+ Divide( X, Y1, X2, Y );\r
+ Divide( X, Y, X2, Y2 );\r
+ Divide( X1, Y, X, Y2 );\r
+ end;\r
+end;\r
+\r
+procedure MakePlasma;\r
+begin\r
+ Dec( W );\r
+ Dec( H );\r
+ mxPutPixel( X, Y, C1 );\r
+ mxPutPixel( X, Y+H, C2 );\r
+ mxPutPixel( X+W, Y+H, C3 );\r
+ mxPutPixel( X+W, Y, C4 );\r
+ Divide( X, Y, X+W, Y+H );\r
+end;\r
+\r
+procedure MakePlasmaPalette;\r
+type\r
+ TPal = array[ byte ] of record R, G, B: byte end;\r
+var\r
+ I: word;\r
+begin\r
+ FillChar( TPal(Palette)[1], 192*3, 0 );\r
+ case What of\r
+ PAL_CLOUDS:\r
+ for I:=1 to 192 do begin\r
+ TPal(Palette)[I].R := Abs( I-96 )*63 div 96;\r
+ TPal(Palette)[I].G := Abs( I-96 )*63 div 96;\r
+ TPal(Palette)[I].B := 63;\r
+ end;\r
+ PAL_LANDSCAPE:\r
+ begin\r
+ for I:=0 to 31 do begin\r
+ TPal(Palette)[I+1].R := I;\r
+ TPal(Palette)[I+1].G := I;\r
+ TPal(Palette)[I+1].B := I + I shr 1+15;\r
+ end;\r
+ for I:=32 to 63 do begin\r
+ TPal(Palette)[I+1].R := 0;\r
+ TPal(Palette)[I+1].G := I;\r
+ TPal(Palette)[I+1].B := 0;\r
+ end;\r
+ for I:=64 to 191 do begin\r
+ TPal(Palette)[I+1].R := (I-64) div 3 + 15;\r
+ TPal(Palette)[I+1].G := (I-64) div 3 + 15;\r
+ TPal(Palette)[I+1].B := (I-64) div 3 + 15;\r
+ end;\r
+ end;\r
+ else\r
+ for I:=1 to 64 do begin\r
+ TPal(Palette)[I].G := I-1;\r
+ TPal(Palette)[I].B := 64-I;\r
+ TPal(Palette)[I+64].R := I-1;\r
+ TPal(Palette)[I+64].G := 64-I;\r
+ TPal(Palette)[I+128].B := I-1;\r
+ TPal(Palette)[I+128].R := 64-I;\r
+ end;\r
+ end;\r
+end;\r
+\r
+end.
\ No newline at end of file
--- /dev/null
+{$E-,N+}\r
+uses Crt, Modex;\r
+\r
+const\r
+ DEFVERT = 12; (* Vertex count *)\r
+ DEFREPL = 3; (* Repetition count *)\r
+ DEFQIXS = 2; (* Qixs *)\r
+ FADESPEED = 48;\r
+type\r
+ TPoint = record\r
+ X, Y : integer;\r
+ end;\r
+ TRGB = record\r
+ R, G, B: byte;\r
+ end;\r
+ TQix = record\r
+ Color: integer;\r
+ Vert : array[ 0..DEFVERT-1, 0..DEFREPL-1 ] of TPoint;\r
+ Delta: array[ 0..DEFVERT-1 ] of TPoint;\r
+ end;\r
+var\r
+ Page : integer;\r
+ MaxX,\r
+ MaxY : word;\r
+ Qix : array[ 0..DEFQIXS-1 ] of TQix;\r
+ Pal : array[ byte ] of TRGB;\r
+\r
+type\r
+ TReal = double;\r
+ TRPoint = record\r
+ X, Y: TReal;\r
+ end;\r
+ TMatrix = array[ 0..3, 0..3 ] of TReal;\r
+var\r
+ M: TMatrix;\r
+ G: array[ 0..DEFVERT-1 ] of TRPoint;\r
+ C: array[ 0..DEFVERT-1 ] of TRPoint;\r
+\r
+procedure BumpPal( Idx, DR, DG, DB, Steps: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=1 to Steps do begin\r
+ Pal[Idx+1].R := Pal[Idx].R + DR;\r
+ Pal[Idx+1].G := Pal[Idx].G + DG;\r
+ Pal[Idx+1].B := Pal[Idx].B + DB;\r
+ Inc( Idx );\r
+ end;\r
+end;\r
+\r
+procedure InitPalette;\r
+begin\r
+ with Pal[0] do begin R:=0; G:=0; B:=0; end;\r
+ with Pal[1] do begin R:=0; G:=0; B:=62; end;\r
+ BumpPal( 1, 0, 2, -2, 31 );\r
+ BumpPal( 32, 2, -2, 0, 31 );\r
+ BumpPal( 63, -2, 2, 2, 31 );\r
+ BumpPal( 94, 2, 0, -2, 31 );\r
+ BumpPal( 125, -2, -2, 2, 31 );\r
+end;\r
+\r
+procedure Init( var Qix: TQix; Color: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ FillChar( Qix.Vert, SizeOf(Qix.Vert), 0 );\r
+ for I:=0 to DEFVERT-1 do begin\r
+ Qix.Vert[I, DEFREPL-1].X := Random( MaxX );\r
+ Qix.Vert[I, DEFREPL-1].Y := Random( MaxY );\r
+ Qix.Delta[I].X := Random(5)+1;\r
+ Qix.Delta[I].Y := Random(5)+1;\r
+ end;\r
+ Qix.Color := Color;\r
+\r
+ (* Initialize matrix (Catmull-Rom) *)\r
+ M[0,0] := -1/2; M[0,1] := 3/2; M[0,2] := -3/2; M[0,3] := 1/2;\r
+ M[1,0] := 1; M[1,1] := -5/2; M[1,2] := 2; M[1,3] := -1/2;\r
+ M[2,0] := -1/2; M[2,1] := 0; M[2,2] := 1/2; M[2,3] := 0;\r
+ M[3,0] := 0; M[3,1] := 1; M[3,2] := 0; M[3,3] := 0;\r
+end;\r
+\r
+procedure mxBezier( var Qix: TQix; I0, Idx, N: integer );\r
+var\r
+ I, J: integer;\r
+ T, T2, T3: TReal;\r
+ X0, Y0, X, Y: TReal;\r
+ Delta: TReal;\r
+begin\r
+ (* Compute coefficients *)\r
+ for I:=0 to 3 do begin\r
+ C[I].X := 0;\r
+ for J:=0 to 3 do C[I].X := C[I].X + M[I,J]*Qix.Vert[(I0+J) mod DEFVERT,Idx].X;\r
+ C[I].Y := 0;\r
+ for J:=0 to 3 do C[I].Y := C[I].Y + M[I,J]*Qix.Vert[(I0+J) mod DEFVERT,Idx].Y;\r
+ end;\r
+ X0 := C[3].X;\r
+ Y0 := C[3].Y;\r
+ Delta := 1 / N;\r
+ T := 0;\r
+ for I:=1 to N do begin\r
+ T := T + Delta;\r
+ T2 := T*T;\r
+ T3 := T*T2;\r
+ X := C[0].X*T3 + C[1].X*T2 + C[2].X*T + C[3].X;\r
+ Y := C[0].Y*T3 + C[1].Y*T2 + C[2].Y*T + C[3].Y;\r
+ mxLine( Round(X0), Page+Round(Y0), Round(X), Page+Round(Y), Qix.Color, OP_SET );\r
+ X0 := X;\r
+ Y0 := Y;\r
+ end;\r
+end;\r
+\r
+procedure Plot( var Qix: TQix; Idx: integer );\r
+var\r
+ I, J: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do begin\r
+ mxBezier( Qix, I, Idx, 12 );\r
+ end;\r
+end;\r
+\r
+procedure Update( var Qix: TQix; Idx: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do with Qix do begin\r
+ Inc( Vert[I,Idx].X, Delta[I].X );\r
+ if( Vert[I,Idx].X < 0 ) then begin\r
+ Vert[I,Idx].X := 0;\r
+ Delta[I].X := Random( 5 )+1;\r
+ end;\r
+ if( Vert[I,Idx].X > MaxX ) then begin\r
+ Vert[I,Idx].X := MaxX;\r
+ Delta[I].X := -Random( 5 )-1;\r
+ end;\r
+ Inc( Vert[I,Idx].Y, Delta[I].Y );\r
+ if( Vert[I,Idx].Y < 0 ) then begin\r
+ Vert[I,Idx].Y := 0;\r
+ Delta[I].Y := Random( 5 )+1;\r
+ end;\r
+ if( Vert[I,Idx].Y > MaxY ) then begin\r
+ Vert[I,Idx].Y := MaxY;\r
+ Delta[I].Y := -Random( 5 )-1;\r
+ end;\r
+ end;\r
+end;\r
+\r
+procedure Copy( var Qix: TQix; Dest, Src: integer );\r
+var\r
+ I: integer;\r
+begin\r
+ for I:=0 to DEFVERT-1 do with Qix do begin\r
+ Vert[I,Dest].X := Vert[I,Src].X;\r
+ Vert[I,Dest].Y := Vert[I,Src].Y;\r
+ end;\r
+end;\r
+\r
+procedure AnimateQix;\r
+var\r
+ Q, Idx, I, J, P, Count: integer;\r
+begin\r
+ Count := 0;\r
+ P := DEFREPL-1;\r
+ I := 0;\r
+ J := 1;\r
+ repeat\r
+ mxSetClipRegion( 0, Page, MaxX+1, MaxY+1 );\r
+ mxSetClip( TRUE );\r
+ mxFillBox( 0, Page, MaxX+1, MaxY+1, 0, OP_SET );\r
+ for Q:=0 to DEFQIXS-1 do begin\r
+ Copy( Qix[Q], I, P );\r
+ Update( Qix[Q], I );\r
+ for Idx:=0 to DEFREPL-1 do begin\r
+ Plot( Qix[Q], Idx );\r
+ end;\r
+ end;\r
+ I := (I+1) mod DEFREPL;\r
+ J := (J+1) mod DEFREPL;\r
+ P := (P+1) mod DEFREPL;\r
+ Inc( Count );\r
+ mxStartLine( Page );\r
+ if( Count >= FADESPEED ) then begin\r
+ for Q:=0 to DEFQIXS-1 do begin\r
+ Inc( Qix[Q].Color );\r
+ if( Qix[Q].Color > 156 ) then\r
+ Qix[Q].Color := 1;\r
+ end;\r
+ Count := 0;\r
+ end;\r
+ Page := 240-Page;\r
+ until( KeyPressed );\r
+end;\r
+\r
+var\r
+ I: integer;\r
+begin\r
+ Randomize;\r
+ mxInit;\r
+ mxSetMode( MX_320x240 );\r
+ mxGetScreenSize( MaxX, MaxY );\r
+ for I:=0 to DEFQIXS-1 do\r
+ Init( Qix[I], (I*(155 div DEFQIXS)) mod 155 + 1 );\r
+ InitPalette;\r
+ mxSetPalette( @Pal, 0, 157 );\r
+ Page := 240;\r
+ Dec( MaxX );\r
+ Dec( MaxY );\r
+ AnimateQix;\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+ModeX - A graphical library for DOS programs\r
+Copyright (c) 1993-1994 Alessandro Scotti\r
+http://www.ascotti.org/\r
+\r
+Please look at the above site in the "Art of..." and\r
+then in the "Old programs" section for more information.\r
+\r
+\r
--- /dev/null
+;\r
+; SINCOS.INC - Sin/cos tables for THREED.ASM\r
+;\r
+\r
+tblSin LABEL DWORD\r
+ DD 0\r
+ DD 411733\r
+ DD 823219\r
+ DD 1234209\r
+ DD 1644455\r
+ DD 2053710\r
+ DD 2461729\r
+ DD 2868265\r
+ DD 3273072\r
+ DD 3675909\r
+ DD 4076531\r
+ DD 4474698\r
+ DD 4870169\r
+ DD 5262706\r
+ DD 5652074\r
+ DD 6038037\r
+ DD 6420363\r
+ DD 6798821\r
+ DD 7173184\r
+ DD 7543226\r
+ DD 7908725\r
+ DD 8269459\r
+ DD 8625213\r
+ DD 8975771\r
+ DD 9320922\r
+ DD 9660458\r
+ DD 9994176\r
+ DD 10321873\r
+ DD 10643353\r
+ DD 10958422\r
+ DD 11266890\r
+ DD 11568571\r
+ DD 11863283\r
+ DD 12150850\r
+ DD 12431097\r
+ DD 12703856\r
+ DD 12968963\r
+ DD 13226258\r
+ DD 13475586\r
+ DD 13716797\r
+ DD 13949745\r
+ DD 14174291\r
+ DD 14390298\r
+ DD 14597637\r
+ DD 14796184\r
+ DD 14985817\r
+ DD 15166424\r
+ DD 15337895\r
+ DD 15500126\r
+ DD 15653022\r
+ DD 15796488\r
+ DD 15930439\r
+ DD 16054795\r
+ DD 16169479\r
+ DD 16274424\r
+ DD 16369565\r
+ DD 16454846\r
+ DD 16530216\r
+ DD 16595628\r
+ DD 16651044\r
+ DD 16696429\r
+ DD 16731757\r
+ DD 16757007\r
+ DD 16772163\r
+ DD 16777216\r
+ DD 16772163\r
+ DD 16757007\r
+ DD 16731757\r
+ DD 16696429\r
+ DD 16651044\r
+ DD 16595628\r
+ DD 16530216\r
+ DD 16454846\r
+ DD 16369565\r
+ DD 16274424\r
+ DD 16169479\r
+ DD 16054795\r
+ DD 15930439\r
+ DD 15796488\r
+ DD 15653022\r
+ DD 15500126\r
+ DD 15337895\r
+ DD 15166424\r
+ DD 14985817\r
+ DD 14796184\r
+ DD 14597637\r
+ DD 14390298\r
+ DD 14174291\r
+ DD 13949745\r
+ DD 13716797\r
+ DD 13475586\r
+ DD 13226258\r
+ DD 12968963\r
+ DD 12703856\r
+ DD 12431097\r
+ DD 12150850\r
+ DD 11863283\r
+ DD 11568571\r
+ DD 11266890\r
+ DD 10958422\r
+ DD 10643353\r
+ DD 10321873\r
+ DD 9994176\r
+ DD 9660458\r
+ DD 9320922\r
+ DD 8975771\r
+ DD 8625213\r
+ DD 8269459\r
+ DD 7908725\r
+ DD 7543226\r
+ DD 7173184\r
+ DD 6798821\r
+ DD 6420363\r
+ DD 6038037\r
+ DD 5652074\r
+ DD 5262706\r
+ DD 4870169\r
+ DD 4474698\r
+ DD 4076531\r
+ DD 3675909\r
+ DD 3273072\r
+ DD 2868265\r
+ DD 2461729\r
+ DD 2053710\r
+ DD 1644455\r
+ DD 1234209\r
+ DD 823219\r
+ DD 411733\r
+ DD 0\r
+ DD -411733\r
+ DD -823219\r
+ DD -1234209\r
+ DD -1644455\r
+ DD -2053710\r
+ DD -2461729\r
+ DD -2868265\r
+ DD -3273072\r
+ DD -3675909\r
+ DD -4076531\r
+ DD -4474698\r
+ DD -4870169\r
+ DD -5262706\r
+ DD -5652074\r
+ DD -6038037\r
+ DD -6420363\r
+ DD -6798821\r
+ DD -7173184\r
+ DD -7543226\r
+ DD -7908725\r
+ DD -8269459\r
+ DD -8625213\r
+ DD -8975771\r
+ DD -9320922\r
+ DD -9660458\r
+ DD -9994176\r
+ DD -10321873\r
+ DD -10643353\r
+ DD -10958422\r
+ DD -11266890\r
+ DD -11568571\r
+ DD -11863283\r
+ DD -12150850\r
+ DD -12431097\r
+ DD -12703856\r
+ DD -12968963\r
+ DD -13226258\r
+ DD -13475586\r
+ DD -13716797\r
+ DD -13949745\r
+ DD -14174291\r
+ DD -14390298\r
+ DD -14597637\r
+ DD -14796184\r
+ DD -14985817\r
+ DD -15166424\r
+ DD -15337895\r
+ DD -15500126\r
+ DD -15653022\r
+ DD -15796488\r
+ DD -15930439\r
+ DD -16054795\r
+ DD -16169479\r
+ DD -16274424\r
+ DD -16369565\r
+ DD -16454846\r
+ DD -16530216\r
+ DD -16595628\r
+ DD -16651044\r
+ DD -16696429\r
+ DD -16731757\r
+ DD -16757007\r
+ DD -16772163\r
+ DD -16777216\r
+ DD -16772163\r
+ DD -16757007\r
+ DD -16731757\r
+ DD -16696429\r
+ DD -16651044\r
+ DD -16595628\r
+ DD -16530216\r
+ DD -16454846\r
+ DD -16369565\r
+ DD -16274424\r
+ DD -16169479\r
+ DD -16054795\r
+ DD -15930439\r
+ DD -15796488\r
+ DD -15653022\r
+ DD -15500126\r
+ DD -15337895\r
+ DD -15166424\r
+ DD -14985817\r
+ DD -14796184\r
+ DD -14597637\r
+ DD -14390298\r
+ DD -14174291\r
+ DD -13949745\r
+ DD -13716797\r
+ DD -13475586\r
+ DD -13226258\r
+ DD -12968963\r
+ DD -12703856\r
+ DD -12431097\r
+ DD -12150850\r
+ DD -11863283\r
+ DD -11568571\r
+ DD -11266890\r
+ DD -10958422\r
+ DD -10643353\r
+ DD -10321873\r
+ DD -9994176\r
+ DD -9660458\r
+ DD -9320922\r
+ DD -8975771\r
+ DD -8625213\r
+ DD -8269459\r
+ DD -7908725\r
+ DD -7543226\r
+ DD -7173184\r
+ DD -6798821\r
+ DD -6420363\r
+ DD -6038037\r
+ DD -5652074\r
+ DD -5262706\r
+ DD -4870169\r
+ DD -4474698\r
+ DD -4076531\r
+ DD -3675909\r
+ DD -3273072\r
+ DD -2868265\r
+ DD -2461729\r
+ DD -2053710\r
+ DD -1644455\r
+ DD -1234209\r
+ DD -823219\r
+ DD -411733\r
+tblCos LABEL DWORD\r
+ DD 16777216\r
+ DD 16772163\r
+ DD 16757007\r
+ DD 16731757\r
+ DD 16696429\r
+ DD 16651044\r
+ DD 16595628\r
+ DD 16530216\r
+ DD 16454846\r
+ DD 16369565\r
+ DD 16274424\r
+ DD 16169479\r
+ DD 16054795\r
+ DD 15930439\r
+ DD 15796488\r
+ DD 15653022\r
+ DD 15500126\r
+ DD 15337895\r
+ DD 15166424\r
+ DD 14985817\r
+ DD 14796184\r
+ DD 14597637\r
+ DD 14390298\r
+ DD 14174291\r
+ DD 13949745\r
+ DD 13716797\r
+ DD 13475586\r
+ DD 13226258\r
+ DD 12968963\r
+ DD 12703856\r
+ DD 12431097\r
+ DD 12150850\r
+ DD 11863283\r
+ DD 11568571\r
+ DD 11266890\r
+ DD 10958422\r
+ DD 10643353\r
+ DD 10321873\r
+ DD 9994176\r
+ DD 9660458\r
+ DD 9320922\r
+ DD 8975771\r
+ DD 8625213\r
+ DD 8269459\r
+ DD 7908725\r
+ DD 7543226\r
+ DD 7173184\r
+ DD 6798821\r
+ DD 6420363\r
+ DD 6038037\r
+ DD 5652074\r
+ DD 5262706\r
+ DD 4870169\r
+ DD 4474698\r
+ DD 4076531\r
+ DD 3675909\r
+ DD 3273072\r
+ DD 2868265\r
+ DD 2461729\r
+ DD 2053710\r
+ DD 1644455\r
+ DD 1234209\r
+ DD 823219\r
+ DD 411733\r
+ DD 0\r
+ DD -411733\r
+ DD -823219\r
+ DD -1234209\r
+ DD -1644455\r
+ DD -2053710\r
+ DD -2461729\r
+ DD -2868265\r
+ DD -3273072\r
+ DD -3675909\r
+ DD -4076531\r
+ DD -4474698\r
+ DD -4870169\r
+ DD -5262706\r
+ DD -5652074\r
+ DD -6038037\r
+ DD -6420363\r
+ DD -6798821\r
+ DD -7173184\r
+ DD -7543226\r
+ DD -7908725\r
+ DD -8269459\r
+ DD -8625213\r
+ DD -8975771\r
+ DD -9320922\r
+ DD -9660458\r
+ DD -9994176\r
+ DD -10321873\r
+ DD -10643353\r
+ DD -10958422\r
+ DD -11266890\r
+ DD -11568571\r
+ DD -11863283\r
+ DD -12150850\r
+ DD -12431097\r
+ DD -12703856\r
+ DD -12968963\r
+ DD -13226258\r
+ DD -13475586\r
+ DD -13716797\r
+ DD -13949745\r
+ DD -14174291\r
+ DD -14390298\r
+ DD -14597637\r
+ DD -14796184\r
+ DD -14985817\r
+ DD -15166424\r
+ DD -15337895\r
+ DD -15500126\r
+ DD -15653022\r
+ DD -15796488\r
+ DD -15930439\r
+ DD -16054795\r
+ DD -16169479\r
+ DD -16274424\r
+ DD -16369565\r
+ DD -16454846\r
+ DD -16530216\r
+ DD -16595628\r
+ DD -16651044\r
+ DD -16696429\r
+ DD -16731757\r
+ DD -16757007\r
+ DD -16772163\r
+ DD -16777216\r
+ DD -16772163\r
+ DD -16757007\r
+ DD -16731757\r
+ DD -16696429\r
+ DD -16651044\r
+ DD -16595628\r
+ DD -16530216\r
+ DD -16454846\r
+ DD -16369565\r
+ DD -16274424\r
+ DD -16169479\r
+ DD -16054795\r
+ DD -15930439\r
+ DD -15796488\r
+ DD -15653022\r
+ DD -15500126\r
+ DD -15337895\r
+ DD -15166424\r
+ DD -14985817\r
+ DD -14796184\r
+ DD -14597637\r
+ DD -14390298\r
+ DD -14174291\r
+ DD -13949745\r
+ DD -13716797\r
+ DD -13475586\r
+ DD -13226258\r
+ DD -12968963\r
+ DD -12703856\r
+ DD -12431097\r
+ DD -12150850\r
+ DD -11863283\r
+ DD -11568571\r
+ DD -11266890\r
+ DD -10958422\r
+ DD -10643353\r
+ DD -10321873\r
+ DD -9994176\r
+ DD -9660458\r
+ DD -9320922\r
+ DD -8975771\r
+ DD -8625213\r
+ DD -8269459\r
+ DD -7908725\r
+ DD -7543226\r
+ DD -7173184\r
+ DD -6798821\r
+ DD -6420363\r
+ DD -6038037\r
+ DD -5652074\r
+ DD -5262706\r
+ DD -4870169\r
+ DD -4474698\r
+ DD -4076531\r
+ DD -3675909\r
+ DD -3273072\r
+ DD -2868265\r
+ DD -2461729\r
+ DD -2053710\r
+ DD -1644455\r
+ DD -1234209\r
+ DD -823219\r
+ DD -411733\r
+ DD 0\r
+ DD 411733\r
+ DD 823219\r
+ DD 1234209\r
+ DD 1644455\r
+ DD 2053710\r
+ DD 2461729\r
+ DD 2868265\r
+ DD 3273072\r
+ DD 3675909\r
+ DD 4076531\r
+ DD 4474698\r
+ DD 4870169\r
+ DD 5262706\r
+ DD 5652074\r
+ DD 6038037\r
+ DD 6420363\r
+ DD 6798821\r
+ DD 7173184\r
+ DD 7543226\r
+ DD 7908725\r
+ DD 8269459\r
+ DD 8625213\r
+ DD 8975771\r
+ DD 9320922\r
+ DD 9660458\r
+ DD 9994176\r
+ DD 10321873\r
+ DD 10643353\r
+ DD 10958422\r
+ DD 11266890\r
+ DD 11568571\r
+ DD 11863283\r
+ DD 12150850\r
+ DD 12431097\r
+ DD 12703856\r
+ DD 12968963\r
+ DD 13226258\r
+ DD 13475586\r
+ DD 13716797\r
+ DD 13949745\r
+ DD 14174291\r
+ DD 14390298\r
+ DD 14597637\r
+ DD 14796184\r
+ DD 14985817\r
+ DD 15166424\r
+ DD 15337895\r
+ DD 15500126\r
+ DD 15653022\r
+ DD 15796488\r
+ DD 15930439\r
+ DD 16054795\r
+ DD 16169479\r
+ DD 16274424\r
+ DD 16369565\r
+ DD 16454846\r
+ DD 16530216\r
+ DD 16595628\r
+ DD 16651044\r
+ DD 16696429\r
+ DD 16731757\r
+ DD 16757007\r
+ DD 16772163\r
--- /dev/null
+COMMENT /\r
+ Fixed-point math functions and 3D transforms\r
+ Copyright (c) 1993,94 by Alessandro Scotti\r
+/\r
+WARN PRO\r
+P386\r
+JUMPS\r
+LOCALS\r
+\r
+INCLUDE MATH.INC\r
+\r
+PUBLIC tdFixedMul\r
+PUBLIC tdGetNormal\r
+PUBLIC tdRotate\r
+PUBLIC tdGetSurfaceLight\r
+PUBLIC tdSetLight\r
+PUBLIC tdSetRotation\r
+PUBLIC tdSetTranslation\r
+PUBLIC tdTransform\r
+PUBLIC tdTransformToImage\r
+PUBLIC tdTransformLight\r
+PUBLIC tdBackPlaneCull\r
+PUBLIC tdSetPerspective\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Data segment\r
+;\r
+MATH_DATA SEGMENT USE16 PARA PUBLIC 'DATA'\r
+ ASSUME ds:MATH_DATA\r
+\r
+INCLUDE SINCOS.INC ; Fixed 8:24 sin/cos table\r
+\r
+XRotation TPOINT <> ; 3x3 rotation matrix\r
+YRotation TPOINT <>\r
+ZRotation TPOINT <>\r
+\r
+Translation TPOINT <> ; Translation vector\r
+\r
+Light TPOINT <> ; Light vector\r
+AmbientLight DW 00 ; Ambient light\r
+\r
+XScale DD 10000h ; Scaling factor for X coordinate\r
+YScale DD 10000h ; Scaling factor for Y coordinate\r
+PerspectiveDistance DD 20000000h\r
+\r
+MATH_DATA ENDS\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Code segment\r
+;\r
+MATH_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MATH_TEXT, es:NOTHING, fs:NOTHING\r
+\r
+tdSetPerspective PROC PASCAL FAR\r
+ ARG Perspective:DWORD, \\r
+ ScaleX:DWORD, \\r
+ ScaleY:DWORD\r
+ USES ds\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ mov eax, [Perspective]\r
+ mov [PerspectiveDistance], eax\r
+ mov eax, [ScaleX]\r
+ mov [XScale], eax\r
+ mov eax, [ScaleY]\r
+ mov [YScale], eax\r
+\r
+ ret\r
+tdSetPerspective ENDP\r
+\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the rotation matrix.\r
+;\r
+; Input:\r
+; RX = X-axis rotation angle\r
+; RY = X-axis rotation angle\r
+; RZ = X-axis rotation angle\r
+; Output:\r
+; none\r
+;\r
+tdSetRotation PROC PASCAL FAR\r
+ ARG RX:WORD, \\r
+ RY:WORD, \\r
+ RZ:WORD\r
+ USES ds, si, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ mov bx, [RZ]\r
+ mov si, [RY]\r
+ mov di, [RX]\r
+ shl bx, 2\r
+ shl si, 2\r
+ shl di, 2\r
+\r
+ push ebp ; We use EBP as a scratch register\r
+\r
+; Set X rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblCos[si]\r
+ mov [XRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblCos[si]\r
+ mov [XRotation.Y], edx\r
+\r
+ mov eax, tblSin[si]\r
+ sar eax, 8 ; Convert fixed 8:24 to fixed 16:16\r
+ mov [XRotation.Z], eax\r
+\r
+; Set Y rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[si] ; EDX:EAX = fixed 16:48\r
+ shrd eax, edx, 24 ; EAX = fixed 8:24\r
+ imul tblSin[di] ; EDX:EAX = fixed 16:48\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblSin[bx]\r
+ imul tblCos[di]\r
+ add eax, ebp\r
+ adc edx, ecx ; EDX:EAX = fixed 16:48\r
+ neg edx\r
+ mov [YRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblSin[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblCos[bx]\r
+ imul tblCos[di]\r
+ sub eax, ebp\r
+ sbb edx, ecx\r
+ mov [YRotation.Y], edx\r
+\r
+ mov eax, tblCos[si]\r
+ imul tblSin[di]\r
+ mov [YRotation.Z], edx\r
+\r
+; Set Z rotation\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblCos[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[di]\r
+ sub eax, ebp\r
+ sbb edx, ecx\r
+ mov [ZRotation.X], edx\r
+\r
+ mov eax, tblSin[bx]\r
+ imul tblSin[si]\r
+ shrd eax, edx, 24\r
+ imul tblCos[di]\r
+ mov ebp, eax\r
+ mov ecx, edx\r
+ mov eax, tblCos[bx]\r
+ imul tblSin[di]\r
+ add eax, ebp\r
+ add edx, ecx\r
+ neg edx\r
+ mov [ZRotation.Y], edx\r
+\r
+ mov eax, tblCos[si]\r
+ imul tblCos[di]\r
+ mov [ZRotation.Z], edx\r
+\r
+ pop ebp ; Restore EBP\r
+\r
+ ret\r
+tdSetRotation ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the translation vector.\r
+;\r
+; Input:\r
+; TV = pointer to translation vector\r
+; Output:\r
+; none\r
+;\r
+tdSetTranslation PROC PASCAL FAR\r
+ ARG TV:DWORD\r
+ USES ds, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [TV]\r
+ mov eax, es:[di].X\r
+ mov [Translation.X], eax\r
+ mov eax, es:[di].Y\r
+ mov [Translation.Y], eax\r
+ mov eax, es:[di].Z\r
+ mov [Translation.Z], eax\r
+\r
+ ret\r
+tdSetTranslation ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Transforms an array of TPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TPOINT\r
+; Count = number of entries to transform\r
+; Output:\r
+; none\r
+;\r
+tdTransform PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ LOCAL Adjust:DWORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+\r
+ ALIGN DWORD\r
+@@Loop:\r
+; Transform Z coordinate\r
+ mov eax, fs:[si].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ mov ebx, eax\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.Z] ; EAX = new Z coord (fixed 16:16)\r
+ mov es:[di].Z, eax\r
+; Get perspective factor\r
+ mov ebx, [PerspectiveDistance]\r
+ sub eax, ebx\r
+ neg eax ; EAX = PD - Z\r
+ xor edx, edx\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx ; EAX = fixed 16:16 result\r
+ mov [Adjust], eax\r
+\r
+; Transform X coordinate\r
+ mov eax, fs:[si].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.X]\r
+ imul [Adjust]\r
+ shrd eax, edx, 16\r
+ mov es:[di].X, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, fs:[si].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ add eax, [Translation.Y]\r
+ imul [Adjust]\r
+ shrd eax, edx, 16\r
+ mov es:[di].Y, eax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdTransform ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Transforms an array of TPOINT into an array of TIMAGEPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TIMAGEPOINT\r
+; Count = number of entries to transform\r
+; DeltaX = translation distance for the X coordinate\r
+; DeltaY = translation distance for the Y coordinate\r
+; Output:\r
+; the maximum Z value\r
+;\r
+tdTransformToImage PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD, \\r
+ DeltaX:WORD, \\r
+ DeltaY:WORD\r
+ LOCAL Adjust:DWORD, \\r
+ Max:DWORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+ mov [Max], 80000000h\r
+\r
+@@Loop:\r
+; Check max Z\r
+ mov eax, fs:[si].Z\r
+ cmp eax, [Max]\r
+ jle @@1\r
+ mov [Max], eax\r
+@@1:\r
+\r
+; Transform X coordinate\r
+ mov ax, WORD PTR fs:[si].X[2]\r
+ add ax, [DeltaX]\r
+ mov es:[di].IX, ax\r
+\r
+; Transform Y coordinate\r
+ mov ax, WORD PTR fs:[si].Y[2]\r
+ add ax, [DeltaY]\r
+ mov es:[di].IY, ax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TIMAGEPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ mov eax, [Max]\r
+ shld edx, eax, 16\r
+ ret\r
+tdTransformToImage ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the light source.\r
+;\r
+; Input:\r
+; Light = pointer to light vector\r
+; Output:\r
+; none\r
+;\r
+tdSetLight PROC PASCAL FAR\r
+ ARG L:DWORD\r
+ USES ds, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [L]\r
+ mov eax, es:[di].X\r
+ mov [Light.X], eax\r
+ mov eax, es:[di].Y\r
+ mov [Light.Y], eax\r
+ mov eax, es:[di].Z\r
+ mov [Light.Z], eax\r
+\r
+ ret\r
+tdSetLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Computes light intensity for an array of surfaces.\r
+;\r
+; Input:\r
+; Normals = pointer to an array of surface normals\r
+; Lights = pointer to an array of integer to be filled with\r
+; light intensity\r
+; Count = number of elements to transform\r
+; Output:\r
+; none\r
+;\r
+tdTransformLight PROC PASCAL FAR\r
+ ARG Normals:DWORD, \\r
+ Lights:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov fs, ax\r
+ ASSUME fs:MATH_DATA\r
+\r
+ lds si, [Normals]\r
+ les di, [Lights]\r
+ ASSUME ds:NOTHING\r
+\r
+; Intensity is given by the dot product between the Light vector and\r
+; the surface normal\r
+@@Loop:\r
+ mov eax, ds:[si].Z\r
+ imul [Light.Z]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, ds:[si].Y\r
+ imul [Light.Y]\r
+ add ebx, eax\r
+ adc ecx, edx\r
+ mov eax, ds:[si].X\r
+ imul [Light.X]\r
+ add eax, ebx\r
+ adc edx, ecx ; EDX:EAX = fixed 32:32 intensity\r
+ add dx, [AmbientLight]\r
+ test dx, dx\r
+ jg @@1\r
+ xor dx, dx ; Return 0 for no light\r
+@@1:\r
+ mov es:[di], dx\r
+ inc di\r
+ inc di\r
+ add si, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ASSUME fs:NOTHING\r
+ ret\r
+tdTransformLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns the light value given the normal to a surface.\r
+;\r
+; Input:\r
+; Normal = pointer to TPOINT surface normal vector\r
+; Output:\r
+; AX = light intensity (>=0)\r
+; Notes:\r
+; the normal is rotated according to the current setting.\r
+;\r
+tdGetSurfaceLight PROC PASCAL FAR\r
+ ARG Normal:DWORD\r
+ USES ds, esi, es, di\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ les di, [Normal]\r
+\r
+; Transform Z coordinate\r
+ mov eax, es:[di].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.Z]\r
+ shrd eax, edx, 16\r
+ mov esi, eax\r
+\r
+; Transform X coordinate\r
+ mov eax, es:[di].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.X]\r
+ shrd eax, edx, 16\r
+ add esi, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, es:[di].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, es:[di].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, es:[di].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ imul [Light.X]\r
+ shrd eax, edx, 16\r
+ add eax, esi\r
+ shr eax, 16\r
+\r
+; Add ambient light\r
+ add ax, [AmbientLight]\r
+ test ax, ax\r
+ jge @@Exit\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ ret\r
+tdGetSurfaceLight ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Rotates an array of TPOINT.\r
+;\r
+; Input:\r
+; Source = pointer to source array of TPOINT\r
+; Dest = pointer to destination array of TPOINT\r
+; Count = number of entries to transform\r
+; Output:\r
+; none\r
+;\r
+tdRotate PROC PASCAL FAR\r
+ ARG Source:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+\r
+ mov ax, SEG MATH_DATA\r
+ mov ds, ax\r
+ ASSUME ds:MATH_DATA\r
+\r
+ lfs si, [Source]\r
+ les di, [Dest]\r
+\r
+@@Loop:\r
+; Transform Z coordinate\r
+ mov eax, fs:[si].X\r
+ imul [ZRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [ZRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [ZRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].Z, eax\r
+\r
+; Transform X coordinate\r
+ mov eax, fs:[si].X\r
+ imul [XRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [XRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [XRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].X, eax\r
+\r
+; Transform Y coordinate\r
+ mov eax, fs:[si].X\r
+ imul [YRotation.X]\r
+ mov ecx, eax\r
+ mov ebx, edx\r
+ mov eax, fs:[si].Y\r
+ imul [YRotation.Y]\r
+ add ecx, eax\r
+ adc ebx, edx\r
+ mov eax, fs:[si].Z\r
+ imul [YRotation.Z]\r
+ add eax, ecx\r
+ adc edx, ebx\r
+ shrd eax, edx, 16\r
+ mov es:[di].Y, eax\r
+\r
+ add si, SIZE TPOINT\r
+ add di, SIZE TPOINT\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdRotate ENDP\r
+\r
+tdFixedMul PROC PASCAL FAR\r
+ ARG F1:DWORD, \\r
+ F2:DWORD\r
+\r
+ mov eax, [F1]\r
+ imul [F2]\r
+ shr eax, 16\r
+\r
+ ret\r
+tdFixedMul ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Returns in EAX the square root of EDX:EAX.\r
+;\r
+subSqrt PROC NEAR\r
+ push esi\r
+ push edi\r
+\r
+ add eax, eax\r
+ adc edx, 0\r
+ mov eax, edx ; Just discard the low bits\r
+\r
+ mov esi, eax\r
+ xor edi, edi\r
+ shld edi, esi, 16\r
+ shl esi, 16\r
+@@Loop:\r
+ mov ebx, eax\r
+ mul eax\r
+ add eax, esi\r
+ adc edx, edi\r
+ shrd eax, edx, 1\r
+ shr edx, 1\r
+ div ebx\r
+ cmp eax, ebx\r
+ jne @@Loop\r
+\r
+; Adjust EAX\r
+ shl eax, 8\r
+\r
+ pop edi\r
+ pop esi\r
+ ret\r
+subSqrt ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Finds the unitary normal to a given surface.\r
+;\r
+; Input:\r
+; Dest = pointer to TPOINT (vector) result\r
+; P1, P2, P3 = pointer to TPOINT points on surface\r
+; Output:\r
+; none\r
+; Notes:\r
+; the normal is given by the cross-product between (P3-P1) and\r
+; (P2-P1), so its orientation depends on the parameters order.\r
+;\r
+tdGetNormal PROC PASCAL FAR\r
+ ARG Dest:DWORD, \\r
+ P1:DWORD, \\r
+ P2:DWORD, \\r
+ P3:DWORD\r
+ LOCAL V1:TPOINT, \\r
+ V2:TPOINT, \\r
+ N:TPOINT\r
+ USES ds, si, es, di\r
+\r
+; Get vector V1\r
+ lds si, [P1]\r
+ les di, [P3]\r
+ mov eax, es:[di].X\r
+ sub eax, ds:[si].X\r
+ mov [V1.X], eax\r
+ mov eax, es:[di].Y\r
+ sub eax, ds:[si].Y\r
+ mov [V1.Y], eax\r
+ mov eax, es:[di].Z\r
+ sub eax, ds:[si].Z\r
+ mov [V1.Z], eax\r
+\r
+; Get vector V2\r
+ les di, [P2]\r
+ mov eax, es:[di].X\r
+ sub eax, ds:[si].X\r
+ mov [V2.X], eax\r
+ mov eax, es:[di].Y\r
+ sub eax, ds:[si].Y\r
+ mov [V2.Y], eax\r
+ mov eax, es:[di].Z\r
+ sub eax, ds:[si].Z\r
+ mov [V2.Z], eax\r
+\r
+; Get normal vector (V1 x V2)\r
+ mov eax, [V1.Z]\r
+ imul [V2.Y]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.Y]\r
+ imul [V2.Z]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.X], eax\r
+\r
+ mov eax, [V1.X]\r
+ imul [V2.Z]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.Z]\r
+ imul [V2.X]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.Y], eax\r
+\r
+ mov eax, [V1.Y]\r
+ imul [V2.X]\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [V1.X]\r
+ imul [V2.Y]\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ shrd eax, edx, 16\r
+ mov [N.Z], eax\r
+\r
+; Get normal length\r
+ mov eax, [N.X]\r
+ imul eax\r
+ mov ebx, eax\r
+ mov ecx, edx\r
+ mov eax, [N.Y]\r
+ imul eax\r
+ add ebx, eax\r
+ adc ecx, edx\r
+ mov eax, [N.Z]\r
+ imul eax\r
+ add eax, ebx\r
+ adc edx, ecx ; EDX:EAX = N.X*N.X + N.Y*N.Y + N.Z*N.Z\r
+ call subSqrt ; EAX = normal length\r
+ mov ebx, eax\r
+\r
+; Adjust vector and save it\r
+ les di, [Dest]\r
+ mov eax, [N.X]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].X, eax\r
+ mov eax, [N.Y]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].Y, eax\r
+ mov eax, [N.Z]\r
+ cdq\r
+ shld edx, eax, 16\r
+ shl eax, 16\r
+ idiv ebx\r
+ mov es:[di].Z, eax\r
+\r
+ ret\r
+tdGetNormal ENDP\r
+\r
+TPOLY STRUC\r
+ Vtx DW 4 DUP(?)\r
+TPOLY ENDS\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Performs surface removal on an array of polygons.\r
+;\r
+; Input:\r
+; Poly = pointer to an array of TPOLY\r
+; Vertex = pointer to an array of TPOINT\r
+; Dest = pointer to an array of integer\r
+; Count = number of polygons to check\r
+; Step = size of TPOLY structure\r
+; Output:\r
+; if the n-th polygon is invisible the n-th entry of the\r
+; Dest array is set to -1, other entries are not modified\r
+; (so it's possible to use the Light array for Dest, because\r
+; the light intensity is always >= 0)\r
+;\r
+tdBackPlaneCull PROC PASCAL FAR\r
+ ARG Step:WORD, \\r
+ Poly:DWORD, \\r
+ Vertex:DWORD, \\r
+ Dest:DWORD, \\r
+ Count:WORD\r
+ USES ds, si, es, di, fs\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ds, WORD PTR Vertex[2]\r
+ les di, [Poly]\r
+ mov fs, WORD PTR Dest[2]\r
+\r
+@@Loop:\r
+ mov ax, es:[di].Vtx[2] ; Index of 2nd vertex\r
+ shl ax, 2\r
+ mov bx, ax\r
+ shl ax, 1\r
+ add bx, ax ; BX = index*SIZE TPOINT\r
+ add bx, WORD PTR [Vertex] ; BX = offset of 2nd vertex\r
+ mov ax, es:[di].Vtx[4] ; Index of 3rd vertex\r
+ shl ax, 2\r
+ mov si, ax\r
+ shl ax, 1\r
+ add si, ax\r
+ add si, WORD PTR [Vertex] ; SI = offset of 3rd vertex\r
+ mov ecx, ds:[si].X\r
+ sub ecx, ds:[bx].X ; ECX = V3.X-V2.X\r
+ mov edx, ds:[si].Y\r
+ sub edx, ds:[bx].Y ; EDX = V3.Y-V2.Y\r
+ mov ax, es:[di].Vtx[0] ; Index of 1st vertex\r
+ shl ax, 2\r
+ mov si, ax\r
+ shl ax, 1\r
+ add si, ax\r
+ add si, WORD PTR [Vertex] ; SI = offset of 1st vertex\r
+ mov eax, ds:[si].X\r
+ sub eax, ds:[bx].X ; EAX = V1.X-V2.X\r
+ mov esi, ds:[si].Y\r
+ sub esi, ds:[bx].Y ; ESI = V1.Y-V2.Y\r
+ imul edx\r
+ mov ebx, eax\r
+ xchg ecx, edx ; ECX:EBX = (V1.X-V2.X)*(V3.Y-V2.Y)\r
+ mov eax, esi\r
+ imul edx ; EDX:EAX = (V1.Y-V2.Y)*(V3.X-V2.X)\r
+ sub eax, ebx\r
+ sbb edx, ecx\r
+ jl @@Next ; Polygon is visible\r
+ mov bx, WORD PTR [Dest] ; FS:BX -> current Dest entry\r
+ mov WORD PTR fs:[bx], -1 ; Remove polygon\r
+@@Next:\r
+ add WORD PTR [Dest], 2 ; Next entry for dest\r
+ add di, [Step] ; Next polygon\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+ ret\r
+tdBackPlaneCull ENDP\r
+\r
+MATH_TEXT ENDS\r
+END\r
--- /dev/null
+typedef struct {\r
+ long x, y, z;\r
+} TVECTOR;\r
+\r
+#define PVECTOR TVECTOR far *\r
+\r
+#define TPOINT TVECTOR\r
+#define PPOINT PVECTOR\r
+\r
+#define VPTR void far *\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+long far pascal tdFixedMul( long, long );\r
+int far pascal tdGetSurfaceLight( PPOINT );\r
+long far pascal tdTransformToImage( VPTR, VPTR, short, short, short );\r
+\r
+void far pascal tdBackPlaneCull( VPTR, VPTR, VPTR, short, short );\r
+void far pascal tdGetNormal( VPTR, PPOINT, PPOINT, PPOINT );\r
+void far pascal tdRotate( VPTR, VPTR, short );\r
+void far pascal tdSetLight( PVECTOR );\r
+void far pascal tdSetRotation( short, short, short );\r
+void far pascal tdSetTranslation( PVECTOR );\r
+void far pascal tdSetPerspective( long, long, long );\r
+void far pascal tdTransform( VPTR, VPTR, short );\r
+void far pascal tdTransformLight( VPTR, VPTR, short );\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
--- /dev/null
+unit ThreeD;\r
+interface\r
+\r
+type\r
+ TVector = record\r
+ X, Y, Z : longint;\r
+ end;\r
+ TPoint = TVector;\r
+\r
+function tdFixedMul( F1, F2: longint ): longint;\r
+function tdGetSurfaceLight( var Normal: TPoint ): integer;\r
+function tdTransformToImage( var Source, Dest; Count, DeltaX, DeltaY: integer ): longint;\r
+\r
+procedure tdBackPlaneCull( var Poly, Vertex, Dest; Count, Step: word );\r
+procedure tdGetNormal( var Dest, P1, P2, P3: TVector );\r
+procedure tdRotate( var Source, Dest; Count: word );\r
+procedure tdSetLight( var Light: TVector );\r
+procedure tdSetRotation( RX, RY, RZ: word );\r
+procedure tdSetTranslation( var TV: TVector );\r
+procedure tdSetPerspective( PD, XF, YF: longint );\r
+procedure tdTransform( var Source, Dest; Count: word );\r
+procedure tdTransformLight( var Source, Dest; Count: word );\r
+\r
+implementation\r
+\r
+function tdGetSurfaceLight; external;\r
+procedure tdSetRotation( RX, RY, RZ: word ); external;\r
+procedure tdGetNormal; external;\r
+procedure tdSetTranslation( var TV: TVector ); external;\r
+procedure tdTransform( var Source, Dest; Count: word ); external;\r
+procedure tdRotate; external;\r
+function tdTransformToImage; external;\r
+procedure tdSetLight( var Light: TVector ); external;\r
+procedure tdSetPerspective; external;\r
+procedure tdTransformLight; external;\r
+function tdFixedMul( F1, F2: longint ): longint; external;\r
+procedure tdBackPlaneCull; external;\r
+{$L THREED}\r
+\r
+end.\r
--- /dev/null
+/*\r
+ DEMO01 - Sprites, page flipping and palette rotation\r
+ Copyright (c) 1994 Alessandro Scotti\r
+*/\r
+uses Crt, Modex;\r
+\r
+#DEFINE MAX_SPRITE 100\r
+type\r
+ (* Sprite structure *)\r
+ TSprite = record\r
+ X, Y : integer; (* Sprite coordinates *)\r
+ DX,DY: integer; (* Deltas for sprite movement *)\r
+ W, H : integer; (* Sprite width and height *)\r
+ Image: array[ 1..16, 1..16 ] of byte; (* Sprite image data *)\r
+ end;\r
+ (* RGB color structure *)\r
+ TRgb = record\r
+ R, G, B: byte;\r
+ end;\r
+var\r
+ S : array[ 1..MAX_SPRITE ] of TSprite; (* An array of sprites *)\r
+ Palette: array[ byte ] of TRgb; (* Palette *)\r
+ Page : word; (* Page offset *)\r
+ I : word;\r
+\r
+(* Initializes a sprite structure *)\r
+procedure sxInit( var S: TSprite );\r
+var\r
+ I: word;\r
+begin\r
+ S.X := Random( 320 ); (* Initialize position with random values *)\r
+ S.Y := Random( 240 );\r
+ S.DX := Random( 7 )-3; (* Initialize speed with random values *)\r
+ S.DY := Random( 7 )-3;\r
+ S.W := 16; (* Size is fixed in this program *)\r
+ S.H := 16;\r
+ (* The image is a square with a hole inside *)\r
+ FillChar( S.Image, SizeOf(S.Image), Random(15)+1 );\r
+ for I:=5 to 12 do FillChar( S.Image[ I, 5 ], 8, 0 );\r
+end;\r
+\r
+(* Moves a sprite *)\r
+procedure sxMove( var S: TSprite );\r
+begin\r
+ Inc( S.X, S.DX ); (* Get new position *)\r
+ Inc( S.Y, S.DY );\r
+ (* Check sprite position, change delta if needed *)\r
+ if( S.X > 320 ) then begin\r
+ S.X := 320;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.X < -16 ) then begin\r
+ S.X := -16;\r
+ S.DX := -S.DX;\r
+ end;\r
+ if( S.Y > 240 ) then begin\r
+ S.Y := 240;\r
+ S.DY := -S.DY;\r
+ end;\r
+ if( S.Y < -16 ) then begin\r
+ S.Y := -16;\r
+ S.DY := -S.DY;\r
+ end;\r
+ (* Draw the sprite, note the Page offset added to the *)\r
+ (* Y coordinate of the image *)\r
+ mxPutImage( @S.Image, S.X, Page+S.Y, S.W, S.H, OP_TRANS );\r
+end;\r
+\r
+begin\r
+ (* Initialize library *)\r
+ mxInit;\r
+\r
+ (* Enter graphics mode *)\r
+ mxSetMode( MX_320x240 );\r
+\r
+ (* Print initialization message *)\r
+ mxSetTextColor( 15, OP_TRANS );\r
+ mxOutStr( 4, 4, 'Initializing...' );\r
+\r
+ (* Initialize sprites *)\r
+ for I:=1 to MAX_SPRITE do sxInit( S[I] );\r
+\r
+ (* Draw background *)\r
+ for I:=1 to 192 do begin\r
+ mxCircle( 160, 480+120, I, I+63 );\r
+ mxCircle( 161, 480+120, I, I+63 );\r
+ end;\r
+\r
+ (* Compute and set palette *)\r
+ for I:=1 to 192 do with Palette[I+63] do begin\r
+ R := 0;\r
+ G := 0;\r
+ B := 0;\r
+ if( I < 64 ) then\r
+ R := I shr 1+31\r
+ else if( I < 128 ) then\r
+ G := (I-64) shr 1+31\r
+ else\r
+ B := (I-128) shr 1+31;\r
+ end;\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+\r
+ (* Main loop *)\r
+ Page := 240;\r
+ while( not KeyPressed ) do begin\r
+ (* Set clip region to current page *)\r
+ mxSetClipRegion( 0, Page, 320, 240 );\r
+ mxSetClip( TRUE );\r
+ (* Restore background *)\r
+ mxBitBlt( 0, 480, 320, 240, 0, Page );\r
+ (* Draw sprites *)\r
+ for I:=1 to MAX_SPRITE do sxMove( S[I] );\r
+ (* Print message *)\r
+ mxOutStr( 4, Page+4, 'Some sprites moving...' );\r
+ (* Flip page *)\r
+ mxStartLine( Page );\r
+ Page := 240-Page;\r
+ (* Animate palette *)\r
+ mxSetPalette( @Palette[64], 64, 192 );\r
+ mxRotatePalette( @Palette[64], 192, 3 );\r
+ end;\r
+\r
+ mxSetMode( MX_TEXT );\r
+ mxTerm;\r
+end.\r
--- /dev/null
+.387
+ PUBLIC XSUBCLIPLINE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ or al,byte ptr [bx+si]
+L$2:
+ DW offset L$3
+ or al,byte ptr [bx+si]
+ DW offset L$4
+ or word ptr [bx+si],ax
+ DW offset L$5
+ ????
+ inc word ptr [bx+si]
+ add byte ptr [bp+si],cl
+ add byte ptr 0a00H[bx+si],al
+ add byte ptr 900H[bp],dl
+ add byte ptr -100H[si],ch
+ inc word ptr [bx+si]
+ add byte ptr ds:[0c000H],al
+ add byte ptr ds:[0ce00H],al
+ add byte ptr [di],al
+ add ah,bl
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ add bh,bh
+ inc word ptr [bx+si]
+ DB 0
+L$3:
+ DW offset MX_TEXT+0ecH
+ DW offset MX_TEXT+0eeH
+ DW offset MX_TEXT+0f1H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+0f4H
+ DW offset MX_TEXT+0f7H
+ DW offset MX_TEXT+104H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+111H
+ DW offset MX_TEXT+114H
+ DW offset MX_TEXT+121H
+L$4:
+ DW offset MX_TEXT+132H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+135H
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+13bH
+ DW offset MX_TEXT+0eaH
+ DW offset MX_TEXT+148H
+ DW offset L$7
+ DW offset L$10
+ DW offset L$7
+ DW offset L$11
+L$5:
+ DW offset L$14
+ DW offset L$15
+ DW offset L$7
+ DW offset L$7
+ DW offset L$16
+ DW offset L$17
+ DW offset L$7
+ DW offset L$7
+ DW offset L$18
+ DW offset L$19
+ DW offset L$22
+ DW offset L$23
+ DW offset L$24
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$25
+ DW offset L$26
+ DW offset L$27
+ DW offset L$30
+ DW offset L$7
+ DW offset L$31
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$32
+ DW offset L$7
+ DW offset L$33
+ DW offset L$36
+ DW offset L$37
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$7
+ DW offset L$38
+ DW offset L$39
+ DW offset L$43
+ DW offset L$44
+ DW offset L$45
+ DW offset L$7
+ DW offset L$46
+ DW offset L$47
+ DW offset L$48
+ DW offset L$51
+ DW offset L$7
+ DW offset L$52
+ DW offset L$7
+ DW offset L$53
+ DW offset L$7
+ DW offset L$54
+ DW offset L$58
+ DW offset L$59
+ DW offset L$7
+ DW offset L$7
+ DW offset L$60
+ DW offset L$61
+L$6:
+ clc
+ ret
+L$7:
+ stc
+ ret
+ clc
+ ret
+ jmp near ptr L$67
+ jmp near ptr L$68
+ jmp near ptr L$70
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$6
+ jmp near ptr L$70
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$6
+ jmp near ptr L$70
+ jmp near ptr L$69
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$6
+ jmp near ptr L$69
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$6
+ jmp near ptr L$69
+L$8:
+ stc
+ ret
+L$9:
+ clc
+ ret
+ jmp near ptr L$63
+ call near ptr L$63
+ jmp near ptr L$68
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$8
+ jmp near ptr L$70
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$8
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$9
+ jmp near ptr L$68
+L$10:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$8
+ jmp near ptr L$69
+L$11:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$8
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$9
+ jmp near ptr L$68
+L$12:
+ clc
+ ret
+L$13:
+ stc
+ ret
+L$14:
+ jmp near ptr L$64
+L$15:
+ call near ptr L$64
+ jmp near ptr L$67
+L$16:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$13
+ jmp near ptr L$70
+L$17:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$13
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$12
+ jmp near ptr L$67
+L$18:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$13
+ jmp near ptr L$69
+L$19:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$13
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$12
+ jmp near ptr L$67
+L$20:
+ clc
+ ret
+L$21:
+ stc
+ ret
+L$22:
+ jmp near ptr L$66
+L$23:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$21
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$20
+ jmp near ptr L$70
+L$24:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$21
+ jmp near ptr L$68
+L$25:
+ call near ptr L$66
+ jmp near ptr L$69
+L$26:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$21
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$20
+ jmp near ptr L$69
+L$27:
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$21
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$20
+ jmp near ptr L$69
+L$28:
+ clc
+ ret
+L$29:
+ stc
+ ret
+L$30:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$28
+ jmp near ptr L$66
+L$31:
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jl L$29
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$28
+ jmp near ptr L$63
+L$32:
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX1
+ jl L$29
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$28
+ jmp near ptr L$63
+L$33:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$29
+ call near ptr L$68
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$29
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$28
+ jmp near ptr L$69
+L$34:
+ clc
+ ret
+L$35:
+ stc
+ ret
+L$36:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$37:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jl L$35
+ call near ptr L$66
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$34
+ jmp near ptr L$64
+L$38:
+ call near ptr L$69
+ cmp cx,word ptr cs:MX_CLIPX2
+ jg L$35
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$39:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jl L$35
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$35
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$40
+ call near ptr L$69
+L$40:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$34
+ jmp near ptr L$66
+L$41:
+ clc
+ ret
+L$42:
+ stc
+ ret
+L$43:
+ jmp near ptr L$65
+L$44:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$42
+ jmp near ptr L$67
+L$45:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$42
+ jmp near ptr L$68
+L$46:
+ call near ptr L$65
+ jmp near ptr L$70
+L$47:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$42
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$42
+ jmp near ptr L$70
+L$48:
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$42
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$41
+ jmp near ptr L$70
+L$49:
+ clc
+ ret
+L$50:
+ stc
+ ret
+L$51:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$49
+ jmp near ptr L$65
+L$52:
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$50
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$49
+ jmp near ptr L$63
+L$53:
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX1
+ jl L$50
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$49
+ jmp near ptr L$65
+L$54:
+ call near ptr L$63
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$50
+ call near ptr L$68
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$50
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$55
+ call near ptr L$65
+L$55:
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$49
+ jmp near ptr L$70
+L$56:
+ clc
+ ret
+L$57:
+ stc
+ ret
+L$58:
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp near ptr L$65
+L$59:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$57
+ call near ptr L$65
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$56
+ jmp L$64
+L$60:
+ call near ptr L$70
+ cmp cx,word ptr cs:MX_CLIPX2
+ jg L$57
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp L$65
+L$61:
+ call near ptr L$67
+ cmp si,word ptr cs:MX_CLIPY2
+ jg L$57
+ call near ptr L$64
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$57
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$62
+ call near ptr L$70
+L$62:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$56
+ jmp L$65
+L$63:
+ mov ax,si
+ sub ax,bx
+ mov dx,word ptr cs:MX_CLIPX1
+ sub dx,di
+ imul dx
+ mov bp,cx
+ sub bp,di
+ idiv bp
+ add bx,ax
+ mov di,word ptr cs:MX_CLIPX1
+ clc
+ ret
+L$64:
+ mov ax,si
+ sub ax,bx
+ mov dx,word ptr cs:MX_CLIPX2
+ sub dx,di
+ imul dx
+ mov bp,cx
+ sub bp,di
+ idiv bp
+ add bx,ax
+ mov di,word ptr cs:MX_CLIPX2
+ clc
+ ret
+L$65:
+ mov ax,cx
+ sub ax,di
+ mov dx,word ptr cs:MX_CLIPY2
+ sub dx,bx
+ imul dx
+ mov bp,si
+ sub bp,bx
+ idiv bp
+ add di,ax
+ mov bx,word ptr cs:MX_CLIPY2
+ clc
+ ret
+L$66:
+ mov ax,cx
+ sub ax,di
+ mov dx,word ptr cs:MX_CLIPY1
+ sub dx,bx
+ imul dx
+ mov bp,si
+ sub bp,bx
+ idiv bp
+ add di,ax
+ mov bx,word ptr cs:MX_CLIPY1
+ clc
+ ret
+L$67:
+ mov ax,bx
+ sub ax,si
+ mov dx,word ptr cs:MX_CLIPX1
+ sub dx,cx
+ imul dx
+ mov bp,di
+ sub bp,cx
+ idiv bp
+ add si,ax
+ mov cx,word ptr cs:MX_CLIPX1
+ clc
+ ret
+L$68:
+ mov ax,bx
+ sub ax,si
+ mov dx,word ptr cs:MX_CLIPX2
+ sub dx,cx
+ imul dx
+ mov bp,di
+ sub bp,cx
+ idiv bp
+ add si,ax
+ mov cx,word ptr cs:MX_CLIPX2
+ clc
+ ret
+L$69:
+ mov ax,di
+ sub ax,cx
+ mov dx,word ptr cs:MX_CLIPY2
+ sub dx,si
+ imul dx
+ mov bp,bx
+ sub bp,si
+ idiv bp
+ add cx,ax
+ mov si,word ptr cs:MX_CLIPY2
+ clc
+ ret
+L$70:
+ mov ax,di
+ sub ax,cx
+ mov dx,word ptr cs:MX_CLIPY1
+ sub dx,si
+ imul dx
+ mov bp,bx
+ sub bp,si
+ idiv bp
+ add cx,ax
+ mov si,word ptr cs:MX_CLIPY1
+ clc
+ ret
+XSUBCLIPLINE:
+ push bp
+ xor si,si
+ cmp dx,word ptr cs:MX_CLIPY2
+ jle L$71
+ or si,8
+ jmp L$72
+L$71:
+ cmp dx,word ptr cs:MX_CLIPY1
+ jge L$72
+ or si,4
+L$72:
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$73
+ or si,2
+ jmp L$74
+L$73:
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$74
+ or si,1
+L$74:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$75
+ or si,80H
+ jmp L$76
+L$75:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$76
+ or si,40H
+L$76:
+ cmp ax,word ptr cs:MX_CLIPX2
+ jle L$77
+ or si,20H
+ jmp L$78
+L$77:
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$78
+ or si,10H
+L$78:
+ mov di,si
+ and di,0fH
+ and si,0f0H
+ shr si,1
+ shr si,1
+ cmp di,word ptr cs:L$1[si]
+ jg L$79
+ mov si,word ptr cs:L$2[si]
+ shl di,1
+ add si,di
+ mov di,ax
+ mov si,word ptr cs:[si]
+ xchg si,dx
+ call dx
+ mov ax,di
+ mov dx,si
+ pop bp
+ ret
+L$79:
+ pop bp
+ stc
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXCOLORTOGRAY
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXCOLORTOGRAY:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 6[bp]
+ jcxz L$2
+ lds si,dword ptr 0cH[bp]
+ les di,dword ptr 8[bp]
+ cld
+ mov bx,4d97H
+L$1:
+ lodsb
+ mul bh
+ mov dx,ax
+ lodsb
+ mul bl
+ add dx,ax
+ lodsb
+ mov ah,1cH
+ mul ah
+ add ax,dx
+ mov al,ah
+ stosw
+ stosb
+ loop L$1
+L$2:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0aH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXCIRCLE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXCIRCLE:
+ push bp
+ mov bp,sp
+ sub sp,2
+ push ds
+ push si
+ push di
+ xor si,si
+ mov di,word ptr 8[bp]
+ mov ax,3
+ sub ax,di
+ sub ax,di
+ mov word ptr -2[bp],ax
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+L$1:
+ cmp si,di
+ jg L$3
+ mov ax,si
+ mov bx,di
+ call near ptr L$4
+ mov ax,si
+ neg ax
+ mov bx,di
+ call near ptr L$4
+ mov ax,si
+ mov bx,di
+ neg bx
+ call near ptr L$4
+ mov ax,si
+ neg ax
+ mov bx,di
+ neg bx
+ call near ptr L$4
+ mov ax,di
+ mov bx,si
+ call near ptr L$4
+ mov ax,di
+ neg ax
+ mov bx,si
+ call near ptr L$4
+ mov ax,di
+ mov bx,si
+ neg bx
+ call near ptr L$4
+ mov ax,di
+ neg ax
+ mov bx,si
+ neg bx
+ call near ptr L$4
+ mov ax,word ptr -2[bp]
+ test ax,ax
+ jl L$2
+ mov ax,di
+ shl ax,1
+ shl ax,1
+ sub ax,4
+ sub word ptr -2[bp],ax
+ dec di
+L$2:
+ mov ax,si
+ shl ax,1
+ shl ax,1
+ add ax,6
+ add word ptr -2[bp],ax
+ inc si
+ jmp L$1
+L$3:
+ xor ax,ax
+ pop di
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+L$4:
+ add bx,word ptr 0cH[bp]
+ add ax,word ptr 0aH[bp]
+ cmp bx,word ptr cs:MX_CLIPX1
+ jl L$5
+ cmp bx,word ptr cs:MX_CLIPX2
+ jg L$5
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$5
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$5
+ mul word ptr cs:MX_BYTESPERLINE
+ mov cx,bx
+ shr bx,1
+ shr bx,1
+ add bx,ax
+ and cl,3
+ mov ax,102H
+ shl ah,cl
+ mov dx,3c4H
+ out dx,ax
+ mov al,byte ptr 6[bp]
+ mov byte ptr [bx],al
+L$5:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MX_CLIPX1
+ PUBLIC MX_CLIPY1
+ PUBLIC MX_CLIPX2
+ PUBLIC MX_CLIPY2
+ PUBLIC MXSETCLIP
+ PUBLIC MXGETCLIP
+ PUBLIC MXSETSYSCLIPREGION
+ PUBLIC MXSETCLIPREGION
+ PUBLIC MXGETCLIPREGION
+ PUBLIC SUBCLIPIMAGE
+ PUBLIC SUBCLIPBOX
+ EXTRN MX_CODESEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_CLIPX1:
+ add byte ptr [bx+si],al
+MX_CLIPY1:
+ add byte ptr [bx+si],al
+MX_CLIPX2:
+ add byte ptr [bx+si],al
+MX_CLIPY2:
+ add byte ptr [bx+si],al
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+L$3:
+ add byte ptr [bx+si],al
+L$4:
+ add byte ptr [bx+si],al
+L$5:
+ add byte ptr [bx+si],al
+L$6:
+ add byte ptr [bx+si],al
+L$7:
+ add byte ptr [bx+si],al
+L$8:
+ add byte ptr [bx+si],al
+L$9:
+ DB 0
+MXSETCLIP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr L$5
+ mov bx,word ptr L$6
+ mov cx,word ptr L$7
+ mov dx,word ptr L$8
+ cmp byte ptr 6[bp],1
+ je L$10
+ mov ax,word ptr L$1
+ mov bx,word ptr L$2
+ mov cx,word ptr L$3
+ mov dx,word ptr L$4
+L$10:
+ mov word ptr MX_CLIPX1,ax
+ mov word ptr MX_CLIPY1,bx
+ mov word ptr MX_CLIPX2,cx
+ mov word ptr MX_CLIPY2,dx
+ mov al,byte ptr 6[bp]
+ xchg byte ptr L$9,al
+ xor ah,ah
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXGETCLIP:
+ mov al,byte ptr cs:L$9
+ xor ah,ah
+ retf
+MXSETSYSCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ xor ax,ax
+ mov word ptr L$1,ax
+ mov word ptr L$2,ax
+ mov ax,word ptr 8[bp]
+ dec ax
+ mov word ptr L$3,ax
+ mov ax,word ptr 6[bp]
+ dec ax
+ mov word ptr L$4,ax
+ mov ax,0
+ push ax
+ push cs
+ call near ptr MXSETCLIP
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXSETCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 0cH[bp]
+ mov word ptr L$5,ax
+ mov ax,word ptr 0aH[bp]
+ mov word ptr L$6,ax
+ mov ax,word ptr 8[bp]
+ add ax,word ptr 0cH[bp]
+ dec ax
+ mov word ptr L$7,ax
+ mov ax,word ptr 6[bp]
+ add ax,word ptr 0aH[bp]
+ dec ax
+ mov word ptr L$8,ax
+ mov al,byte ptr L$9
+ cmp al,1
+ jne L$11
+ push ax
+ push cs
+ call near ptr MXSETCLIP
+L$11:
+ xor ax,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXGETCLIPREGION:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push es
+ push di
+ mov ax,word ptr cs:L$5
+ les di,dword ptr 12H[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$6
+ les di,dword ptr 0eH[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$7
+ sub ax,word ptr cs:L$5
+ inc ax
+ les di,dword ptr 0aH[bp]
+ mov word ptr es:[di],ax
+ mov ax,word ptr cs:L$8
+ sub ax,word ptr cs:L$6
+ inc ax
+ les di,dword ptr 6[bp]
+ mov word ptr es:[di],ax
+ mov al,byte ptr cs:L$9
+ xor ah,ah
+ pop di
+ pop es
+ mov sp,bp
+ pop bp
+ retf 10H
+SUBCLIPIMAGE:
+ xor si,si
+ mov di,word ptr cs:MX_CLIPY1
+ cmp ax,di
+ jge L$12
+ sub di,ax
+ sub dx,di
+ jle L$16
+ mov ax,di
+ mov di,dx
+ mul cx
+ mov si,ax
+ mov dx,di
+ mov ax,word ptr cs:MX_CLIPY1
+L$12:
+ mov di,word ptr cs:MX_CLIPY2
+ cmp ax,di
+ jg L$16
+ inc di
+ sub di,dx
+ sub di,ax
+ jge L$13
+ add dx,di
+L$13:
+ mov di,word ptr cs:MX_CLIPX1
+ cmp bx,di
+ jge L$14
+ sub di,bx
+ sub cx,di
+ jle L$16
+ add si,di
+ mov bx,word ptr cs:MX_CLIPX1
+L$14:
+ mov di,word ptr cs:MX_CLIPX2
+ cmp bx,di
+ jg L$16
+ inc di
+ sub di,bx
+ sub di,cx
+ jge L$15
+ add cx,di
+L$15:
+ clc
+ ret
+L$16:
+ stc
+ ret
+SUBCLIPBOX:
+ mov di,word ptr cs:MX_CLIPY1
+ cmp ax,di
+ jge L$17
+ sub di,ax
+ sub dx,di
+ jle L$21
+ mov ax,word ptr cs:MX_CLIPY1
+L$17:
+ mov di,word ptr cs:MX_CLIPY2
+ cmp ax,di
+ jg L$21
+ inc di
+ sub di,dx
+ sub di,ax
+ jge L$18
+ add dx,di
+L$18:
+ mov di,word ptr cs:MX_CLIPX1
+ cmp bx,di
+ jge L$19
+ sub di,bx
+ sub cx,di
+ jle L$21
+ mov bx,word ptr cs:MX_CLIPX1
+L$19:
+ mov di,word ptr cs:MX_CLIPX2
+ cmp bx,di
+ jg L$21
+ inc di
+ sub di,bx
+ sub di,cx
+ jge L$20
+ add cx,di
+L$20:
+ clc
+ ret
+L$21:
+ stc
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXFILLBOX
+ EXTRN SUBCLIPBOX:BYTE
+ EXTRN SUBHORIZONTALLINEINFO:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov ah,al
+ shr cx,1
+ rep stosw
+ rcl cx,1
+ rep stosb
+ ret
+L$2:
+ mov byte ptr [bx],al
+ add bx,dx
+ loop L$2
+ ret
+L$3:
+ mov si,di
+L$4:
+ mov ah,byte ptr [si]
+ mov byte ptr [si],al
+ inc si
+ loop L$4
+ ret
+L$5:
+ mov ah,byte ptr [bx]
+ mov byte ptr [bx],al
+ add bx,dx
+ loop L$5
+ ret
+MXFILLBOX:
+ push bp
+ mov bp,sp
+ sub sp,8
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 10H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ mov dx,word ptr 0aH[bp]
+ call near ptr MX_TEXT:SUBCLIPBOX
+ jae L$6
+ jmp near ptr L$12
+L$6:
+ mov word ptr 0aH[bp],dx
+ call near ptr MX_TEXT:SUBHORIZONTALLINEINFO
+ mov word ptr 0cH[bp],cx
+ mov byte ptr -2[bp],al
+ mov byte ptr -4[bp],ah
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov es,ax
+ mov ds,ax
+ cld
+ mov word ptr -6[bp],offset L$2
+ mov word ptr -8[bp],offset L$1
+ mov ax,word ptr 6[bp]
+ cmp al,3
+ ja L$7
+ cmp al,0
+ je L$7
+ shl al,1
+ shl al,1
+ shl al,1
+ mov ah,al
+ mov al,3
+ mov dx,3ceH
+ out dx,ax
+ mov word ptr -6[bp],offset L$5
+ mov word ptr -8[bp],offset L$3
+L$7:
+ mov ah,byte ptr -2[bp]
+ or ah,ah
+ je L$8
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ mov cx,word ptr 0aH[bp]
+ mov bx,di
+ mov al,byte ptr 8[bp]
+ call word ptr -6[bp]
+ inc di
+L$8:
+ mov cx,word ptr 0cH[bp]
+ jcxz L$10
+ mov dx,3c4H
+ mov ax,0f02H
+ out dx,ax
+ mov al,byte ptr 8[bp]
+ mov bx,di
+ mov dx,word ptr 0aH[bp]
+ push di
+L$9:
+ mov di,bx
+ call word ptr -8[bp]
+ mov cx,word ptr 0cH[bp]
+ add bx,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$9
+ pop di
+ add di,word ptr 0cH[bp]
+L$10:
+ mov ah,byte ptr -4[bp]
+ or ah,ah
+ je L$11
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ mov cx,word ptr 0aH[bp]
+ mov bx,di
+ mov al,byte ptr 8[bp]
+ call word ptr -6[bp]
+L$11:
+ mov dx,3ceH
+ mov ax,3
+ out dx,ax
+L$12:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXFADEPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+ inc bx
+ outsw
+ jo L$5
+ jb L$4
+ push 2074H
+ sub byte ptr 29H[bp+di],ah
+ and byte ptr [bx+di],dh
+ cmp word ptr [bx+di],di
+ xor ch,byte ptr [di]
+ xor word ptr [bx+di],di
+ cmp word ptr [si],si
+ and byte ptr 52H[bx+di],al
+ push sp
+ dec cx
+ push bx
+ and byte ptr 2eH[bp+di],dh
+ jb L$1
+ insb
+ and byte ptr cs:6cH[bx+di],al
+ insb
+ and byte ptr 69H[bp+si],dh
+ push 7374H
+ and byte ptr 65H[bp+si],dh
+ jae L$7
+ jb L$9
+ DB 65H, 64H, 2eH
+MXFADEPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,60aH
+ push si
+ push di
+ push ds
+ push es
+ mov word ptr -608H[bp],1
+ mov ax,word ptr 10H[bp]
+ and ax,0ff00H
+L$1:
+ je L$2
+ mov cl,8
+ shr ax,cl
+ mov word ptr -608H[bp],ax
+L$2:
+ mov ax,word ptr 10H[bp]
+ and ax,0feH
+ mov cl,1
+ shr ax,cl
+ or ax,ax
+ jne L$3
+ mov ax,30H
+L$3:
+ mov word ptr -60aH[bp],ax
+L$4:
+ inc ax
+ mov byte ptr -606H[bp],al
+ mov byte ptr -604H[bp],1
+ DB 0c6H, 86H, 0feH, 0f9H
+L$5:
+ add byte ptr 0e46H[bp+di],cl
+ cmp ax,100H
+ jb L$6
+ jmp near ptr L$12
+L$6:
+ add ax,word ptr 0cH[bp]
+ cmp ax,100H
+ jbe L$8
+ mov ax,100H
+ sub ax,word ptr 0eH[bp]
+ DB 89H, 46H
+L$7:
+ or al,0bH
+ ????
+ jne L$8
+ jmp near ptr L$12
+L$8:
+ mov cx,word ptr 0cH[bp]
+ mov ax,cx
+ shl ax,1
+ add cx,ax
+ mov ax,ss
+L$9:
+ mov es,ax
+ lea di,-300H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov si,ax
+ shl ax,1
+ add ax,si
+ lds si,dword ptr 12H[bp]
+ add si,ax
+ cld
+ shr cx,1
+ rep movsw
+ rcl cx,1
+ rep movsb
+ test word ptr 10H[bp],1
+ je L$10
+ mov ax,word ptr -60aH[bp]
+ mov byte ptr -602H[bp],al
+ mov byte ptr -604H[bp],0ffH
+ mov ax,ss
+ mov ds,ax
+ mov es,ax
+ lea di,-300H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ call near ptr L$19
+L$10:
+ mov bh,byte ptr 0aH[bp]
+ and bh,3fH
+ mov bl,byte ptr 8[bp]
+ and bl,3fH
+ mov dh,byte ptr 6[bp]
+ and dh,3fH
+ mov dl,byte ptr -602H[bp]
+ mov ax,ss
+ mov ds,ax
+ mov es,ax
+L$11:
+ mov ax,word ptr 0cH[bp]
+ mov cx,word ptr -60aH[bp]
+ lea si,-300H[bp]
+ lea di,-600H[bp]
+ call near ptr L$13
+ push bx
+ push dx
+ lea si,-600H[bp]
+ mov ax,word ptr 0eH[bp]
+ mov bx,word ptr 0cH[bp]
+ mov cx,word ptr -608H[bp]
+ call near ptr L$15
+ pop dx
+ pop bx
+ add dl,byte ptr -604H[bp]
+ dec byte ptr -606H[bp]
+ jne L$11
+L$12:
+ pop es
+ pop ds
+ pop di
+ pop si
+ mov sp,bp
+ pop bp
+ retf 10H
+L$13:
+ cld
+ push bp
+ mov bp,ax
+L$14:
+ lodsb
+ sub al,bh
+ imul dl
+ idiv cl
+ add al,bh
+ stosb
+ lodsb
+ sub al,bl
+ imul dl
+ idiv cl
+ add al,bl
+ stosb
+ lodsb
+ sub al,dh
+ imul dl
+ idiv cl
+ add al,dh
+ stosb
+ dec bp
+ jne L$14
+ pop bp
+ ret
+L$15:
+ mov ah,al
+ mov dx,3daH
+L$16:
+ in al,dx
+ test al,8
+ jne L$16
+L$17:
+ in al,dx
+ test al,8
+ je L$17
+ loop L$16
+ mov cx,bx
+ mov dx,3c8H
+ mov al,ah
+ out dx,al
+ inc dx
+ cld
+ cli
+L$18:
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ loop L$18
+ sti
+ ret
+L$19:
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ cld
+L$20:
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ loop L$20
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGETCOLOR
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr 12H[bp]
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ lds si,dword ptr 0eH[bp]
+ in al,dx
+ mov byte ptr [si],al
+ lds si,dword ptr 0aH[bp]
+ in al,dx
+ mov byte ptr [si],al
+ lds si,dword ptr 6[bp]
+ in al,dx
+ mov byte ptr [si],al
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0eH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGETIMAGE
+ EXTRN SUBCLIPIMAGE:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,10H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 0cH[bp]
+ mov ax,word ptr 0aH[bp]
+ mov cx,word ptr 8[bp]
+ mov dx,word ptr 6[bp]
+ call near ptr MX_TEXT:SUBCLIPIMAGE
+ jae L$1
+ jmp near ptr L$7
+L$1:
+ mov word ptr 6[bp],dx
+ add word ptr 0eH[bp],si
+ mul word ptr cs:MX_BYTESPERLINE
+ mov si,bx
+ shr si,1
+ shr si,1
+ add si,ax
+ mov word ptr -0aH[bp],si
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -0eH[bp],bl
+ mov bx,cx
+ shr bx,1
+ shr bx,1
+ and cl,3
+ mov al,8
+ shr al,cl
+ mov di,6
+L$2:
+ mov word ptr -8[bp+di],bx
+ shr al,1
+ adc bx,0
+ dec di
+ dec di
+ jge L$2
+ cld
+ mov byte ptr -10H[bp],4
+ lea bx,-8[bp]
+ mov es,word ptr 10H[bp]
+ mov ah,byte ptr -0eH[bp]
+L$3:
+ cmp word ptr ss:[bx],0
+ je L$7
+ mov di,word ptr 0eH[bp]
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov dx,word ptr 6[bp]
+ mov si,word ptr -0aH[bp]
+L$4:
+ push si
+ push di
+ mov cx,word ptr ss:[bx]
+L$5:
+ movsb
+ add di,3
+ dec cx
+ jne L$5
+ pop di
+ pop si
+ add di,word ptr 8[bp]
+ add si,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$4
+ inc bx
+ inc bx
+ inc ah
+ test ah,4
+ je L$6
+ inc word ptr -0aH[bp]
+ and ah,3
+L$6:
+ inc word ptr 0eH[bp]
+ dec byte ptr -10H[bp]
+ jne L$3
+L$7:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGAMMACORRECT
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bp+si],cl
+ push cs
+ adc word ptr [bp+di],dx
+ adc ax,1817H
+ sbb bl,byte ptr [bp+di]
+ sbb al,1dH
+ pop ds
+ and byte ptr [bx+di],ah
+ and ah,byte ptr [bp+di]
+ and al,25H
+ and ax,2726H
+ sub byte ptr [bx+di],ch
+ sub word ptr [bp+si],bp
+ sub bp,word ptr [si]
+ sub al,2dH
+ das
+ xor byte ptr [bx+si],dh
+ xor word ptr [bx+di],si
+ xor dh,byte ptr [bp+di]
+ xor si,word ptr [si]
+ xor al,35H
+ xor ax,3636H
+ aaa
+ aaa
+ cmp byte ptr [bx+si],bh
+ cmp word ptr [bx+di],di
+ cmp bh,byte ptr [bp+si]
+ cmp di,word ptr [bp+di]
+ cmp al,3cH
+ cmp ax,3e3dH
+ aas
+ aas
+MXGAMMACORRECT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 6[bp]
+ jcxz L$3
+ lds si,dword ptr 0cH[bp]
+ les di,dword ptr 8[bp]
+ mov bx,offset L$1
+ cld
+ mov ax,cx
+ add cx,cx
+ add cx,ax
+L$2:
+ lodsb
+ xlat word ptr cs:[bx]
+ stosb
+ loop L$2
+L$3:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0aH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGETPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push es
+ push di
+ les di,dword ptr 0aH[bp]
+ mov cx,word ptr 6[bp]
+ mov ax,word ptr 8[bp]
+ mov dx,3c7H
+ out dx,al
+ inc dx
+ inc dx
+ cld
+L$1:
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ in al,dx
+ stosb
+ loop L$1
+ pop di
+ pop es
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGETVERSION
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETVERSION:
+ mov ax,128H
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC SUBHORIZONTALLINEINFO
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bx+si],al
+ add ax,word ptr [bx+si]
+ add al,byte ptr [bx+si]
+ add word ptr [bx+si],ax
+L$2:
+ add byte ptr ds:[80cH],cl
+L$3:
+ add byte ptr [bx+di],al
+ add ax,word ptr [bx]
+L$4:
+ DB 2, 6
+SUBHORIZONTALLINEINFO:
+ DD ds:[0f72eH]
+ add byte ptr -2e05H[bp+di],cl
+ out dx,ax
+ shr di,1
+ add di,ax
+ and bx,3
+ mov al,byte ptr cs:L$2[bx]
+ shl bx,1
+ sub cx,word ptr cs:L$1[bx]
+ jge L$5
+ mov bx,cx
+ inc bx
+ inc bx
+ and al,byte ptr cs:L$4[bx]
+ xor ah,ah
+ xor cx,cx
+ jmp L$6
+L$5:
+ mov bx,cx
+ and bx,3
+ mov ah,byte ptr cs:L$3[bx]
+ shr cx,1
+ shr cx,1
+L$6:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MX_VIDEOSEGMENT
+ PUBLIC MX_CODESEGMENT
+ PUBLIC MXINIT
+ PUBLIC MXTERM
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+ dec bp
+ dec di
+ inc sp
+ inc bp
+ pop ax
+ and byte ptr 69H[si],ch
+ bound si,word ptr 61H[bp+si]
+ jb L$3
+ and byte ptr [di],ch
+ and byte ptr 6fH[bp+di],al
+ jo L$5
+ jb L$2
+ push 2074H
+ sub byte ptr 29H[bp+di],ah
+ and byte ptr [bx+di],dh
+ cmp word ptr [bx+di],di
+ xor ch,byte ptr [di]
+ xor word ptr [bx+di],di
+ cmp word ptr [si],si
+ and byte ptr 6cH[bx+di],al
+ ; The label referred to here is an undefined location
+ jae 0a0H
+ popa
+ outsb
+ ; The label referred to here is an undefined location
+ jb 0a1H
+ and byte ptr 63H[bp+di],dl
+ outsw
+ ; The label referred to here is an undefined location
+ je 0acH
+ DB 69H
+MX_VIDEOSEGMENT:
+ DB 0, 0a0H
+MX_CODESEGMENT:
+ DW MX_TEXT
+MXINIT:
+ push bp
+ mov bp,sp
+ sub sp,6
+ push ds
+ push si
+ push es
+ push di
+ mov word ptr -2[bp],0ffffH
+ mov word ptr -4[bp],0a000H
+ mov word ptr -6[bp],cs
+ mov ax,1686H
+ int 2fH
+ or ax,ax
+ jne L$1
+ mov ax,0aH
+ mov bx,cs
+ int 31H
+ jb L$4
+ mov word ptr -6[bp],ax
+ mov ax,2
+ mov bx,0a000H
+ int 31H
+ jb L$4
+ mov word ptr -4[bp],ax
+L$1:
+ mov ds,word ptr -6[bp]
+ mov word ptr MX_CODESEGMENT,ds
+ DB 8bH, 46H
+L$2:
+ cld
+ mov word ptr MX_VIDEOSEGMENT,ax
+ DB 0c7H, 46H, 0feH
+L$3:
+ add byte ptr [bx+si],al
+L$4:
+ mov ax,word ptr -2[bp]
+ pop di
+ pop es
+L$5:
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf
+MXTERM:
+ xor ax,ax
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXLOADLATCHES
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXLOADLATCHES:
+ push ds
+ push si
+ mov dx,3ceH
+ mov ax,0ff08H
+ out dx,ax
+ mov ax,3
+ out dx,ax
+ mov ax,5
+ out dx,ax
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ mov si,0ffffH
+ mov bh,8
+ mov cx,3
+L$1:
+ mov dx,3ceH
+ mov al,4
+ mov ah,cl
+ out dx,ax
+ mov dx,3c4H
+ mov al,2
+ mov ah,bh
+ out dx,ax
+ mov al,byte ptr [si]
+ push ax
+ mov byte ptr [si],bl
+ mov al,byte ptr [di]
+ shr bh,1
+ loop L$1
+ mov cx,3
+ mov bh,8
+ mov dx,3c4H
+L$2:
+ mov al,2
+ mov ah,bh
+ out dx,ax
+ pop ax
+ mov byte ptr [si],al
+ shr bh,1
+ loop L$2
+ pop si
+ pop ds
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXLINE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$29
+ DW offset L$32
+ DW offset L$35
+ DW offset L$38
+MXLINE:
+ push bp
+ mov bp,sp
+ sub sp,12H
+ push ds
+ push si
+ push di
+ mov ax,word ptr 10H[bp]
+ mov bx,word ptr 0eH[bp]
+ mov cx,word ptr 0cH[bp]
+ mov dx,word ptr 0aH[bp]
+ call near ptr L$8
+ jae L$2
+ jmp near ptr L$7
+L$2:
+ mov si,cx
+ xchg ax,si
+ sub ax,si
+ jge L$3
+ xchg cx,si
+ xchg dx,bx
+ neg ax
+L$3:
+ mov word ptr -2[bp],ax
+ mov cx,word ptr cs:MX_BYTESPERLINE
+ mov ax,dx
+ sub ax,bx
+ jge L$4
+ neg cx
+ neg ax
+L$4:
+ mov word ptr -4[bp],ax
+ mov word ptr -0cH[bp],cx
+ mov ax,bx
+ mul word ptr cs:MX_BYTESPERLINE
+ mov cx,si
+ shr si,1
+ shr si,1
+ add si,ax
+ and cl,3
+ mov ax,1102H
+ shl ah,cl
+ mov byte ptr -12H[bp],ah
+ mov dx,3c4H
+ out dx,ax
+ mov ax,word ptr cs:MX_VIDEOSEGMENT
+ mov ds,ax
+ xor bx,bx
+ mov al,byte ptr 6[bp]
+ cmp al,0
+ je L$5
+ and al,3
+ shl al,1
+ shl al,1
+ shl al,1
+ mov ah,al
+ mov al,3
+ mov dx,3ceH
+ out dx,ax
+ inc bx
+ inc bx
+L$5:
+ mov ax,word ptr -2[bp]
+ mov cx,word ptr -4[bp]
+ cmp ax,cx
+ jae L$6
+ inc bx
+L$6:
+ shl bx,1
+ call word ptr cs:L$1[bx]
+ cmp byte ptr 6[bp],0
+ je L$7
+ mov ax,3
+ mov dx,3ceH
+ out dx,ax
+L$7:
+ xor ax,ax
+ pop di
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+L$8:
+ mov di,ax
+ mov si,dx
+ xor al,al
+ cmp cx,word ptr cs:MX_CLIPX1
+ jge L$9
+ or al,1
+L$9:
+ cmp cx,word ptr cs:MX_CLIPX2
+ jle L$10
+ or al,2
+L$10:
+ cmp si,word ptr cs:MX_CLIPY1
+ jge L$11
+ or al,4
+L$11:
+ cmp si,word ptr cs:MX_CLIPY2
+ jle L$12
+ or al,8
+L$12:
+ mov byte ptr -10H[bp],al
+ xor al,al
+ cmp di,word ptr cs:MX_CLIPX1
+ jge L$13
+ or al,1
+L$13:
+ cmp di,word ptr cs:MX_CLIPX2
+ jle L$14
+ or al,2
+L$14:
+ cmp bx,word ptr cs:MX_CLIPY1
+ jge L$15
+ or al,4
+L$15:
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$16
+ or al,8
+L$16:
+ mov byte ptr -0eH[bp],al
+ mov ah,byte ptr -10H[bp]
+ test ah,al
+ je L$17
+ jmp near ptr L$28
+L$17:
+ or ah,al
+ jne L$18
+ jmp near ptr L$27
+L$18:
+ mov ax,cx
+ sub ax,di
+ mov word ptr -0aH[bp],ax
+ mov ax,si
+ sub ax,bx
+ mov word ptr -0cH[bp],ax
+ mov al,byte ptr -0eH[bp]
+L$19:
+ test al,al
+ jne L$20
+ xchg di,cx
+ xchg si,bx
+ xchg byte ptr -10H[bp],al
+L$20:
+ test al,1
+ je L$21
+ mov ax,word ptr cs:MX_CLIPX1
+ sub ax,di
+ mov di,word ptr cs:MX_CLIPX1
+ jmp L$22
+L$21:
+ test al,2
+ je L$23
+ mov ax,word ptr cs:MX_CLIPX2
+ sub ax,di
+ mov di,word ptr cs:MX_CLIPX2
+L$22:
+ imul word ptr -0cH[bp]
+ idiv word ptr -0aH[bp]
+ add bx,ax
+ mov al,8
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$26
+ mov al,4
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$26
+ xor al,al
+ jmp L$26
+L$23:
+ test al,4
+ je L$24
+ mov ax,word ptr cs:MX_CLIPY1
+ sub ax,bx
+ mov bx,word ptr cs:MX_CLIPY1
+ jmp L$25
+L$24:
+ mov ax,word ptr cs:MX_CLIPY2
+ sub ax,bx
+ mov bx,word ptr cs:MX_CLIPY2
+L$25:
+ imul word ptr -0aH[bp]
+ idiv word ptr -0cH[bp]
+ add di,ax
+ mov al,1
+ cmp di,word ptr cs:MX_CLIPX1
+ jl L$26
+ mov al,2
+ cmp di,word ptr cs:MX_CLIPX2
+ jg L$26
+ xor al,al
+L$26:
+ mov ah,byte ptr -10H[bp]
+ test ah,al
+ jne L$28
+ or ah,al
+ je L$27
+ jmp near ptr L$19
+L$27:
+ mov ax,di
+ mov dx,si
+ clc
+ ret
+L$28:
+ stc
+ ret
+L$29:
+ mov di,ax
+ neg di
+ shl cx,1
+ mov word ptr -6[bp],cx
+ mov cx,ax
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov al,2
+ mov ah,byte ptr -12H[bp]
+ mov bl,byte ptr 8[bp]
+ mov dx,3c4H
+ inc cx
+L$30:
+ mov byte ptr [si],bl
+ dec cx
+ je L$31
+ rol ah,1
+ adc si,0
+ out dx,ax
+ add di,word ptr -6[bp]
+ jl L$30
+ add si,word ptr -0cH[bp]
+ sub di,word ptr -8[bp]
+ jmp L$30
+L$31:
+ ret
+L$32:
+ mov di,cx
+ neg di
+ shl ax,1
+ mov word ptr -6[bp],ax
+ mov ax,cx
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov bl,byte ptr 8[bp]
+ mov ah,byte ptr -12H[bp]
+ mov al,2
+ mov dx,3c4H
+ inc cx
+L$33:
+ mov byte ptr [si],bl
+ dec cx
+ je L$34
+ add si,word ptr -0cH[bp]
+ add di,word ptr -6[bp]
+ jl L$33
+ rol ah,1
+ adc si,0
+ out dx,ax
+ sub di,word ptr -8[bp]
+ jmp L$33
+L$34:
+ ret
+L$35:
+ mov di,ax
+ neg di
+ shl cx,1
+ mov word ptr -6[bp],cx
+ mov cx,ax
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov al,2
+ mov ah,byte ptr -12H[bp]
+ mov bl,byte ptr 8[bp]
+ mov dx,3c4H
+ inc cx
+L$36:
+ mov bh,byte ptr [si]
+ mov byte ptr [si],bl
+ dec cx
+ je L$37
+ rol ah,1
+ adc si,0
+ out dx,ax
+ add di,word ptr -6[bp]
+ jl L$36
+ add si,word ptr -0cH[bp]
+ sub di,word ptr -8[bp]
+ jmp L$36
+L$37:
+ ret
+L$38:
+ mov di,cx
+ neg di
+ shl ax,1
+ mov word ptr -6[bp],ax
+ mov ax,cx
+ shl ax,1
+ mov word ptr -8[bp],ax
+ mov bl,byte ptr 8[bp]
+ mov ah,byte ptr -12H[bp]
+ mov al,2
+ mov dx,3c4H
+ inc cx
+L$39:
+ mov bh,byte ptr [si]
+ mov byte ptr [si],bl
+ dec cx
+ je L$40
+ add si,word ptr -0cH[bp]
+ add di,word ptr -6[bp]
+ jl L$39
+ rol ah,1
+ adc si,0
+ out dx,ax
+ sub di,word ptr -8[bp]
+ jmp L$39
+L$40:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSETFONT
+ PUBLIC MXSETTEXTCOLOR
+ PUBLIC MXOUTCHAR
+ PUBLIC MXOUTTEXT
+ PUBLIC MXSETTEXTSTEP
+ PUBLIC MXGETTEXTSTEP
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MXPUTIMAGE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ; The label referred to here is an undefined location
+ jle 0ffffff8bH
+ movsw
+ and word ptr -7e67H[di],7e7eH
+ call bx
+ call bx
+ out 0ffH,ax
+ jle L$9
+ ????
+ ????
+ ????
+ jl L$7
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+L$2:
+ jl L$2
+ jl L$8
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+ adc byte ptr -2[si],dl
+ push sp
+ adc dh,bh
+ adc byte ptr [bx+si],bh
+L$3:
+ jl L$3
+L$4:
+ ????
+ jl L$5
+ inc byte ptr [bx+si]
+ sbb byte ptr [si],bh
+ jle L$11
+ cmp al,18H
+ add bh,bh
+ out 0c3H,ax
+ DB 81H, 81H, 0c3H, 0e7H
+L$5:
+ inc word ptr [bx+si]
+ cmp al,66H
+ inc dx
+ inc dx
+ DB 66H, 3cH
+L$6:
+ add bh,bh
+ ret
+ cwd
+ mov bp,99bdH
+L$7:
+ ret
+ inc word ptr [bx]
+ add ax,word ptr [di]
+ ; The label referred to here is an undefined location
+ js 0ffffffe1H
+ DB 84H
+L$8:
+ test byte ptr 7cH[bx+si],bh
+ add byte ptr 7c82H[bp+si],10H
+ cmp byte ptr [bx+si],dl
+ sbb al,10H
+ sbb al,10H
+ adc byte ptr [bx+si],dl
+ xor byte ptr [bx+si],dh
+ and bh,byte ptr ds:[2222H]
+ pushad
+ cwd
+ pop dx
+ cmp al,0e7H
+ out 3cH,ax
+ pop dx
+ cwd
+ add byte ptr [bx+si],dl
+ xor byte ptr -10H[bx+si],dh
+L$9:
+ jo L$10
+ adc byte ptr [bx+si],al
+ add al,0e0H
+ lock loopnz L$6
+ adc byte ptr [bx+si],38H
+ push sp
+ adc byte ptr [bx+si],dl
+ push sp
+ cmp byte ptr [bx+si],dl
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ add byte ptr [bx+si],cl
+ jle L$4
+ xchg ax,dx
+ jb L$10
+ adc dl,byte ptr [bp+si]
+ add byte ptr [si],bh
+ and bl,byte ptr [bx+si]
+ and al,24H
+ sbb byte ptr 3cH[si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ DB 0, 3eH
+ DD ds:[3eH]
+L$10:
+ add byte ptr [bx+si],bh
+ push sp
+ DB 10H
+L$11:
+ adc byte ptr [bx+si],dl
+ push sp
+ cmp dh,bh
+ add byte ptr [bx+si],dl
+ cmp byte ptr 10H[si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr 38H[si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],cl
+ add al,0feH
+ add al,8
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],ah
+ inc ax
+ inc byte ptr 20H[bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr -380H[bx+si],0
+ add byte ptr [bx+si],al
+ and al,42H
+ inc word ptr 24H[bp+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],bh
+L$12:
+ jl L$12
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ????
+ jl L$15
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ and al,24H
+ add byte ptr [bx+si],al
+ DB 0
+L$13:
+ add byte ptr [bx+si],al
+ and al,24H
+ jle 140H
+ jle 142H
+L$14:
+ and al,0
+ cmp byte ptr 50H[si],dl
+ cmp byte ptr [si],dl
+ push sp
+ cmp byte ptr [bx+si],dl
+ add byte ptr [bp+si],al
+ inc sp
+ or byte ptr [bx+si],dl
+ and byte ptr [bp+si],al
+ cmp byte ptr 38H[si],al
+ pusha
+ xchg ax,sp
+L$15:
+ DB 88H
+L$16:
+ je 138H
+ and byte ptr [bx+si],ah
+ inc ax
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ and byte ptr 40H[bx+si],al
+ inc ax
+ and byte ptr [bx+si],dl
+ add byte ptr 20H[bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],ah
+L$17:
+ inc ax
+ add byte ptr [bx+si],al
+ and al,18H
+ jle L$18
+ and al,0
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ jl L$18
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ and byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cld
+ DB 0
+L$18:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add al,8
+ adc byte ptr [bx+si],ah
+ inc ax
+L$19:
+ add byte ptr [bx+si],7cH
+ ????
+ DB 8aH, 92H
+L$20:
+ mov byte ptr 0c6H,al
+ DD L$21
+L$21:
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],bh
+ add byte ptr L$13[bx+si],bh
+ add al,18H
+ pusha
+ cmp ah,0
+ js L$14
+ add al,38H
+ add al,84H
+ js L$22
+L$22:
+ sbb al,24H
+ inc sp
+ test dh,bh
+ add al,0eH
+ add ah,bh
+ cmp al,4
+ add al,84H
+ js L$23
+L$23:
+ js L$16
+ cmp al,84H
+ test byte ptr [bx+si],bh
+ cld
+ add al,4
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],ah
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr -7cH[bx+si],bh
+ test byte ptr [bx+si],bh
+ js L$17
+ test byte ptr 4[si],bh
+ test byte ptr [bx+si],bh
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],ah
+ or byte ptr [bx+si],dl
+ and byte ptr 20H[bx+si],al
+ adc byte ptr [bx+si],cl
+ add byte ptr [bx+si],al
+ add ah,bh
+ add byte ptr [bx+si],al
+ cld
+ add byte ptr [bx+si],al
+ inc ax
+ and byte ptr [bx+si],dl
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],al
+ js L$19
+ add al,8
+ adc byte ptr [bx+si],al
+L$24:
+ adc byte ptr [bx+si],al
+ jl L$20
+ mov dx,0bea6H
+ cmp byte ptr [si],78H
+ test byte ptr -7b04H[si],al
+ test byte ptr -800H[si],al
+ test byte ptr -7b08H[si],al
+ test al,bh
+ add byte ptr -7cH[bx+si],bh
+ add byte ptr -7b80H[bx+si],78H
+ add al,dh
+ mov byte ptr -7b7cH[si],al
+ mov al,dh
+ add ah,bh
+ add byte ptr -7f10H[bx+si],80H
+ cld
+ add ah,bh
+ add byte ptr -7f10H[bx+si],80H
+ add byte ptr [bx+si],78H
+ test byte ptr -7b64H[bx+si],al
+ test byte ptr [bx+si],bh
+ test byte ptr -37cH[si],al
+ test byte ptr 84H[si],al
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ cmp byte ptr [bx+si],al
+ sbb al,8
+ or byte ptr [bx+si],cl
+ mov byte ptr 70H[bx+si],cl
+ test byte ptr -1f70H[bx+si],cl
+ nop
+ mov byte ptr -8000H[si],al
+ add byte ptr -7f80H[bx+si],80H
+ cld
+ add dh,al
+ stosb
+ xchg ax,dx
+ add byte ptr -7d7eH[bp+si],0
+ add dl,0a2H
+ xchg ax,dx
+ mov al,byte ptr 82H[bp]
+ js L$24
+ test byte ptr -7b7cH[si],al
+ js L$25
+L$25:
+ clc
+ test byte ptr -7f08H[si],al
+ add byte ptr 7800H[bx+si],84H
+ test byte ptr -776cH[si],al
+ jbe L$26
+L$26:
+ clc
+ test byte ptr -6f08H[si],al
+ mov byte ptr 7800H[si],al
+ test byte ptr 478H[bx+si],al
+ test byte ptr [bx+si],bh
+ ????
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr -7b7cH[si],al
+ test byte ptr 7884H[si],al
+ add byte ptr -7b7cH[si],al
+ test byte ptr 3048H[si],al
+ add byte ptr -7d7eH[bp+si],al
+ adc byte ptr -3956H[bp+si],0
+ add byte ptr 28H[si],10H
+ sub byte ptr -7eH[si],al
+ add byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add dh,bh
+ add al,8
+ adc byte ptr [bx+si],ah
+ inc ax
+ inc byte ptr [bx+si]
+ js L$32
+ inc ax
+ inc ax
+ inc ax
+ inc ax
+ js L$27
+L$27:
+ add byte ptr 2040H[bx+si],al
+ adc byte ptr [bx+si],cl
+ add al,0
+ js L$29
+ or byte ptr [bx+si],cl
+ or byte ptr [bx+si],cl
+ js L$28
+L$28:
+ adc byte ptr [bx+si],ch
+L$29:
+ inc sp
+ add byte ptr [bx+si],0
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ and byte ptr [bx+si],ah
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$30
+L$30:
+ add byte ptr 40H[bx+si],al
+ js L$33
+ inc sp
+ js L$31
+L$31:
+ add byte ptr [bx+si],al
+L$32:
+ cmp al,40H
+ inc ax
+ inc ax
+ cmp al,0
+ add byte ptr [si],al
+ add al,3cH
+ inc sp
+ inc sp
+ cmp al,0
+ add byte ptr [bx+si],al
+ cmp byte ptr 7cH[si],al
+ inc ax
+ cmp al,0
+ add byte ptr [si],cl
+ adc byte ptr [si],bh
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,44H
+ inc sp
+ cmp al,4
+ cmp byte ptr [bx+si],al
+ inc ax
+ inc ax
+ js L$35
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add al,0
+ add al,4
+ add al,44H
+ cmp byte ptr [bx+si],al
+L$33:
+ inc ax
+ inc ax
+ push ax
+ pusha
+ push ax
+ dec ax
+ add byte ptr [bx+si],al
+ xor byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr 54H[bx+si],ch
+ push sp
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ add byte ptr 44H[bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+L$34:
+ js L$42
+ inc sp
+ js L$41
+ inc ax
+ DB 0
+L$35:
+ add byte ptr [si],bh
+ inc sp
+ inc sp
+ cmp al,4
+ add al,0
+ add byte ptr 60H[si],bl
+ inc ax
+ inc ax
+ inc ax
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bh
+L$36:
+ inc ax
+ jl L$38
+ jl L$37
+L$37:
+ add byte ptr [bx+si],dl
+L$38:
+ cmp byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ sub byte ptr [bx+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr 44H[si],al
+L$39:
+ push sp
+ push sp
+ insb
+ add byte ptr [bx+si],al
+ add byte ptr 28H[si],al
+L$40:
+ adc byte ptr [bx+si],ch
+ inc sp
+L$41:
+ DB 0
+L$42:
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp al,4
+ jl L$43
+L$43:
+ add byte ptr 4[si],bh
+ cmp byte ptr 7cH[bx+si],al
+ add byte ptr [bx+si],al
+ or byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dh
+ adc byte ptr [bx+si],dl
+ or byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ and byte ptr [bx+si],dl
+ adc byte ptr [bx+si],bl
+ adc byte ptr [bx+si],dl
+ and byte ptr -68H[si],ah
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],dl
+ sub byte ptr -7eH[si],al
+ cmp dh,0
+ jl L$34
+ add byte ptr 7c80H[bx+si],4
+ jl L$44
+L$44:
+ sub byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ cmp al,0
+ jl L$54
+ jl L$53
+ jl L$45
+L$45:
+ jle L$36
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$46
+L$46:
+ and al,0
+L$47:
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$48
+L$48:
+ js L$49
+L$49:
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$50
+L$50:
+ sbb byte ptr [bx+si],bl
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$51
+L$51:
+ add byte ptr [bx+si],al
+ js L$39
+ cmp byte ptr 8[bx+si],38H
+ jl L$40
+ cmp byte ptr 7cH[si],al
+ inc ax
+ cmp al,0
+ dec ax
+ add byte ptr [bx+si],bh
+ inc sp
+ jl L$55
+ cmp al,0
+ js L$52
+L$52:
+ cmp byte ptr 7cH[si],al
+ inc ax
+L$53:
+ cmp al,0
+L$54:
+ add byte ptr [bx+si],ch
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],ch
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],dh
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ dec ax
+ add byte ptr -7cH[bx+si],bh
+ cld
+ test byte ptr 3000H[si],al
+ xor byte ptr -7cH[bx+si],bh
+ cld
+ test byte ptr 3800H[si],al
+ add ah,bh
+ xor al,80H
+ cld
+ add byte ptr [bx+si],al
+ add byte ptr 8[bp],bh
+ jle L$59
+L$55:
+ jle L$56
+L$56:
+ jle L$47
+ nop
+ cld
+ nop
+ nop
+ sahf
+ add byte ptr -7eH[si],bh
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ sub byte ptr [bx+si],al
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ jo L$57
+L$57:
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ cmp byte ptr [si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ jo L$58
+L$58:
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ sub byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ cmp al,4
+ jl L$64
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr 78H[si],al
+ dec ax
+ add byte ptr -7b7cH[si],al
+ DB 84H
+L$59:
+ js 4d8H
+ add byte ptr [bx+si],dl
+ cmp byte ptr 40H[bx+si],al
+ inc ax
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr 40H[si],al
+ loopnz L$66
+ inc ax
+ cmp ah,44H
+ jl L$60
+ jl L$61
+ jl L$62
+ add al,dh
+ mov byte ptr -7d09H[bp+si],cl
+ add byte ptr 0c00H[bp+si],12H
+ DB 10H
+L$60:
+ sbb byte ptr [bx+si],dh
+L$61:
+ DB 10H, 90H
+L$62:
+ pusha
+ cmp al,0
+ cmp byte ptr [si],al
+ cmp al,44H
+ jl L$63
+L$63:
+ add byte ptr [bx+si],bl
+ add byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],al
+ DB 1cH
+L$64:
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ sbb al,0
+ inc sp
+ inc sp
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ jl L$65
+L$65:
+ js L$67
+ inc sp
+L$66:
+ inc sp
+ inc sp
+ add byte ptr [si],bh
+ inc sp
+ push sp
+ dec sp
+ inc sp
+ add byte ptr [bx+si],bl
+ and al,24H
+ push ds
+ add byte ptr ds:[0],bh
+ sbb al,22H
+ and bl,byte ptr [si]
+ add byte ptr ds:[0],bh
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],ah
+ inc ax
+ inc dx
+ cmp al,0
+ add byte ptr [bx+si],al
+ add ah,bh
+ add byte ptr [bx+si],0
+ add byte ptr [bx+si],al
+ cld
+ add al,4
+ add byte ptr [bx+si],al
+ inc ax
+ inc sp
+ dec ax
+ push di
+ and word ptr 4[bx],ax
+ pop es
+ inc ax
+ inc sp
+ dec ax
+ push dx
+ dec dx
+ pop ds
+ DB 2
+L$67:
+ adc byte ptr [bx+si],al
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+L$68:
+ adc byte ptr [bx+si],al
+ add byte ptr [si],ah
+L$69:
+ dec ax
+ nop
+ dec ax
+ and al,0
+ add byte ptr [bx+si],al
+ dec ax
+ and al,12H
+ and al,48H
+ add byte ptr [bx+si],al
+ and cl,byte ptr -77deH[bx+si]
+ and cl,byte ptr -77deH[bx+si]
+ push bp
+ stosb
+ push bp
+ stosb
+ push bp
+ stosb
+ push bp
+ stosb
+ ????
+ ja L$68
+ out dx,al
+ ????
+ ja L$69
+ out dx,al
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ clc
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb al,bh
+ sbb al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[3636H],dh
+ div byte ptr ss:[3636H]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ ????
+ add byte ptr ss:[bx+si],al
+ clc
+ sbb al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[0f636H],dh
+ push es
+ div byte ptr ds:[3636H]
+ add byte ptr ss:[bx+si],al
+ inc byte ptr ds:[36f6H]
+ test byte ptr ss:[0feH],0
+ add byte ptr ds:[3636H],dh
+ inc byte ptr ss:[bx+si]
+ add byte ptr [bx+si],al
+ sbb byte ptr [bx+si],bl
+ clc
+ sbb al,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add al,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb bh,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add bh,bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb bh,bh
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr ds:[3636H],dh
+ aaa
+ aaa
+ xor byte ptr [bx],bh
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bh
+ xor byte ptr [bx],dh
+ test word ptr ss:[bx+si],0ffH
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc word ptr [bx+si]
+ div word ptr ds:[3636H]
+ aaa
+ xor byte ptr [bx],dh
+ add byte ptr ss:[bx+si],al
+ inc word ptr [bx+si]
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ test word ptr ss:[bx+si],36f7H
+ sbb byte ptr ss:[bx+si],bl
+ inc word ptr [bx+si]
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ inc word ptr ss:[bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc word ptr [bx+si]
+ call dword ptr [bx+si]
+ sbb byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push word ptr ds:[3636H]
+ aas
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bl
+ sbb byte ptr [bx],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bh
+ push word ptr ss:[3636H]
+ sbb byte ptr [bx+si],bl
+ call dword ptr [bx+si]
+ call dword ptr [bx+si]
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ sbb byte ptr [bx+si],bl
+ clc
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx],bl
+ DB 18H
+L$70:
+ sbb byte ptr [bx+si],bl
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ add bh,bh
+ ????
+ ????
+ push ax
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ ????
+ inc word ptr [bx+si]
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr -6cH[bp+si],ah
+ mov byte ptr 62H[si],dl
+ add al,dh
+ mov al,dh
+ mov byte ptr -7f10H[bx+si],cl
+ add al,bh
+ mov byte ptr -7f80H[bx+si],al
+ add byte ptr [bx+si],0
+ cld
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ dec ax
+ add ah,bh
+ test byte ptr 20H[bx+si],al
+ inc ax
+ test ah,bh
+ add byte ptr [si],bh
+ inc ax
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ inc sp
+ inc sp
+ inc sp
+ js L$71
+ inc ax
+ add byte ptr ds:[848H],dh
+ or byte ptr [bx+si],cl
+ or byte ptr [bx+si],al
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr 44H[si],al
+ cmp byte ptr [bx+si],dl
+ cmp byte ptr -7cH[bx+si],bh
+ test ah,bh
+ test byte ptr 78H[si],al
+ js L$70
+ test byte ptr 4848H[si],al
+ int 3
+ add byte ptr 4[bx+si],bh
+ cmp byte ptr 44H[si],al
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ insb
+ xchg ax,dx
+ xchg ax,dx
+ insb
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,byte ptr 5aH[si]
+ and bl,byte ptr [si]
+ sbb byte ptr [bx+si],ah
+ inc ax
+ js L$73
+ and byte ptr [bx+si],bl
+L$71:
+ add byte ptr -7cH[bx+si],bh
+ test byte ptr -7b7cH[si],al
+ test byte ptr [bx+si],al
+ add ah,bh
+ add ah,bh
+ add ah,bh
+ add byte ptr [bx+si],al
+ and byte ptr [bx+si],ah
+ clc
+ and byte ptr [bx+si],ah
+ add al,bh
+ add byte ptr [bx+si],ah
+ adc byte ptr [bx+si],cl
+ adc byte ptr [bx+si],ah
+ add byte ptr [si],bh
+ or byte ptr [bx+si],dl
+ and byte ptr [bx+si],dl
+ or byte ptr [bx+si],al
+ jl L$72
+L$72:
+ or al,12H
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ adc byte ptr [bx+si],dl
+ nop
+ pusha
+ add byte ptr [bx+si],dl
+ add byte ptr [si],bh
+L$73:
+ adc byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ xor cl,byte ptr [si]
+ xor cl,byte ptr [si]
+ add byte ptr [bx+si],bh
+ inc sp
+ inc sp
+ cmp byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ sbb byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],bl
+ add byte ptr [bx+si],al
+ add byte ptr ds:[808H],cl
+ or byte ptr 28H[bx+si],cl
+ sbb byte ptr [bx+si],cl
+ cmp byte ptr [si],ah
+ and al,24H
+ and al,0
+ add byte ptr [bx+si],al
+ cmp al,4
+ cmp al,20H
+ cmp al,0
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ cmp al,3cH
+ cmp al,3cH
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+L$74:
+ DW offset L$1
+L$75:
+ DB 8
+L$76:
+ add byte ptr [bx+si],cl
+ DB 0
+L$77:
+ DW offset L$1
+L$78:
+ DW seg L$1
+L$79:
+ or byte ptr [bx+si],al
+L$80:
+ or byte ptr [bx+si],al
+L$81:
+ or byte ptr [bx+si],al
+L$82:
+ inc word ptr [bx+si]
+L$83:
+ add byte ptr [bx+si],al
+L$84:
+ or byte ptr [bx+si],al
+L$85:
+ add byte ptr [bx+si],al
+MXSETFONT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 0cH[bp]
+ test ax,ax
+ jne L$87
+ mov ax,word ptr 0aH[bp]
+ cmp ax,1
+ jb L$86
+ xor ax,ax
+L$86:
+ shl ax,1
+ shl ax,1
+ mov bx,ax
+ mov ax,word ptr L$74[bx]
+ mov word ptr L$77,ax
+ mov word ptr L$78,cs
+ mov al,byte ptr L$75[bx]
+ xor ah,ah
+ mov word ptr L$79,ax
+ mov word ptr L$84,ax
+ mov dl,byte ptr L$76[bx]
+ xor dh,dh
+ mov word ptr L$80,dx
+ mul dx
+ mov word ptr L$81,ax
+ mov word ptr L$84,ax
+ xor ax,ax
+ mov word ptr L$85,ax
+ jmp L$88
+L$87:
+ mov ax,0ffffH
+ mov bx,word ptr 8[bp]
+ cmp bx,10H
+ ja L$88
+ mov dx,word ptr 6[bp]
+ cmp dx,20H
+ ja L$88
+ mov word ptr L$79,bx
+ mov word ptr L$80,dx
+ mov ax,bx
+ add ax,7
+ shr ax,1
+ shr ax,1
+ shr ax,1
+ mul dx
+ mov word ptr L$81,ax
+ mov ax,word ptr 0aH[bp]
+ mov word ptr L$77,ax
+ mov ax,word ptr 0cH[bp]
+ mov word ptr L$78,ax
+ xor ax,ax
+L$88:
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXSETTEXTCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 8[bp]
+ mov word ptr L$82,ax
+ mov ax,word ptr 6[bp]
+ mov word ptr L$83,ax
+ xor ax,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXOUTCHAR:
+ push bp
+ mov bp,sp
+ sub sp,202H
+ push ds
+ push si
+ push es
+ push di
+ lds si,dword ptr cs:L$77
+ mov al,byte ptr 6[bp]
+ xor ah,ah
+ mul word ptr cs:L$81
+ add si,ax
+ mov ax,ss
+ mov es,ax
+ lea di,-200H[bp]
+ mov dx,word ptr cs:L$82
+ mov ax,word ptr cs:L$80
+ mov word ptr -202H[bp],ax
+L$89:
+ mov cx,word ptr cs:L$79
+ mov bh,byte ptr [si]
+ inc si
+ cmp cx,8
+ jbe L$90
+ mov bl,byte ptr [si]
+ inc si
+L$90:
+ mov al,dl
+ shl bx,1
+ jb L$91
+ mov al,dh
+L$91:
+ mov byte ptr es:[di],al
+ inc di
+ dec cx
+ jne L$90
+ dec word ptr -202H[bp]
+ jne L$89
+ lea ax,-200H[bp]
+ push es
+ push ax
+ push word ptr 0aH[bp]
+ push word ptr 8[bp]
+ push word ptr cs:L$79
+ push word ptr cs:L$80
+ push word ptr cs:L$83
+ push cs
+ call near ptr MX_TEXT:MXPUTIMAGE
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 6
+MXOUTTEXT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 6[bp]
+L$92:
+ mov al,byte ptr [si]
+ test al,al
+ je L$93
+ inc si
+ push word ptr 0cH[bp]
+ push word ptr 0aH[bp]
+ push ax
+ push cs
+ call near ptr MXOUTCHAR
+ mov ax,word ptr cs:L$84
+ add word ptr 0cH[bp],ax
+ mov ax,word ptr cs:L$85
+ add word ptr 0aH[bp],ax
+ dec word ptr -202H[bp]
+ jne L$92
+L$93:
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+ retf
+MXSETTEXTSTEP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr 8[bp]
+ mov word ptr L$84,ax
+ mov ax,word ptr 6[bp]
+ mov word ptr L$85,ax
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXGETTEXTSTEP:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr cs:L$84
+ lds si,dword ptr 0aH[bp]
+ mov word ptr [si],ax
+ mov ax,word ptr cs:L$85
+ lds si,dword ptr 6[bp]
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+;-----------------------------------------------------------\r
+;\r
+; MXOT.ASM - Text functions\r
+; Copyright (c) 1994 by Alessandro Scotti\r
+;\r
+;-----------------------------------------------------------\r
+;WARN PRO\r
+;NOWARN RES ; We use the reserved name 'WIDTH'\r
+INCLUDE MODEX.DEF\r
+\r
+PUBLIC mxOutChar\r
+PUBLIC mxOutText\r
+PUBLIC mxSetFont\r
+PUBLIC mxSetTextColor\r
+PUBLIC mxGetTextStep\r
+PUBLIC mxSetTextStep\r
+\r
+MAX_WIDTH EQU 16 ; Must be <= 16\r
+MAX_HEIGHT EQU 32\r
+\r
+MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'\r
+ ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING\r
+\r
+EXTRN mx_CodeSegment : WORD\r
+EXTRN mxPutImage : FAR\r
+\r
+; Default 8x8 font\r
+fnt_Default LABEL BYTE\r
+ INCLUDE DEFAULT.FNT\r
+\r
+; Table of system fonts\r
+tbl_SystemFont LABEL WORD\r
+ DW fnt_Default, 8, 8\r
+\r
+MX_MAXSYSFONT EQU ($-OFFSET tbl_SystemFont) SHR 2\r
+\r
+mx_FontPtr DW OFFSET fnt_Default, SEG MX_TEXT\r
+mx_FontWidth DW 8 ; Font width in pixels\r
+mx_FontHeight DW 8 ; Font height in pixels\r
+mx_FontCharSize DW 8 ; Size in bytes of a font character\r
+mx_FontColor DW 00FFh ; Color: foreground + background*256\r
+mx_FontOp DW OP_MOVE ; Raster op\r
+mx_DeltaX DW 8 ; Horizontal step\r
+mx_DeltaY DW 0 ; Vertical step\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the current font.\r
+;\r
+; Input:\r
+; Font = pointer to font data\r
+; Width = width of font character in pixels\r
+; Height = height of font character in pixels\r
+; Output:\r
+; AX = 0 on success, else invalid parameters\r
+;\r
+; Note: when the high word of Font (i.e. the segment) is zero, the low\r
+; word is used to select one of the system fonts.\r
+;\r
+mxSetFont PROC FAR\r
+ push bp\r
+ mov bp,sp\r
+ sub sp,0\r
+ push ds\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, WORD PTR Font[2] ; Get font segment\r
+ test ax, ax ; Null segment?\r
+ jnz @@UserFont ; No, install user font\r
+\r
+; Install system font\r
+ mov ax, WORD PTR Font[0] ; Get font number\r
+ cmp ax, MX_MAXSYSFONT ; Check range\r
+ jb @@SystemFont\r
+ xor ax, ax ; Out of range, use default font\r
+@@SystemFont:\r
+ shl ax, 1\r
+ shl ax, 1\r
+ mov bx, ax\r
+ mov ax, tbl_SystemFont[bx] ; Get font offset\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov WORD PTR mx_FontPtr[2], cs\r
+ mov al, BYTE PTR tbl_SystemFont[bx+2]\r
+ xor ah, ah\r
+ mov [mx_FontWidth], ax\r
+ mov [mx_DeltaX], ax\r
+ mov dl, BYTE PTR tbl_SystemFont[bx+3]\r
+ xor dh, dh\r
+ mov [mx_FontHeight], dx\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov [mx_DeltaX], ax\r
+ xor ax, ax\r
+ mov [mx_DeltaY], ax\r
+ jmp @@Exit\r
+\r
+; Install user font\r
+@@UserFont:\r
+ mov ax, -1 ; Assume an error\r
+ mov bx, [bp+8]\r
+ cmp bx, MAX_WIDTH\r
+ ja @@Exit ; Invalid character width\r
+ mov dx, [bp+4]\r
+ cmp dx, MAX_HEIGHT\r
+ ja @@Exit ; Invalid character height\r
+ mov [mx_FontWidth], bx\r
+ mov [mx_FontHeight], dx\r
+ mov ax, bx\r
+ add ax, 7\r
+ shr ax, 1\r
+ shr ax, 1\r
+ shr ax, 1\r
+ mul dx\r
+ mov [mx_FontCharSize], ax\r
+ mov ax, WORD PTR Font[0]\r
+ mov WORD PTR mx_FontPtr[0], ax\r
+ mov ax, WORD PTR Font[2]\r
+ mov WORD PTR mx_FontPtr[2], ax\r
+ xor ax, ax\r
+\r
+@@Exit:\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ ;.leave ARG_SIZE\r
+mxSetFont ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the text color and raster op.\r
+;\r
+; Input:\r
+; Color = text color (foreground + background*256)\r
+; Op = raster op\r
+; Output:\r
+; none\r
+;\r
+mxSetTextColor PROC FAR\r
+ ARG Op:WORD, \\r
+ Color:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [Color]\r
+ mov [mx_FontColor], ax\r
+ mov ax, [Op]\r
+ mov [mx_FontOp], ax\r
+\r
+ xor ax, ax\r
+ .pop ds\r
+ ASSUME ds:NOTHING\r
+ .leave ARG_SIZE\r
+mxSetTextColor ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a character using the current font and attributes.\r
+;\r
+; Input:\r
+; X, Y = video coordinates\r
+; C = character to print\r
+; Output:\r
+; none\r
+;\r
+mxOutChar PROC FAR\r
+ ARG C:BYTE:2, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ LOCAL Image:BYTE:MAX_WIDTH*MAX_HEIGHT, \\r
+ Count:WORD = AUTO_SIZE\r
+ .enter AUTO_SIZE\r
+ .push ds, si, es, di\r
+ ASSUME ds:NOTHING\r
+\r
+; Gets the pointer to font data for the selected character\r
+ lds si, DWORD PTR [mx_FontPtr]\r
+ mov al, [C]\r
+ xor ah, ah\r
+ mul [mx_FontCharSize] ; Offset into font\r
+ add si, ax ; DS:SI -> font data for character\r
+\r
+; Converts font data into a 256-color linear image\r
+ mov ax, ss\r
+ mov es, ax\r
+ lea di, [Image]\r
+ mov dx, [mx_FontColor]\r
+ mov ax, [mx_FontHeight]\r
+ mov [Count], ax\r
+@@HeightLoop:\r
+ mov cx, [mx_FontWidth]\r
+ mov bh, ds:[si]\r
+ inc si ; Get a byte from font data\r
+ cmp cx, 8\r
+ jbe @@WidthLoop ; Ok for width <= 8\r
+ mov bl, ds:[si] ; Get another byte\r
+ inc si\r
+@@WidthLoop:\r
+ mov al, dl ; Assume foreground color\r
+ shl bx, 1 ; Is font bit set?\r
+ jc @@1 ; Yes, foreground is just great\r
+ mov al, dh ; Get background color\r
+@@1:\r
+ mov es:[di], al ; Put pixel into image\r
+ inc di\r
+ dec cx\r
+ jnz @@WidthLoop\r
+ dec [Count]\r
+ jnz @@HeightLoop\r
+\r
+; Now pass image to mx_PutImage\r
+ lea ax, [Image]\r
+ push es\r
+ push ax ; Pointer to image\r
+ push [X]\r
+ push [Y] ; Image coordinates\r
+ push [mx_FontWidth]\r
+ push [mx_FontHeight] ; Image size\r
+ push [mx_FontOp] ; Raster op\r
+ call mxPutImage ; Write character\r
+\r
+ xor ax, ax\r
+ .pop ds, si, es, di\r
+ .leave ARG_SIZE\r
+mxOutChar ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Writes a string at the coordinates specified.\r
+;\r
+; Input:\r
+; X, Y = text coordinates\r
+; S = pointer to ASCIIZ string\r
+; Output:\r
+; none\r
+;\r
+mxOutText PROC FAR\r
+ ARG S:DWORD, \\r
+ Y:WORD, \\r
+ X:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ lds si, [S]\r
+@@Loop:\r
+ mov al, ds:[si]\r
+ test al, al ; End of string?\r
+ jz @@Exit ; Yes, exit\r
+ inc si\r
+ push [X] ; Display character\r
+ push [Y]\r
+ push ax\r
+ call mxOutChar\r
+ mov ax, [mx_DeltaX]\r
+ add [X], ax ; Bump X coordinate\r
+ mov ax, [mx_DeltaY]\r
+ add [Y], ax ; Bump Y coordinate\r
+ dec [Count]\r
+ jnz @@Loop\r
+\r
+@@Exit:\r
+ xor ax, ax\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+ ret\r
+mxOutText ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Sets the distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = horizontal distance in pixels\r
+; DeltaY = vertical distance in pixels\r
+; Output:\r
+; none\r
+;\r
+; Note: this function may be used to set the text direction.\r
+;\r
+mxSetTextStep PROC FAR\r
+ ARG DeltaY:WORD, \\r
+ DeltaX:WORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds\r
+\r
+ mov ds, [mx_CodeSegment]\r
+ ASSUME ds:MX_TEXT\r
+\r
+ mov ax, [DeltaX]\r
+ mov [mx_DeltaX], ax\r
+ mov ax, [DeltaY]\r
+ mov [mx_DeltaY], ax\r
+\r
+ .pop ds\r
+ .leave ARG_SIZE\r
+mxSetTextStep ENDP\r
+\r
+;-----------------------------------------------------------\r
+;\r
+; Gets the current distance between characters.\r
+;\r
+; Input:\r
+; DeltaX = pointer to horizontal distance in pixels (integer)\r
+; DeltaY = pointer to vertical distance in pixels (integer)\r
+; Output:\r
+; none\r
+;\r
+mxGetTextStep PROC FAR\r
+ ARG DeltaY:DWORD, \\r
+ DeltaX:DWORD = ARG_SIZE\r
+ .enter 0\r
+ .push ds, si\r
+ ASSUME ds:NOTHING\r
+\r
+ mov ax, [mx_DeltaX]\r
+ lds si, [DeltaX]\r
+ mov ds:[si], ax\r
+ mov ax, [mx_DeltaY]\r
+ lds si, [DeltaY]\r
+ mov ds:[si], ax\r
+\r
+ .pop ds, si\r
+ .leave ARG_SIZE\r
+mxGetTextStep ENDP\r
+\r
+MX_TEXT ENDS\r
+END\r
--- /dev/null
+.387
+ PUBLIC MX_SCANBUFFER
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_SCANBUFFER:
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXFILLPOLY
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_SCANBUFFER:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov cx,word ptr [si]
+ sub cx,word ptr [bx]
+ jg L$2
+ ret
+L$2:
+ push bp
+ mov ax,word ptr 2[si]
+ mov bx,word ptr 2[bx]
+ sub ax,bx
+ jg L$4
+ jl L$6
+ mov ax,bx
+L$3:
+ mov word ptr es:[di],ax
+ add di,4
+ dec cx
+ jne L$3
+ jmp L$8
+L$4:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$5:
+ mov word ptr es:[di],ax
+ add di,4
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$5
+ jmp L$8
+L$6:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$7:
+ mov word ptr es:[di],ax
+ add di,4
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$7
+L$8:
+ pop bp
+ ret
+MXFILLPOLY:
+ push bp
+ mov bp,sp
+ sub sp,1eH
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 10H[bp]
+ cmp cx,3
+ jae L$9
+ jmp near ptr L$36
+L$9:
+ les di,dword ptr 0cH[bp]
+ lds si,dword ptr 8[bp]
+ mov word ptr -16H[bp],7fffH
+ mov word ptr -1aH[bp],8000H
+ mov word ptr -18H[bp],7fffH
+ mov word ptr -1eH[bp],8000H
+ xor dx,dx
+L$10:
+ mov bx,word ptr es:[di]
+ shl bx,1
+ shl bx,1
+ add bx,si
+ mov ax,word ptr [bx]
+ cmp ax,word ptr -16H[bp]
+ jge L$11
+ mov word ptr -16H[bp],ax
+ mov word ptr -0eH[bp],dx
+ mov word ptr -10H[bp],dx
+L$11:
+ cmp ax,word ptr -1aH[bp]
+ jle L$12
+ mov word ptr -1aH[bp],ax
+ mov word ptr -12H[bp],dx
+L$12:
+ mov ax,word ptr 2[bx]
+ cmp ax,word ptr -18H[bp]
+ jge L$13
+ mov word ptr -18H[bp],ax
+L$13:
+ cmp ax,word ptr -1eH[bp]
+ jle L$14
+ mov word ptr -1eH[bp],ax
+L$14:
+ inc di
+ inc dx
+ inc di
+ inc dx
+ dec cx
+ jne L$10
+ mov ax,word ptr -1aH[bp]
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$15
+ jmp near ptr L$36
+L$15:
+ mov bx,word ptr -16H[bp]
+ cmp bx,word ptr cs:MX_CLIPX2
+ jle L$16
+ jmp near ptr L$36
+L$16:
+ sub ax,bx
+ jg L$17
+ jmp near ptr L$36
+L$17:
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jge L$18
+ jmp near ptr L$36
+L$18:
+ mov bx,word ptr -18H[bp]
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$19
+ jmp near ptr L$36
+L$19:
+ sub ax,bx
+ jg L$20
+ jmp near ptr L$36
+L$20:
+ dec word ptr 10H[bp]
+ shl word ptr 10H[bp],1
+ mov es,word ptr cs:MX_CODESEGMENT
+ mov ax,offset MX_TEXT:MX_SCANBUFFER
+ mov word ptr -4[bp],ax
+ mov si,word ptr -0eH[bp]
+L$21:
+ lds bx,dword ptr 0cH[bp]
+ mov di,word ptr [bx+si]
+ dec si
+ dec si
+ test si,si
+ jge L$22
+ mov si,word ptr 10H[bp]
+L$22:
+ mov word ptr -0eH[bp],si
+ mov si,word ptr [bx+si]
+ shl di,1
+ shl di,1
+ shl si,1
+ shl si,1
+ lds bx,dword ptr 8[bp]
+ add si,bx
+ add bx,di
+ mov di,word ptr -4[bp]
+ call near ptr L$1
+ mov word ptr -4[bp],di
+ mov si,word ptr -0eH[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$21
+ mov ax,offset MX_TEXT:MX_SCANBUFFER+2
+ mov word ptr -6[bp],ax
+ mov si,word ptr -10H[bp]
+L$23:
+ lds bx,dword ptr 0cH[bp]
+ mov di,word ptr [bx+si]
+ inc si
+ inc si
+ cmp si,word ptr 10H[bp]
+ jbe L$24
+ xor si,si
+L$24:
+ mov word ptr -10H[bp],si
+ mov si,word ptr [bx+si]
+ shl di,1
+ shl di,1
+ shl si,1
+ shl si,1
+ lds bx,dword ptr 8[bp]
+ add si,bx
+ add bx,di
+ mov di,word ptr -6[bp]
+ call near ptr L$1
+ mov word ptr -6[bp],di
+ mov si,word ptr -10H[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$23
+ mov si,offset MX_TEXT:MX_SCANBUFFER
+ mov ax,word ptr -16H[bp]
+ mov cx,word ptr -1aH[bp]
+ sub cx,ax
+ mov bx,word ptr cs:MX_CLIPX1
+ sub bx,ax
+ jle L$25
+ sub cx,bx
+ add ax,bx
+ mov word ptr -16H[bp],ax
+ shl bx,1
+ shl bx,1
+ add si,bx
+L$25:
+ mov bx,ax
+ add bx,cx
+ sub bx,word ptr cs:MX_CLIPX2
+ jle L$26
+ sub cx,bx
+L$26:
+ test cx,cx
+ jg L$27
+ jmp near ptr L$36
+L$27:
+ mov word ptr -8[bp],cx
+ mov word ptr -4[bp],si
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr -18H[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$28
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$28
+ jmp L$32
+L$28:
+ mov di,cx
+ inc di
+ sub si,4
+L$29:
+ dec di
+ je L$32
+ add si,4
+ mov ax,word ptr [si]
+ mov cx,word ptr 2[si]
+ mov dx,word ptr cs:MX_CLIPY2
+ cmp ax,dx
+ jg L$31
+ cmp cx,dx
+ jle L$30
+ mov word ptr 2[si],dx
+ mov bx,cx
+ sub bx,dx
+ sub cx,ax
+ jle L$31
+ mov cx,word ptr 2[si]
+L$30:
+ mov dx,word ptr cs:MX_CLIPY1
+ cmp cx,dx
+ jl L$31
+ sub cx,ax
+ jle L$31
+ cmp ax,dx
+ jge L$29
+ mov word ptr [si],dx
+ sub dx,ax
+ cmp cx,dx
+ ja L$29
+L$31:
+ mov word ptr [si],0ffffH
+ jmp L$29
+L$32:
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ mov si,word ptr -4[bp]
+ mov cl,byte ptr -16H[bp]
+ and cl,3
+ mov al,11H
+ shl al,cl
+ mov byte ptr -2[bp],al
+ shr word ptr -16H[bp],1
+ shr word ptr -16H[bp],1
+L$33:
+ mov ax,word ptr [si]
+ test ax,ax
+ js L$35
+ mov cx,word ptr 2[si]
+ sub cx,ax
+ jle L$35
+ mul word ptr cs:MX_BYTESPERLINE
+ add ax,word ptr -16H[bp]
+ mov di,ax
+ mov ah,byte ptr -2[bp]
+ mov dx,3c4H
+ mov al,2
+ out dx,ax
+ mov ax,word ptr 6[bp]
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ shr cx,1
+ jae L$34
+ mov byte ptr es:[di],al
+ add di,dx
+ jcxz L$35
+L$34:
+ mov byte ptr es:[di],al
+ add di,dx
+ mov byte ptr es:[di],al
+ add di,dx
+ dec cx
+ jne L$34
+L$35:
+ rol byte ptr -2[bp],1
+ adc word ptr -16H[bp],0
+ add si,4
+ dec word ptr -8[bp]
+ jne L$33
+L$36:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGOURAUDPOLY
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_SCANBUFFER:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ mov cx,word ptr [si]
+ sub cx,word ptr [bx]
+ jg L$2
+ ret
+L$2:
+ push bp
+ push di
+ push cx
+ push ax
+ push dx
+ mov ax,word ptr 2[si]
+ mov bx,word ptr 2[bx]
+ sub ax,bx
+ jg L$4
+ jl L$6
+ mov ax,bx
+L$3:
+ mov word ptr es:[di],ax
+ add di,8
+ dec cx
+ jne L$3
+ jmp L$8
+L$4:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$5:
+ mov word ptr es:[di],ax
+ add di,8
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$5
+ jmp L$8
+L$6:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$7:
+ mov word ptr es:[di],ax
+ add di,8
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$7
+L$8:
+ pop bx
+ pop ax
+ pop cx
+ pop di
+ sub ax,bx
+ jg L$10
+ jl L$12
+ mov ah,bl
+ mov al,80H
+L$9:
+ mov word ptr es:2[di],ax
+ add di,8
+ dec cx
+ jne L$9
+ jmp L$14
+L$10:
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$11:
+ mov byte ptr es:3[di],al
+ mov byte ptr es:2[di],dh
+ add di,8
+ add dx,bx
+ adc ax,bp
+ dec cx
+ jne L$11
+ jmp L$14
+L$12:
+ neg ax
+ cwd
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ xchg ax,bx
+ mov dx,8000H
+L$13:
+ mov byte ptr es:3[di],al
+ mov byte ptr es:2[di],dh
+ add di,8
+ sub dx,bx
+ sbb ax,bp
+ dec cx
+ jne L$13
+L$14:
+ pop bp
+ ret
+L$15:
+ mov ax,word ptr 6[si]
+ mov bx,word ptr 2[si]
+ cmp ah,bh
+ jg L$17
+ jl L$19
+ add ax,dx
+ mov dx,word ptr cs:MX_BYTESPERLINE
+L$16:
+ mov byte ptr es:[di],ah
+ add di,dx
+ dec cx
+ jne L$16
+ ret
+L$17:
+ push bp
+ push si
+ mov si,bx
+ add si,dx
+ sub ax,bx
+ xor dx,dx
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ mov bx,ax
+ mov dx,8000H
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ xchg ax,si
+L$18:
+ mov byte ptr es:[di],ah
+ add dx,bx
+ adc ax,bp
+ add di,si
+ dec cx
+ jne L$18
+ pop si
+ pop bp
+ ret
+L$19:
+ push bp
+ push si
+ mov si,bx
+ add si,dx
+ sub ax,bx
+ neg ax
+ xor dx,dx
+ div cx
+ mov bp,ax
+ xor ax,ax
+ div cx
+ mov bx,ax
+ mov dx,8000H
+ mov ax,word ptr cs:MX_BYTESPERLINE
+ xchg ax,si
+L$20:
+ mov byte ptr es:[di],ah
+ sub dx,bx
+ sbb ax,bp
+ add di,si
+ dec cx
+ jne L$20
+ pop si
+ pop bp
+ ret
+MXGOURAUDPOLY:
+ push bp
+ mov bp,sp
+ sub sp,1eH
+ push ds
+ push si
+ push es
+ push di
+ mov cx,word ptr 14H[bp]
+ cmp cx,3
+ jae L$21
+ jmp near ptr L$47
+L$21:
+ les di,dword ptr 10H[bp]
+ lds si,dword ptr 0cH[bp]
+ mov word ptr -16H[bp],7fffH
+ mov word ptr -1aH[bp],8000H
+ mov word ptr -18H[bp],7fffH
+ mov word ptr -1eH[bp],8000H
+ xor dx,dx
+L$22:
+ mov bx,word ptr es:[di]
+ shl bx,1
+ shl bx,1
+ add bx,si
+ mov ax,word ptr [bx]
+ cmp ax,word ptr -16H[bp]
+ jge L$23
+ mov word ptr -16H[bp],ax
+ mov word ptr -0eH[bp],dx
+ mov word ptr -10H[bp],dx
+L$23:
+ cmp ax,word ptr -1aH[bp]
+ jle L$24
+ mov word ptr -1aH[bp],ax
+ mov word ptr -12H[bp],dx
+L$24:
+ mov ax,word ptr 2[bx]
+ cmp ax,word ptr -18H[bp]
+ jge L$25
+ mov word ptr -18H[bp],ax
+L$25:
+ cmp ax,word ptr -1eH[bp]
+ jle L$26
+ mov word ptr -1eH[bp],ax
+L$26:
+ inc di
+ inc di
+ inc dx
+ inc dx
+ dec cx
+ jne L$22
+ mov ax,word ptr -1aH[bp]
+ cmp ax,word ptr cs:MX_CLIPX1
+ jge L$27
+ jmp near ptr L$47
+L$27:
+ mov bx,word ptr -16H[bp]
+ cmp bx,word ptr cs:MX_CLIPX2
+ jle L$28
+ jmp near ptr L$47
+L$28:
+ sub ax,bx
+ jg L$29
+ jmp near ptr L$47
+L$29:
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jge L$30
+ jmp near ptr L$47
+L$30:
+ mov bx,word ptr -18H[bp]
+ cmp bx,word ptr cs:MX_CLIPY2
+ jle L$31
+ jmp near ptr L$47
+L$31:
+ sub ax,bx
+ jg L$32
+ jmp near ptr L$47
+L$32:
+ dec word ptr 14H[bp]
+ shl word ptr 14H[bp],1
+ mov es,word ptr cs:MX_CODESEGMENT
+ mov ax,offset MX_TEXT:MX_SCANBUFFER
+ mov word ptr -4[bp],ax
+ mov si,word ptr -0eH[bp]
+L$33:
+ lds bx,dword ptr 10H[bp]
+ mov di,word ptr [bx+si]
+ dec si
+ dec si
+ test si,si
+ jge L$34
+ mov si,word ptr 14H[bp]
+L$34:
+ mov word ptr -0eH[bp],si
+ mov si,word ptr [bx+si]
+ lds bx,dword ptr 8[bp]
+ shl di,1
+ shl si,1
+ mov ax,word ptr [bx+si]
+ mov dx,word ptr [bx+di]
+ lds bx,dword ptr 0cH[bp]
+ shl si,1
+ shl di,1
+ add si,bx
+ add bx,di
+ mov di,word ptr -4[bp]
+ call near ptr L$1
+ mov word ptr -4[bp],di
+ mov si,word ptr -0eH[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$33
+ mov ax,offset MX_TEXT:MX_SCANBUFFER+4
+ mov word ptr -6[bp],ax
+ mov si,word ptr -10H[bp]
+L$35:
+ lds bx,dword ptr 10H[bp]
+ mov di,word ptr [bx+si]
+ inc si
+ inc si
+ cmp si,word ptr 14H[bp]
+ jbe L$36
+ xor si,si
+L$36:
+ mov word ptr -10H[bp],si
+ mov si,word ptr [bx+si]
+ lds bx,dword ptr 8[bp]
+ shl di,1
+ shl si,1
+ mov ax,word ptr [bx+si]
+ mov dx,word ptr [bx+di]
+ lds bx,dword ptr 0cH[bp]
+ shl si,1
+ shl di,1
+ add si,bx
+ add bx,di
+ mov di,word ptr -6[bp]
+ call near ptr L$1
+ mov word ptr -6[bp],di
+ mov si,word ptr -10H[bp]
+ cmp si,word ptr -12H[bp]
+ jne L$35
+ mov si,offset MX_TEXT:MX_SCANBUFFER
+ mov ax,word ptr -16H[bp]
+ mov cx,word ptr -1aH[bp]
+ sub cx,ax
+ mov bx,word ptr cs:MX_CLIPX1
+ sub bx,ax
+ jle L$37
+ sub cx,bx
+ add ax,bx
+ mov word ptr -16H[bp],ax
+ shl bx,1
+ shl bx,1
+ shl bx,1
+ add si,bx
+L$37:
+ mov bx,ax
+ add bx,cx
+ sub bx,word ptr cs:MX_CLIPX2
+ jle L$38
+ sub cx,bx
+L$38:
+ test cx,cx
+ jg L$39
+ jmp near ptr L$47
+L$39:
+ mov word ptr -8[bp],cx
+ mov word ptr -4[bp],si
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,word ptr -18H[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$40
+ mov ax,word ptr -1eH[bp]
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$40
+ jmp L$44
+L$40:
+ mov di,cx
+ inc di
+ sub si,8
+L$41:
+ dec di
+ je L$44
+ add si,8
+ mov ax,word ptr [si]
+ mov cx,word ptr 4[si]
+ mov dx,word ptr cs:MX_CLIPY2
+ cmp ax,dx
+ jg L$43
+ cmp cx,dx
+ jle L$42
+ mov word ptr 4[si],dx
+ mov bx,cx
+ sub bx,dx
+ sub cx,ax
+ jle L$43
+ mov ax,word ptr 2[si]
+ sub ax,word ptr 6[si]
+ imul bx
+ idiv cx
+ add word ptr 6[si],ax
+ mov ax,word ptr [si]
+ mov cx,word ptr 4[si]
+L$42:
+ mov dx,word ptr cs:MX_CLIPY1
+ cmp cx,dx
+ jl L$43
+ sub cx,ax
+ jle L$43
+ cmp ax,dx
+ jge L$41
+ mov word ptr [si],dx
+ sub dx,ax
+ cmp cx,dx
+ jbe L$43
+ mov ax,word ptr 6[si]
+ sub ax,word ptr 2[si]
+ imul dx
+ idiv cx
+ add word ptr 2[si],ax
+ jmp L$41
+L$43:
+ mov word ptr [si],0ffffH
+ jmp L$41
+L$44:
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ mov si,word ptr -4[bp]
+ mov cl,byte ptr -16H[bp]
+ and cl,3
+ mov al,11H
+ shl al,cl
+ mov byte ptr -2[bp],al
+ shr word ptr -16H[bp],1
+ shr word ptr -16H[bp],1
+ mov ax,word ptr 6[bp]
+ mov ah,al
+ xor al,al
+ mov word ptr 6[bp],ax
+L$45:
+ mov ax,word ptr [si]
+ test ax,ax
+ js L$46
+ mov cx,word ptr 4[si]
+ sub cx,ax
+ jle L$46
+ mul word ptr cs:MX_BYTESPERLINE
+ add ax,word ptr -16H[bp]
+ mov di,ax
+ mov ah,byte ptr -2[bp]
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov dx,word ptr 6[bp]
+ call near ptr L$15
+L$46:
+ rol byte ptr -2[bp],1
+ adc word ptr -16H[bp],0
+ add si,8
+ dec word ptr -8[bp]
+ jne L$45
+L$47:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 10H
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXPUTIMAGE
+ EXTRN SUBCLIPIMAGE:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$2
+ DW offset L$6
+ DW offset L$10
+ DW offset L$14
+ DW offset L$18
+ DW offset L$20
+L$2:
+ shr cx,1
+ jb L$5
+L$3:
+ movsb
+ add si,3
+ movsb
+ add si,3
+ dec cx
+ jne L$3
+L$4:
+ ret
+L$5:
+ movsb
+ add si,3
+ jcxz L$4
+ jmp L$3
+L$6:
+ shr cx,1
+ jb L$9
+L$7:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ and word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$7
+L$8:
+ ret
+L$9:
+ lodsb
+ and byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$8
+ jmp L$7
+L$10:
+ shr cx,1
+ jb L$13
+L$11:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ or word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$11
+L$12:
+ ret
+L$13:
+ lodsb
+ or byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$12
+ jmp L$11
+L$14:
+ shr cx,1
+ jb L$17
+L$15:
+ mov al,byte ptr [si]
+ mov ah,byte ptr 4[si]
+ xor word ptr es:[di],ax
+ inc di
+ inc di
+ add si,8
+ dec cx
+ jne L$15
+L$16:
+ ret
+L$17:
+ lodsb
+ xor byte ptr es:[di],al
+ inc di
+ add si,3
+ jcxz L$16
+ jmp L$15
+L$18:
+ mov al,byte ptr [si]
+ cmp al,ah
+ je L$19
+ mov byte ptr es:[di],al
+L$19:
+ inc di
+ add si,4
+ dec cx
+ jne L$18
+ ret
+L$20:
+ mov al,byte ptr [si]
+ add byte ptr es:[di],al
+ inc di
+ add si,4
+ dec cx
+ jne L$20
+ ret
+MXPUTIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,14H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 0eH[bp]
+ mov ax,word ptr 0cH[bp]
+ mov cx,word ptr 0aH[bp]
+ mov dx,word ptr 8[bp]
+ call near ptr MX_TEXT:SUBCLIPIMAGE
+ jae L$21
+ jmp near ptr L$26
+L$21:
+ mov word ptr 8[bp],dx
+ add word ptr 10H[bp],si
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,bx
+ shr di,1
+ shr di,1
+ add di,ax
+ mov word ptr -0aH[bp],di
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -10H[bp],bl
+ mov bx,cx
+ shr bx,1
+ shr bx,1
+ and cl,3
+ mov al,8
+ shr al,cl
+ mov si,6
+L$22:
+ mov word ptr -8[bp+si],bx
+ shr al,1
+ adc bx,0
+ dec si
+ dec si
+ jge L$22
+ mov cl,byte ptr -10H[bp]
+ mov al,11H
+ shl al,cl
+ mov byte ptr -14H[bp],al
+ mov bx,word ptr 6[bp]
+ mov byte ptr -12H[bp],bh
+ xor bh,bh
+ cmp bl,5
+ jbe L$23
+ xor bl,bl
+L$23:
+ shl bx,1
+ mov ax,word ptr cs:L$1[bx]
+ mov word ptr -0cH[bp],ax
+ cld
+ mov byte ptr -0eH[bp],4
+ lea bx,-8[bp]
+ mov ds,word ptr 12H[bp]
+L$24:
+ cmp word ptr ss:[bx],0
+ je L$26
+ mov si,word ptr 10H[bp]
+ mov ah,byte ptr -14H[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov ah,byte ptr -10H[bp]
+ and ah,3
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov dx,word ptr 8[bp]
+ mov di,word ptr -0aH[bp]
+L$25:
+ push si
+ push di
+ mov cx,word ptr ss:[bx]
+ mov ah,byte ptr -12H[bp]
+ call word ptr -0cH[bp]
+ pop di
+ pop si
+ add si,word ptr 0aH[bp]
+ add di,word ptr cs:MX_BYTESPERLINE
+ dec dx
+ jne L$25
+ inc bx
+ inc bx
+ inc byte ptr -10H[bp]
+ rol byte ptr -14H[bp],1
+ adc word ptr -0aH[bp],0
+ inc word ptr 10H[bp]
+ dec byte ptr -0eH[bp]
+ jne L$24
+L$26:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0eH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXPAN
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MXWAITDISPLAY:BYTE
+ EXTRN MXSTARTADDRESS:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXPAN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov dx,word ptr 8[bp]
+ shr dx,1
+ shr dx,1
+ add ax,dx
+ push ax
+ call far ptr MXWAITDISPLAY
+ call far ptr MXSTARTADDRESS
+ mov dx,3daH
+ in al,dx
+ mov dx,3c0H
+ mov al,33H
+ out dx,al
+ mov al,byte ptr 8[bp]
+ and al,3
+ shl al,1
+ out dx,al
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 4
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXGETPIXEL
+ PUBLIC MXPUTPIXEL
+ EXTRN MX_CLIPX1:BYTE
+ EXTRN MX_CLIPX2:BYTE
+ EXTRN MX_CLIPY1:BYTE
+ EXTRN MX_CLIPY2:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXGETPIXEL:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ xor ax,ax
+ mov si,word ptr 8[bp]
+ cmp si,word ptr cs:MX_CLIPX1
+ jl L$1
+ cmp si,word ptr cs:MX_CLIPX2
+ jg L$1
+ mov bx,word ptr 6[bp]
+ cmp bx,word ptr cs:MX_CLIPY1
+ jl L$1
+ cmp bx,word ptr cs:MX_CLIPY2
+ jg L$1
+ mov al,4
+ mov ah,byte ptr 8[bp]
+ and ah,3
+ mov dx,3ceH
+ out dx,ax
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ mov ax,bx
+ mul word ptr cs:MX_BYTESPERLINE
+ shr si,1
+ shr si,1
+ add si,ax
+ mov al,byte ptr [si]
+ xor ah,ah
+L$1:
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXPUTPIXEL:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov si,word ptr 0aH[bp]
+ cmp si,word ptr cs:MX_CLIPX1
+ jl L$2
+ cmp si,word ptr cs:MX_CLIPX2
+ jg L$2
+ mov ax,word ptr 8[bp]
+ cmp ax,word ptr cs:MX_CLIPY1
+ jl L$2
+ cmp ax,word ptr cs:MX_CLIPY2
+ jg L$2
+ mov ds,word ptr cs:MX_VIDEOSEGMENT
+ mul word ptr cs:MX_BYTESPERLINE
+ shr si,1
+ shr si,1
+ add si,ax
+ mov cl,byte ptr 0aH[bp]
+ and cl,3
+ mov ax,102H
+ shl ah,cl
+ mov dx,3c4H
+ out dx,ax
+ mov al,byte ptr 6[bp]
+ mov byte ptr [si],al
+L$2:
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 6
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXROWADDRESS
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXROWADDRESS:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov dx,3d4H
+ mov al,13H
+ mov ah,byte ptr 6[bp]
+ out dx,ax
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXROTATEPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXROTATEPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,300H
+ push ds
+ push si
+ push es
+ push di
+ mov bx,word ptr 8[bp]
+ add bx,bx
+ add bx,word ptr 8[bp]
+ lds si,dword ptr 0aH[bp]
+ push ss
+ pop es
+ lea di,-300H[bp]
+ cld
+ mov ax,word ptr 6[bp]
+ mov dx,ax
+ test ax,ax
+ je L$2
+ jl L$1
+ add ax,ax
+ add dx,ax
+ sub bx,dx
+ add si,bx
+ push si
+ mov cx,dx
+ rep movsb
+ mov es,word ptr 0cH[bp]
+ mov di,si
+ dec di
+ pop si
+ dec si
+ mov cx,bx
+ std
+ rep movsb
+ push ss
+ pop ds
+ lea si,-300H[bp]
+ les di,dword ptr 0aH[bp]
+ mov cx,dx
+ cld
+ rep movsb
+ jmp L$2
+L$1:
+ add ax,ax
+ add dx,ax
+ neg dx
+ sub bx,dx
+ mov cx,dx
+ rep movsb
+ les di,dword ptr 0aH[bp]
+ mov cx,bx
+ rep movsb
+ push ss
+ pop ds
+ lea si,-300H[bp]
+ mov cx,dx
+ rep movsb
+L$2:
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSTARTADDRESS
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSTARTADDRESS:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov bx,word ptr 6[bp]
+ mov dx,3d4H
+ mov al,0cH
+ mov ah,bh
+ cli
+ out dx,ax
+ mov al,0dH
+ mov ah,bl
+ out dx,ax
+ sti
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSETCOLOR
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSETCOLOR:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr 0cH[bp]
+ mov dx,3c8H
+ out dx,al
+ inc dx
+ mov al,byte ptr 0aH[bp]
+ out dx,al
+ mov al,byte ptr 8[bp]
+ out dx,al
+ mov al,byte ptr 6[bp]
+ out dx,al
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSTRETCHIMAGE
+ EXTRN SUBCLIPBOX:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ DW offset L$8
+ DW offset L$10
+ DW offset L$12
+ DW offset L$14
+ DW offset L$16
+ DW offset L$19
+MXSTRETCHIMAGE:
+ push bp
+ mov bp,sp
+ sub sp,14H
+ push ds
+ push si
+ push es
+ push di
+ xor dx,dx
+ mov ax,word ptr 0eH[bp]
+ mov bx,word ptr 0aH[bp]
+ div bx
+ mov word ptr -0aH[bp],ax
+ xor ax,ax
+ div bx
+ mov word ptr -0cH[bp],ax
+ xor dx,dx
+ mov ax,word ptr 0cH[bp]
+ mov bx,word ptr 8[bp]
+ div bx
+ mov word ptr -0eH[bp],ax
+ xor ax,ax
+ div bx
+ mov word ptr -10H[bp],ax
+ mov bx,word ptr 12H[bp]
+ mov ax,word ptr 10H[bp]
+ mov cx,word ptr 0aH[bp]
+ mov dx,word ptr 8[bp]
+ call near ptr MX_TEXT:SUBCLIPBOX
+ jae L$2
+ jmp near ptr L$7
+L$2:
+ mov word ptr 0aH[bp],cx
+ mov word ptr 8[bp],dx
+ sub word ptr 12H[bp],bx
+ sub word ptr 10H[bp],ax
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,bx
+ shr di,1
+ shr di,1
+ add di,ax
+ mov word ptr -2[bp],di
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ and bl,3
+ mov byte ptr -6[bp],bl
+ mov cl,bl
+ mov al,11H
+ shl al,cl
+ mov byte ptr -14H[bp],al
+ mov ax,word ptr 10H[bp]
+ test ax,ax
+ je L$3
+ mov bx,ax
+ mul word ptr -10H[bp]
+ mov cx,dx
+ mov ax,bx
+ mul word ptr -0eH[bp]
+ add ax,cx
+ mul word ptr 0eH[bp]
+ add word ptr 14H[bp],ax
+L$3:
+ mov ax,word ptr 12H[bp]
+ test ax,ax
+ je L$4
+ mov bx,ax
+ mul word ptr -0cH[bp]
+ mov cx,dx
+ mov ax,bx
+ mul word ptr -0aH[bp]
+ add ax,cx
+ add word ptr 14H[bp],ax
+L$4:
+ mov ax,word ptr -0eH[bp]
+ mul word ptr 0eH[bp]
+ mov word ptr -0eH[bp],ax
+ mov bx,word ptr 6[bp]
+ mov byte ptr -8[bp],bh
+ xor bh,bh
+ cmp bl,5
+ jbe L$5
+ xor bl,bl
+L$5:
+ shl bx,1
+ mov ax,word ptr cs:L$1[bx]
+ mov word ptr -4[bp],ax
+ mov ds,word ptr 16H[bp]
+ xor ax,ax
+ mov word ptr -12H[bp],ax
+L$6:
+ mov si,word ptr 14H[bp]
+ mov ah,byte ptr -14H[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov ah,byte ptr -6[bp]
+ and ah,3
+ mov al,4
+ mov dx,3ceH
+ out dx,ax
+ mov cx,word ptr 8[bp]
+ mov di,word ptr -2[bp]
+ mov ah,byte ptr -8[bp]
+ xor bx,bx
+ mov dx,word ptr cs:MX_BYTESPERLINE
+ call word ptr -4[bp]
+ inc byte ptr -6[bp]
+ rol byte ptr -14H[bp],1
+ adc word ptr -2[bp],0
+ mov dx,word ptr -0cH[bp]
+ mov ax,word ptr -0aH[bp]
+ add word ptr -12H[bp],dx
+ adc word ptr 14H[bp],ax
+ dec word ptr 0aH[bp]
+ jne L$6
+L$7:
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 12H
+L$8:
+ mov al,byte ptr [si]
+ mov byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$9
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$8
+ add si,word ptr 0eH[bp]
+ jmp L$8
+L$9:
+ ret
+L$10:
+ mov al,byte ptr [si]
+ and byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$11
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$10
+ add si,word ptr 0eH[bp]
+ jmp L$10
+L$11:
+ ret
+L$12:
+ mov al,byte ptr [si]
+ or byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$13
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$12
+ add si,word ptr 0eH[bp]
+ jmp L$12
+L$13:
+ ret
+L$14:
+ mov al,byte ptr [si]
+ xor byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$15
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$14
+ add si,word ptr 0eH[bp]
+ jmp L$14
+L$15:
+ ret
+L$16:
+ mov al,byte ptr [si]
+ cmp al,ah
+ je L$17
+ mov byte ptr es:[di],al
+L$17:
+ add di,dx
+ dec cx
+ je L$18
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$16
+ add si,word ptr 0eH[bp]
+ jmp L$16
+L$18:
+ ret
+L$19:
+ mov al,byte ptr [si]
+ add byte ptr es:[di],al
+ add di,dx
+ dec cx
+ je L$20
+ add si,word ptr -0eH[bp]
+ add bx,word ptr -10H[bp]
+ jae L$19
+ add si,word ptr 0eH[bp]
+ jmp L$19
+L$20:
+ ret
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSTARTLINE
+ EXTRN MX_BYTESPERLINE:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSTARTLINE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ xchg ax,bx
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ jne L$1
+ mov dx,3d4H
+ mov al,0cH
+ mov ah,bh
+ cli
+ out dx,ax
+ mov al,0dH
+ mov ah,bl
+ out dx,ax
+ sti
+ mov dx,3daH
+L$2:
+ in al,dx
+ test al,8
+ je L$2
+ xor ax,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MX_SCREENWIDTH
+ PUBLIC MX_SCREENHEIGHT
+ PUBLIC MX_BYTESPERLINE
+ PUBLIC MXSETMODE
+ PUBLIC MXCHANGEMODE
+ PUBLIC MXGETASPECT
+ PUBLIC MXGETSCREENSIZE
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MXSETSYSCLIPREGION:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MX_SCREENWIDTH:
+ add byte ptr [bx+si],al
+MX_SCREENHEIGHT:
+ add byte ptr [bx+si],al
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+MX_BYTESPERLINE:
+ add byte ptr [bx+si],al
+L$3:
+ or word ptr 14H[bx+si],ax
+ add byte ptr [bx],dl
+ jcxz L$4
+L$4:
+ DB 0
+L$5:
+ or word ptr 14H[bx+di],ax
+ add byte ptr [bx],dl
+ jcxz L$6
+L$6:
+ DB 0
+L$7:
+ add byte ptr 1[bx],bl
+ dec di
+ add dl,byte ptr 3[bx+si]
+ add byte ptr [si],54H
+ add ax,1380H
+ sub byte ptr [bx+si],al
+ DB 0
+L$8:
+ add byte ptr 1[bp+di],ch
+ pop cx
+ add bl,byte ptr 3[bp+si]
+ mov es,word ptr [si]
+ pop si
+ add ax,138aH
+ sub ax,0
+ push es
+ mov di,1f07H
+ adc byte ptr -7aefH[bp+di],al
+ adc bl,byte ptr 15H[di]
+ arpl word ptr ds:[0baH],dx
+ DB 0
+L$9:
+ push es
+ DD ds:[7bfH]
+ pushf
+ adc word ptr -70eeH[bp],cx
+ adc ax,1696H
+ mov cx,0
+L$10:
+ push es
+ or ax,3e07H
+ adc dl,ch
+ adc word ptr -20eeH[si],cx
+ adc ax,16e7H
+ push es
+ add byte ptr [bx+si],al
+L$11:
+ add byte ptr 1[si],dh
+ arpl word ptr [bp+si],ax
+ add dx,word ptr fs:6804H[bx]
+ add ax,695H
+ xchg byte ptr [bx],al
+ lock or word ptr 0fH[bx+si],sp
+ xor word ptr [bx+si],dx
+ pop bx
+ adc word ptr 5712H[di],cx
+ adc si,word ptr [bp+si]
+ adc al,0
+ adc ax,1660H
+ adc byte ptr [bx],0e3H
+ add byte ptr [bx+si],al
+L$12:
+ arpl word ptr ds:[500H],ax
+ add byte ptr 1[bx+si],al
+ enter 1a00H,0
+ DW offset L$9
+ DW offset L$5
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$13:
+ jcxz L$14
+ DB 0
+L$14:
+ add word ptr [bx+si],ax
+ inc ax
+ add ax,si
+ add byte ptr [bp+si],bl
+ add byte ptr [bp+si],bl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$15:
+ arpl word ptr ds:[0a00H],ax
+ add byte ptr 1[bx+si],al
+ nop
+ add word ptr [bp+si],bx
+ add byte ptr [bp+si],cl
+ DW offset L$3
+ add byte ptr [bx+si],al
+ xor ax,word ptr [bp+di]
+L$16:
+ jcxz L$17
+ DB 0
+L$17:
+ add al,byte ptr [bx+si]
+ inc ax
+ add ax,sp
+ DD L$18
+L$18:
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$19:
+ sbb ax,word ptr [eax]
+ adc al,0
+ push 0c801H
+ add byte ptr [bp+si],ch
+ add byte ptr [bp+si],cl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$20:
+ out 9,ax
+ add byte ptr [bx+si],cl
+ add byte ptr 1[bx+si],ch
+ lock add byte ptr [bp+si],ch
+ add byte ptr [bp+si],bl
+ DW offset L$5
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$21:
+ sbb ax,word ptr [eax]
+ sub byte ptr [bx+si],al
+ push 9001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],cl
+ DW offset L$3
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$22:
+ out 9,ax
+ add byte ptr [bx+si],dl
+ add byte ptr 1[bx+si],ch
+ loopnz L$23
+ DW offset L$8
+L$23 equ $-1
+ DW offset L$10
+ DW offset L$3
+ add byte ptr [bx+si],al
+ fadd dword ptr [bp+si]
+L$24:
+ mov word ptr ds:[0],ax
+ add byte ptr [bx+si],al
+ inc ax
+ add word ptr 1a00H[bx],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],dl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$25:
+ mov word ptr 0,ax
+ add byte ptr [bx+si],al
+ inc ax
+ add word ptr 1a00H[bx],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add byte ptr [bp+di],dh
+ DB 3
+L$26:
+ cmpsw
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push 0e001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],dl
+ add byte ptr [bx+si],al
+ add al,bl
+ DB 2
+L$27:
+ cmpsw
+ add byte ptr [bx+si],al
+ add byte ptr [bx+si],al
+ push 0e001H
+ add word ptr [bp+si],bp
+ add byte ptr [bp+si],bh
+ add byte ptr [bp+si],cl
+ add byte ptr [bx+si],al
+ add al,bl
+ DB 2
+L$28:
+ out 1,ax
+ add byte ptr [bp+si],al
+ add byte ptr 5801H[bx+si],dl
+ add ch,byte ptr [bp+si]
+ add byte ptr [bx+si],al
+ pop word ptr [bp+si]
+L$29:
+ DW offset L$24
+ DW offset L$12
+ DW offset L$13
+ DW offset L$25
+ DW offset L$15
+ DW offset L$16
+ DW offset L$26
+ DW offset L$19
+ DW offset L$20
+ DW offset L$27
+ DW offset L$21
+ DW offset L$22
+ DW offset L$28
+L$30:
+ mov ax,3
+ int 10H
+ mov word ptr MX_SCREENHEIGHT,0
+ mov word ptr MX_BYTESPERLINE,0
+ ret
+MXSETMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov si,word ptr 6[bp]
+ cmp si,0dH
+ jbe L$31
+ jmp near ptr L$36
+L$31:
+ test si,si
+ jne L$32
+ call near ptr L$30
+ jmp near ptr L$36
+L$32:
+ dec si
+ shl si,1
+ mov si,word ptr L$29[si]
+ cld
+ push si
+ mov ax,13H
+ int 10H
+ pop si
+ mov dx,3c4H
+ mov ax,604H
+ out dx,ax
+ mov ax,100H
+ out dx,ax
+ mov dx,3c2H
+ lodsb
+ out dx,al
+ mov dx,3c4H
+ mov ax,300H
+ out dx,ax
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ and al,7fH
+ out dx,al
+ lodsw
+ mov word ptr L$1,ax
+ lodsw
+ mov word ptr L$2,ax
+ lodsw
+ mov word ptr MX_SCREENWIDTH,ax
+ shr ax,1
+ shr ax,1
+ mov word ptr MX_BYTESPERLINE,ax
+ lodsw
+ mov word ptr MX_SCREENHEIGHT,ax
+ mov bx,si
+ mov dx,3d4H
+L$33:
+ mov si,word ptr [bx]
+ inc bx
+ inc bx
+ test si,si
+ je L$35
+L$34:
+ lodsw
+ test ax,ax
+ je L$33
+ out dx,ax
+ jmp L$34
+L$35:
+ push word ptr MX_SCREENWIDTH
+ push word ptr [bx]
+ push cs
+ call near ptr MX_TEXT:MXSETSYSCLIPREGION
+ mov dx,3c4H
+ mov ax,0f02H
+ out dx,ax
+ mov es,word ptr MX_TEXT:MX_VIDEOSEGMENT
+ xor di,di
+ mov cx,8000H
+ xor ax,ax
+ rep stosw
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ or al,80H
+ out dx,al
+L$36:
+ xor ax,ax
+ mov ax,word ptr MX_SCREENWIDTH
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXCHANGEMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov si,word ptr 6[bp]
+ cmp si,0dH
+ ja L$40
+ test si,si
+ je L$40
+ dec si
+ shl si,1
+ mov si,word ptr L$29[si]
+ cld
+ mov dx,3c4H
+ mov ax,604H
+ out dx,ax
+ mov ax,100H
+ out dx,ax
+ mov dx,3c2H
+ lodsb
+ out dx,al
+ mov dx,3c4H
+ mov ax,300H
+ out dx,ax
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ and al,7fH
+ out dx,al
+ lodsw
+ mov word ptr L$1,ax
+ lodsw
+ mov word ptr L$2,ax
+ lodsw
+ mov word ptr MX_SCREENWIDTH,ax
+ lodsw
+ mov word ptr MX_SCREENHEIGHT,ax
+ mov bx,si
+ mov dx,3d4H
+L$37:
+ mov si,word ptr [bx]
+ inc bx
+ inc bx
+ test si,si
+ je L$39
+L$38:
+ lodsw
+ test ax,ax
+ je L$37
+ cmp al,13H
+ je L$38
+ out dx,ax
+ jmp L$38
+L$39:
+ mov dx,3d4H
+ mov al,11H
+ out dx,al
+ inc dx
+ in al,dx
+ or al,80H
+ out dx,al
+L$40:
+ xor ax,ax
+ mov ax,word ptr MX_SCREENWIDTH
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 2
+MXGETASPECT:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov ax,word ptr cs:L$1
+ mov word ptr [si],ax
+ lds si,dword ptr 6[bp]
+ mov ax,word ptr cs:L$2
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MXGETSCREENSIZE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov ax,word ptr cs:MX_SCREENWIDTH
+ mov word ptr [si],ax
+ lds si,dword ptr 6[bp]
+ mov ax,word ptr cs:MX_SCREENHEIGHT
+ mov word ptr [si],ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSETPALETTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSETPALETTE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ lds si,dword ptr 0aH[bp]
+ mov cx,word ptr 6[bp]
+ mov ax,word ptr 8[bp]
+ mov dx,3c8H
+ out dx,al
+ inc dx
+ cld
+ cli
+L$1:
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ lodsb
+ out dx,al
+ loop L$1
+ sti
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSPLITSCREEN
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXSPLITSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ax,word ptr 6[bp]
+ shl ax,1
+ mov bh,ah
+ mov bl,ah
+ and bx,201H
+ mov cl,4
+ shl bx,cl
+ shl bh,1
+ mov dx,3d4H
+ mov ah,al
+ mov al,18H
+ out dx,ax
+ mov al,7
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ mov ah,al
+ and ah,0efH
+ or ah,bl
+ mov al,7
+ out dx,ax
+ mov al,9
+ out dx,al
+ inc dx
+ in al,dx
+ dec dx
+ mov ah,al
+ and ah,0bfH
+ or ah,bh
+ mov al,9
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXPUTTILE
+ PUBLIC MXTRANSPUTTILE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MX_VIDEOSEGMENT:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXPUTTILE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ax,word ptr 0aH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,word ptr 0cH[bp]
+ shr di,1
+ shr di,1
+ add di,ax
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ lds si,dword ptr 0eH[bp]
+ shr word ptr 8[bp],1
+ shr word ptr 8[bp],1
+ mov cl,byte ptr 0cH[bp]
+ and cl,3
+ mov ah,11H
+ shl ah,cl
+ mov word ptr 0aH[bp],4
+ mov bx,word ptr cs:MX_BYTESPERLINE
+ sub bx,word ptr 8[bp]
+L$1:
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov word ptr 0cH[bp],di
+ mov dx,word ptr 6[bp]
+L$2:
+ mov cx,word ptr 8[bp]
+ shr cx,1
+ rep movsw
+ rcl cx,1
+ rep movsb
+ add di,bx
+ dec dx
+ jne L$2
+ mov di,word ptr 0cH[bp]
+ rol ah,1
+ adc di,0
+ dec word ptr 0aH[bp]
+ jne L$1
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MXTRANSPUTTILE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ push es
+ push di
+ mov ax,word ptr 0aH[bp]
+ mul word ptr cs:MX_BYTESPERLINE
+ mov di,word ptr 0cH[bp]
+ shr di,1
+ shr di,1
+ add di,ax
+ mov es,word ptr cs:MX_VIDEOSEGMENT
+ lds si,dword ptr 0eH[bp]
+ shr word ptr 8[bp],1
+ shr word ptr 8[bp],1
+ mov cl,byte ptr 0cH[bp]
+ and cl,3
+ mov ah,11H
+ shl ah,cl
+ mov word ptr 0aH[bp],4
+ mov bx,word ptr cs:MX_BYTESPERLINE
+ sub bx,word ptr 8[bp]
+L$3:
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov word ptr 0cH[bp],di
+ mov dx,word ptr 6[bp]
+L$4:
+ mov cx,word ptr 8[bp]
+ jcxz L$7
+L$5:
+ mov al,byte ptr [si]
+ test al,al
+ je L$6
+ mov byte ptr es:[di],al
+L$6:
+ inc si
+ inc di
+ dec cx
+ jne L$5
+L$7:
+ add di,bx
+ dec dx
+ jne L$4
+ mov di,word ptr 0cH[bp]
+ rol ah,1
+ adc di,0
+ dec word ptr 0aH[bp]
+ jne L$3
+ xor ax,ax
+ pop di
+ pop es
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 0cH
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXSETVIRTUALSCREEN
+ PUBLIC MXGETVIRTUALSCREEN
+ EXTRN MX_CODESEGMENT:BYTE
+ EXTRN MX_BYTESPERLINE:BYTE
+ EXTRN MXROWADDRESS:BYTE
+ EXTRN MXSETSYSCLIPREGION:BYTE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+L$1:
+ add byte ptr [bx+si],al
+L$2:
+ add byte ptr [bx+si],al
+MXSETVIRTUALSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ mov ds,word ptr cs:MX_CODESEGMENT
+ mov ax,1
+ cmp word ptr 8[bp],140H
+ jb L$3
+ push ax
+ mov dx,4
+ xor ax,ax
+ div word ptr 8[bp]
+ cmp word ptr 6[bp],ax
+ pop ax
+ ja L$3
+ mov ax,word ptr 8[bp]
+ and ax,0fff8H
+ mov word ptr L$1,ax
+ shr ax,1
+ shr ax,1
+ mov word ptr MX_TEXT:MX_BYTESPERLINE,ax
+ shr ax,1
+ push ax
+ call far ptr MXROWADDRESS
+ mov ax,word ptr 6[bp]
+ mov word ptr L$2,ax
+ push word ptr 8[bp]
+ push word ptr 6[bp]
+ call far ptr MXSETSYSCLIPREGION
+ xor ax,ax
+L$3:
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 4
+MXGETVIRTUALSCREEN:
+ push bp
+ mov bp,sp
+ sub sp,0
+ push ds
+ push si
+ mov ax,word ptr cs:L$1
+ lds si,dword ptr 0aH[bp]
+ mov word ptr [si],ax
+ mov ax,word ptr cs:L$2
+ lds si,dword ptr 6[bp]
+ mov word ptr [si],ax
+ xor ax,ax
+ pop si
+ pop ds
+ mov sp,bp
+ pop bp
+ retf 8
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXWAITDISPLAY
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWAITDISPLAY:
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ jne L$1
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXWRITEMODE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWRITEMODE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov dx,3ceH
+ mov ah,byte ptr 6[bp]
+ and ah,3
+ or ah,40H
+ mov al,5
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXWRITEPLANE
+ PUBLIC MXREADPLANE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWRITEPLANE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov ah,byte ptr 6[bp]
+ and ah,0fH
+ mov al,2
+ mov dx,3c4H
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MXREADPLANE:
+ push bp
+ mov bp,sp
+ sub sp,0
+ mov al,4
+ mov ah,byte ptr 6[bp]
+ and ah,3
+ mov dx,3ceH
+ out dx,ax
+ mov sp,bp
+ pop bp
+ retf 2
+MX_TEXT ENDS
+ END
--- /dev/null
+.387
+ PUBLIC MXWAITRETRACE
+MX_TEXT SEGMENT PARA PUBLIC USE16 'CODE'
+ ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
+MXWAITRETRACE:
+ mov dx,3daH
+L$1:
+ in al,dx
+ test al,8
+ je L$1
+ retf
+MX_TEXT ENDS
+ END
--- /dev/null
+ModeX - A graphical library for DOS programs\r
+Copyright (c) 1993-1994 Alessandro Scotti\r
+http://www.ascotti.org/\r
+\r
+Please look at the above site in the "Art of..." and\r
+then in the "Old programs" section for more information.\r
+\r
+\r
--- /dev/null
+@echo off\r
+wdis -a MXBB.OBJ > mxbb.asm\r
+wdis -a MXCC.OBJ > mxcc.asm\r
+wdis -a MXCG.OBJ > mxcg.asm\r
+wdis -a MXCL.OBJ > mxcl.asm\r
+wdis -a MXCR.OBJ > mxcl.asm\r
+wdis -a MXFB.OBJ > mxfb.asm\r
+wdis -a MXFP.OBJ > mxfp.asm\r
+wdis -a MXGC.OBJ > mxgc.asm\r
+wdis -a MXGI.OBJ > mxgi.asm\r
+wdis -a MXGM.OBJ > mxgm.asm\r
+wdis -a MXGP.OBJ > mxgp.asm\r
+wdis -a MXGV.OBJ > mxgv.asm\r
+wdis -a MXHL.OBJ > mxhl.asm\r
+wdis -a MXIT.OBJ > mxit.asm\r
+wdis -a MXLL.OBJ > mxll.asm\r
+wdis -a MXLN.OBJ > mxln.asm\r
+wdis -a MXOT.OBJ > mxot.asm\r
+wdis -a MXPB.OBJ > mxpb.asm\r
+wdis -a MXPF.OBJ > mxpf.asm\r
+wdis -a MXPG.OBJ > mxpg.asm\r
+wdis -a MXPI.OBJ > mxpi.asm\r
+wdis -a MXPN.OBJ > mxpn.asm\r
+wdis -a MXPP.OBJ > mxpp.asm\r
+wdis -a MXRA.OBJ > mxra.asm\r
+wdis -a MXRP.OBJ > mxrp.asm\r
+wdis -a MXSA.OBJ > mxsa.asm\r
+wdis -a MXSC.OBJ > mxsc.asm\r
+wdis -a MXSI.OBJ > mxsi.asm\r
+wdis -a MXSL.OBJ > mxsl.asm\r
+wdis -a MXSM.OBJ > mxsm.asm\r
+wdis -a MXSP.OBJ > mxsp.asm\r
+wdis -a MXSS.OBJ > mxss.asm\r
+wdis -a MXTL.OBJ > mxtl.asm\r
+wdis -a MXVS.OBJ > mxvs.asm\r
+wdis -a MXWD.OBJ > mxwd.asm\r
+wdis -a MXWM.OBJ > mxwm.asm\r
+wdis -a MXWP.OBJ > mxwp.asm\r
+wdis -a MXWR.OBJ > mxwr.asm\r
@wmake all
@cd ../../
-x: .symbolic
- @cd 16/x
- @wmake -f makefile.wat pee
- @cd ../xw_/
- @wmake all
+mx_: .symbolic
+ @cd 16/xw_
+ @wmake -f makefile.wat all
@cd ../../