]> 4ch.mooo.com Git - plz.git/commitdiff
wwwwwwwwww
authorsparky4 <sparky4@cock.li>
Sat, 13 Feb 2016 17:28:17 +0000 (11:28 -0600)
committersparky4 <sparky4@cock.li>
Sat, 13 Feb 2016 17:28:17 +0000 (11:28 -0600)
14 files changed:
16.map [new file with mode: 0755]
asmyt.asm [new file with mode: 0755]
asmyt.err [new file with mode: 0755]
asmyt.h [new file with mode: 0755]
asmyt.o [deleted file]
copper.h [new file with mode: 0755]
copper.o
makefile
plz.o
plzpart.c
plzpart.h [new file with mode: 0755]
plzpart.o
tweak.asm [new file with mode: 0755]
tweak.h [new file with mode: 0755]

diff --git a/16.map b/16.map
new file mode 100755 (executable)
index 0000000..43450b1
--- /dev/null
+++ b/16.map
@@ -0,0 +1,223 @@
+Open Watcom Linker Version 2.0 beta Jan 20 2016 10:21:07 (32-bit)
+Copyright (c) 2002-2016 The Open Watcom Contributors. All Rights Reserved.
+Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
+Created on:       16/02/13 11:25:37
+Executable Image: plzpart.exe
+creating a DOS executable
+Error! E2028: init_copper_ is an undefined reference
+Error! E2028: close_copper_ is an undefined reference
+Error! E2028: _m1 is an undefined reference
+Error! E2028: _m2 is an undefined reference
+Error! E2028: _m3 is an undefined reference
+Error! E2028: _m4 is an undefined reference
+Error! E2028: _n1 is an undefined reference
+Error! E2028: _n2 is an undefined reference
+Error! E2028: _n3 is an undefined reference
+Error! E2028: _n4 is an undefined reference
+Error! E2028: setplzparas_ is an undefined reference
+Error! E2028: plzline_ is an undefined reference
+Error! E2028: tw_opengraph2_ is an undefined reference
+Error! E2028: set_plzstart_ is an undefined reference
+Error! E2028: tw_setrgbpalette_ is an undefined reference
+
+
+                        +------------+
+                        |   Groups   |
+                        +------------+
+
+Group                           Address              Size
+=====                           =======              ====
+
+DGROUP                          0ed5:0000            0000a650
+
+
+
+                        +--------------+
+                        |   Segments   |
+                        +--------------+
+
+Segment                Class          Group          Address         Size
+=======                =====          =====          =======         ====
+
+plzpart_TEXT           CODE           AUTO           0000:0000       00000020
+copper_TEXT            CODE           AUTO           0000:0020       00000997
+ASMYT_TEXT             CODE           AUTO           0000:09b8       00000000
+PORO                   CODE           AUTO           009c:0000       0000d4ac
+plz_TEXT               CODE           AUTO           009c:d4b0       00000a0a
+_TEXT                  CODE           AUTO           009c:deba       000004c8
+FAR_DATA               FAR_DATA       AUTO           0ed4:0002       00000000
+_NULL                  BEGDATA        DGROUP         0ed5:0000       00000020
+_AFTERNULL             BEGDATA        DGROUP         0ed7:0000       00000002
+CONST                  DATA           DGROUP         0ed7:0002       00000000
+CONST2                 DATA           DGROUP         0ed7:0002       00000000
+_DATA                  DATA           DGROUP         0ed7:0002       00000218
+XIB                    DATA           DGROUP         0ef8:000a       00000000
+XI                     DATA           DGROUP         0ef8:000a       00000006
+XIE                    DATA           DGROUP         0ef9:0000       00000000
+YIB                    DATA           DGROUP         0ef9:0000       00000000
+YI                     DATA           DGROUP         0ef9:0000       00000000
+YIE                    DATA           DGROUP         0ef9:0000       00000000
+STRINGS                DATA           DGROUP         0ef9:0000       00000000
+DATA                   DATA           DGROUP         0ef9:0000       00000000
+_BSS                   BSS            DGROUP         0ef9:0000       00002406
+STACK                  STACK          DGROUP         113a:0000       00008000
+
+
+                        +----------------+
+                        |   Memory Map   |
+                        +----------------+
+
+* = unreferenced symbol
++ = symbol only referenced locally
+
+Address        Symbol
+=======        ======
+
+Module: plzpart.o(/dos/z/plz/plzpart.c)
+0000:0000      main_
+Module: copper.o(/dos/z/plz/copper.asm)
+0000:0020      _frame_count
+0000:0022      _cop_drop
+0000:0024*     _cop_pal
+0000:0028*     _do_pal
+0000:002a      _cop_start
+0000:002c*     _cop_scrl
+0000:002e*     _cop_plz
+0000:0030*     _close_copper
+0000:005b*     _init_copper
+0000:00fb*     _pompota
+0000:0129*     _moveplz
+0000:0203      _fadepal
+0000:0803      _cop_fadepal
+Module: asmyt.o(ASMYT.ASM)
+009c:c000*     _plzline
+009c:c618*     _setplzparas
+009c:0000*     _psini
+009c:4000*     _lsini4
+009c:8000*     _lsini16
+009c:d48e*     _set_plzstart
+Module: plz.o(/dos/z/plz/plz.c)
+009c:d4b0      plz_
+009c:d74c+     init_plz_
+0ed5:0022+     _ptau
+0ed5:0122+     _curpal
+0ed5:0124*     _timetable
+0ed5:0138+     _ttptr
+0ed5:013a      _l1
+0ed5:013c      _l2
+0ed5:013e      _l3
+0ed5:0140      _l4
+0ed5:0142      _k1
+0ed5:0144      _k2
+0ed5:0146      _k3
+0ed5:0148      _k4
+0ed5:014a      _il1
+0ed5:014c      _il2
+0ed5:014e      _il3
+0ed5:0150      _il4
+0ed5:0152      _ik1
+0ed5:0154      _ik2
+0ed5:0156      _ik3
+0ed5:0158      _ik4
+0ed5:015a+     _inittable
+0ed5:0240+     _pals
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(stk086.asm)
+009c:debf      __STK
+009c:dedf*     __STKOVERFLOW_
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(cstart)
+0ed5:0000*     __nullarea
+0ed5:01fc*     __ovlflag
+0ed5:01fd*     __intno
+0ed5:01fe*     __ovlvec
+009c:defc      _cstart_
+009c:dfcf*     _Not_Enough_Memory_
+009c:e101      __exit_
+009c:e120      __do_exit_with_msg__
+009c:e17d      __GETDS
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(cmodel.asm)
+009c:e188      _big_code_
+009c:e188*     CodeModelMismatch
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(i4m.asm)
+009c:e188      __I4M
+009c:e188*     __U4M
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(pia.asm)
+009c:e1a7      __PIA
+009c:e1a0*     __PIS
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(kbhit.c)
+009c:e1be      kbhit_
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(xmsg.c)
+009c:e1d5*     __exit_with_msg_
+009c:e1da      __fatal_runtime_error_
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(crwdata)
+0ed5:0202      __curbrk
+0ed5:020a      __STACKLOW
+0ed5:020c      __STACKTOP
+0ed5:020e      __cbyte
+0ed5:0210      __child
+0ed5:0212      __no87
+0ed5:021f      ___FPE_handler
+0ed5:0204      __psp
+0ed5:0213      __get_ovl_stack
+0ed5:0217      __restore_ovl_stack
+0ed5:021b      __close_ovl_file
+0ed5:0223      __LpCmdLine
+0ed5:0227      __LpPgmName
+0ed5:0206      __osmajor
+0ed5:0207      __osminor
+0ed5:0208      __osmode
+0ed5:0209      __HShift
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(cmain086.c)
+009c:e1f8      __CMain
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(initrtns.c)
+009c:e25e      __InitRtns
+009c:e25e*     __FInitRtns
+009c:e2b9      __FiniRtns
+009c:e2b9*     __FFiniRtns
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(uselfn.c)
+0ed5:022c      ___uselfn
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(dosseg)
+009c:e31e      __DOSseg__
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(enterdb.c)
+009c:e31f      __EnterWVIDEO_
+0ed5:022e+     ___WD_Present
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(___argc.c)
+0ed5:2640      ____Argv
+0ed5:2644      ____Argc
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(amblksiz.c)
+0ed5:0230      __amblksiz
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(exit.c)
+009c:e343+     _null_exit_rtn_
+009c:e343+     __null_int23_exit_
+009c:e344      exit_
+009c:e365+     _exit_
+0ed5:0232+     ___int23_exit
+0ed5:0236+     ___FPE_handler_exit
+Module: /dos/fdos/watcom2/lib286/dos/clibh.lib(sgdef086)
+0ed5:023a      __Start_XI
+0ed5:0240      __End_XI
+0ed5:0240      __Start_YI
+0ed5:0240      __End_YI
+
+
+                        +---------------------------+
+                        |   Unresolved References   |
+                        +---------------------------+
+
+Undefined Symbol                Referenced by
+================                =============
+
+init_copper_                    plzpart.o(/dos/z/plz/plzpart.c)
+close_copper_                   plzpart.o(/dos/z/plz/plzpart.c)
+setplzparas_                    plz.o(/dos/z/plz/plz.c)
+plzline_                        plz.o(/dos/z/plz/plz.c)
+tw_opengraph2_                  plz.o(/dos/z/plz/plz.c)
+set_plzstart_                   plz.o(/dos/z/plz/plz.c)
+init_copper_                    plz.o(/dos/z/plz/plz.c)
+tw_setrgbpalette_               plz.o(/dos/z/plz/plz.c)
+
+
+                        +--------------------+
+                        |   Libraries Used   |
+                        +--------------------+
+
+/dos/fdos/watcom2/lib286/dos/clibh.lib
diff --git a/asmyt.asm b/asmyt.asm
new file mode 100755 (executable)
index 0000000..f1244b0
--- /dev/null
+++ b/asmyt.asm
@@ -0,0 +1,118 @@
+       IDEAL\r
+       MODEL huge\r
+\r
+EXTRN C l1:word, C l2:word, C l3:word, C l4:word, C k1:word, C k2:word, C k3:word, C k4:word\r
+EXTRN C m1:word, C m2:word, C m3:word, C m4:word, C n1:word, C n2:word, C n3:word, C n4:word\r
+\r
+SEGMENT poro para private 'CODE'\r
+\r
+ASSUME cs:poro\r
+\r
+PUBLIC C plzline, C setplzparas, C psini, C lsini4, C lsini16\r
+\r
+LABEL psini BYTE\r
+INCLUDE 'psini.inc'\r
+;       db      16384 dup(?)\r
+\r
+LABEL lsini4 WORD\r
+INCLUDE 'lsini4.inc'\r
+;       db      16384 dup(?)\r
+\r
+LABEL lsini16 WORD\r
+INCLUDE 'lsini16.inc'\r
+;       db      16384 dup(?)\r
+\r
+PROC    C plzline\r
+\r
+        ARG     y1:word, vseg:word\r
+\r
+        push    ds es si di\r
+\r
+        push    [vseg]\r
+        pop     es\r
+        push    cs\r
+        pop     ds\r
+        mov     si, [y1]\r
+;       and     si, 0fffeh\r
+        shl     si, 1d\r
+       mov     di, si\r
+\r
+        IRP ccc, <3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12,19,18,17,16,23,22,21,20,27,26,25,24,31,30,29,28,35,34,33,32,39,38,37,36,43,42,41,40,47,46,45,44,51,50,49,48,55,54,53,52,59,58,57,56,63,62,61,60,67,66,65,64,71,70,69,68,75,74,73,72,79,78,77,76,83,82,81,80>\r
+\r
+IF (ccc AND 1) EQ 1\r
+\r
+lc2_&ccc=$+2\r
+        mov     bx, [ds:si+0c200h]\r
+lc1_&ccc=$+2\r
+        mov     ah, [ds:ccc*32 + bx + 0c100h]\r
+lc4_&ccc=$+2\r
+        mov     bx, [ds:ccc*64 + di + 0c400h]\r
+lc3_&ccc=$+2\r
+        add     ah, [ds:bx + di + 0c300h]\r
+ELSE\r
+lc2_&ccc=$+2\r
+        mov     bx, [ds:si+0c200h]\r
+lc1_&ccc=$+2\r
+        mov     al, [ds:ccc*32 + bx + 0c100h]\r
+lc4_&ccc=$+2\r
+        mov     bx, [ds:ccc*64 + di + 0c400h]\r
+lc3_&ccc=$+2\r
+        add     al, [ds:bx + di + 0c300h]\r
+ENDIF\r
+IF (ccc AND 3) EQ 2\r
+        shl     eax, 16d\r
+ENDIF\r
+IF (ccc AND 3) EQ 0\r
+        mov     [es:ccc], eax\r
+ENDIF\r
+        ENDM\r
+        pop     di si es ds\r
+        ret\r
+ENDP\r
+\r
+PROC    C setplzparas\r
+\r
+        ARG     c1:word, c2:word, c3:word, c4:word\r
+\r
+        IRP ccc, <0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83>\r
+        mov     ax, [c1]\r
+       add     ax, OFFSET psini+ccc*8\r
+        mov     [word (cs:lc1_&ccc)], ax\r
+        mov     ax, [c2]\r
+       shl     ax, 1d\r
+       add     ax, OFFSET lsini16-ccc*8+80*8\r
+       mov     [word (cs:lc2_&ccc)], ax\r
+       mov     ax, [c3]\r
+       add     ax, OFFSET psini-ccc*4+80*4\r
+       mov     [word (cs:lc3_&ccc)], ax\r
+       mov     ax, [c4]\r
+       shl     ax, 1d\r
+       add     ax, OFFSET lsini4+ccc*32\r
+       mov     [word (cs:lc4_&ccc)], ax\r
+       ENDM\r
+       ret\r
+ENDP\r
+\r
+PUBLIC C set_plzstart\r
+\r
+PROC   C set_plzstart\r
+\r
+       ARG     start:word\r
+\r
+       mov     dx, 3d4h\r
+       mov     al, 18h         ; linecompare\r
+       mov     ah, [Byte start]\r
+       out     dx, ax\r
+       mov     al, 07h\r
+       mov     ah, [Byte start+1]\r
+       shl     ah, 4d\r
+       and     ah, 10h\r
+       or      ah, 0fh\r
+       out     dx, ax                  ; 8th bit\r
+       ret\r
+\r
+ENDP\r
+\r
+\r
+ENDS\r
+END\r
diff --git a/asmyt.err b/asmyt.err
new file mode 100755 (executable)
index 0000000..973dacc
Binary files /dev/null and b/asmyt.err differ
diff --git a/asmyt.h b/asmyt.h
new file mode 100755 (executable)
index 0000000..dc4a31f
--- /dev/null
+++ b/asmyt.h
@@ -0,0 +1,5 @@
+#ifndef _ASMYT_H_\r
+#define _ASMYT_H_\r
+int plzline();\r
+\r
+#endif\r
diff --git a/asmyt.o b/asmyt.o
deleted file mode 100755 (executable)
index cccfe42..0000000
Binary files a/asmyt.o and /dev/null differ
diff --git a/copper.h b/copper.h
new file mode 100755 (executable)
index 0000000..fbe485b
--- /dev/null
+++ b/copper.h
@@ -0,0 +1,5 @@
+#ifndef _COPPER_H_\r
+#define _COPPER_H_\r
+init_copper();\r
+close_copper();\r
+#endif\r
index 59b62a5e150668d5f91ce58752526ec02d6dd616..d315cdbee972b7b7e2e7ae5bf4ac068760acd309 100755 (executable)
Binary files a/copper.o and b/copper.o differ
index f01a098845e230d9bd00c0e0224634a621d57e9a..bef08895c2ec72386f71766d0397c7ebd2c119f6 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -50,19 +50,10 @@ TARGET_OS = dos
 #EXMMTESTDIR=16$(DIRSEP)exmmtest$(DIRSEP)\r
 SRC=src$(DIRSEP)\r
 SRCLIB=$(SRC)lib$(DIRSEP)\r
-JSMNLIB=$(SRCLIB)jsmn$(DIRSEP)\r
-NYANLIB=$(SRCLIB)nyan$(DIRSEP)\r
-#EXMMLIB=$(SRCLIB)exmm$(DIRSEP)\r
-MODEXLIB=$(SRCLIB)modex16$(DIRSEP)\r
-MODEXLIB_=$(SRCLIB)modex$(DIRSEP)\r
-VGMSNDLIB=$(SRCLIB)vgmsnd$(DIRSEP)\r
-DOSLIB=$(SRCLIB)doslib$(DIRSEP)\r
-WCPULIB=$(SRCLIB)wcpu$(DIRSEP)\r
 \r
 AFLAGS=-mh -0 -d1\r
-16FLAGS=-fh=16.hed\r
-BAKAPIFLAGS=-fh=bakapi.hed\r
-SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k55808#60000#32768\r
+PLZFLAGS=-fh=plzpart.hed\r
+SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768\r
 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS)\r
 ZFLAGS=-zk0 -zq -zc -zp8# -zm\r
 CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo##wwww\r
@@ -70,17 +61,6 @@ OFLAGS=-obmiler -out -oh -ei -zp8 -fpi87  -onac -ol+ -ok####x
 FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS)\r
 \r
 \r
-DOSLIBEXMMOBJ = himemsys.$(OBJ) emm.$(OBJ)\r
-VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)\r
-DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)\r
-16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) timer.$(OBJ)\r
-#\r
-#3812intf.$(OBJ)\r
-GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ)\r
-\r
-TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe\r
-# tsthimem.exe\r
-#testemm.exe testemm0.exe fonttes0.exe miditest.exe sega.exe sountest.exe\r
 EXEC = plzpart.exe\r
 \r
 all: $(EXEC)\r
@@ -88,25 +68,31 @@ all: $(EXEC)
 #\r
 #game and bakapi executables\r
 #\r
-16.exe: 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib\r
-       wcl $(FLAGS) $(16FLAGS) 16.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=16.map\r
+plzpart.exe: plzpart.$(OBJ) copper.$(OBJ) asmyt.$(OBJ) tweak.$(OBJ) plz.$(OBJ)\r
+       wcl $(FLAGS) $(PLZFLAGS) plzpart.$(OBJ) copper.$(OBJ) asmyt.$(OBJ) tweak.$(OBJ) plz.$(OBJ) -fm=16.map\r
 \r
 \r
 #\r
 #executable's objects\r
 #\r
-16.$(OBJ): $(SRC)16.h $(SRC)16.c\r
-       wcl $(FLAGS) -c $(SRC)16.c\r
+plzpart.$(OBJ): plzpart.h plzpart.c\r
+       wcl $(FLAGS) -c plzpart.c\r
 \r
 #\r
 #non executable objects libraries\r
 #\r
-16.lib: $(16LIBOBJS)# doslib.lib vgmsnd.lib\r
-       wlib -b -q $(16LIBOBJS) $(16LIBOBJS)# doslib.lib vgmsnd.lib\r
+plz.$(OBJ): plz.h plz.c\r
+       wcl $(FLAGS) -c plz.c\r
+copper.$(OBJ): copper.h copper.asm\r
+       wcl $(AFLAGS) -zcm=tasm -c copper.asm\r
+tweak.$(OBJ): tweak.h tweak.asm\r
+       wcl $(AFLAGS) -zcm=tasm -c tweak.asm\r
+asmyt.$(OBJ): asmyt.h asmyt.asm\r
+       wcl $(AFLAGS) -zcm=tasm -c asmyt.asm\r
 \r
 #\r
 #other~\r
 #\r
 clean: .symbolic\r
        @$(REMOVECOMMAND) $(EXEC)\r
-       @$(REMOVECOMMAND) *.$(OBJ)\r
+       #@$(REMOVECOMMAND) *.$(OBJ)\r
diff --git a/plz.o b/plz.o
index 9de156e7b65df1fb5be076aeedd60c4f6c70243f..266fa9a1ca8863be6effb994d1486ac41bc8f5a7 100755 (executable)
Binary files a/plz.o and b/plz.o differ
index c5e798e7f8362568639185c0975775a78f7ff341..0f79e63eae817fa6256548b92bc8c3baa8732791 100755 (executable)
--- a/plzpart.c
+++ b/plzpart.c
@@ -1,8 +1,6 @@
 //#include "..\dis\dis.h"\r
+#include "plzpart.h"\r
 \r
-extern plz();\r
-extern  init_copper();\r
-extern  close_copper();\r
 //extern vect();\r
 \r
 void main()  {\r
diff --git a/plzpart.h b/plzpart.h
new file mode 100755 (executable)
index 0000000..9055993
--- /dev/null
+++ b/plzpart.h
@@ -0,0 +1,7 @@
+#ifndef _PLZPART_H_\r
+#define _PLZPART_H_\r
+#include "asmyt.h"\r
+#include "copper.h"\r
+#include "plz.h"\r
+\r
+#endif\r
index d9ad96e513ffb391745e09484315133bbe38868f..2becf4fe0acce9c0692e6e704b7642e6f3cd7889 100755 (executable)
Binary files a/plzpart.o and b/plzpart.o differ
diff --git a/tweak.asm b/tweak.asm
new file mode 100755 (executable)
index 0000000..56af677
--- /dev/null
+++ b/tweak.asm
@@ -0,0 +1,349 @@
+               IDEAL\r
+               MODEL huge\r
+\r
+CODESEG\r
+\r
+PUBLIC C tw_opengraph, C tw_putpixel, C tw_setpalette, C tw_setstart\r
+PUBLIC C tw_pictovmem, C tw_closegraph, C tw_waitvr, C tw_setrgbpalette\r
+PUBLIC         C tw_clrscr, C tw_setpalarea, C tw_getpixel, C tw_opengraph2\r
+\r
+PUBLIC         C scr_seg               ; videomuistin alku segmentti\r
+\r
+planetau       db      1,2,4,8\r
+scr_seg                dw      0a000h\r
+\r
+;      avaa 320x200 tweak tilan, 4 sivua, 4 planea\r
+\r
+PROC   tw_opengraph\r
+\r
+       mov     dx, 03c4h\r
+       mov     ax, 0f02h\r
+       out     dx, ax\r
+       mov     dx, 0a000h\r
+       mov     es, dx\r
+       xor     di, di\r
+       xor     ax, ax\r
+       mov     cx, 8000h\r
+       rep     stosw                   ; clear vmem\r
+\r
+       mov     dx, 3d4h\r
+       mov     ax, 0209h\r
+       out     dx, ax                  ; 134 y\r
+\r
+       mov     ax, 5013h\r
+       out     dx, ax                  ; 640 wide\r
+       ret\r
+ENDP\r
+\r
+\r
+PROC   tw_opengraph2\r
+\r
+       mov     dx, 03c4h\r
+       mov     ax, 0604h\r
+       out     dx, ax                  ; chain4 off\r
+\r
+       mov     ax, 0f02h\r
+       out     dx, ax\r
+       mov     dx, 0a000h\r
+       mov     es, dx\r
+       xor     di, di\r
+       xor     ax, ax\r
+       mov     cx, 8000h\r
+       rep     stosw                   ; clear vmem\r
+\r
+       mov     dx, 03d4h\r
+       mov     ax, 0014h\r
+       out     dx, ax                  ; crtc long off\r
+\r
+       mov     ax, 0e317h\r
+       out     dx, ax                  ; crtc byte on\r
+\r
+       mov     ax, 0009h\r
+       out     dx, ax                  ; 400\r
+\r
+       mov     ax, 3013h\r
+       out     dx, ax                  ; 384 wide\r
+\r
+       ret\r
+ENDP\r
+\r
+\r
+\r
+PROC    tw_clrscr\r
+\r
+       mov     dx, 3c4h\r
+       mov     ax, 0f02h\r
+       out     dx, ax\r
+       mov     dx, [cs:scr_seg]\r
+       mov     es, dx\r
+       xor     di, di\r
+       xor     eax, eax\r
+       mov     cx, 1000h\r
+       rep     stosd                   ; clear vmem\r
+\r
+       ret\r
+ENDP\r
+\r
+PROC   tw_closegraph\r
+\r
+       mov     ax, 03h\r
+       int     10h\r
+\r
+       ret\r
+ENDP\r
+\r
+;      piirt\84\84 pisteen ruudulle\r
+\r
+PROC   tw_putpixel\r
+\r
+       ARG     x:word, y:word, color:word\r
+\r
+       push    bp\r
+       mov     bp, sp\r
+\r
+       mov     ax, [cs:scr_seg]\r
+       mov     es, ax\r
+\r
+       mov     dx, 03c4h\r
+       mov     bx, [x]\r
+       and     bx, 03h\r
+       mov     ah, [cs:planetau+bx]\r
+       mov     al, 02h\r
+       out     dx, ax              ; select plane\r
+\r
+       mov     bx, [x]\r
+       shr     bx, 2\r
+       mov     ax, [y]\r
+       shl     ax, 4\r
+       add     bx, ax\r
+       shl     ax, 1\r
+       add     bx, ax\r
+       shl     ax, 2\r
+       add     bx, ax\r
+\r
+       mov cx, [color]\r
+       mov     [es:bx], cl\r
+\r
+       pop     bp\r
+       ret\r
+ENDP\r
+\r
+PROC   tw_getpixel\r
+\r
+       ARG     x:word, y:word\r
+\r
+       push    bp\r
+       mov     bp, sp\r
+\r
+       mov     ax, [scr_seg]\r
+       mov     es, ax\r
+\r
+       mov     dx, 03ceh\r
+       mov     ax, [x]\r
+       and     ax, 03h\r
+       mov     ah, al\r
+       mov     al, 04h\r
+       out     dx, ax                          ; select plane\r
+\r
+       mov     ax, [y]\r
+       shl     ax, 4\r
+       mov     bx, ax\r
+       shl     ax, 1\r
+       add     bx, ax\r
+       shl     ax, 2\r
+       add     bx, ax\r
+       mov     ax, [x]\r
+       shr     ax, 2\r
+       add     bx, ax\r
+\r
+       xor     ax, ax\r
+       mov     al,[es:bx]\r
+\r
+       pop     bp\r
+       ret\r
+ENDP\r
+;      vaihtaa koko paletin\r
+\r
+PROC   tw_setpalette\r
+\r
+       ARG     pal:dword\r
+\r
+       push    bp\r
+       mov     bp, sp\r
+       push    si ds\r
+\r
+       lds     si,[pal]\r
+       cld\r
+       mov     cx, 300h\r
+       mov     dx, 03c8h\r
+       mov     al, 0\r
+       out     dx, al\r
+       inc     dx\r
+\r
+       rep     outsb\r
+\r
+       pop     ds si\r
+       pop     bp\r
+       ret\r
+ENDP\r
+\r
+PROC   C tw_setpalarea\r
+\r
+       ARG     pal:dword, start:word, cnt:word\r
+\r
+       push    si ds\r
+\r
+       lds     si,[pal]\r
+       cld\r
+       mov     cx, [cnt]\r
+       mov     ax, cx\r
+       add     cx, ax\r
+       add     cx, ax\r
+       mov     dx, 03c8h\r
+       mov     ax, [start]\r
+       out     dx, al\r
+       inc     dx\r
+\r
+       rep     outsb\r
+\r
+       pop     ds si\r
+       ret\r
+ENDP\r
+\r
+;      asettaa videomuistin alun\r
+\r
+PROC   tw_setstart\r
+\r
+       ARG     start:word\r
+\r
+       push    bp\r
+       mov     bp,sp\r
+\r
+       mov     bx, [start]\r
+       mov     dx, 03d4h\r
+       mov     al, 0dh\r
+       mov     ah, bl\r
+       out     dx, ax\r
+       mov     al, 0ch\r
+       mov     ah, bh\r
+       out     dx, ax\r
+\r
+       pop     bp\r
+       ret\r
+ENDP\r
+\r
+; kopioi muistista unpacked 1bpl kuvan 4planen kuvaksi videomuistiin\r
+; void tw_pictovmem(char far *pic, unsigned int vstart, unsigned int bytes);\r
+\r
+PROC   tw_pictovmem\r
+\r
+       ARG     pic:dword,to:word,len:word\r
+\r
+       push    bp\r
+       mov     bp,sp\r
+       push    ds es si di\r
+\r
+       mov     es, [scr_seg]\r
+       mov     di, [to]\r
+       lds     si, [pic]\r
+       mov     cx, [len]\r
+\r
+       mov    dx,03ceh\r
+       mov    ax,4005h                 ; w-mode 0\r
+       out    dx,ax\r
+\r
+       mov     dx, 03c4h\r
+       mov     al, 02h\r
+       mov     ah, 1h\r
+       out     dx, ax\r
+       shr     cx, 2\r
+@@l1:\r
+       movsb\r
+       add     si, 3\r
+       loop    @@l1\r
+\r
+\r
+       lds     si, [pic]\r
+       add     si, 1d\r
+       mov     di, [to]\r
+       mov     cx, [len]\r
+\r
+       mov     ax, 0202h\r
+       out     dx, ax\r
+       shr     cx, 2\r
+@@l2:\r
+       movsb\r
+       add     si, 3\r
+       loop    @@l2\r
+\r
+\r
+       lds     si, [pic]\r
+       add     si, 2d\r
+       mov     di, [to]\r
+       mov     cx, [len]\r
+\r
+       mov     ax, 0402h\r
+       out     dx, ax\r
+       shr     cx, 2\r
+@@l3:\r
+       movsb\r
+       add     si, 3\r
+       loop    @@l3\r
+\r
+\r
+       lds     si, [pic]\r
+       add     si, 3d\r
+       mov     di, [to]\r
+       mov     cx, [len]\r
+\r
+       mov     ax, 0802h\r
+       out     dx, ax\r
+       shr     cx, 2\r
+@@l4:\r
+       movsb\r
+       add     si, 3\r
+       loop    @@l4\r
+\r
+       pop     di si es ds\r
+       pop     bp\r
+       ret\r
+ENDP\r
+\r
+PROC    tw_waitvr\r
+\r
+       mov     dx, 03dah\r
+\r
+@@loop1:\r
+       in      al, dx\r
+       test    al, 08h\r
+       jnz     @@loop1\r
+\r
+@@loop2:\r
+       in      al, dx\r
+       test    al, 08h\r
+       jz      @@loop2\r
+\r
+       ret\r
+ENDP\r
+\r
+\r
+PROC   C tw_setrgbpalette\r
+\r
+       ARG     pal:word, r:word, g:word, b:word\r
+\r
+       mov     dx, 3c8h\r
+       mov     ax, [pal]\r
+       out     dx, al\r
+\r
+       inc     dx\r
+       mov     ax, [r]\r
+       out     dx, al\r
+       mov     ax, [g]\r
+       out     dx, al\r
+       mov     ax, [b]\r
+       out     dx, al\r
+\r
+       ret\r
+ENDP\r
+\r
+END\r
diff --git a/tweak.h b/tweak.h
new file mode 100755 (executable)
index 0000000..5fe23be
--- /dev/null
+++ b/tweak.h
@@ -0,0 +1,5 @@
+#ifndef _TWEAK_H_\r
+#define _TWEAK_H_\r
+void tw_opengraph2();\r
+void tw_setrgbpalette();\r
+#endif\r