Initial commit

This commit is contained in:
Gwen Gourevich
2021-10-27 10:34:18 +02:00
parent 43ad18eb04
commit c5f4f6ba25
199 changed files with 73169 additions and 0 deletions

13
LIB386/LIB_3D/BUILD.BAT Normal file
View File

@@ -0,0 +1,13 @@
call watcom10
pkunzip -o obj >NUL
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

123
LIB386/LIB_3D/LIB_3D.H Normal file
View File

@@ -0,0 +1,123 @@
#ifdef WATCOM9
#pragma library ("f:\projet\lib386\lib_3d\lb9_3d.lib");
#else
#pragma library ("f:\projet\lib386\lib_3d\lib_3d.lib");
#endif
#define NORMAL_UNIT 64
#define INFO_TRI 1
#define INFO_ANIM 2
#define TYPE_ROTATE 0
#define TYPE_TRANSLATE 1
#define TYPE_ZOOM 2
#define MAT_TRISTE 0
#define MAT_PIERRE 1
#define MAT_COPPER 2
#define MAT_BOPPER 3
#define MAT_MARBRE 4
#define MAT_TRANS 5
#define MAT_TRAME 6
#define MAT_FLAT 7
#define MAT_GRANIT 8
#define MAT_GOURAUD 9
#define MAT_DITHER 10
/* structures */
typedef struct { WORD X ;
WORD Y ;
WORD Z ; } T_GROUPE_INFO ;
typedef struct { WORD StartValue ;
WORD EndValue ;
UWORD TimeValue ;
ULONG MemoTicks ; } T_REAL_VALUE ;
typedef struct { WORD Xp ;
WORD Yp ;
WORD Zrot ; } T_LIST_POINT ;
extern WORD AnimMasterRot ;
extern WORD AnimStepAlpha, AnimStepBeta, AnimStepGamma ;
extern WORD AnimStepX, AnimStepY, AnimStepZ ;
extern WORD ScreenXmin, ScreenXmax, ScreenYmin, ScreenYmax ;
extern WORD XCentre, YCentre ;
extern WORD IsoScale ;
extern WORD Xp, Yp ;
extern WORD Z_Min, Z_Max ;
extern WORD NbPoints ;
extern T_LIST_POINT List_Point ;
extern LONG KFactor, LFactorY, LFactorX ;
extern LONG X0, Y0, Z0 ;
extern LONG EX0, EY0 ; /* Rot2D sur LONG */
extern LONG CameraX, CameraY, CameraZ ;
extern LONG CameraXr, CameraYr, CameraZr ;
extern LONG Alpha, Beta, Gamma ;
extern LONG lAlpha, lBeta, lGamma ;
extern LONG AlphaLight, BetaLight, GammaLight ;
extern LONG NormalXLight, NormalYLight, NormalZLight ;
extern LONG MatriceWorld, MatriceTempo;
extern LONG MatriceRot, MatriceDummy;
extern LONG Distance ;
extern LONG CmptMemoTimerRef ;
void InitRealValue( WORD start,
WORD end,
WORD time,
T_REAL_VALUE *ptrstruct ) ;
void InitRealAngle( WORD start,
WORD end,
WORD time,
T_REAL_VALUE *ptrstruct ) ;
WORD GetRealValue( T_REAL_VALUE *ptrstruct ) ;
WORD GetRealAngle( T_REAL_VALUE *ptrstruct ) ;
WORD StockInterAnim( UBYTE *BufferAnim, UBYTE *PtrObj ) ;
LONG RegleTrois32( LONG val1, LONG val2, LONG nbstep, LONG step ) ;
LONG Distance2D( LONG x0, LONG z0, LONG x1, LONG z1 ) ;
LONG Distance3D( LONG x0, LONG y0, LONG z0,
LONG x1, LONG y1, LONG z1 ) ;
void Rot2D( LONG x, LONG y, LONG angle ) ;
void WorldRotatePoint( LONG x, LONG y, LONG angle ) ;
void LongWorldRotatePoint( LONG x, LONG y, LONG angle ) ;
void LongInverseRotatePoint( LONG x, LONG y, LONG angle ) ;
void SetLightVector( WORD alpha, WORD beta, WORD gamma ) ;
void CopyMatrice( LONG *MatSrc, LONG *MatDest );
LONG AffObjetIso(LONG xwr, LONG ywr, LONG zwr,
LONG palpha, LONG pbeta, LONG pgamma,
void *ptrobj);
void PatchObjet(void *ptrobj);
LONG ProjettePoint(LONG CoorX, LONG CoorY, LONG CoorZ);
LONG LongProjettePoint(LONG CoorX, LONG CoorY, LONG CoorZ);
void SetProjection(LONG xc, LONG yc, LONG kfact, LONG lfactx, LONG lfacty);
void SetIsoProjection(LONG xc, LONG yc, LONG scale);
ULONG Sqr(ULONG x);

60
LIB386/LIB_3D/MAKEFILE Normal file
View File

@@ -0,0 +1,60 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom\bin\wcc386p
WL = f:\compil\watcom\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oeaxt /zp2 /4s /zq /s /DWATCOM9
!else
CFLAGS = /oeaxt /zp2 /5s /zq /s
!endif
LFLAGS = /c /q /b /n
#AFLAGS = /m2 /mx /z /p /q /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
OBJETS1 = P_SINTAB.obj P_ANIM.obj
OBJETS2 = P_OB_ISO.obj P_TRIGO.obj
OBJETS3 = P_FUNC.obj
OBJETS4 =
!ifeq WATCOM9 yes
LIB = LB9_3D
!else
LIB = LIB_3D
!endif
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4)
@echo $(OBJETS1) > clibmak.rsp
@echo $(OBJETS2) >> clibmak.rsp
@echo $(OBJETS3) >> clibmak.rsp
# @echo $(OBJETS4) >> clibmak.rsp
@$(WL) $(WLIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre G "$(LIB)"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(WCFLAGS) $*

1115
LIB386/LIB_3D/P_ANIM.ASM Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
NORMAL_UNIT equ 64
INFO_TRI equ 1
INFO_ANIM equ 2
INFO_TORTUE equ 4
E_LIGNE equ 0 ; drawing entite
E_POLY equ 1
E_SPHERE equ 2
E_POINT equ 3
TYPE_ROTATE equ 0
TYPE_TRANSLATE equ 1
TYPE_ZOOM equ 2
TYPE_3D equ 0
TYPE_ISO equ 1
T00 equ 0
T01 equ 2
T02 equ 4
T10 equ 6
T11 equ 8
T12 equ 10
T20 equ 12
T21 equ 14
T22 equ 16
LT00 equ 0
LT01 equ 4
LT02 equ 8
LT10 equ 12
LT11 equ 16
LT12 equ 20
LT20 equ 24
LT21 equ 28
LT22 equ 32

1259
LIB386/LIB_3D/P_FUNC.ASM Normal file

File diff suppressed because it is too large Load Diff

1749
LIB386/LIB_3D/P_OBJET.ASM Normal file

File diff suppressed because it is too large Load Diff

1712
LIB386/LIB_3D/P_OBJ_3D.ASM Normal file

File diff suppressed because it is too large Load Diff

1736
LIB386/LIB_3D/P_OB_ISO.ASM Normal file

File diff suppressed because it is too large Load Diff

276
LIB386/LIB_3D/P_SINTAB.ASM Normal file
View File

@@ -0,0 +1,276 @@
.386p
.model SMALL, SYSCALL
.data
EVEN
public NoLanguage P_SinTab
comment #
P_SinTab dw 0, 201, 402, 603, 804, 1005, 1206, 1407
dw 1608, 1809, 2009, 2210, 2411, 2611, 2811, 3012
dw 3212, 3412, 3612, 3812, 4011, 4211, 4410, 4609
dw 4808, 5007, 5205, 5404, 5602, 5800, 5998, 6195
dw 6393, 6590, 6787, 6983, 7180, 7376, 7571, 7767
dw 7962, 8157, 8351, 8546, 8740, 8933, 9127, 9319
dw 9512, 9704, 9896, 10088, 10279, 10469, 10660, 10850
dw 11039, 11228, 11417, 11605, 11793, 11980, 12167, 12354
dw 12540, 12725, 12910, 13095, 13279, 13463, 13646, 13828
dw 14010, 14192, 14373, 14553, 14733, 14912, 15091, 15269
dw 15447, 15624, 15800, 15976, 16151, 16326, 16500, 16673
dw 16846, 17018, 17190, 17361, 17531, 17700, 17869, 18037
dw 18205, 18372, 18538, 18703, 18868, 19032, 19195, 19358
dw 19520, 19681, 19841, 20001, 20160, 20318, 20475, 20632
dw 20788, 20943, 21097, 21251, 21403, 21555, 21706, 21856
dw 22006, 22154, 22302, 22449, 22595, 22740, 22884, 23028
dw 23170, 23312, 23453, 23593, 23732, 23870, 24008, 24144
dw 24279, 24414, 24548, 24680, 24812, 24943, 25073, 25202
dw 25330, 25457, 25583, 25708, 25833, 25956, 26078, 26199
dw 26320, 26439, 26557, 26674, 26791, 26906, 27020, 27133
dw 27246, 27357, 27467, 27576, 27684, 27791, 27897, 28002
dw 28106, 28209, 28311, 28411, 28511, 28610, 28707, 28803
dw 28899, 28993, 29086, 29178, 29269, 29359, 29448, 29535
dw 29622, 29707, 29792, 29875, 29957, 30038, 30118, 30196
dw 30274, 30350, 30425, 30499, 30572, 30644, 30715, 30784
dw 30853, 30920, 30986, 31050, 31114, 31177, 31238, 31298
dw 31357, 31415, 31471, 31527, 31581, 31634, 31686, 31737
dw 31786, 31834, 31881, 31927, 31972, 32015, 32058, 32099
dw 32138, 32177, 32214, 32251, 32286, 32319, 32352, 32383
dw 32413, 32442, 32470, 32496, 32522, 32546, 32568, 32590
dw 32610, 32629, 32647, 32664, 32679, 32693, 32706, 32718
dw 32729, 32738, 32746, 32753, 32758, 32762, 32766, 32767
dw 32767, 32767, 32766, 32762, 32758, 32753, 32746, 32738
dw 32729, 32718, 32706, 32693, 32679, 32664, 32647, 32629
dw 32610, 32590, 32568, 32546, 32522, 32496, 32470, 32442
dw 32413, 32383, 32352, 32319, 32286, 32251, 32214, 32177
dw 32138, 32099, 32058, 32015, 31972, 31927, 31881, 31834
dw 31786, 31737, 31686, 31634, 31581, 31527, 31471, 31415
dw 31357, 31298, 31238, 31177, 31114, 31050, 30986, 30920
dw 30853, 30784, 30715, 30644, 30572, 30499, 30425, 30350
dw 30274, 30196, 30118, 30038, 29957, 29875, 29792, 29707
dw 29622, 29535, 29448, 29359, 29269, 29178, 29086, 28993
dw 28899, 28803, 28707, 28610, 28511, 28411, 28311, 28209
dw 28106, 28002, 27897, 27791, 27684, 27576, 27467, 27357
dw 27246, 27133, 27020, 26906, 26791, 26674, 26557, 26439
dw 26320, 26199, 26078, 25956, 25833, 25708, 25583, 25457
dw 25330, 25202, 25073, 24943, 24812, 24680, 24548, 24414
dw 24279, 24144, 24008, 23870, 23732, 23593, 23453, 23312
dw 23170, 23028, 22884, 22740, 22595, 22449, 22302, 22154
dw 22006, 21856, 21706, 21555, 21403, 21251, 21097, 20943
dw 20788, 20632, 20475, 20318, 20160, 20001, 19841, 19681
dw 19520, 19358, 19195, 19032, 18868, 18703, 18538, 18372
dw 18205, 18037, 17869, 17700, 17531, 17361, 17190, 17018
dw 16846, 16673, 16500, 16326, 16151, 15976, 15800, 15624
dw 15447, 15269, 15091, 14912, 14733, 14553, 14373, 14192
dw 14010, 13828, 13646, 13463, 13279, 13095, 12910, 12725
dw 12540, 12354, 12167, 11980, 11793, 11605, 11417, 11228
dw 11039, 10850, 10660, 10469, 10279, 10088, 9896, 9704
dw 9512, 9319, 9127, 8933, 8740, 8546, 8351, 8157
dw 7962, 7767, 7571, 7376, 7180, 6983, 6787, 6590
dw 6393, 6195, 5998, 5800, 5602, 5404, 5205, 5007
dw 4808, 4609, 4410, 4211, 4011, 3812, 3612, 3412
dw 3212, 3012, 2811, 2611, 2411, 2210, 2009, 1809
dw 1608, 1407, 1206, 1005, 804, 603, 402, 201
dw 0, -201, -402, -603, -804, -1005, -1206, -1407
dw -1608, -1809, -2009, -2210, -2411, -2611, -2811, -3012
dw -3212, -3412, -3612, -3812, -4011, -4211, -4410, -4609
dw -4808, -5007, -5205, -5404, -5602, -5800, -5998, -6195
dw -6393, -6590, -6787, -6983, -7180, -7376, -7571, -7767
dw -7962, -8157, -8351, -8546, -8740, -8933, -9127, -9319
dw -9512, -9704, -9896, -10088, -10279, -10469, -10660, -10850
dw -11039, -11228, -11417, -11605, -11793, -11980, -12167, -12354
dw -12540, -12725, -12910, -13095, -13279, -13463, -13646, -13828
dw -14010, -14192, -14373, -14553, -14733, -14912, -15091, -15269
dw -15447, -15624, -15800, -15976, -16151, -16326, -16500, -16673
dw -16846, -17018, -17190, -17361, -17531, -17700, -17869, -18037
dw -18205, -18372, -18538, -18703, -18868, -19032, -19195, -19358
dw -19520, -19681, -19841, -20001, -20160, -20318, -20475, -20632
dw -20788, -20943, -21097, -21251, -21403, -21555, -21706, -21856
dw -22006, -22154, -22302, -22449, -22595, -22740, -22884, -23028
dw -23170, -23312, -23453, -23593, -23732, -23870, -24008, -24144
dw -24279, -24414, -24548, -24680, -24812, -24943, -25073, -25202
dw -25330, -25457, -25583, -25708, -25833, -25956, -26078, -26199
dw -26320, -26439, -26557, -26674, -26791, -26906, -27020, -27133
dw -27246, -27357, -27467, -27576, -27684, -27791, -27897, -28002
dw -28106, -28209, -28311, -28411, -28511, -28610, -28707, -28803
dw -28899, -28993, -29086, -29178, -29269, -29359, -29448, -29535
dw -29622, -29707, -29792, -29875, -29957, -30038, -30118, -30196
dw -30274, -30350, -30425, -30499, -30572, -30644, -30715, -30784
dw -30853, -30920, -30986, -31050, -31114, -31177, -31238, -31298
dw -31357, -31415, -31471, -31527, -31581, -31634, -31686, -31737
dw -31786, -31834, -31881, -31927, -31972, -32015, -32058, -32099
dw -32138, -32177, -32214, -32251, -32286, -32319, -32352, -32383
dw -32413, -32442, -32470, -32496, -32522, -32546, -32568, -32590
dw -32610, -32629, -32647, -32664, -32679, -32693, -32706, -32718
dw -32729, -32738, -32746, -32753, -32758, -32762, -32766, -32767
dw -32768, -32767, -32766, -32762, -32758, -32753, -32746, -32738
dw -32729, -32718, -32706, -32693, -32679, -32664, -32647, -32629
dw -32610, -32590, -32568, -32546, -32522, -32496, -32470, -32442
dw -32413, -32383, -32352, -32319, -32286, -32251, -32214, -32177
dw -32138, -32099, -32058, -32015, -31972, -31927, -31881, -31834
dw -31786, -31737, -31686, -31634, -31581, -31527, -31471, -31415
dw -31357, -31298, -31238, -31177, -31114, -31050, -30986, -30920
dw -30853, -30784, -30715, -30644, -30572, -30499, -30425, -30350
dw -30274, -30196, -30118, -30038, -29957, -29875, -29792, -29707
dw -29622, -29535, -29448, -29359, -29269, -29178, -29086, -28993
dw -28899, -28803, -28707, -28610, -28511, -28411, -28311, -28209
dw -28106, -28002, -27897, -27791, -27684, -27576, -27467, -27357
dw -27246, -27133, -27020, -26906, -26791, -26674, -26557, -26439
dw -26320, -26199, -26078, -25956, -25833, -25708, -25583, -25457
dw -25330, -25202, -25073, -24943, -24812, -24680, -24548, -24414
dw -24279, -24144, -24008, -23870, -23732, -23593, -23453, -23312
dw -23170, -23028, -22884, -22740, -22595, -22449, -22302, -22154
dw -22006, -21856, -21706, -21555, -21403, -21251, -21097, -20943
dw -20788, -20632, -20475, -20318, -20160, -20001, -19841, -19681
dw -19520, -19358, -19195, -19032, -18868, -18703, -18538, -18372
dw -18205, -18037, -17869, -17700, -17531, -17361, -17190, -17018
dw -16846, -16673, -16500, -16326, -16151, -15976, -15800, -15624
dw -15447, -15269, -15091, -14912, -14733, -14553, -14373, -14192
dw -14010, -13828, -13646, -13463, -13279, -13095, -12910, -12725
dw -12540, -12354, -12167, -11980, -11793, -11605, -11417, -11228
dw -11039, -10850, -10660, -10469, -10279, -10088, -9896, -9704
dw -9512, -9319, -9127, -8933, -8740, -8546, -8351, -8157
dw -7962, -7767, -7571, -7376, -7180, -6983, -6787, -6590
dw -6393, -6195, -5998, -5800, -5602, -5404, -5205, -5007
dw -4808, -4609, -4410, -4211, -4011, -3812, -3612, -3412
dw -3212, -3012, -2811, -2611, -2411, -2210, -2009, -1809
dw -1608, -1407, -1206, -1005, -804, -603, -402, -201
#
;comment #
P_SinTab dw 0, 101, 201, 302, 402, 503, 603, 704
dw 804, 904, 1005, 1105, 1205, 1306, 1406, 1506
dw 1606, 1706, 1806, 1906, 2006, 2105, 2205, 2305
dw 2404, 2503, 2603, 2702, 2801, 2900, 2999, 3098
dw 3196, 3295, 3393, 3492, 3590, 3688, 3786, 3883
dw 3981, 4078, 4176, 4273, 4370, 4467, 4563, 4660
dw 4756, 4852, 4948, 5044, 5139, 5235, 5330, 5425
dw 5520, 5614, 5708, 5803, 5897, 5990, 6084, 6177
dw 6270, 6363, 6455, 6547, 6639, 6731, 6823, 6914
dw 7005, 7096, 7186, 7276, 7366, 7456, 7545, 7635
dw 7723, 7812, 7900, 7988, 8076, 8163, 8250, 8337
dw 8423, 8509, 8595, 8680, 8765, 8850, 8935, 9019
dw 9102, 9186, 9269, 9352, 9434, 9516, 9598, 9679
dw 9760, 9841, 9921, 10001, 10080, 10159, 10238, 10316
dw 10394, 10471, 10549, 10625, 10702, 10778, 10853, 10928
dw 11003, 11077, 11151, 11224, 11297, 11370, 11442, 11514
dw 11585, 11656, 11727, 11797, 11866, 11935, 12004, 12072
dw 12140, 12207, 12274, 12340, 12406, 12472, 12537, 12601
dw 12665, 12729, 12792, 12854, 12916, 12978, 13039, 13100
dw 13160, 13219, 13279, 13337, 13395, 13453, 13510, 13567
dw 13623, 13678, 13733, 13788, 13842, 13896, 13949, 14001
dw 14053, 14104, 14155, 14206, 14256, 14305, 14354, 14402
dw 14449, 14497, 14543, 14589, 14635, 14680, 14724, 14768
dw 14811, 14854, 14896, 14937, 14978, 15019, 15059, 15098
dw 15137, 15175, 15213, 15250, 15286, 15322, 15357, 15392
dw 15426, 15460, 15493, 15525, 15557, 15588, 15619, 15649
dw 15679, 15707, 15736, 15763, 15791, 15817, 15843, 15868
dw 15893, 15917, 15941, 15964, 15986, 16008, 16029, 16049
dw 16069, 16088, 16107, 16125, 16143, 16160, 16176, 16192
dw 16207, 16221, 16235, 16248, 16261, 16273, 16284, 16295
dw 16305, 16315, 16324, 16332, 16340, 16347, 16353, 16359
dw 16364, 16369, 16373, 16376, 16379, 16381, 16383, 16384
dw 16384, 16384, 16383, 16381, 16379, 16376, 16373, 16369
dw 16364, 16359, 16353, 16347, 16340, 16332, 16324, 16315
dw 16305, 16295, 16284, 16273, 16261, 16248, 16235, 16221
dw 16207, 16192, 16176, 16160, 16143, 16125, 16107, 16088
dw 16069, 16049, 16029, 16008, 15986, 15964, 15941, 15917
dw 15893, 15868, 15843, 15817, 15791, 15763, 15736, 15707
dw 15679, 15649, 15619, 15588, 15557, 15525, 15493, 15460
dw 15426, 15392, 15357, 15322, 15286, 15250, 15213, 15175
dw 15137, 15098, 15059, 15019, 14978, 14937, 14896, 14854
dw 14811, 14768, 14724, 14680, 14635, 14589, 14543, 14497
dw 14449, 14402, 14354, 14305, 14256, 14206, 14155, 14104
dw 14053, 14001, 13949, 13896, 13842, 13788, 13733, 13678
dw 13623, 13567, 13510, 13453, 13395, 13337, 13279, 13219
dw 13160, 13100, 13039, 12978, 12916, 12854, 12792, 12729
dw 12665, 12601, 12537, 12472, 12406, 12340, 12274, 12207
dw 12140, 12072, 12004, 11935, 11866, 11797, 11727, 11656
dw 11585, 11514, 11442, 11370, 11297, 11224, 11151, 11077
dw 11003, 10928, 10853, 10778, 10702, 10625, 10549, 10471
dw 10394, 10316, 10238, 10159, 10080, 10001, 9921, 9841
dw 9760, 9679, 9598, 9516, 9434, 9352, 9269, 9186
dw 9102, 9019, 8935, 8850, 8765, 8680, 8595, 8509
dw 8423, 8337, 8250, 8163, 8076, 7988, 7900, 7812
dw 7723, 7635, 7545, 7456, 7366, 7276, 7186, 7096
dw 7005, 6914, 6823, 6731, 6639, 6547, 6455, 6363
dw 6270, 6177, 6084, 5990, 5897, 5803, 5708, 5614
dw 5520, 5425, 5330, 5235, 5139, 5044, 4948, 4852
dw 4756, 4660, 4563, 4467, 4370, 4273, 4176, 4078
dw 3981, 3883, 3786, 3688, 3590, 3492, 3393, 3295
dw 3196, 3098, 2999, 2900, 2801, 2702, 2603, 2503
dw 2404, 2305, 2205, 2105, 2006, 1906, 1806, 1706
dw 1606, 1506, 1406, 1306, 1205, 1105, 1005, 904
dw 804, 704, 603, 503, 402, 302, 201, 101
dw 0, -101, -201, -302, -402, -503, -603, -704
dw -804, -904, -1005, -1105, -1205, -1306, -1406, -1506
dw -1606, -1706, -1806, -1906, -2006, -2105, -2205, -2305
dw -2404, -2503, -2603, -2702, -2801, -2900, -2999, -3098
dw -3196, -3295, -3393, -3492, -3590, -3688, -3786, -3883
dw -3981, -4078, -4176, -4273, -4370, -4467, -4563, -4660
dw -4756, -4852, -4948, -5044, -5139, -5235, -5330, -5425
dw -5520, -5614, -5708, -5803, -5897, -5990, -6084, -6177
dw -6270, -6363, -6455, -6547, -6639, -6731, -6823, -6914
dw -7005, -7096, -7186, -7276, -7366, -7456, -7545, -7635
dw -7723, -7812, -7900, -7988, -8076, -8163, -8250, -8337
dw -8423, -8509, -8595, -8680, -8765, -8850, -8935, -9019
dw -9102, -9186, -9269, -9352, -9434, -9516, -9598, -9679
dw -9760, -9841, -9921, -10001, -10080, -10159, -10238, -10316
dw -10394, -10471, -10549, -10625, -10702, -10778, -10853, -10928
dw -11003, -11077, -11151, -11224, -11297, -11370, -11442, -11514
dw -11585, -11656, -11727, -11797, -11866, -11935, -12004, -12072
dw -12140, -12207, -12274, -12340, -12406, -12472, -12537, -12601
dw -12665, -12729, -12792, -12854, -12916, -12978, -13039, -13100
dw -13160, -13219, -13279, -13337, -13395, -13453, -13510, -13567
dw -13623, -13678, -13733, -13788, -13842, -13896, -13949, -14001
dw -14053, -14104, -14155, -14206, -14256, -14305, -14354, -14402
dw -14449, -14497, -14543, -14589, -14635, -14680, -14724, -14768
dw -14811, -14854, -14896, -14937, -14978, -15019, -15059, -15098
dw -15137, -15175, -15213, -15250, -15286, -15322, -15357, -15392
dw -15426, -15460, -15493, -15525, -15557, -15588, -15619, -15649
dw -15679, -15707, -15736, -15763, -15791, -15817, -15843, -15868
dw -15893, -15917, -15941, -15964, -15986, -16008, -16029, -16049
dw -16069, -16088, -16107, -16125, -16143, -16160, -16176, -16192
dw -16207, -16221, -16235, -16248, -16261, -16273, -16284, -16295
dw -16305, -16315, -16324, -16332, -16340, -16347, -16353, -16359
dw -16364, -16369, -16373, -16376, -16379, -16381, -16383, -16384
dw -16384, -16384, -16383, -16381, -16379, -16376, -16373, -16369
dw -16364, -16359, -16353, -16347, -16340, -16332, -16324, -16315
dw -16305, -16295, -16284, -16273, -16261, -16248, -16235, -16221
dw -16207, -16192, -16176, -16160, -16143, -16125, -16107, -16088
dw -16069, -16049, -16029, -16008, -15986, -15964, -15941, -15917
dw -15893, -15868, -15843, -15817, -15791, -15763, -15736, -15707
dw -15679, -15649, -15619, -15588, -15557, -15525, -15493, -15460
dw -15426, -15392, -15357, -15322, -15286, -15250, -15213, -15175
dw -15137, -15098, -15059, -15019, -14978, -14937, -14896, -14854
dw -14811, -14768, -14724, -14680, -14635, -14589, -14543, -14497
dw -14449, -14402, -14354, -14305, -14256, -14206, -14155, -14104
dw -14053, -14001, -13949, -13896, -13842, -13788, -13733, -13678
dw -13623, -13567, -13510, -13453, -13395, -13337, -13279, -13219
dw -13160, -13100, -13039, -12978, -12916, -12854, -12792, -12729
dw -12665, -12601, -12537, -12472, -12406, -12340, -12274, -12207
dw -12140, -12072, -12004, -11935, -11866, -11797, -11727, -11656
dw -11585, -11514, -11442, -11370, -11297, -11224, -11151, -11077
dw -11003, -10928, -10853, -10778, -10702, -10625, -10549, -10471
dw -10394, -10316, -10238, -10159, -10080, -10001, -9921, -9841
dw -9760, -9679, -9598, -9516, -9434, -9352, -9269, -9186
dw -9102, -9019, -8935, -8850, -8765, -8680, -8595, -8509
dw -8423, -8337, -8250, -8163, -8076, -7988, -7900, -7812
dw -7723, -7635, -7545, -7456, -7366, -7276, -7186, -7096
dw -7005, -6914, -6823, -6731, -6639, -6547, -6455, -6363
dw -6270, -6177, -6084, -5990, -5897, -5803, -5708, -5614
dw -5520, -5425, -5330, -5235, -5139, -5044, -4948, -4852
dw -4756, -4660, -4563, -4467, -4370, -4273, -4176, -4078
dw -3981, -3883, -3786, -3688, -3590, -3492, -3393, -3295
dw -3196, -3098, -2999, -2900, -2801, -2702, -2603, -2503
dw -2404, -2305, -2205, -2105, -2006, -1906, -1806, -1706
dw -1606, -1506, -1406, -1306, -1205, -1105, -1005, -904
dw -804, -704, -603, -503, -402, -302, -201, -101
;#
end

1764
LIB386/LIB_3D/P_TRIGO.ASM Normal file

File diff suppressed because it is too large Load Diff

5
LIB386/LIB_CD/BUILD.BAT Normal file
View File

@@ -0,0 +1,5 @@
call watcom10
pkunzip -o obj >NUL
wmake /f lib_CD.mak
pkzip -m obj *.obj >NUL
call watcom9

1124
LIB386/LIB_CD/CDROM.ASM Normal file

File diff suppressed because it is too large Load Diff

79
LIB386/LIB_CD/LIB_CD.H Normal file
View File

@@ -0,0 +1,79 @@
//----------------------------------------------------------------------------
#pragma library ("f:\projet\lib386\lib_cd\lib_cd.lib");
extern WORD BufferData[] ;
extern WORD DriveCDR ;// Lettre drive 0=A 1=B etc. apres InitCDR
extern ULONG LeadOut ;
extern UBYTE LowTrack, HigTrack ;
extern LONG FileCD_Start ;
extern LONG FileCD_Sect ;
extern LONG FileCD_Size ;
//----------------------------------------------------------------------------
// Initialiser le lesteur de cdrom, si pas verif alors chaine vide
LONG InitCDR( char *nameid ) ;
// Jouer seulement une track prcise
LONG PlayTrackCDR( LONG track ) ;
// Arreter le PlayTrackCDR
void StopCDR() ;
// Verouiller ou dverouiller la porte du lecteur
void LockCDR() ;
void UnLockCDR() ;
// Reset, Init ou suite a une erreur par exemple
void ResetCDR() ;
// Ejecter le cdrom quand c'est possible ( pas toujours motoris )
void EjectCDR() ;
// Fermer tiroir electrique quand c'est possible ( pas toujours motoris )
void CloseTrayCDR() ;
// Reprends une track apres un stopCDR
void ResumeCDR() ;
//-------------------------------------- Fonction bas niveau
// Return pointeur sur Copyright File name ( pas forcement file )
char *GetCopyrightName() ;
// Conversion Red to Hsg ( belle jambe non ;-) )
LONG Red2Hsg( LONG value ) ;
// Return la taille d'une track en HSG
LONG GetLengthTrackCDR( LONG track ) ;
// Return secteur depart Track
LONG StartTrackCDR( LONG track ) ;
// Return status of CD Drive
LONG StatusCDR() ;
// Return Track currently play or 0
LONG GetMusicCDR() ;
// Change volume selon chanel
void ControlCDR( WORD chan0, WORD vol0, WORD chan1, WORD vol1 ) ;
// Return position de la tete
LONG LocateHeadCDR() ;
// Play a part of cd
LONG PlayCDR( LONG debut, LONG duree );
// Lecture data
LONG ReadLongCDR( LONG start, LONG nbsect, void *buffer ) ;
// Get Directory Entry
LONG GetFileCDR( char *name ) ;
//----------------------------------------------------------------------------

31
LIB386/LIB_CD/LIB_CD.MAK Normal file
View File

@@ -0,0 +1,31 @@
TASMFLAGS = /m2 /mx /q /p /z /t /jMASM51 /jQUIRKS
WCFLAGS = /l=dos4g /oaxet /s /zp2 /5s /c /x /zq
WLIBFLAGS = -b -n -c -q
OBJETS1 = cdrom.obj
OBJETS2 =
OBJETS3 =
OBJETS4 =
LIB = LIB_CD
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4)
@echo $(OBJETS1) > clibmak.rsp
# @echo $(OBJETS2) >> clibmak.rsp
# @echo $(OBJETS3) >> clibmak.rsp
# @echo $(OBJETS4) >> clibmak.rsp
@WLIB $(WLIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre G "$(LIB)"
.asm.obj:
@PRNTITRE M "$*.ASM"
@TASM $(TASMFLAGS) $*;
.c.obj:
@PRNTITRE M "$*.C"
@wcl386 $(WCFLAGS) $*

2
LIB386/LIB_CD/M.BAT Normal file
View File

@@ -0,0 +1,2 @@
build

View File

@@ -0,0 +1,41 @@
.386P
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
public NoLanguage MySortCompFunc
strcmp proto SYSCALL
.code
;//-------------------------------------------------------------------------
MySortCompFunc proc uses ebx ecx edx esi edi ebp,\
ptra:DWORD, ptrb:DWORD
mov eax, ptrb
mov ecx, ptra
push [eax]
push [ecx]
call strcmp
add esp, 8
ret
MySortCompFunc endp
;----------------------------------------------------------------------------
; The
End

13
LIB386/LIB_MENU/BUILD.BAT Normal file
View File

@@ -0,0 +1,13 @@
call watcom10
pkunzip -o obj >NUL
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

157
LIB386/LIB_MENU/LIB_MENU.H Normal file
View File

@@ -0,0 +1,157 @@
#ifdef WATCOM9
#pragma library ("f:\projet\lib386\lib_menu\lb9_menu.lib");
#else
#pragma library ("f:\projet\lib386\lib_menu\lib_menu.lib");
#endif
#define SELECT_NO_FLAG 0
#define SELECT_SHOW_EXT 1
#define SELECT_TEST_EXIST 2
#define SELECT_TEST_OVERWRITE 4
#define SELECT_KEEP_POS 8
#define NO_FLAG 0
#define FLAG_PUSHED 0x0001
#define FLAG_RED 0x0002
#define FLAG_NO_PUSH 0x0004
#define FLAG_CENTRE 0x0100
#define FLAG_CONTOUR 0x0200
#define FLAG_FILENAME 0x0400
#define TYPE_TEXT 0x0001
#define TYPE_BUTTON 0x0002
#define TYPE_WINDOW 0x0004
#define TYPE_SWITCH 0x0008
#define TYPE_CHANGE_VALUE 0x0010
#define TYPE_DEC_VALUE 0x0020
#define TYPE_INC_VALUE 0x0040
extern UBYTE SelectorPathname[] ;
typedef struct { WORD X1 ; /* size/pos pixel box */
WORD Y1 ;
WORD X2 ;
WORD Y2 ;
WORD Type ;
WORD Flags ; /* texte centr... */
WORD Handle ; /* info retourne si != -1 */
UBYTE *PtrString ;
WORD *PtrVar ; /* info switch */
WORD Mask ;
} T_CLICK_BOX ;
typedef struct { WORD NbBox ;
WORD LastClicked ;
T_CLICK_BOX *PtrMallocList ;
WORD Largeur ; /* en caractere */
WORD Hauteur ;
WORD X1 ;
WORD Y1 ;
WORD X2 ;
WORD Y2 ;
WORD Flags ;
WORD Repeat ;
} T_MENU ;
typedef struct { WORD WindowX1 ;
WORD WindowY1 ;
WORD WindowX2 ;
WORD WindowY2 ;
WORD WindowLig ;
WORD WindowCol ;
WORD WindowTab ;
WORD WindowNbIndex ;
UBYTE **WindowArray ;
} T_WINLIST ;
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
#define B_GRIS 1
#define B_ROUGE 4
#define BLEU 9
#define VERT 10
#define CYAN 11
#define ROUGE 12
#define MAGENTA 13
#define JAUNE 14
#define BLANC 15
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* asm_sort.asm */
extern int MySortCompFunc( char**, char** ) ;
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* menu.c */
extern void SetMenuAutoPal(short );
extern void InitPalMenu(void);
extern void CopyPalMenu(unsigned char *);
extern void DrawWindow(long ,long ,long ,long ,long );
extern void OpenWindow(T_WINLIST *,short ,short ,short ,short );
extern void GetWindowButton(T_MENU *,short ,T_WINLIST *);
extern void WinText(T_WINLIST *,unsigned char *,long );
extern void WinList(T_WINLIST *,unsigned char **,short ,short );
extern void WinSelect(T_WINLIST *,short ,short );
extern void WinSepar(T_WINLIST *);
extern void FlipWindow(T_WINLIST *);
extern short GetIndexWinList(T_WINLIST *);
extern void DrawBox(T_MENU *,short ,short ,short );
extern T_CLICK_BOX *AddHeaderButton(T_MENU *,short ,short ,short ,short );
extern void GetCoorButton(T_MENU *,short ,long *,long *,long *,long *);
extern void AddButton(T_MENU *,short ,short ,short ,short ,short ,short ,unsigned char *);
extern void AddChangeValue(T_MENU *,short ,short ,short ,short ,short ,short ,unsigned char *,short *,short ,short ,short );
extern void AddSwitch(T_MENU *,short ,short ,short ,short ,short ,short ,unsigned char *,short *,short );
extern void AddText(T_MENU *,short ,short ,short ,short ,short ,unsigned char *);
extern void AddWindow(T_MENU *,short ,short ,short ,short ,short ,short );
extern short GetOptimalSize(short );
extern short OpenMenu(T_MENU *,short ,short );
extern void CloseMenu(T_MENU *);
extern short DrawMenu(T_MENU *,short ,short );
extern void ClearMenu(T_MENU *);
extern short ScanListClick(T_MENU *);
extern long GereMenu(T_MENU *);
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
/* menufunc.c */
extern T_CLICK_BOX *GetPtrLcb(T_MENU *,short );
extern void OrButtonFlagIfTrue(T_MENU *,short ,short ,short );
extern void SwitchButton(T_MENU *,short );
extern void ChangeButtonFlags(T_MENU *,short ,short ,short );
extern void ChangeButtonString(T_MENU *,short ,unsigned char *,short );
extern void InputString(T_MENU *,short ,short );
extern void Message(unsigned char *,long );
extern long Confirm(unsigned char *,unsigned char *,unsigned char *);
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
/* selector.c */
extern void CutFileName(unsigned char *);
extern void DrawListFiles(short );
extern void ScanFiles(unsigned char *,long );
extern short ThereIsFiles(unsigned char *);
extern void ScanDirs(unsigned char *);
extern void ScanDrives(void);
extern long NumDrive(unsigned char *);
extern short FileSelector(unsigned char *,unsigned char *,unsigned char *,long );
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/

61
LIB386/LIB_MENU/MAKEFILE Normal file
View File

@@ -0,0 +1,61 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom\bin\wcc386p
WL = f:\compil\watcom\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oeaxt /zp2 /4s /zq /s /DWATCOM9
!else
CFLAGS = /oeaxt /zp2 /5s /zq /s
!endif
LFLAGS = /c /q /b /n
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
OBJETS1 = menu.obj selector.obj menufunc.obj
OBJETS2 = asm_sort.obj
OBJETS3 =
OBJETS4 =
!ifeq WATCOM9 yes
LIB = LB9_MENU
!else
LIB = LIB_MENU
!endif
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4)
@echo $(OBJETS1) > clibmak.rsp
@echo $(OBJETS2) >> clibmak.rsp
# @echo $(OBJETS3) >> clibmak.rsp
# @echo $(OBJETS4) >> clibmak.rsp
@$(WL) $(LIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre M "$(LIB) OK"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(CFLAGS) $*

1056
LIB386/LIB_MENU/MENU.C Normal file

File diff suppressed because it is too large Load Diff

489
LIB386/LIB_MENU/MENUFUNC.C Normal file
View File

@@ -0,0 +1,489 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include "lib_menu.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#ifndef WATCOM9
#include <mem.h>
#endif
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
T_CLICK_BOX *GetPtrLcb( T_MENU *ptrmenu, WORD handle )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
return ptrlcb ;
}
ptrlcb++ ;
}
return 0L ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void OrButtonFlagIfTrue( T_MENU *ptrmenu, WORD handle, WORD flags, WORD test )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
if( test != 0 )
{
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
ptrlcb->Flags |= flags ;
return ;
}
ptrlcb++ ;
}
}
}
void SwitchButton( T_MENU *ptrmenu, WORD handle )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
ptrlcb->Flags ^= FLAG_PUSHED ;
/* if( flagaff )
{
DrawBox( ptrmenu, n, NO_FLAG, TRUE ) ;
}
*/
return ;
}
ptrlcb++ ;
}
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void ChangeButtonFlags( T_MENU *ptrmenu, WORD handle, WORD flags, WORD flagaff )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
ptrlcb->Flags = flags ;
if( flagaff )
{
DrawBox( ptrmenu, n, NO_FLAG, TRUE ) ;
}
return ;
}
ptrlcb++ ;
}
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
/*
WORD GetButtonFlags( T_MENU *ptrmenu, WORD handle )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
return ptrlcb->Flags ;
}
ptrlcb++ ;
}
return 0 ;
}
*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void ChangeButtonString( T_MENU *ptrmenu, WORD handle, UBYTE *string, WORD flagaff )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
ptrlcb->PtrString = string ;
if( flagaff )
{
DrawBox( ptrmenu, n, NO_FLAG, TRUE ) ;
}
return ;
}
ptrlcb++ ;
}
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
/*
UBYTE* GetButtonString( T_MENU *ptrmenu, WORD handle )
{
WORD n, nblcb ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle )
{
return ptrlcb->PtrString ;
}
ptrlcb++ ;
}
return 0L ;
}
*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void InputString( T_MENU *ptrmenu, WORD handle, WORD maxcar )
{
WORD n, nblcb, numlcb ;
WORD coul,x,y ;
LONG x1,y1,x2,y2 ;
WORD start,pc ;
WORD exit ;
WORD len ;
WORD nbaffcar ;
WORD carsizex ;
WORD myclick, mykey ;
WORD memoasciimode ;
UBYTE car ;
UBYTE string[256] ;
T_CLICK_BOX *ptrlcb ;
nblcb = ptrmenu->NbBox ;
ptrlcb = ptrmenu->PtrMallocList ;
for( n=0; n<nblcb; n++ )
{
if( ptrlcb->Handle == handle ) break ;
ptrlcb++ ;
}
if( n==nblcb ) return ;
numlcb = n ;
strcpy( string, ptrlcb->PtrString ) ;
pc = -1 ; /* pos curseur (-1 no cursor) */
start = 0 ;
x1 = ptrlcb->X1+3 ;
y1 = ptrlcb->Y1+3 ;
x2 = ptrlcb->X2-3 ;
y2 = ptrlcb->Y2-3 ;
nbaffcar = (carsizex=((x2 - x1)+1)/SizeCar) * (((y2-y1)+1)/SizeCar) ;
if( ptrlcb->Flags & FLAG_RED ) coul = B_ROUGE+1 ;
else coul = B_GRIS+1 ;
memoasciimode = AsciiMode ;
AsciiMode = TRUE ;
CoulText( BLANC,-1 ) ;
ShowMouse( 0 ) ;
while( Click ) ;
exit = FALSE ;
while( !exit )
{
/* affichage */
/* DrawInputString( string, nbffcar, start, pc, */
len = strlen( string ) ;
if( pc-start >= nbaffcar ) start = pc - nbaffcar + 1 ;
if( pc < start ) start = pc ;
Vsync() ;
if( pc == -1 )
{
x = x1+(len*SizeCar) ;
if( x>x2 ) x = x2 ;
Box( x1,y1,x,y2, 9 ) ;
}
else
{
Box( x1,y1,x2,y2, coul ) ;
}
x = x1 ;
y = y1 ;
for( n=0; n<=len; n++ )
{
if( n < start ) continue ;
if( n == pc )
{
Box(x,y,x+SizeCar-2,y+SizeCar-1,BLANC ) ;
x += SizeCar ;
if( x > x2-SizeCar-1 )
{
if( y > y2-SizeCar-1 )
{
break ;
}
else
{
y += SizeCar ;
x = x1 ;
}
}
}
Text( x,y, "%c", string[n] ) ;
x += SizeCar ;
if( x > x2-SizeCar-1 )
{
y += SizeCar ;
if( y > y2-SizeCar-1 )
{
break ;
}
else
{
x = x1 ;
}
}
}
CopyBlockPhys( ptrlcb->X1, ptrlcb->Y1, ptrlcb->X2, ptrlcb->Y2 ) ;
/* input */
while( !(mykey=GetAscii()) AND (!(myclick=Click)) ) ;
if( myclick )
{
exit = TRUE ;
break ;
}
car = mykey & 255 ;
if( (car >= 32) AND (car < 255) )
{
if( pc == -1 )
{
pc = 1 ;
string[0] = car ;
string[1] = 0 ;
}
else
{
if( len < maxcar )
{ /* insert */
memmove( &string[pc+1],&string[pc],strlen(&string[pc])+1 ) ;
string[pc] = car ;
pc++ ;
if( pc > len ) string[pc] = 0 ;
}
}
}
else
{
switch( mykey )
{
case A_ESC:
exit = TRUE ;
break ;
case A_RETURN:
exit = TRUE ;
break ;
case A_END:
pc = len ;
break ;
case A_HOME:
pc = 0 ;
break ;
case A_BACKSPACE:
if( pc == -1 ) pc = len ;
if( pc > 0 )
{
pc-- ;
memmove( &string[pc],&string[pc+1],strlen(&string[pc+1])+1 ) ;
}
break ;
case A_SUPPR:
if( pc == -1 ) pc = len ;
if( pc < len )
{
memmove( &string[pc],&string[pc+1],strlen(&string[pc+1])+1 ) ;
}
break ;
case A_LEFT:
if( pc == -1 ) pc = len-1 ;
else
if( pc > 0 ) pc-- ;
break ;
case A_RIGHT:
if( pc == -1 ) pc = 1 ;
else
if( pc < len ) pc++ ;
break ;
case A_DOWN:
if( pc == -1 )
{
if( carsizex < len )
pc = carsizex ;
else
pc = 0 ;
}
else
if( pc+carsizex < len )
pc += carsizex ;
break ;
case A_UP:
if( pc == -1 ) pc = 0 ;
else
if( pc-carsizex >= 0 )
pc -= carsizex ;
break ;
}
}
}
if( (mykey==A_RETURN) OR (myclick) )
{
strcpy( ptrlcb->PtrString, string ) ;
}
DrawBox( ptrmenu, numlcb, NO_FLAG, TRUE ) ;
AsciiMode = memoasciimode ;
ShowMouse( 1 ) ;
while( Key OR Click OR Fire ) AffMouse() ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* fontions evolues */
void Message( UBYTE *message, LONG flag )
{
T_MENU menu ;
WORD len ;
len = strlen(message)*SizeCar / (SizeCar+7) + 2 ;
if( !OpenMenu( &menu, len,2 ) ) return ;
AddText( &menu, 0,0, len,2, FLAG_CENTRE+FLAG_CONTOUR, message ) ;
DrawMenu( &menu, -1, -1 ) ;
if( flag )
{
ShowMouse( 1 ) ;
while( Click OR Fire OR Key ) ;
while( !Click AND !Fire AND !Key ) AffMouse() ;
while( Click OR Fire OR Key) ;
}
CloseMenu( &menu ) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/* Confirm( "Voulez-vous vraiment ?", "OUI" (RETURN), "NON"(ESC) ) ; */
LONG Confirm( UBYTE *message, UBYTE *oui, UBYTE *non )
{
T_MENU menu ;
WORD len, select ;
len = strlen(message)*SizeCar / (SizeCar+7) + 2 ;
if( !OpenMenu( &menu, len,3 ) ) return 2 ;
AddText( &menu, 0,0, len,2, FLAG_CENTRE+FLAG_CONTOUR, message ) ;
AddButton( &menu, 1, 0,2, len/2,1, FLAG_CENTRE+FLAG_RED, oui ) ;
AddButton( &menu, 2, len/2,2, len/2,1, FLAG_CENTRE, non ) ;
DrawMenu( &menu, -1, -1 ) ;
ShowMouse( 1 ) ;
while( Click OR Fire OR Key ) AffMouse() ;
select = 0 ;
while( select < 1 )
{
AffMouse() ;
select = GereMenu( &menu ) ;
if( Fire & F_RETURN )
{
select = 1 ;
DrawBox( &menu, 1, FLAG_PUSHED, TRUE ) ;
}
if( Key == K_ESC )
{
select = 2 ;
DrawBox( &menu, 2, FLAG_PUSHED, TRUE ) ;
}
}
while( Click OR Fire OR Key ) AffMouse() ;
CloseMenu( &menu ) ;
return select ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/

554
LIB386/LIB_MENU/SELECTOR.C Normal file
View File

@@ -0,0 +1,554 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include "\projet\lib386\lib_menu\lib_menu.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys\types.h>
#include <direct.h>
#include <string.h>
#include <dos.h>
#ifndef WATCOM9
#include <mem.h>
#endif
#define MAX_FILES 500
#define MAX_DIRS 100
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
Ûßßßß Û Û Ûßßßß ÛÛßßß Ûßßßß Û Ûßßßß Ûßßßß ßßÛßß ÛßßßÛ ÛßßßÛ
ÛÛßß ÛÛ ÛÛ ÛÛßß ßßßßÛ ÛÛßß ÛÛ ÛÛßß ÛÛ ÛÛ ÛÛ Û ÛÛßÛß
ßß ßß ßßßßß ßßßßß ßßßßß ßßßßß ßßßßß ßßßßß ßßßßß ßß ßßßßß ßß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
UBYTE SelectorPathname [_MAX_PATH] ;
UBYTE SDrive[_MAX_DRIVE] ;
UBYTE SDir[_MAX_DIR] ;
UBYTE SName[_MAX_FNAME] ;
UBYTE SExt[_MAX_EXT] ;
WORD NbFiles ;
UBYTE *ListFiles ;
UBYTE **IndexFiles ;
WORD NbDirs ;
UBYTE *ListDirs ;
UBYTE **IndexDirs ;
WORD StartFile = 0 ;
UBYTE SearchPathname[_MAX_PATH] ;
T_MENU Selector ;
T_WINLIST FilesWindow ;
T_WINLIST DirsWindow ;
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void CutFileName( UBYTE *filename )
{
while( (*filename!=0) AND (*filename!='.') )
filename++ ;
*filename = 0 ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void DrawListFiles( WORD flag )
{
WORD nb ;
ShowMouse( 0 ) ;
GetWindowButton( &Selector, 10, &FilesWindow ) ;
if( NbFiles )
{
if( StartFile >= NbFiles ) StartFile = NbFiles-1 ;
nb = NbFiles - StartFile ;
if( flag & SELECT_SHOW_EXT )
WinList( &FilesWindow, IndexFiles+StartFile, nb, 14 ) ;
else
WinList( &FilesWindow, IndexFiles+StartFile, nb, 9 ) ;
}
else
{
WinList( &FilesWindow, IndexFiles, 0, 14 ) ;
}
FlipWindow( &FilesWindow ) ;
ShowMouse( 1 ) ;
}
/*
int my_sort_function( char **a, char **b)
{
return( strcmp( *a, *b) ) ;
}
*/
void ScanFiles( UBYTE *selection, LONG flag )
{
struct find_t fileinfo ;
ULONG rc ;
UBYTE *ptr ;
UBYTE path[_MAX_PATH] ;
_splitpath( selection, SDrive, SDir, SName, SExt ) ;
_makepath( path, "", SearchPathname, SName, SExt ) ;
rc = _dos_findfirst( path, _A_NORMAL, &fileinfo ) ;
NbFiles = 0 ;
ptr = ListFiles ;
while( !rc )
{
IndexFiles[NbFiles] = ptr ;
if( !(flag & SELECT_SHOW_EXT) ) CutFileName( fileinfo.name ) ;
strcpy( ptr, fileinfo.name ) ;
ptr += strlen( fileinfo.name ) + 1 ;
NbFiles++ ;
if( NbFiles == MAX_FILES )
{
Message( "Warning: Truncated List", TRUE ) ;
break ;
}
rc = _dos_findnext( &fileinfo ) ;
}
if( NbFiles ) /* ? */
qsort( (void *)IndexFiles, NbFiles, sizeof( char * ), MySortCompFunc );
DrawListFiles( flag ) ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
WORD ThereIsFiles( UBYTE *path )
{
struct find_t fileinfo ;
if( !_dos_findfirst( path, _A_NORMAL, &fileinfo ) )
return 1 ;
else
return 0 ;
}
void ScanDirs( UBYTE *selection )
{
struct find_t fileinfo ;
ULONG rc ;
UBYTE *ptr ;
WORD n ;
UBYTE path[_MAX_PATH] ;
rc = _dos_findfirst( "*.*", _A_SUBDIR, &fileinfo ) ;
NbDirs = 0 ;
ptr = ListDirs ;
while( !rc )
{
if( fileinfo.attrib & _A_SUBDIR )
{
IndexDirs[NbDirs] = ptr ;
strcpy( ptr, fileinfo.name ) ;
ptr += strlen( fileinfo.name ) + 1 ;
NbDirs++ ;
if( NbDirs == MAX_FILES )
{
Message( "Warning: Truncated List", TRUE ) ;
break ;
}
}
rc = _dos_findnext( &fileinfo ) ;
}
ShowMouse( 0 ) ;
GetWindowButton( &Selector, 11, &DirsWindow ) ;
WinList( &DirsWindow, IndexDirs, NbDirs, 14 ) ;
FlipWindow( &DirsWindow ) ;
/* if option scan files */
for( n=0; n<NbDirs; n++ )
{
strcpy( path, IndexDirs[n] ) ;
strcat( path, "\\" ) ;
strcat( path, selection ) ;
if( ThereIsFiles( path ) )
{
WinSelect( &DirsWindow, n, B_ROUGE+1 ) ;
}
}
ShowMouse( 1 ) ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void ScanDrives()
{
unsigned total ;
unsigned drive ;
unsigned orgdrive ;
WORD n ;
UBYTE *ptr ;
_dos_getdrive( &orgdrive ) ;
NbDirs = 0 ;
ptr = ListDirs ;
for( n=1; n<=26; n++ )
{
_dos_setdrive( n, &total ) ;
_dos_getdrive( &drive ) ;
if( drive == n )
{
IndexDirs[NbDirs] = ptr ;
strcpy( ptr, "A:" ) ;
ptr[0] = drive + 'A' -1 ;
ptr += 3 ;
NbDirs++ ;
}
}
_dos_setdrive( orgdrive, &total ) ;
ShowMouse( 0 ) ;
GetWindowButton( &Selector, 11, &DirsWindow ) ;
WinList( &DirsWindow, IndexDirs, NbDirs, 14 ) ;
FlipWindow( &DirsWindow ) ;
ShowMouse( 1 ) ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
LONG NumDrive( UBYTE *drive )
{
return ((*drive)&=~20)-'A'+1 ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
WORD FileSelector( UBYTE *titre,
UBYTE *selection,
UBYTE *defaultname,
LONG flags )
{
WORD n, num ;
WORD flag, handle ;
WORD mode = 0 ;
unsigned total ;
unsigned testdrive = 0 ;
WORD rcode ;
WORD oldnum = -1 ;
char memopath[_MAX_PATH] ;
UBYTE workstring[256] ;
WORD memoasciimode ;
/* inits */
MemoClip() ;
UnSetClip() ;
/* memo drive/dir org */
getcwd( memopath, _MAX_PATH ) ;
/* init directory fichier par defaut */
strcpy( SelectorPathname , defaultname ) ;
_splitpath( SelectorPathname , SDrive, SDir, SName, SExt ) ;
if( strlen( SDir ) > 2 )
{
if( SDir[strlen(SDir)-1] == '\\' ) SDir[strlen(SDir)-1] = 0 ;
}
if( SDrive[0] != 0 )
{
SDrive[0] &= ~0x20 ;
_dos_setdrive( SDrive[0]-'A'+1, &total ) ;
_dos_getdrive( &testdrive ) ;
if( testdrive == SDrive[0]-'A'+1 )
{
chdir( SDir ) ;
}
else
{
Message( "Drive Error", TRUE ) ;
}
}
else chdir( SDir ) ;
strcpy( SelectorPathname, SName ) ;
_splitpath( selection, SDrive, SDir, SName, SExt ) ;
strcat( SelectorPathname, SExt ) ;
getcwd( SearchPathname, _MAX_PATH ) ;
/* window */
if( !OpenMenu( &Selector, 32,20 ) ) return 0 ;
AddText( &Selector, 0, 0, 32, 1, FLAG_CENTRE+FLAG_CONTOUR, titre ) ;
AddText( &Selector, 0, 1, 3, 1, NO_FLAG, "Path" ) ;
AddButton( &Selector, 0, 3, 1, 29, 1, NO_FLAG, SearchPathname ) ;
AddText( &Selector, 0, 2, 3, 1, NO_FLAG, "File" ) ;
AddButton( &Selector, 4, 3, 2, 29, 1, FLAG_RED, SelectorPathname ) ;
AddWindow( &Selector,10, 0, 4, 16,14, NO_FLAG ) ;
AddWindow( &Selector,11, 16, 4, 16,14, NO_FLAG ) ;
AddText( &Selector, 0, 3, 16, 1, FLAG_CENTRE+FLAG_CONTOUR, selection ) ;
AddButton( &Selector, 2, 16, 3, 8, 1, FLAG_CENTRE+FLAG_PUSHED, "Dirs" ) ;
AddButton( &Selector, 3, 24, 3, 8, 1, FLAG_CENTRE, "Drives" ) ;
AddButton( &Selector, 5, 16,18, 16, 2, FLAG_CENTRE+FLAG_CONTOUR, "Cancel" ) ;
AddButton( &Selector, 6, 0,18, 16, 2, FLAG_CENTRE+FLAG_CONTOUR+FLAG_RED, "OK" ) ;
DrawMenu( &Selector, -1,-1 ) ;
ShowMouse( 1 ) ;
IndexFiles = Malloc( MAX_FILES * sizeof(UBYTE*) ) ;
IndexDirs = Malloc( MAX_DIRS * sizeof(UBYTE*) ) ;
ListFiles = Malloc( MAX_FILES * 13 ) ;
ListDirs = Malloc( MAX_DIRS * 13 ) ;
/* test erreur malloc */
if( !IndexFiles OR !ListFiles OR !IndexDirs OR !ListDirs )
{
Message( "File List Malloc Error", TRUE ) ;
return 0 ;
}
if( !(flags & SELECT_KEEP_POS) ) StartFile = 0 ;
ScanFiles( selection, flags ) ;
ScanDirs( selection ) ;
while( Click ) AffMouse() ;
rcode = -1 ;
flag = 1 ;
while( flag != -1 )
{
if( Key == K_ESC ) rcode = 0 ;
if( Fire == F_RETURN ) rcode = 1 ;
AffMouse() ;
handle = GereMenu( &Selector ) ;
switch( handle )
{
case 10: /* files list */
if( Click & 2 )
{
GetMouseDep() ;
while( Click & 2 )
{
GetMouseDep() ;
StartFile -= Mouse_Y_Dep ;
if( StartFile < 0 ) StartFile = 0 ;
DrawListFiles(flags) ;
}
oldnum = -1 ;
}
else
{
num = GetIndexWinList( &FilesWindow ) + StartFile ;
if( oldnum != -1 )
{
if( num == oldnum ) /* double click */
{
rcode = 1 ;
break ;
}
WinSelect( &FilesWindow, oldnum-StartFile, 0 ) ; /* efface */
}
if( num != -1 )
{
WinSelect( &FilesWindow, num-StartFile, 15 ) ;
oldnum = num ;
if( flags & SELECT_SHOW_EXT )
{
strcpy( SelectorPathname, IndexFiles[num] ) ;
}
else
{
strcpy( SelectorPathname, IndexFiles[num] ) ;
_splitpath( selection, SDrive, SDir, SName, SExt ) ;
strcat( SelectorPathname, SExt ) ;
}
ChangeButtonString( &Selector, 4, SelectorPathname , TRUE ) ;
while( Click ) AffMouse() ;
}
}
break ;
case 11: /* dirs/drive list */
num = GetIndexWinList( &DirsWindow ) ;
if( num != -1 )
{
WinSelect( &DirsWindow, num, 15 ) ;
if( !mode ) /* dir */
{
chdir( IndexDirs[num] ) ;
getcwd( SearchPathname, _MAX_PATH ) ;
ChangeButtonString( &Selector, 0, SearchPathname, TRUE ) ;
ScanDirs( selection ) ;
}
else /* drive */
{
n = IndexDirs[num][0] - 'A' + 1 ;
memoasciimode = AsciiMode ;
AsciiMode = TRUE ;
_dos_setdrive( n, &total ) ;
getcwd( SearchPathname, _MAX_PATH ) ;
AsciiMode = memoasciimode ;
ScanDrives() ;
}
getcwd( SearchPathname, _MAX_PATH ) ;
ChangeButtonString( &Selector, 0, SearchPathname, TRUE ) ;
ScanFiles( selection, flags ) ;
oldnum = -1 ;
while( Click ) AffMouse() ;
}
break ;
case 0: /* input new searchpath */
InputString( &Selector, 0, _MAX_PATH ) ;
_splitpath( SearchPathname, SDrive,SDir,SName,SExt ) ;
_dos_setdrive( SDrive[0]-'A'+1, &total ) ;
chdir( SDir ) ;
getcwd( SearchPathname, _MAX_PATH ) ;
ChangeButtonString( &Selector, 0, SearchPathname, TRUE ) ;
ScanFiles( selection, flags ) ;
ScanDirs( selection ) ;
oldnum = -1 ;
break ;
case 2: /* dirs */
ChangeButtonFlags( &Selector, 2, FLAG_CENTRE+FLAG_PUSHED, 1 ) ;
ChangeButtonFlags( &Selector, 3, FLAG_CENTRE, 1 ) ;
ScanDirs( selection ) ;
mode = 0 ;
oldnum = -1 ;
break ;
case 3: /* drives */
ChangeButtonFlags( &Selector, 2, FLAG_CENTRE, 1 ) ;
ChangeButtonFlags( &Selector, 3, FLAG_CENTRE+FLAG_PUSHED, 1 ) ;
ScanDrives() ;
mode = 1 ;
oldnum = -1 ;
break ;
case 4: /* selected */
InputString( &Selector, 4, _MAX_PATH ) ;
_splitpath( SelectorPathname, SDrive, SDir, SName, SExt ) ;
strcpy( SelectorPathname, SName ) ;
_splitpath( selection, SDrive,SDir,SName,SExt ) ;
strcat( SelectorPathname, SExt ) ;
ChangeButtonString( &Selector, 4, SelectorPathname, 1 ) ;
oldnum = -1 ;
break ;
case 6: /* ok */
rcode = 1 ;
break ;
case 5: /* cancel */
rcode = 0 ;
break ;
}
if( rcode == 1 )
{
_splitpath( SelectorPathname, SDrive, SDir, SName, SExt ) ;
strcpy( SelectorPathname, SearchPathname ) ;
strcat( SelectorPathname, "\\" ) ;
strcat( SelectorPathname, SName ) ;
strcat( SelectorPathname, SExt ) ;
if( flags & SELECT_TEST_EXIST )
{
if( FileSize( SelectorPathname ) != 0L )
{
strcpy( defaultname, SelectorPathname ) ;
flag = -1 ; /* OK */
}
else
{
strcpy( workstring, SelectorPathname ) ;
strcat( workstring, " n'existe pas !" ) ;
Message( workstring, TRUE ) ;
}
}
else if( flags & SELECT_TEST_OVERWRITE )
{
if( FileSize( SelectorPathname ) != 0L )
{
strcpy( workstring, SelectorPathname ) ;
strcat( workstring, " existe dj… !" ) ;
if( Confirm(workstring, "Ecrase", "Oups") == 1 )
{ /* ok */
strcpy( defaultname, SelectorPathname ) ;
flag = -1 ;
}
}
else
{
strcpy( defaultname, SelectorPathname ) ;
flag = -1 ; /* OK */
}
}
else
{
strcpy( defaultname, SelectorPathname ) ;
flag = -1 ; /* OK */
}
if( flag != -1 )
{
DrawMenu( &Selector, -1,-1 ) ;
ScanFiles( selection, flags ) ;
if( !mode ) /* dir */
{
ScanDirs( selection ) ;
}
else /* drive */
{
ScanDrives() ;
}
ShowMouse( 1 ) ;
rcode = -1 ;
}
}
if( rcode == 0 )
{
strcpy( SelectorPathname, "" ) ;
flag = -1 ;
}
}
Free( IndexFiles ) ;
Free( ListFiles ) ;
Free( IndexDirs ) ;
Free( ListDirs ) ;
CloseMenu( &Selector ) ;
while( Click OR Key OR Fire ) AffMouse() ;
RestoreClip() ;
/* restore drive/dir org */
_dos_setdrive( memopath[0]-'A'+1, &total ) ;
chdir( memopath ) ;
return rcode ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/

15
LIB386/LIB_MIDI/BUILD.BAT Normal file
View File

@@ -0,0 +1,15 @@
call watcom10
pkunzip -o obj >NUL
copy wr\ail32.obj
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
copy wr\ail32.obj
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

View File

@@ -0,0 +1,7 @@
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <malloc.h>
#include <string.h>
#include <conio.h>

View File

@@ -0,0 +1,28 @@
#ifdef WATCOM9
#pragma library ("f:\projet\lib386\lib_midi\lb9_midi.lib");
#else
#pragma library ("f:\projet\lib386\lib_midi\lib_midi.lib");
#endif
#include "f:\projet\lib386\lib_midi\ail32.h" // Audio Interface Library API function header
extern char Midi_Driver[_MAX_PATH] ;
extern char Midi_Driver_Name[80] ;
extern WORD Midi_Driver_Enable ;
extern char GTL_filename[_MAX_PATH] ; // fichier des sons
extern void AskMidiVars(char ***,long **);
extern long InitMidiDLL(char *);
extern long InitMidi(void);
extern void InitPathMidiSampleFile(unsigned char *);
extern void ClearMidi(void);
extern void PlayMidi(unsigned char *);
extern void StopMidi(void);
extern long IsMidiPlaying(void);
extern void FadeMidiDown(short );
extern void FadeMidiUp(short );
extern void WaitFadeMidi(void);
extern void VolumeMidi(short );
extern void SetLoopMidi(short );
extern void DoLoopMidi(void);

57
LIB386/LIB_MIDI/MAKEFILE Normal file
View File

@@ -0,0 +1,57 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom95\bin\wcc386
WL = f:\compil\watcom95\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oaxet /s /zp2 /4s /zq /DWATCOM9
!else
CFLAGS = /oaxet /s /zp2 /5s /zq /wx
!endif
LFLAGS = -b -n -c -q
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
OBJETS1 = midi.obj ail32.obj
OBJETS2 =
OBJETS3 =
OBJETS4 =
!ifeq WATCOM9 yes
LIB = LB9_MIDI
!else
LIB = LIB_MIDI
!endif
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4)
@echo $(OBJETS1) > clibmak.rsp
@$(WL) $(LIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre M "$(LIB) OK"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(CFLAGS) $*

461
LIB386/LIB_MIDI/MIDI.C Normal file
View File

@@ -0,0 +1,461 @@
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛ ÛÛ
//ÛÛ Project: IBM Audio Interface Library for 32-bit DPMI (AIL/32) ÛÛ
//ÛÛ Author: John Miles ÛÛ
//ÛÛ ÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//ÛÛ ÛÛ
//ÛÛ Gestionnaire Midi for Adeline Soft le 2/4/94 ÛÛ
//ÛÛ ÛÛ
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
#include <process.h>
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <malloc.h>
#include <string.h>
#include <conio.h>
#include "f:\projet\lib386\lib_sys\adeline.h"
#include "f:\projet\lib386\lib_sys\lib_sys.h"
#include "f:\projet\lib386\lib_midi\lib_midi.h"
/***************************************************************/
void NewProc08() ;
WORD Midi_Driver_Enable = FALSE ;
char *DriverError = "Error MidiDriver:" ;
char *ListIdentifier[] = { "MidiBase" ,
"MidiIRQ" ,
"MidiDMA" ,
"" };
LONG Midi_Base, Midi_IRQ, Midi_DMA ;
HDRIVER hdriver ;
HSEQUENCE hseq = -1 ;
drvr_desc *desc;
//FILE *GTL;
char *ptrGTL;
char MidiPath[_MAX_PATH];
char *state;
char *drvr,*dll;
char *timb;
char *tc_addr;
unsigned char *ail_buffer;
unsigned long state_size;
unsigned short ail_bank,patch,tc_size,seqnum;
unsigned short treq;
WORD MidiLoop = FALSE ;
LONG MaxVolume = 100 ;
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void AskMidiVars( char ***listidentifier, LONG **ptrvars )
{
*listidentifier = ListIdentifier ;
*ptrvars = &Midi_Base ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//
// Standard C routine for Global Timbre Library access
//
#ifdef ytuyjbd
void *load_global_timbre(FILE *GTL, unsigned short bank, unsigned short patch)
{
unsigned short *timb_ptr;
static unsigned short len;
static struct // GTL file header entry structure
{
signed char patch;
signed char bank;
unsigned long offset;
}
GTL_hdr;
if (GTL==NULL) return NULL; // if no GTL, return failure
rewind(GTL); // else rewind to GTL header
do // search file for requested timbre
{
fread(&GTL_hdr,sizeof(GTL_hdr),1,GTL);
if (GTL_hdr.bank == -1)
return NULL; // timbre not found, return NULL
}
while ((GTL_hdr.bank != bank) ||
(GTL_hdr.patch != patch));
fseek(GTL,GTL_hdr.offset,SEEK_SET);
fread(&len,2,1,GTL); // timbre found, read its length
timb_ptr = malloc(len); // allocate memory for timbre ..
*timb_ptr = len;
// and load it
fread((timb_ptr+1),len-2,1,GTL);
if (ferror(GTL)) // return NULL if any errors
{
free(timb_ptr);
return NULL; // occurred
}
else
return timb_ptr; // else return pointer to timbre
}
#endif
void *load_global_timbre(unsigned short bank, unsigned short patch)
{
static struct GTL_h // GTL file header entry structure
{
signed char patch;
signed char bank;
unsigned long offset;
}
*GTL_hdr;
GTL_hdr = (struct GTL_h *)ptrGTL ;// to GTL header
// search file for requested timbre
while ((GTL_hdr->bank != bank) ||
(GTL_hdr->patch != patch))
{
if (GTL_hdr->bank == -1)
return NULL; // timbre not found, return NULL
GTL_hdr++;
}
return((void *)(ptrGTL + GTL_hdr->offset)) ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
LONG InitMidiDLL( char *driverpathname )
{
char *str;
//
// Load driver file
//
dll = FILE_read( driverpathname, NULL);
if (dll==NULL)
{
printf("%s Could not load driver '%s'.\n", DriverError, driverpathname );
return FALSE ;
}
drvr=DLL_load(dll,DLLMEM_ALLOC | DLLSRC_MEM,NULL);
if (drvr==NULL)
{
printf("%s Invalid DLL image.\n", DriverError );
return FALSE ;
}
Free(dll);
//
// Initialize API before calling any Library functions
//
AIL_startup();
//
// Register the driver with the API
//
hdriver = AIL_register_driver(drvr);
if (hdriver==-1)
{
printf("%s Driver %s not compatible with linked API version.\n",
DriverError, driverpathname );
AIL_shutdown(NULL);
return FALSE ;
}
//
// Get driver type and factory default I/O parameters; exit if
// driver is not capable of interpreting MIDI files
//
desc = AIL_describe_driver(hdriver);
if (desc->drvr_type != XMIDI_DRVR)
{
printf("%s Driver %s not an XMIDI driver.\n", DriverError, driverpathname );
AIL_shutdown(NULL);
return FALSE ;
}
//
// Print Driver name and copyright notice
//
printf("AIL/32 midi driver for:\n");
str = desc->dev_name_table ;
while(*str != 0)
{
printf("%s\n", str);
while(*str != 0)
str++;
str++;
}
printf("\nCopyright (C) 1991,1992 Miles Design, Inc.\n\n");
return TRUE ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
LONG InitMidi()
{
char GTL_filename[_MAX_PATH];
// use if defined new parameters
if( Midi_Base != -1 ) desc->default_IO = Midi_Base ;
if( Midi_IRQ != -1 ) desc->default_IRQ = Midi_IRQ ;
if( Midi_DMA != -1 )
{
desc->default_DMA = Midi_DMA ;
desc->default_DRQ = Midi_DMA ;
}
//
// Verify presence of driver's sound hardware and prepare
// driver/hardware for use
//
if (!AIL_detect_device(hdriver,desc->default_IO,desc->default_IRQ,
desc->default_DMA,desc->default_DRQ))
{
AIL_shutdown(NULL);
printf( "%s Sound Hardware not found.\n", DriverError ) ;
return FALSE ;
}
Midi_Driver_Enable = TRUE ;
AIL_init_driver(hdriver,desc->default_IO,desc->default_IRQ,
desc->default_DMA,desc->default_DRQ);
state_size = AIL_state_table_size(hdriver);
//
// Set up local timbre cache; open Global Timbre Library file
//
tc_size = AIL_default_timbre_cache_size(hdriver);
if (tc_size)
{
tc_addr = malloc((unsigned long) tc_size);
AIL_define_timbre_cache(hdriver,tc_addr,tc_size);
}
state = malloc(state_size);
//
// Get name of Global Timbre Library file by appending suffix
// supplied by XMIDI driver to GTL filename prefix "SAMPLE."
//
strcpy(GTL_filename, MidiPath ) ;
strcat(GTL_filename,"SAMPLE.");
strcat(GTL_filename,desc->data_suffix);
// Load it into memory
if(!(ptrGTL = DosMalloc(FileSize(GTL_filename), NULL)))
return FALSE ;
Load( GTL_filename, ptrGTL );
return TRUE ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void InitPathMidiSampleFile( UBYTE *path )
{
//
// Get name of Global Timbre Library file by appending suffix
// supplied by XMIDI driver to GTL filename prefix "SAMPLE."
//
strcpy(MidiPath, path ) ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void ClearMidi()
{
if( !Midi_Driver_Enable ) return ;
AIL_shutdown( "" );
hseq = -1 ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void PlayMidi( /*char *filename*/ UBYTE *ail_buffer )
{
if( !Midi_Driver_Enable ) return ;
//
// Look up and register desired sequence in XMIDI file, loading
// timbres if needed
//
if( hseq != -1 )
{
AIL_stop_sequence(hdriver,hseq) ;
AIL_release_sequence_handle( hdriver, hseq ) ;
}
seqnum = 0 ;
if ((hseq = AIL_register_sequence( hdriver,
ail_buffer,
seqnum,
state,
NULL )
) == -1)
{
// printf("Sequence %u not present in XMIDI file \"%s\".\n",seqnum,argv[1]);
return ;
}
// GTL = NULL ;
while ((treq=AIL_timbre_request(hdriver,hseq)) != 0xffff)
{
// if( GTL == NULL )
// {
// GTL = fopen(GTL_filename,"rb"); // sample.ad/.opl
// }
ail_bank = treq / 256; patch = treq % 256;
// timb = load_global_timbre(GTL,ail_bank,patch);
timb = load_global_timbre(ail_bank,patch);
if (timb != NULL)
{
// printf("Installed timbre bank %u, patch %u\n",bank,patch);
AIL_install_timbre(hdriver,ail_bank,patch,timb);
// free(timb);
}
else
{
// printf("Timbre bank %u, patch %u not found ",bank,patch);
// if (GTL != NULL) fclose(GTL);
return ;
}
// AIL_install_timbre(hdriver,ail_bank,patch,timb);
}
//
// Start music playback
//
/* printf("Playing sequence %u from XMIDI file \"%s\" ...\n\n",
seqnum,argv[1]); */
AIL_start_sequence(hdriver,hseq) ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void StopMidi()
{
if( hseq != -1 )
{
AIL_stop_sequence(hdriver,hseq) ;
AIL_release_sequence_handle( hdriver, hseq ) ;
hseq = -1 ;
}
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
LONG IsMidiPlaying()
{
if( hseq != -1 )
{
if( AIL_sequence_status( hdriver, hseq ) == 1 )
return TRUE ;
}
return FALSE ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void FadeMidiDown( WORD nbsec )
{
if( hseq != -1 )
{
AIL_set_relative_volume(hdriver, 0, 0, 1000 * nbsec ) ;
}
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void FadeMidiUp( WORD nbsec )
{
if( hseq != -1 )
{
AIL_set_relative_volume(hdriver, 0, MaxVolume, 1000 * nbsec ) ;
}
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void WaitFadeMidi()
{
if( hseq != -1 )
{
while( AIL_relative_volume( hdriver, 0 ) != 0 ) ;
}
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void VolumeMidi( WORD volume )
{
if( hseq != -1 )
{
AIL_set_relative_volume(hdriver, 0, (volume*MaxVolume)/100, 0 ) ;
}
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
void DoLoopMidi()
{
// loop track
if( hseq != -1 )
if( AIL_sequence_status( hdriver, 0 ) == 2 ) // seg done
AIL_start_sequence(hdriver,hseq) ;
}
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ

41
LIB386/LIB_MIDI/README.md Normal file
View File

@@ -0,0 +1,41 @@
# LIB_MIDI
In order to build LIB_MIDI, following third party SDK is required:
- Miles Sound System AIL32 v1.0
AIL32 v1.0 is licensed under "Copyright (C) 1991, 1992 Miles Design, Inc."
terms and so is not delivered in this package.
Following files from AIL32 SDK are expected to be in LIB_MIDI folder:
```
+---LIB_MIDI
| | A32ADLIB.DLL
| | A32ALGFM.DLL
| | A32GFX.DLL
| | A32MT32.DLL
| | A32OP3FM.DLL
| | A32PASFM.DLL
| | A32PASOP.DLL
| | A32SP1FM.DLL
| | A32SP2FM.DLL
| | A32SPKR.DLL
| | A32TANDY.DLL
| | AIL32.H
| | GUSMID32.DLL
| |
| +---GUS
| | DEMO.BAT
| | DEMO.XMI
| | DLLLOAD.C
| | DOS4GW.EXE
| | GUSDIG32.DLL
| | GUSMID32.DLL
| | LOADPATS.EXE
| | PATCHES.INI
| | README
| | VPRICE.VOC
| |
| +---WR
| AIL32.OBJ
```

13
LIB386/LIB_MIX/BUILD.BAT Normal file
View File

@@ -0,0 +1,13 @@
call watcom10
pkunzip -o obj >NUL
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

View File

@@ -0,0 +1,3 @@
pkunzip -o obj >NUL
wmake /f mix_dll.mak
pkzip -m obj *.obj >NUL

85
LIB386/LIB_MIX/LIB_MIX.H Normal file
View File

@@ -0,0 +1,85 @@
#ifdef WATCOM9
#pragma library ("f:\projet\lib386\lib_mix\lb9_mix.lib");
#else
#pragma library ("f:\projet\lib386\lib_mix\lib_mix.lib");
#endif
extern LONG Mixer_Driver_Enable;
/*----------------------------------------------------------------------*/
/* MixerAskVars : Get list of vars for the lib */
/* */
/* listidentifier : pointer to an array of string*/
/* pointers, each string */
/* contains the name of the var */
/* to initialise for the DLL */
/* ptrvars : pointer to an array of DWORD to */
/* store the value of each var in */
/* listidentifier */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void MixerAskVars( char ***listidentifier,
LONG **ptrvars );
/*----------------------------------------------------------------------*/
/* MixerChangeVolume : Change the hardware volume for MIDI, */
/* WAVE, CD, Line, Master */
/* */
/* VolWave : Volume for WAVE (0-255) */
/* VolMidi : Volume for MIDI (0-255) */
/* VolCD : Volume for CD (0-255) */
/* VolLine : Volume for LINE (0-255) */
/* VolMaster : Volume for MASTER (0-255) */
/* */
/* NOTE : A VOLUME OF -1 MEANS NO CHANGE */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void MixerChangeVolume( LONG VolWave,
LONG VolMidi,
LONG VolCD,
LONG VolLine,
LONG VolMaster );
/*----------------------------------------------------------------------*/
/* MixerGetVolume : Get the hardware volume for MIDI, WAVE, */
/* CD, Line and Master */
/* */
/* VolWave : ptr on Volume for WAVE (0-255) */
/* VolMidi : ptr on Volume for MIDI (0-255) */
/* VolCD : ptr on Volume for CD (0-255) */
/* VolLine : ptr on Volume for LINE (0-255) */
/* VolMaster : ptr on Volume for MASTER (0-255) */
/* */
/* NOTE : A NULL PTR MEANS NO GET */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void MixerGetVolume( LONG *VolWave,
LONG *VolMidi,
LONG *VolCD,
LONG *VolLine,
LONG *VolMaster );
/*----------------------------------------------------------------------*/
/* MixerGetInfo : Get the hardware volume capabilities */
/* */
/* VolWave : ptr on Volume for WAVE (0/1) */
/* VolMidi : ptr on Volume for MIDI (0/1) */
/* VolCD : ptr on Volume for CD (0/1) */
/* VolLine : ptr on Volume for LINE (0/1) */
/* VolMaster : ptr on Volume for MASTER (0/1) */
/* */
/* NOTE : A NULL PTR MEANS NO GET */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void MixerGetInfo( LONG *VolWave,
LONG *VolMidi,
LONG *VolCD,
LONG *VolLine,
LONG *VolMaster );

54
LIB386/LIB_MIX/MAKEFILE Normal file
View File

@@ -0,0 +1,54 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom\bin\wcc386p
WL = f:\compil\watcom\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oeaxt /zp2 /4s /zq /s /DWATCOM9
!else
CFLAGS = /oeaxt /zp2 /5s /zq /s
!endif
LFLAGS = /c /q /b /n
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
OBJETS1 = mixer.obj mixer_i.obj
OBJETS2 =
OBJETS3 =
OBJETS4 =
!ifeq WATCOM9 yes
LIB = LB9_MIX
!else
LIB = LIB_MIX
!endif
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4)
@echo $(OBJETS1) > clibmak.rsp
@$(WL) $(LIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre M "$(LIB) OK"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(CFLAGS) $*

50
LIB386/LIB_MIX/MIXER.C Normal file
View File

@@ -0,0 +1,50 @@
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
SAMP.C 386
(c) Adeline 1993
*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_mix\lib_mix.h"
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <i86.h>
char *MixerError = "Error MixerDriver:";
extern void *Mixer_listfcts;
extern LONG Mixer_Driver_Enable;
/*-------------------------------------------------------------------------*/
LONG MixerInitDLL(char *driverpathname)
{
char *dll, *drvr;
//
// Load driver file
//
dll = FILE_read( driverpathname, NULL);
if (dll==NULL)
{
printf("%s Could not load driver '%s'.\n", MixerError, driverpathname );
return FALSE ;
}
drvr=DLL_load(dll,DLLMEM_ALLOC | DLLSRC_MEM,NULL);
if (drvr==NULL)
{
printf("%s Invalid DLL image.\n", MixerError );
return FALSE ;
}
Free(dll);
Mixer_listfcts = *(void **)drvr;
printf("%s", drvr+4);
return (Mixer_Driver_Enable = TRUE);
}
/*-------------------------------------------------------------------------*/

1384
LIB386/LIB_MIX/MIXER_A.ASM Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,83 @@
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
; MIXER_I.ASM 386
; (c) Adeline 1993
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
;*--------------------------------------------------------------------------*
.386
jumps
.model SMALL, SYSCALL
.DATA
PUBLIC NoLanguage Mixer_listfcts
PUBLIC NoLanguage Mixer_Driver_Enable
Mixer_listfcts dd 0
Mixer_Driver_Enable dd 0
.CODE
PUBLIC NoLanguage MixerAskVars
PUBLIC NoLanguage MixerChangeVolume
PUBLIC NoLanguage MixerGetVolume
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
MixerCallFuncs PROC
cmp byte ptr[Mixer_Driver_Enable], 0
je return
shl eax, 2
add eax, dword ptr[Mixer_listfcts]
jmp dword ptr[eax]
return:
ret
MixerCallFuncs ENDP
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
MixerAskVars PROC
mov eax, 0
jmp MixerCallFuncs
MixerAskVars ENDP
;----------------------------------------------------------------------------
MixerChangeVolume PROC
mov eax, 1
jmp MixerCallFuncs
MixerChangeVolume ENDP
;----------------------------------------------------------------------------
MixerGetVolume PROC
mov eax, 2
jmp MixerCallFuncs
MixerGetVolume ENDP
;----------------------------------------------------------------------------
MixerGetInfo PROC
mov eax, 3
jmp MixerCallFuncs
MixerGetInfo ENDP
;----------------------------------------------------------------------------
END

View File

@@ -0,0 +1,52 @@
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
LINKDIR = format os2 lx dll
dll: m_pas.dll m_mwss.dll m_sb2cd.dll m_sbpro.dll m_sb16.dll m_gold.dll
#
# Mixer driver: AD1848 SoundPort, Microsoft Windows Sound System
#
m_mwss.dll: mixer_a.asm
ml $(AFLAGS) /DMWSS mixer_a.asm
wlink n m_mwss.dll f mixer_a $(LINKDIR)
#
# Mixer driver: Pro Audio Spectrum
#
m_pas.dll: mixer_a.asm
ml $(AFLAGS) /DPAS mixer_a.asm
wlink n m_pas.dll f mixer_a $(LINKDIR)
#
# Mixer driver: Sound Blaster 2 CD Interface card
#
m_sb2cd.dll: mixer_a.asm
ml $(AFLAGS) /DSB2CD mixer_a.asm
wlink n m_sb2cd.dll f mixer_a $(LINKDIR)
#
# Mixer driver: Sound Blaster Pro
#
m_sbpro.dll: mixer_a.asm
ml $(AFLAGS) /DSBPRO mixer_a.asm
wlink n m_sbpro.dll f mixer_a $(LINKDIR)
#
# Mixer driver: Sound Blaster 16
#
m_sb16.dll: mixer_a.asm
ml $(AFLAGS) /DSB16 mixer_a.asm
wlink n m_sb16.dll f mixer_a $(LINKDIR)
#
# Mixer driver: Yamaha Gold, Adlib Gold
#
m_gold.dll: mixer_a.asm
ml $(AFLAGS) /DGOLD mixer_a.asm
wlink n m_gold.dll f mixer_a $(LINKDIR)

View File

@@ -0,0 +1,44 @@
.386p
jumps
.model SMALL, C
.data
extrn NoLanguage P_SinTab:WORD
.code
public NoLanguage Balance
Balance PROC uses ebx,\
bal:DWORD, vol:DWORD, volleft:DWORD, volright:DWORD
mov eax, bal
shl eax, 1
mov edx, vol
xor ecx, ecx
mov cx, word ptr[P_SinTab + eax]
imul ecx, edx
shr ecx, 14
mov ebx, volright
mov dword ptr[ebx], ecx
xor ecx, ecx
mov cx, word ptr[P_SinTab + 512 + eax]
imul ecx, edx
shr ecx, 14
mov ebx, volleft
mov dword ptr[ebx], ecx
ret
Balance ENDP
END

View File

@@ -0,0 +1,3 @@
/* balance between 0 and 256, volume between 0 and 128 */
void Balance( ULONG balance, ULONG volume, ULONG *vol_left, ULONG *vol_right ) ;

15
LIB386/LIB_SAMP/BUILD.BAT Normal file
View File

@@ -0,0 +1,15 @@
call watcom10
pkunzip -o obj >NUL
copy wr\ail32.obj
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
copy wr\ail32.obj
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

View File

@@ -0,0 +1,3 @@
pkunzip -o obj >NUL
wmake /f wave_dll.mak
pkzip -m obj *.obj >NUL

View File

@@ -0,0 +1,378 @@
.DATA
Status EQU 08h ;DMAC status port (read) \ same port
Command EQU 08h ;DMAC command port (write) / (read/write)
Request EQU 09h ;DMAC channel request (write-only)
DMA_Mask EQU 0Ah ;DMAC DMA_Mask (write-only)
Mode EQU 0Bh ;DMAC mode (write)
byte_ptr EQU 0Ch ;byte pointer flip-flop
addr EQU 000h ; per-channel base address
count EQU 001h ; per-channel byte count
read_cmd EQU 058h ; autoinitialising read
write_cmd EQU 054h ; auto write
set_cmd EQU 000h ; DMA_Mask set (enable dma)
reset_cmd EQU 004h ; DMA_Mask reset (disable)
page_table DW 00087h ; channel 0
DW 00083h ; channel 1
DW 00081h ; channel 2
DW 00082h ; channel 3
DW 0FFFFh ; ch 4 (not used)
DW 0008Bh ; ch 5
DW 00089h ; ch 6
DW 0008Ah ; ch 7
dmac2 DB 0 ; Flag set to non-zero when using the 2nd DMA controller
.CODE
MACRO adjust reg ; Adjust register port for 2nd DMA cont
local no_adjust
cmp byte ptr[dmac2], 0
jz no_adjust
shl reg, 1
add reg, 0C0h
no_adjust:
ENDM adjust
;+---------------------------------------------------------------------------+
;| int dma_setup(int Channel, char far *Buffer, unsigned Length) |
;| ------------------------------------------------------------------------- |
;| Channel = 0-7 |
;| Buffer = Address of data to transfer |
;| Length = Length of data to transfer |
;| ------------------------------------------------------------------------- |
;| Returns: 0 if no errors (dma_errno == 0) |
;| -1 if errors occurred (dma_errno set to indicate error.) |
;+---------------------------------------------------------------------------+
dma_setup PROC USES EBX,\
Channel:DWORD, Buffer:DWORD, Len:DWORD
;Convert 20-bit physical address of buffer into page:offset
mov edi, Buffer
mov ecx, edi
shr ecx, 8
; ch:di == The physical buffer base.
; Adjust channel number
mov byte ptr[dmac2], 0
mov bx, Channel
cmp bx, 4
jb OkChannel
and bx, 3
mov byte ptr[dmac2], 1
OkChannel:
; BX contains the adjusted channel number
mov si, read_cmd
add si, bx
mov cl, set_cmd ;allow dma requests
add cl, bl
;si contains READ/WRITE command for DMA controller
;cl contains confirmation command for DMA controller
shl bx, 1
;bx == Port # Channel*2
;-------------------------------------------------------------------------
; Calculations have been done ahead of time to minimize time with
; interrupts disabled.
;
; edi (ch:di) == physical base address (must be on word boundary for 16 bits)
;
; cl == Confirmation command (Unmasks the channel)
;
; bx == I/O port Channel*2 (This is where the address is written)
;
; si == Mode command for DMA
;-------------------------------------------------------------------------
; Now we shift the address and word count right one bit if in 16 bit mode.
cmp [dmac2], 0
jz AddrOk
shr ch, 1
rcr di, 1
shl ch, 1
shr [Len], 1 ;Odd byte lengths are rounded down
AddrOk:
;The "byte pointer" is also known as the LSB/MSB flip flop.
;By writing any value to it, the DMA controller registers are prepared
;to accept the address and length values LSB first.
mov dx, byte_pt ;Reset byte pointer Flip/flop
adjust dx
out dx, al
mov dx, bx ;dx=DMAC Base Address port
adjust dx
mov ax, di ;ax=LSW of 20-bit address
out dx, al ;Store LSB
mov al, ah
out dx, al ;Store MSB
;Write length to port (Channel * 2 + 1)
inc dx ;dx=DMAC Count port
mov eax, Len
out dx, al ;Write LSB of Length
mov al, ah
out dx, al ;Write MSB
;Write page to port page_table[channel]
mov ebx, Channel
shl bx, 1
mov dx, word ptr[OFFSET page_table + bx]
mov al, ch ;al=Page number
out dx, al ;Store the page
;Write Readcmd for channel to Mode port
mov dx, Mode ;dx=DMAC mode register
adjust dx
mov ax, si ;Load pre-calculated mode
out dx, al ;Write it to the DSP
mov dx, DMA_Mask ;dx=DMAX DMA_Mask register
adjust dx
mov al, cl ;al=pre-calulated DMA_Mask value
out dx, al ;Write DMA_Mask (allow dma on this channel)
ret
dma_setup ENDP
;+---------------------------------------------------------------------------+
;| int prevent_dma(int Channel) |
;| ------------------------------------------------------------------------- |
;| Channel = 0-7 |
;| Prevents DMA requests from Channel by masking bit in DMA_C. |
;| ------------------------------------------------------------------------- |
;+---------------------------------------------------------------------------+
prevent_dma PROC ,\
Channel:DWORD
; Check channel number range
mov dx, DMA_Mask
mov eax, Channel
cmp al, 4
jb OkChannel
and al, 3
shl dx, 1
add dx, 0C0h
OkChannel:
add al, reset_cmd ; Add disable DMA requests
out dx, al
ret
prevent_dma ENDP
;+---------------------------------------------------------------------------+
;| int allow_dma(int Channel) |
;| ------------------------------------------------------------------------- |
;| Channel = 0-7 |
;| Unmasks DMA on the specified channel. |
;| ------------------------------------------------------------------------- |
;+---------------------------------------------------------------------------+
allow_dma PROC ,\
Channel:DWORD
; Check channel number range
mov dx, DMA_Mask
mov eax, Channel
cmp al, 4
jb OkChannel
and al, 3
shl dx, 1
add dx, 0C0h
OkChannel:
add al, set_cmd ; Add enable DMA requests
out dx, al
ret
allow_dma ENDP
;+---------------------------------------------------------------------------+
;| int dma_count(Channel) |
;| ------------------------------------------------------------------------- |
;| Channel = 0-7 |
;| ------------------------------------------------------------------------- |
;| Returns: -1 if DMA transaction completed |
;| else returns the number of bytes/words left to transfer |
;+---------------------------------------------------------------------------+
PROC dma_count ,\
Channel:DWORD
mov eax, Channel
mov dx, ax
and dx, 3
shl dx, 1
add dx, count
cmp al, 4
jb OkChannel
shl dx, 1
add dx, 0C0h
OkChannel:
xor eax, eax
cli
in al, dx
mov ah, al
in al, dx
sti
xchg al, ah
ret
dma_count ENDP
;+---------------------------------------------------------------------------+
;| unsigned dma_addr(Channel) |
;| ------------------------------------------------------------------------- |
;| Channel = 0-7 |
;| ------------------------------------------------------------------------- |
;| Returns: Current address word of that channel |
;| Value must be multiplied by 2 for a 16-bit channel. |
;| It is best to start at offset 0, ie on a 64K boundary |
;+---------------------------------------------------------------------------+
dma_addr PROC ,\
Channel:DWORD
mov eax, Channel
mov dx, ax
and dx, 3
shl dx, 1
cmp al, 4
jb OkChannel
shl dx, 1
add dx, 0C0h
OkChannel:
xor eax, eax
cli
in al, dx
mov ah, al
in al, dx
sti
xchg al, ah
ret
dma_addr ENDP
VOID *DMABuffer, *DMAAllocBuffer;
BYTE LockedDMARegion;
#define MAX_DMABUFFERATTEMPTS 10;
;+---------------------------------------------------------------------------+
;| BYTE *AlignOn4KBoundry( BYTE *Buf ) |
;| ------------------------------------------------------------------------- |
;| Align Buf to the nearest 4K page |
;+---------------------------------------------------------------------------+
#define AlignOn4KBoundry(Buf) ((Buf + 0x00000FFF) & 0xFFFFF000)
;+---------------------------------------------------------------------------+
;| BYTE *AllocateDMABuffer( WORD BufferSize ) |
;| ------------------------------------------------------------------------- |
;| BufferSize = 0-64K |
;| ------------------------------------------------------------------------- |
;| Returns: Buffer if successful |
;| NULL if error |
;+---------------------------------------------------------------------------+
BYTE *AllocateDMABuffer( WORD BufferSize )
{
VOID *Tried[ MAX_DMABUFFERATTEMPTS ] ;
VOID *Buf, *DMAAddr ;
int Tries, Error ;
for (Tries = 0; Tries < MAX_DMABUFFERATTEMPTS; Tries++)
Tried[ Tries ] = NULL ;
Tries = 0;
LockedDMARegion = FALSE;
do
{
// printf( "DMA buffer allocation attempt: %d\n", Tries + 1 ) ;
if ((DMAAllocBuffer = (VOID *)DosMalloc( BufferSize + 0xFFF)) != NULL)
{
DMABuffer = AlignOn4KBoundry(DMAAllocBuffer);
if ( ((LONG)DMABuffer & 0xF0000) !=
(((LONG)DMABuffer + BufferSize) & 0xF0000) )
{
Tried[ Tries ] = DMAAllocBuffer ;
DMAAllocBuffer = NULL ;
DMABuffer = NULL ;
}
}
Tries++ ;
DMAAllocBuf = Buf;
DMABuffer = DMAAddr ;
}
while ((DMAAllocBuf == NULL) && (Tries < MAX_DMABUFFERATTEMPTS)) ;
for (wTries = 0; wTries < MAX_DMABUFFERATTEMPTS; wTries++)
{
if (alpTried[ wTries ])
free( alpTried[ wTries ] ) ;
else
break ;
}
return( DMABuffer ) ;
;+---------------------------------------------------------------------------+
;| VOID FreeDMABuffer( VOID ) |
;| ------------------------------------------------------------------------- |
;| Free the DMA buffer |
;+---------------------------------------------------------------------------+
VOID FreeDMABuffer( VOID )
{
if (LockedDMARegion)
UnlockDMARegion( &gDDS, 0 ) ;
if (DMAAllocBuf)
{
free( glpDMAAllocBuf ) ;
DMAAllocBuf = NULL ;
}
}

1
LIB386/LIB_SAMP/GUS.BAT Normal file
View File

@@ -0,0 +1 @@
@nmake /f gus.mak gusdig32.obj

87
LIB386/LIB_SAMP/GUS.C Normal file
View File

@@ -0,0 +1,87 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#pragma library ("\gussdk21\libs\ultra0wc.lib");
#include "forte.h"
#include "gf1proto.h"
#include "extern.h"
#include "ultraerr.h"
extern void NewIRQ(void);
extern void *BUFFER_DMA;
extern ULONG R_BUFFER_CARD;
extern ULONG MID_R_BUFFER_CARD;
extern ULONG CURRENT_R_BUFFER_CARD;
extern ULONG L_BUFFER_CARD;
extern ULONG MID_L_BUFFER_CARD;
extern ULONG CURRENT_L_BUFFER_CARD;
extern LONG BUFFER_SIZE;
extern UWORD PlayRate;
void ResetCard(void)
{
ULTRA_CFG config;
UBYTE RMode, LMode;
/* Get the ULTRASND environment string parameters */
UltraGetCfg(&config);
/* Open the card with 14 voices (44 Khz) */
UltraOpen(&config, 14);
/* Get a chunk of memory on the card */
UltraMemAlloc(BUFFER_SIZE << 1, &R_BUFFER_CARD);
MID_R_BUFFER_CARD = R_BUFFER_CARD + BUFFER_SIZE;
CURRENT_R_BUFFER_CARD = MID_R_BUFFER_CARD;
/* Reset memory on the card to 0 */
UltraDownload(BUFFER_DMA, DMA_8|DMA_CVT_2, R_BUFFER_CARD, BUFFER_SIZE, TRUE);
UltraDownload(BUFFER_DMA, DMA_8|DMA_CVT_2, MID_R_BUFFER_CARD, BUFFER_SIZE, TRUE);
/* Get a chunk of memory on the card */
UltraMemAlloc(BUFFER_SIZE << 1, &L_BUFFER_CARD);
MID_L_BUFFER_CARD = L_BUFFER_CARD + BUFFER_SIZE;
CURRENT_L_BUFFER_CARD = MID_L_BUFFER_CARD;
/* Reset memory on the card to 0 */
UltraDownload(BUFFER_DMA, DMA_8|DMA_CVT_2, L_BUFFER_CARD, BUFFER_SIZE, TRUE);
UltraDownload(BUFFER_DMA, DMA_8|DMA_CVT_2, MID_L_BUFFER_CARD, BUFFER_SIZE, TRUE);
/* set Balance for each voice */
UltraSetBalance(0, 7);
UltraSetBalance(1, 7);
/* Set Frequency for each voice to PlayRate */
UltraSetFrequency(0, PlayRate);
UltraSetFrequency(1, PlayRate);
/* set Volume for each voice */
UltraSetVolume(0, 511);
UltraSetVolume(1, 511);
/* get voices ready... */
RMode = UltraPrimeVoice(0, R_BUFFER_CARD, R_BUFFER_CARD,
R_BUFFER_CARD + (BUFFER_SIZE << 1), 0x20 | 0x08 | 0x04);
LMode = UltraPrimeVoice(1, L_BUFFER_CARD, MID_L_BUFFER_CARD,
L_BUFFER_CARD + (BUFFER_SIZE << 1), 0x20 | 0x08 | 0x04);
/* Plug in our IRQ handler for wave events */
UltraWaveHandler(NewIRQ);
/*set, go ! */
UltraGoVoice(0, RMode);
UltraGoVoice(1, LMode);
}
void StartDMACard(void)
{
UltraDownload(BUFFER_DMA, DMA_8|DMA_CVT_2, CURRENT_R_BUFFER_CARD, BUFFER_SIZE, FALSE);
}

25
LIB386/LIB_SAMP/GUS.INC Normal file
View File

@@ -0,0 +1,25 @@
;*--------------------------------------------------------------------------*
BUFFER_SIZE equ 1024 ; number of samples
; in half-buffer
LIST_SIZE equ 50
STRUCT_SIZE equ 40
SNAP_SIZE equ 8
SHIFT_SAMPLE equ 3 ; max number of
; samples mixed
;*--------------------------------------------------------------------------*
EXTERN SYSCALL playrate:WORD
EXTERN SYSCALL bufferhalf:DWORD
EXTERN SYSCALL buffer_dma:DWORD
EXTERN SYSCALL current_buffer:DWORD
EXTERN SYSCALL DoUpdate:WORD
EXTERN SYSCALL Critical:WORD
;*--------------------------------------------------------------------------*
UpdateBuffer PROTO SYSCALL
;*--------------------------------------------------------------------------*

206
LIB386/LIB_SAMP/LIB_WAVE.H Normal file
View File

@@ -0,0 +1,206 @@
#ifdef WATCOM9
#pragma library ("f:\projet\lib386\lib_samp\lb9_wave.lib");
#else
#pragma library ("f:\projet\lib386\lib_samp\lib_wave.lib");
#endif
typedef struct
{
ULONG LongHandle;
ULONG Info0;
ULONG Position;
}
T_WAVE;
extern char Wave_Driver[];
extern char Wave_Driver_Name[];
extern LONG Wave_Driver_Enable;
/*----------------------------------------------------------------------*/
/* WaveInitDLL : Load and connect the DLL to the program */
/* */
/* dlldriver : Pathname of the DLL */
/* */
/* Returns : TRUE if ok, FALSE if problems */
/*----------------------------------------------------------------------*/
LONG WaveInitDLL( char *dlldriver ) ;
/*----------------------------------------------------------------------*/
/* WaveAskVars : Get the list of variables needed by the DLL */
/* */
/* listidentifier : pointer to an array of string*/
/* pointers, each string */
/* contains the name of the var */
/* to initialise for the DLL */
/* ptrvars : pointer to an array of DWORD to */
/* store the value of each var in */
/* listidentifier */
/* */
/* Returns : TRUE if ok, FALSE if problems */
/*----------------------------------------------------------------------*/
void WaveAskVars( char ***listidentifier, LONG **ptrvars ) ;
/*----------------------------------------------------------------------*/
/* InitWave : Init the library */
/* */
/* Returns : TRUE if ok, FALSE if problems */
/*----------------------------------------------------------------------*/
ULONG InitWave( void );
/*----------------------------------------------------------------------*/
/* ClearWave : Close the library */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void ClearWave( void );
/*----------------------------------------------------------------------*/
/* WavePlay : Play a Sample */
/* */
/* Handle : a number identifying the sample */
/* Pitchbend : 4096 is no bend */
/* Repeat : number of times to play the sample */
/* Follow : if TRUE, this sample will play after */
/* the previous one */
/* VolLeft : Volume for Left channel (128 max) */
/* VolRight : Volume for Right channel (128 max) */
/* Buffer : Pointer to the sample in mem */
/* */
/* Returns : the lib internal handle */
/*----------------------------------------------------------------------*/
ULONG WavePlay( UWORD Handle,
UWORD Pitchbend,
UWORD Repeat,
UBYTE Follow,
UWORD VolLeft,
UWORD VolRight,
void *Buffer );
/*----------------------------------------------------------------------*/
/* WaveGiveInfo0 : Fill the user Info0 field */
/* */
/* LongHandle : Lib internal handle */
/* Info0 : the info to be stored (up to you) */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveGiveInfo0( ULONG LongHandle,
ULONG Info0 );
/*----------------------------------------------------------------------*/
/* WaveStop : Stop all samples, clear all internal vars */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveStop( void );
/*----------------------------------------------------------------------*/
/* WaveStopOne : Stop one sample */
/* */
/* Handle : Your Handle */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveStopOne( UWORD Handle );
/*----------------------------------------------------------------------*/
/* WaveStopOneLong : Stop one sample */
/* */
/* LongHandle : Lib internal handle */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveStopOneLong( ULONG LongHandle );
/*----------------------------------------------------------------------*/
/* WaveInList : Test if one sample is currently used by */
/* the lib */
/* */
/* Handle : Your Handle */
/* */
/* Returns : TRUE if used */
/*----------------------------------------------------------------------*/
int WaveInList( UWORD handle );
/*----------------------------------------------------------------------*/
/* WaveGetSnap : Take a snapshot of all Internal handles and */
/* Info0 for currently playing samples in array */
/* ListSnapSample */
/* */
/* Buffer : A pointer that will be filled with */
/* the address of the buffer */
/* */
/* Returns : The number of samples currently used by the */
/* lib */
/*----------------------------------------------------------------------*/
int WaveGetSnap( void **Buffer );
/*----------------------------------------------------------------------*/
/* WavePause : Pause all the playing samples */
/* */
/* Returns : TRUE if paused */
/*----------------------------------------------------------------------*/
int WavePause( void );
/*----------------------------------------------------------------------*/
/* WaveContinue : Continue all the playing samples */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveContinue( void );
/*----------------------------------------------------------------------*/
/* WaveSaveState : Save the internal state of the lib and */
/* get ready to play somme other samples */
/* */
/* Remark : Can be called only once */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveSaveState( void );
/*----------------------------------------------------------------------*/
/* WaveRestoreState: Restore the internal state of the lib */
/* and resume playback */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveRestoreState( void );
/*----------------------------------------------------------------------*/
/* WaveChangeVolume: Change the volume of a sample */
/* */
/* LongHandle : Lib internal handle */
/* VolLeft : New Left volume (128 max) */
/* VolRight : New Right volume (128 max) */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveChangeVolume( ULONG longhandle,
ULONG VolGauche,
ULONG VolDroit );
/*----------------------------------------------------------------------*/
/* WaveMove : Tell the driver to move the samples from */
/* SrcAddr to DestAddr. Size given by Size */
/* */
/* DestAddr : Dest */
/* SrcAddr : Source */
/* Size : number of bytes to move */
/* */
/* Returns : nothing */
/*----------------------------------------------------------------------*/
void WaveMove( void *DestAddr,
void *SrcAddr,
ULONG Size );
/*----------------------------------------------------------------------*/
/* WaveGetAddr : Return a pointer to the current playing */
/* sample data */
/* */
/* Returns : a pointer (FLAT) */
/*----------------------------------------------------------------------*/
void *WaveGetAddr( void );

54
LIB386/LIB_SAMP/MAKEFILE Normal file
View File

@@ -0,0 +1,54 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom\bin\wcc386p
WL = f:\compil\watcom\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oeaxt /zp2 /4s /zq /s /DWATCOM9
!else
CFLAGS = /oeaxt /zp2 /5s /zq /s
!endif
LFLAGS = /c /q /b /n
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
.SILENT
OBJETS1 = wave.obj wave_i.obj
!ifeq WATCOM9 yes
LIB = LB9_WAVE
!else
LIB = LIB_WAVE
!endif
$(LIB).LIB: $(OBJETS1)
@echo $(OBJETS1) > clibmak.rsp
@$(WL) $(LIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre M "$(LIB) OK"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(CFLAGS) $*

3436
LIB386/LIB_SAMP/N_WAVE.ASM Normal file

File diff suppressed because it is too large Load Diff

141
LIB386/LIB_SAMP/PATCH.INC Normal file
View File

@@ -0,0 +1,141 @@
ENVELOPES equ 6
HEADER_SIZE equ 12
ID_SIZE equ 10
DESC_SIZE equ 60
RESERVED_SIZE equ 40
PATCH_HEADER_RESERVED_SIZE equ 36
LAYER_RESERVED_SIZE equ 40
PATCH_DATA_RESERVED_SIZE equ 36
PatchHeader STRUC
;PatchHeader
header db HEADER_SIZE dup (?)
gravis_id db ID_SIZE dup (?)
description db DESC_SIZE dup (?)
instruments db ?
voices db ?
channels db ?
wave_forms dw ?
master_volume dw ?
data_size dd ?
reserved_h db PATCH_HEADER_RESERVED_SIZE dup (?)
;InstrumentData
instrument dw ?
instrument_name db 16 dup (?)
instrument_size dd ?
layers db ?
reserved_i db RESERVED_SIZE dup (?)
;LayerData
layer_duplicate db ?
layer db ?
layer_size dd ?
samples db ?
reserved_l db LAYER_RESERVED_SIZE dup (?)
PatchHeader ENDS
PatchData STRUC
wave_name db 7 dup (?)
fractions db ?
wave_size dd ?
start_loop dd ?
end_loop dd ?
sample_rate dw ?
low_frequency dd ?
high_frequency dd ?
root_frequency dd ?
tune dw ?
balance db ?
envelope_rate db ENVELOPES dup (?)
envelope_offset db ENVELOPES dup (?)
tremolo_sweep db ?
tremolo_rate db ?
tremolo_depth db ?
vibrato_sweep db ?
vibrato_rate db ?
vibrato_depth db ?
modes db ?
scale_frequency dw ?
scale_factor dw ?
reserved_w db PATCH_DATA_RESERVED_SIZE dup (?)
PatchData ENDS
CommonData STRUC
Control db ?
NumbSamples db ?
DataOffset dw ?
CommonData ENDS
;SampleData STRUC
;
;_wave_start dd ?
;_wave_end dd ?
;_start_loop dd ?
;_end_loop dd ?
;_sample_rate dw ?
;_low_frequency dd ?
;_high_frequency dd ?
;_root_frequency dd ?
;_balance db ?
;_envelope_rate db ENVELOPES dup (?)
;_envelope_offset db ENVELOPES dup (?)
;_tremolo_sweep db ?
;_tremolo_rate db ?
;_tremolo_depth db ?
;_vibrato_sweep db ?
;_vibrato_rate db ?
;_vibrato_depth db ?
;_modes db ?
;_scale_frequency dw ?
;_scale_factor dw ?
;
;SampleData ENDS
wave_struct STRUC
_start_loop dd ?
_end_loop dd ?
_low_frequency dd ?
_high_frequency dd ?
_root_frequency dd ?
_mem dd ?
_scale_frequency dw ?
_sample_rate dw ?
_scale_factor dw ?
_start_acc_low dw ?
_start_acc_high dw ?
_start_low dw ?
_start_high dw ?
_end_low dw ?
_end_high dw ?
_end_acc_low dw ?
_end_acc_high dw ?
_sample_ratio dw ?
_wave_size dd ?
_fractions db ?
_balance db ?
_envelope_rate db ENVELOPES dup (?)
_envelope_offset db ENVELOPES dup (?)
_tremolo_sweep db ?
_tremolo_rate db ?
_tremolo_depth db ?
_vibrato_sweep db ?
_vibrato_rate db ?
_vibrato_depth db ?
_modes db ?
wave_struct ENDS

30
LIB386/LIB_SAMP/README.md Normal file
View File

@@ -0,0 +1,30 @@
# LIB_SAMP
In order to build LIB_SAMP, following third party SDK is required:
- Miles Sound System AIL32 v1.0
- Gravis Ultra Sound SDK v2.1 (gussdk21)
AIL32 v1.0 is licensed under "Copyright (C) 1991, 1992 Miles Design, Inc."
terms and is not delivered in this package.
Gravis Ultra Sound SDK is licensed under
"Copyright (C): 1993,1994 by Advanced Gravis Computer Technology" terms and is
not delivered in this package. It's included in the AIL32 SDK.
Following files from AIL32 SDK are expected to be in LIB_SAMP folder:
```
+---LIB_SAMP
| 386.MAC
| AIL32.INC
| AIL32PAT.EXE
| GF1NEW.INC
| GF1PROTO.INC
| GF1_OSPM.LIB
| GUS.BAT
| GUS.MAK
| GUSDIG32.ASM
| GUSMID32.INC
| PMINIT.ASM
| PMINIT.INC
```

26
LIB386/LIB_SAMP/REAL.ASM Normal file
View File

@@ -0,0 +1,26 @@
.386
;-----------------------------------------------------------------------------
_TEXT16 SEGMENT BYTE PUBLIC USE16 'CODE'
ASSUME CS:_TEXT16
ASSUME DS:_TEXT16
PUBLIC RealInt
;-----------------------------------------------------------------------------
RealInt:
db 0EAh, 78h, 56h, 34h, 12h ; jmp far 1234h:5678h
;-----------------------------------------------------------------------------
_TEXT16 ENDS
;-----------------------------------------------------------------------------
;
; The
End

10
LIB386/LIB_SAMP/TEST.C Normal file
View File

@@ -0,0 +1,10 @@
//#include <stdlib.h>
void InitWave()
{
int i;
void *bad_handle[10];
for(i=0; i<10; i++)
bad_handle[i]=NULL;
}

26
LIB386/LIB_SAMP/VOL.INC Normal file
View File

@@ -0,0 +1,26 @@
gf1_volumes dw 00000h, 009ffh, 00a80h, 00affh
dw 00b40h, 00b80h, 00bc0h, 00bffh, 00c20h
dw 00c40h, 00c60h, 00c80h, 00ca0h, 00cc0h
dw 00ce0h, 00cffh, 00d10h, 00d20h, 00d30h
dw 00d40h, 00d50h, 00d60h, 00d70h, 00d80h
dw 00d90h, 00da0h, 00db0h, 00dc0h, 00dd0h
dw 00de0h, 00df0h, 00dffh, 00e08h, 00e10h
dw 00e18h, 00e20h, 00e28h, 00e30h, 00e38h
dw 00e40h, 00e48h, 00e50h, 00e58h, 00e60h
dw 00e68h, 00e70h, 00e78h, 00e80h, 00e88h
dw 00e90h, 00e98h, 00ea0h, 00ea8h, 00eb0h
dw 00eb8h, 00ec0h, 00ec8h, 00ed0h, 00ed8h
dw 00ee0h, 00ee8h, 00ef0h, 00ef8h, 00effh
dw 00f04h, 00f08h, 00f0ch, 00f10h, 00f14h
dw 00f18h, 00f1ch, 00f20h, 00f24h, 00f28h
dw 00f2ch, 00f30h, 00f34h, 00f38h, 00f3ch
dw 00f40h, 00f44h, 00f48h, 00f4ch, 00f50h
dw 00f54h, 00f58h, 00f5ch, 00f60h, 00f64h
dw 00f68h, 00f6ch, 00f70h, 00f74h, 00f78h
dw 00f7ch, 00f80h, 00f84h, 00f88h, 00f8ch
dw 00f90h, 00f94h, 00f98h, 00f9ch, 00fa0h
dw 00fa4h, 00fa8h, 00fach, 00fb0h, 00fb4h
dw 00fb8h, 00fbch, 00fc0h, 00fc4h, 00fc8h
dw 00fcch, 00fd0h, 00fd4h, 00fd8h, 00fdch
dw 00fe0h, 00fe4h, 00fe8h, 00fech, 00ff0h
dw 00ff4h, 00ff8h, 00ffch, 00fffh

123
LIB386/LIB_SAMP/WAVE.C Normal file
View File

@@ -0,0 +1,123 @@
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
SAMP.C 386
(c) Adeline 1993
*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_samp\lib_wave.h"
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <i86.h>
char *WaveError = "Error WaveDriver:";
extern void *Wave_listfcts;
extern LONG Wave_Driver_Enable;
ULONG _InitCard( void *Buffer );
void _ClearCard( void );
ULONG _GetBufferSize( void );
void *BUFFER_DMA;
void *END_BUFFER_DMA;
/*-------------------------------------------------------------------------*/
LONG WaveInitDLL(char *driverpathname)
{
char *dll, *drvr;
//
// Load driver file
//
dll = FILE_read( driverpathname, NULL);
if (dll==NULL)
{
printf("%s Could not load driver '%s'.\n", WaveError, driverpathname );
return FALSE ;
}
drvr=DLL_load(dll,DLLMEM_ALLOC | DLLSRC_MEM,NULL);
if (drvr==NULL)
{
printf("%s Invalid DLL image.\n", WaveError );
return FALSE ;
}
Free(dll);
Wave_listfcts = *(void **)drvr;
printf("%s", drvr+4);
return (Wave_Driver_Enable = TRUE);
}
/*-------------------------------------------------------------------------*/
ULONG InitWave()
{
union REGS r;
struct SREGS sr;
void far *fh;
int i;
int IRQ_number;
int kilo_buffer;
ULONG bad_handle[10];
kilo_buffer = _GetBufferSize();
/*- Reserve some space for a sound buffer that doesn't cross a 64K page -*/
// for(i=0; i<10; i++)
// bad_handle[i]=NULL;
i = 0;
do
{
if (!(BUFFER_DMA = DosMalloc( kilo_buffer, &bad_handle[i] )))
{
BUFFER_DMA = NULL;
i+=2;
break;
}
END_BUFFER_DMA = (void *)((ULONG)BUFFER_DMA + kilo_buffer - 1);
if (((LONG)BUFFER_DMA & 0xFFFF0000) != ((LONG)END_BUFFER_DMA & 0xFFFF0000))
{
BUFFER_DMA = NULL;
}
i++;
} while ((BUFFER_DMA == NULL) && (i<=10));
// for(i-=2; i>=0; i--)
// DosFree( bad_handle[i] );
if (BUFFER_DMA == NULL)
{
printf("%s Couldn't allocate a contiguous buffer in DOS memory.\n", WaveError);
return 0;
}
/*----- Init Sound Card (and IRQ controller) ---*/
Wave_Driver_Enable = _InitCard(BUFFER_DMA);
if (!Wave_Driver_Enable)
{
printf("%s Sound card not found.\n", WaveError);
}
return Wave_Driver_Enable;
}
void ClearWave()
{
union REGS r;
struct SREGS sr;
if (!Wave_Driver_Enable)
return;
/*----- Reset Sound Card (and IRQ controller) ---*/
_ClearCard();
}
/*-------------------------------------------------------------------------*/

114
LIB386/LIB_SAMP/WAVE.INC Normal file
View File

@@ -0,0 +1,114 @@
;*--------------------------------------------------------------------------*
;DEBUG equ 1
VOICE_HANDLE equ 1234h
IFDEF SB16
SBLASTER equ 1 ; it is also a SBLASTER !
ENDIF
IFDEF SBPRO
SBLASTER equ 1 ; it is also a SBLASTER !
STEREO equ 1
ENDIF
IFDEF SBLASTER1
SBLASTER equ 1 ; it is also a SBLASTER !
SINGLE_DMA equ 1 ; use DMA (no auto-reinit on the SB ver 1.00-1.99)
ELSEIFDEF SBLASTER
AUTO_DMA equ 1 ; use auto_reinit DMA (faster and cleaner)
ENDIF
IFDEF MWSS
SAMPLE16BIT equ 1
STEREO equ 1
AUTO_DMA equ 1 ; use auto_reinit DMA (faster and cleaner)
ENDIF
IFDEF GOLD
SAMPLE16BIT equ 1
STEREO equ 1
SINGLE_DMA equ 1 ; use DMA (no counter on the card)
ENDIF
IFDEF GUS
AUTO_DMA equ 1 ; use auto_reinit DMA (faster and cleaner)
SAMPLE16BIT equ 1
STEREO equ 1
NOIRQ equ 1
ENDIF
IFDEF PAS16
PAS equ 1
SAMPLE16BIT equ 1
ENDIF
IFDEF PAS
STEREO equ 1
AUTO_DMA equ 1 ; use auto_reinit DMA (faster and cleaner)
BI_OUTPUTMIXER equ 00h ; PAS equates
BI_L_PCM equ 06h
BI_R_PCM equ 0dh
INTRCTLRST equ 0b89h
AUDIOFILT equ 0b8ah
INTRCTLR equ 0b8bh
PCMDATA equ 0f88h
CROSSCHANNEL equ 0f8ah
TMRCTLR equ 138bh
SAMPLERATE equ 1388h
SAMPLECNT equ 1389h
SYSCONF equ 8389h
ENDIF
;*--------------------------------------------------------------------------*
IFDEF SAMPLE16BIT
IFDEF STEREO
SLONG equ 1
SSIZE equ 4
ELSE
SUWORD equ 1
SSIZE equ 2
ENDIF
ELSE
IFDEF STEREO
SUWORD equ 1
SSIZE equ 2
ELSE
SCHAR equ 1
SSIZE equ 1
ENDIF
ENDIF
;*--------------------------------------------------------------------------*
BUFFER_SIZE equ 1024 ; number of samples
; in half-buffer
LIST_SIZE equ 50
STRUCT_SIZE equ 44
SNAP_SIZE equ 8
SHIFT_SAMPLE equ 3 ; max number of
; samples mixed
;*--------------------------------------------------------------------------*

3769
LIB386/LIB_SAMP/WAVE_A.ASM Normal file

File diff suppressed because it is too large Load Diff

6190
LIB386/LIB_SAMP/WAVE_A.LST Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
ASM = ml
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
LINKDIR = format os2 lx dll
dll: w_pas16.dll w_pas.dll w_gus.dll w_mwss.dll w_sb.dll w_sb2.dll w_sbpro.dll w_sb16.dll w_gold.dll
#
# Wave driver: GF1, Gravis UltraSound
#
w_gus.dll: wave_a.asm gusdig32.obj
$(ASM) $(AFLAGS) /DGUS wave_a.asm
wlink n w_gus.dll f wave_a,gusdig32,pminit_d l gf1_ospm.lib $(LINKDIR)
#
# Wave driver: PAS16
#
w_pas16.dll: wave_a.asm
$(ASM) $(AFLAGS) /DPAS16 wave_a.asm
wlink n w_pas16.dll f wave_a $(LINKDIR)
#
# Wave driver: PAS
#
w_pas.dll: wave_a.asm
$(ASM) $(AFLAGS) /DPAS wave_a.asm
wlink n w_pas.dll f wave_a $(LINKDIR)
#
# Wave driver: AD1848 SoundPort, Microsoft Windows Sound System
#
w_mwss.dll: wave_a.asm
$(ASM) $(AFLAGS) /DMWSS wave_a.asm
wlink n w_mwss.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster
#
w_sb.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSBLASTER1 wave_a.asm
wlink n w_sb.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster 2
#
w_sb2.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSBLASTER wave_a.asm
wlink n w_sb2.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster Pro
#
w_sbpro.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSBPRO wave_a.asm
wlink n w_sbpro.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster 16, STEREO, 16 BIT
#
w_sb16.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSB16 /DSTEREO /DSAMPLE16BIT wave_a.asm
wlink n w_sb16.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster 16, STEREO, 16 BIT, SURROUND
#
w_sb16_s.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSB16 /DSTEREO /DSAMPLE16BIT /DSURROUND wave_a.asm
wlink n w_sb16_s.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster 16, STEREO, 8 BIT
#
w_sb16_8.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSB16 /DSTEREO wave_a.asm
wlink n w_sb16_8.dll f wave_a $(LINKDIR)
#
# Wave driver: Sound Blaster 16, MONO, 16 BIT
#
w_sb16_m.dll: wave_a.asm
$(ASM) $(AFLAGS) /DSB16 /DSAMPLE16BIT wave_a.asm
wlink n w_sb16_m.dll f wave_a $(LINKDIR)
#
# Wave driver: Yamaha Gold, Adlib Gold
#
w_gold.dll: wave_a.asm
$(ASM) $(AFLAGS) /DGOLD wave_a.asm
wlink n w_gold.dll f wave_a $(LINKDIR)

227
LIB386/LIB_SAMP/WAVE_I.ASM Normal file
View File

@@ -0,0 +1,227 @@
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
; SAMP_A.ASM 386
; (c) Adeline 1993
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
;*--------------------------------------------------------------------------*
.386
jumps
.model SMALL, SYSCALL
.DATA
PUBLIC NoLanguage Wave_listfcts
PUBLIC NoLanguage Wave_Driver_Enable
Wave_listfcts dd 0
Wave_Driver_Enable dd 0
.CODE
PUBLIC NoLanguage _InitCard
PUBLIC NoLanguage _ClearCard
PUBLIC NoLanguage WaveAskVars
PUBLIC NoLanguage WavePlay
PUBLIC NoLanguage WaveGiveInfo0
PUBLIC NoLanguage WaveStop
PUBLIC NoLanguage WaveStopOne
PUBLIC NoLanguage WaveInList
PUBLIC NoLanguage WaveGetSnap
PUBLIC NoLanguage WavePause
PUBLIC NoLanguage WaveContinue
PUBLIC NoLanguage WaveSaveState
PUBLIC NoLanguage WaveRestoreState
PUBLIC NoLanguage WaveChangeVolume
PUBLIC NoLanguage WaveGetAddr
PUBLIC NoLanguage _GetBufferSize
PUBLIC NoLanguage WaveChangeVolume
PUBLIC NoLanguage WaveMove
PUBLIC NoLanguage WaveStopOneLong
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
WaveCallFuncs PROC
cmp byte ptr[Wave_Driver_Enable], 0
je return
shl eax, 2
add eax, dword ptr[Wave_listfcts]
jmp dword ptr[eax]
return:
xor eax, eax ; FALSE, NULL or 0
ret
WaveCallFuncs ENDP
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
_InitCard PROC
mov eax, 0
jmp WaveCallFuncs
_InitCard ENDP
;----------------------------------------------------------------------------
_ClearCard PROC
mov eax, 1
jmp WaveCallFuncs
_ClearCard ENDP
;----------------------------------------------------------------------------
WaveAskVars PROC
mov eax, 2
jmp WaveCallFuncs
WaveAskVars ENDP
;*--------------------------------------------------------------------------*
WavePlay PROC
mov eax, 3
jmp WaveCallFuncs
WavePlay ENDP
;----------------------------------------------------------------------------
WaveGiveInfo0 PROC
mov eax, 4
jmp WaveCallFuncs
WaveGiveInfo0 ENDP
;*--------------------------------------------------------------------------*
WaveStop PROC
mov eax, 5
jmp WaveCallFuncs
WaveStop ENDP
;*--------------------------------------------------------------------------*
WaveStopOne PROC
mov eax, 6
jmp WaveCallFuncs
WaveStopOne ENDP
;*--------------------------------------------------------------------------*
WaveInList PROC
mov eax, 7
jmp WaveCallFuncs
WaveInList ENDP
;----------------------------------------------------------------------------
WaveGetSnap PROC
mov eax, 8
jmp WaveCallFuncs
WaveGetSnap ENDP
;*--------------------------------------------------------------------------*
WavePause PROC
mov eax, 9
jmp WaveCallFuncs
WavePause ENDP
;*--------------------------------------------------------------------------*
WaveContinue PROC
mov eax, 10
jmp WaveCallFuncs
WaveContinue ENDP
;----------------------------------------------------------------------------
WaveSaveState PROC
mov eax, 11
jmp WaveCallFuncs
WaveSaveState ENDP
;----------------------------------------------------------------------------
WaveRestoreState PROC
mov eax, 12
jmp WaveCallFuncs
WaveRestoreState ENDP
;----------------------------------------------------------------------------
WaveGetAddr PROC
mov eax, 13
jmp WaveCallFuncs
WaveGetAddr ENDP
;----------------------------------------------------------------------------
_GetBufferSize PROC
mov eax, 14
jmp WaveCallFuncs
_GetBufferSize ENDP
;----------------------------------------------------------------------------
WaveChangeVolume PROC
mov eax, 15
jmp WaveCallFuncs
WaveChangeVolume ENDP
;----------------------------------------------------------------------------
WaveMove PROC
mov eax, 16
jmp WaveCallFuncs
WaveMove ENDP
;----------------------------------------------------------------------------
WaveStopOneLong PROC
mov eax, 17
jmp WaveCallFuncs
WaveStopOneLong ENDP
;----------------------------------------------------------------------------
END

6
LIB386/LIB_SVGA/BLOC.C Normal file
View File

@@ -0,0 +1,6 @@
/*ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ*
ロロ゚゚゚ ロ゚゚゚゚ ロ゚゚゚ロ ロ゚゚゚゚ ロ゚゚゚゚ ロロワ ロ ロワ ワロ ロ゚゚゚ロ ロ゚゚゚ワ ロ゚゚゚゚
゚゚゚゚ロ ロロ ロロ゚ロ゚ ロロ゚゚ ロロ゚゚ ロロ゚ロロ ロロ゚ ロ ロロ ロ ロロ ロ ロロ゚゚
゚゚゚゚゚ ゚゚゚゚゚ ゚゚ ゚ ゚゚゚゚゚ ゚゚゚゚゚ ゚゚ ゚ ゚゚゚゚゚ ゚゚ ゚ ゚゚゚゚゚ ゚゚゚゚ ゚゚゚゚゚
*ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ*/
/*トトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトトト*/

13
LIB386/LIB_SVGA/BUILD.BAT Normal file
View File

@@ -0,0 +1,13 @@
call watcom10
pkunzip -o obj >NUL
wmake
pkzip -m obj *.obj >NUL
call watcom9
pkunzip -o obj9 >NUL
wmake WATCOM9=yes
pkzip -m obj9 *.obj >NUL
call watcom10

View File

@@ -0,0 +1,3 @@
pkunzip -o obj >NUL
wmake /f dll.mak
pkzip -m obj *.obj >NUL

405
LIB386/LIB_SVGA/CPYMASK.ASM Normal file
View File

@@ -0,0 +1,405 @@
;----------------------------------------------------------------------------
; Mask_A.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
include \projet\lib386\lib_svga\svga.ash
comment @
DWORD TabOffset[]
Brick:
- BYTE Delta X
- BYTE Delta Y
Line(Delta Y):
- BYTE NbBlock
Block 0: Nb Zero to Jump
Block 1: Nb Zero to Write
Block 2: Nb Zero to Jump
etc...
@
BufferClip db 512 dup(?)
OffsetBegin dd 0
NbPix dd 0
extrn NoLanguage Screen:DWORD
;----------------------------------------------------------------------------
.code
public NoLanguage CopyMask
;----------------------------------------------------------------------------
CopyMask proc uses esi edi ebx ebp,\
nummask:DWORD, xmask:DWORD, ymask:DWORD, \
bankmask:DWORD, ptsrc:DWORD
mov eax, nummask
mov ebx, xmask
mov ecx, ymask
mov esi, bankmask
add esi, [esi+eax*4]; ESI = Begin Data
movzx eax, byte ptr[esi+2] ; Hot X
add ebx, eax
movzx eax, byte ptr[esi+3] ; Hot Y
add ecx, eax
;-----------------------------------------------
lodsb ; Delta X
movzx edx, al ;
lodsb ; Nb Line ( Delta Y )
movzx eax, al
add esi, 2 ; Jump Hot X & Hot Y
;----------------------------------------------- Test Clipping
add edx, ebx
add eax, ecx
dec edx
dec eax
cmp ebx, ClipXmin
jl ClippingMask
cmp ecx, ClipYmin
jl ClippingMask
cmp edx, ClipXmax
jg ClippingMask
cmp eax, ClipYmax
jg ClippingMask
sub edx, ebx
sub eax, ecx
inc edx
inc eax
;----------------------------------------------- Calcul Offset Ecran
add ebx, TabOffLine[ecx*4]
mov edi, Log
add edi, ebx
mov ebp, ptsrc
add ebp, ebx
mov bh, al ; BH = NbLine
sub edx, Screen_X ; EDX = Offset Screen
neg edx ; EDX = Screen_X-edx
xor ecx, ecx ; Maz Compteur
mov eax, ecx
;----------------------------------------------- Init NbBlock for this line
NextLine: lodsb ; Nb Block for this line
mov bl, al ; BL = NbBlock
;----------------------------------------------- Manage One Line
SameLine: lodsb ; Nb Zero to Jump
add edi, eax ; Incrust on Log
add ebp, eax ; And on PtSrc
dec bl
je EndBlock
lodsb ; Nb Zero to Write
mov cl, al
; xor al, al
; rep stosb
xchg esi, ebp
mov al, cl
shr cl, 2
rep movsd ; Write Datas From PtSrc
mov cl, al
and cl, 11b
rep movsb
xchg esi, ebp
dec bl ; Nb Block--
jne SameLine ; Continue Same Line
EndBlock:
add edi, edx ; EDI += Offset Screen
add ebp, edx
dec bh ; NbLine--
jne NextLine ; Next Line
;----------------------------------------------- Incrust
ret
;-------------------------------------------------------------------- Clipping
; Graph : ( EBX, ECX ) ( EDX, EAX )
ClippingMask:
cmp ebx, ClipXmax
jg EndMask
cmp ecx, ClipYmax
jg EndMask
cmp edx, ClipXmin
jl EndMask
cmp eax, ClipYmin
jl EndMask
cmp ecx, ClipYmin
jge PasHaut
;---------------------- Clipping Haut, Saute ClipYmin-ECX Line(s)
sub ecx, ClipYMin
neg ecx
mov ebp, eax
xor eax, eax
NextH: lodsb
add esi, eax
loop NextH
mov ecx, ClipYMin
mov eax, ebp
;---------------------- Clipping Bas
PasHaut: cmp eax, ClipYmax
jle PasBas
mov eax, ClipYmax
;---------------------- Clipping Gauche
Pasbas: mov OffsetBegin, 0
cmp ebx, ClipXmin
jge PasGauche
mov ebp, ClipXmin
sub ebp, ebx
mov OffsetBegin, ebp
;---------------------- Clipping Droit
PasGauche:
mov ebp, edx
sub ebp, ebx
sub ebp, OffsetBegin
inc ebp
mov NbPix, ebp
cmp edx, ClipXmax
jle PasDroit
sub edx, ClipXmax
sub NbPix, edx
mov edx, ClipXmax
;----------------------
PasDroit: ; ESI debut data Y ok pas X
; EBX not clipped X0
; ECX good Y0
; EAX clipped Y1
; NbPix real X nb pix
; OffsetBegin start X ( !!!!! < 128 )
mov ebp, esi
mov edi, TabOffLine[ecx*4]
add edi, ebx
mov esi, edi ; good Y offset screen
add edi, Log
add esi, Screen ; Screen
mov edx, eax
sub edx, ecx
inc edx
xor ecx, ecx
l1: push esi
push edi
mov bl, byte ptr[ebp] ; nb blocs
inc ebp
mov bh, byte ptr[NbPix] ; nb point … copier
mov ecx, [OffsetBegin] ; start x
mov ah, cl ; nb pix count
add edi, ecx ; new pos screen
add esi, ecx
l0: mov al, byte ptr[ebp] ; nb pix to jump
inc ebp
dec bl
sub ah, al
jz okdraw ; tombe pile
jc rptj ; reste pix to jump
or bl, bl
jz aplus
mov al, byte ptr[ebp] ; nb copy point
inc ebp
dec bl
sub ah, al
jz okjump
jc rgtc ; reste graph to copy
or bl, bl ; jmp l0
jnz l0
jmp aplus
rptj: neg ah ; ah nb pix to jump
mov cl, ah
sub bh, ah ; reste … ecrire
jle aplus
add edi, ecx
add esi, ecx
jmp okdraw
rgtc: neg ah ; al nb pix to copy
mov cl, ah
sub bh, ah ; reste … ecrire
jc cpt ; copy pas tout
rep movsb ; copy
jz aplus ; tombe pile
jmp okjump
cpt: add cl, bh
rep movsb
jmp aplus
EVEN
okjump: mov cl, byte ptr[ebp] ; al nb pix to jump
inc ebp
dec bl
jz aplus
sub bh, cl ; reste … ecrire
jle aplus ; fini
add edi, ecx
add esi, ecx
okdraw: mov cl, byte ptr[ebp] ; nb pix to copy
inc ebp
dec bl
sub bh, cl ; reste … ecrire
jc cpt ; copy pas tout
rep movsb ; copy
jz aplus ; tombe pile
or bl,bl ; nb bloc--
jz aplus
jmp short okjump
aplus: ; ligne finie
movzx eax, bl
add ebp, eax
pop edi
pop esi
add edi, 640
add esi, 640
dec dl ; nb lig--
jnz l1
comment #
add ebx, TabOffLine[ecx*4]
mov edi, Log
add edi, ebx
sub eax, ecx
inc al
mov bh, al ; BH NbLine
xor ecx, ecx
mov ebp, edi
;----------------------------------------------
; ESI = DATAS LINE
NextL: lea edi, BufferClip ; EDI = BUFFERCLIP
lodsb ; NbBlock
mov bl, al
SameL: lodsb
mov cl, al
mov al, 1
rep stosb
dec bl
je EndLine
lodsb
mov cl, al
xor al, al
rep stosb
dec bl
jne SameL
;----------------------
EndLine: push esi ; SAVE ESI
lea esi, BufferClip ; ESI = BUFFERCLIP
mov edi, ebp ; EDI = SCREEN
mov ecx, OffsetBegin
add esi, ecx
add edi, ecx
mov ecx, NbPix
;----------------------
Again:
lodsb
or al, al
jne Incrust
mov [edi], al
Incrust: inc edi
loop Again
add ebp, 640
pop esi
dec bh
jne NextL
;----------------------
#
EndMask: ret
CopyMask endp
;----------------------------------------------------------------------------
; The
End

1
LIB386/LIB_SVGA/DB.BAT Normal file
View File

@@ -0,0 +1 @@
td286 -do -vg test

628
LIB386/LIB_SVGA/DLL.ASM Normal file
View File

@@ -0,0 +1,628 @@
;----------------------------------------------------------------------------
; INITSVGA.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386p
jumps
.model FLAT, SYSCALL
;----------------------------------------------------------------------------
.code
PUBLIC driver_start
driver_start dd OFFSET ListFuncs
IFDEF REALTEK
db 'Realtek RTG 3105'
ENDIF
IFDEF OAK
db 'OAK OTI 067/077'
ENDIF
IFDEF NCR
db 'NCR 77C22'
ENDIF
IFDEF COMPAQ
db 'Compaq QVision/AVGA'
ENDIF
IFDEF TSENG
db 'Tseng Lab ET 3000/4000'
ENDIF
IFDEF PARADISE
db 'Paradise/Western Digital'
ENDIF
IFDEF GENOA
db 'Genoa'
ENDIF
IFDEF S3
db 'S3'
ENDIF
IFDEF CIRRUS
db 'Cirrus Logic'
ENDIF
IFDEF TRIDENT
db 'Trident'
ENDIF
IFDEF ATI
db 'ATI'
ENDIF
db ' Super VGA Driver, Version 1.00,', 13, 10
db 'Copyright (c) Adeline Software International 1994, All Rights Reserved.', 13, 10, 10, 0
Scanline textequ <dword ptr[eax]>
BankSize textequ <dword ptr[eax+4]>
BankOver textequ <dword ptr[eax+8]>
NonStdVESA textequ <byte ptr[eax+12]>
BankShift textequ <byte ptr[eax+13]>
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
; ÛÛßßß Ûßßßß ÛßßßÛ Ûßßßß Ûßßßß ÛÛÜ Û ÛÜ ÜÛ ÛßßßÛ ÛßßßÜ Ûßßßß
; ßßßßÛ ÛÛ ÛÛßÛß ÛÛßß ÛÛßß ÛÛßÛÛ ÛÛß Û ÛÛ Û ÛÛ Û ÛÛßß
; ßßßßß ßßßßß ßß ß ßßßßß ßßßßß ßß ß ßßßßß ßß ß ßßßßß ßßßß ßßßßß
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef REALTEK
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc
mov dx, 3D7h
out dx, al
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 26h
int 10h
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef OAK
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc
mov ah, al
shl al, 4
or ah, al
mov dx, 3DEh
mov al, 11h
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 53h
int 10h
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef NCR
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc
shl ax, 10
mov al, 18h
mov dx, 03C4h
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 5Fh
int 10h
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef COMPAQ
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc
shl ax, 12
mov al, 45h
mov dx, 03CEh
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ScanLine, 1024
mov NonStdVESA, 1
mov ax, 32h
int 10h
mov dx, 03CEh
mov ax, 050Fh
out dx, ax ; unlock extended regs
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef TSENG
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc ; ET3000, Should work
; on the ET4000 also
; as long as we don't
; read the screen...
mov dx, 03CDh
or al, 40h
out dx, al
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc ; ET3000/ET4000
mov ax, 2Eh ; Basculer Mode Video
int 10h ; Tseng 640*480*256
mov dx, 3BFh ; Enable access to extended registers
mov al, 3 ; for ET4000
out dx, al
mov dl, 0D8h
mov al, 0A0h
out dx, al
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef PARADISE
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc ; Western Digital /
; Paradise
mov dx, 03CEh
shl ax, 12 ; 4K banks
mov al, 09h
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 5Fh ; Basculer Mode Video
int 10h ; WD/Paradise 640*480*256
mov dx, 03CEh
mov al, 0Fh
out dx, al
inc dx ; 3CFh
in al, dx
and al, 11101000b
or al, 00000101b
out dx, al
dec dx ; 3CEh
mov al, 0Bh
out dx, al
inc dx ; 3CFh
in al, dx
and al, 11110111b
out dx, al
mov dl, 0C4h ; 3C4h
mov al, 11h
out dx, al
inc dx ; 3C5h
in al, dx
and al, 01111111b
out dx, al
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef GENOA
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc ; Genoa (not old ET3000 model)
mov dx, 03C4h
mov ah, al
shl ah, 3
or ah, al
or ah, 40h
mov al, 06h
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc ; Genoa (not old ET3000 model)
mov ax, 5Ch ; Basculer Mode Video
int 10h ; Genoa 640*480*256
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef S3
ListFuncs dd 0
dd offset NewBank
dd offset Enable
;----------------------------------------------------------------------------
NewBank proc
mov dx, 3d4h ; Switch banks
mov ah, al
mov al, 35h
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
Enable proc
mov dx, 3d4h ; Enable extended registers
mov al, 38h
out dx, al
inc dx
mov al, 48h
out dx, al
dec dx ; Enable write to bank registers
mov al, 31h
out dx, al
inc dx
mov al, 89h
in al, dx
mov ah, al
dec dx
mov al, 31h
out dx, al
inc dx
mov al, ah
or al, 9
out dx, al
ret
Enable endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef CIRRUS
ListFuncs dd 0
dd offset NewBank
dd offset Enable
;----------------------------------------------------------------------------
NewBank proc
mov dx, 03CEh
shl ax, 12
mov al, 09h
out dx, ax
dec al
out dx, al
ret
NewBank endp
;----------------------------------------------------------------------------
Enable proc
comment @
mov dx, 03D4h ; 3D4h
mov al, 0Ch ; Screen A start addr Hi
out dx, al
inc dx ; 3D5h
in al, dx
mov cl, al ; cl = start addr
xor al, al
out dx, al ; write 0 to gain
; access to Eagle ID
dec dx ; 3D4h
mov al, 1Fh ; Eagle ID reg
out dx, al
inc dx ; 3D5h
in al, dx ; get Eagle ID
mov ah, al ; ah = Eagle ID
mov dl, 0C4h ; 3C4h
mov al, 06h ; extension register
mov ah, 12h ; should not be there
out dx, ax ; write Eagle ID to
; enable extended regs
; Used to be 12h...
mov dl, 0D4h ; 3D4h
mov al, 0Ch ; Screen A start addr Hi
mov ah, cl ; old start addr
out dx, ax ; write old value
@
mov dx, 3c4h
mov ax, 1206h
out dx, ax
ret
Enable endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef TRIDENT
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
;----------------------------------------------------------------------------
NewBank proc
mov dx, 3C4h
xor al, 2 ; (strange chip design)
mov ah, al
mov al, 0Eh
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 5Dh ; Basculer Mode Video
int 10h ; Trident 640*480*256
mov dx, 3CEh ; set pagesize to 64k
mov al, 6
out dx, al
inc dx
in al, dx
or al, 4
mov ah, al
mov al, 6
dec dx
out dx, ax
mov dl, 0C4h ; switch to BPS mode
mov al, 0Bh
out dx, al
inc dx
in al, dx
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
ifdef ATI
ListFuncs dd offset InitMode
dd offset NewBank
dd 0
comment @
;----------------------------------------------------------------------------
NewBank proc
shl ax, 9
mov dx, 1CEh
mov al, 0B2h
out dx, al
inc dx
in al, dx
and al, 0E1h
or ah, al
mov al, 0B2h
dec dx
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 62h ; Basculer Mode Video
int 10h ; ATI 640*480*256
ret
InitMode endp
;----------------------------------------------------------------------------
@
NewBank proc
shl ax, 9
extended_reg equ $+4
mov dx, 1CEh
mov al, 0B2h
out dx, al
inc dx
in al, dx
and al, 0E1h
or ah, al
mov al, 0B2h
dec dx
out dx, ax
ret
NewBank endp
;----------------------------------------------------------------------------
InitMode proc
mov ax, 62h ; Basculer Mode Video
int 10h ; ATI 640*480*256
mov ax, [0C0010h]
mov word ptr[extended_reg], ax
ret
InitMode endp
;----------------------------------------------------------------------------
endif
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
End

91
LIB386/LIB_SVGA/DLL.MAK Normal file
View File

@@ -0,0 +1,91 @@
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
LINKDIR = format os2 lx dll
dll: realtek.dll oak.dll ncr.dll compaq.dll ati.dll cirrus.dll genoa.dll paradise.dll s3.dll trident.dll tseng.dll
#
# Svga driver: REALTEK
#
realtek.dll: dll.asm
ml $(AFLAGS) /DREALTEK dll.asm
wlink n realtek.dll f dll $(LINKDIR)
#
# Svga driver: OAK
#
oak.dll: dll.asm
ml $(AFLAGS) /DOAK dll.asm
wlink n oak.dll f dll $(LINKDIR)
#
# Svga driver: NCR
#
ncr.dll: dll.asm
ml $(AFLAGS) /DNCR dll.asm
wlink n ncr.dll f dll $(LINKDIR)
#
# Svga driver: COMPAQ
#
compaq.dll: dll.asm
ml $(AFLAGS) /DCOMPAQ dll.asm
wlink n compaq.dll f dll $(LINKDIR)
#
# Svga driver: ATI
#
ati.dll: dll.asm
ml $(AFLAGS) /DATI dll.asm
wlink n ati.dll f dll $(LINKDIR)
#
# Svga driver: CIRRUS
#
cirrus.dll: dll.asm
ml $(AFLAGS) /DCIRRUS dll.asm
wlink n cirrus.dll f dll $(LINKDIR)
#
# Svga driver: GENOA
#
genoa.dll: dll.asm
ml $(AFLAGS) /DGENOA dll.asm
wlink n genoa.dll f dll $(LINKDIR)
#
# Svga driver: PARADISE
#
paradise.dll: dll.asm
ml $(AFLAGS) /DPARADISE dll.asm
wlink n paradise.dll f dll $(LINKDIR)
#
# Svga driver: S3
#
s3.dll: dll.asm
ml $(AFLAGS) /DS3 dll.asm
wlink n s3.dll f dll $(LINKDIR)
#
# Svga driver: TRIDENT
#
trident.dll: dll.asm
ml $(AFLAGS) /DTRIDENT dll.asm
wlink n trident.dll f dll $(LINKDIR)
#
# Svga driver: Tseng Lab ET3000 & ET4000
#
tseng.dll: dll.asm
ml $(AFLAGS) /DTSENG dll.asm
wlink n tseng.dll f dll $(LINKDIR)

129
LIB386/LIB_SVGA/DLL_I.ASM Normal file
View File

@@ -0,0 +1,129 @@
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
; SAMP_A.ASM 386
; (c) Adeline 1993
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
;*--------------------------------------------------------------------------*
.386
jumps
.model SMALL, SYSCALL
.DATA
PUBLIC NoLanguage listfcts
listfcts dd offset Vesafcts
Vesafcts dd offset SvgaInitVesa
dd offset SvgaBankVesa
.CODE
PUBLIC NoLanguage SvgaInit
PUBLIC NoLanguage SvgaBank
;----------------------------------------------------------------------------
RMI equ $
RMI_EDI dd 0
RMI_ESI dd 0
RMI_EBP dd 0
RMI_RESERVED dd 0
RMI_EBX dd 0
RMI_EDX dd 0
RMI_ECX dd 0
RMI_EAX dd 0
RMI_flags dw 0
RMI_ES dw 0
RMI_DS dw 0
RMI_FS dw 0
RMI_GS dw 0
RMI_IP dw 0
RMI_CS dw 0
RMI_SP dw 0
RMI_SS dw 0
;----------------------------------------------------------------------------
NewBankVesa proc
push ebx
Shift equ $+3
shl ax, 0
mov dx, ax
mov eax, 4F05h ; change bank VESA
xor ebx, ebx ; bh = 0, set bank
int 10h
pop ebx
ret
NewBankVesa endp
;----------------------------------------------------------------------------
InitModeVesa proc
mov eax, 0100h ; DMPI Allocate Dos Mem
mov ebx, 32 ; 512 byte just in case
int 31h ; return dos segment in ax
push edx ; save selector
push eax ; save real-mode segment
push es ; save es
mov RMI_ES, ax ; buffer segment
xor RMI_EDI, 0 ; buffer offset 0
mov RMI_EAX, 4F01h ; Vesa information
mov RMI_ECX, 0101h ; mode 101h
mov ax, ds
mov es, ax ; es = ds (just in case)
mov edi, offset RMI ; registers
mov ax, 0300h ; DMPI generate real-mode int
mov bx, 10h ; int 10h
int 31h
pop es ; restore es
pop eax ; restore real-mode segment
and eax, 0FFFFh ; only segment
shl eax, 4 ; convert to linear
mov ax, [eax+4] ; get granularity
bsr ax, ax ; get higher bit position
neg al ; - position
add al, 6 ; shift = 6 - position
mov byte ptr[Shift], al
pop edx ; restore selector
mov eax, 0101h ; DPMI return Dos memory
int 31h
mov ax, 4F02h ; Switch to Video Mode
mov bx, 0101h ; VESA 640*480*256
int 10h
ret
InitModeVesa endp
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
NewBank PROC
mov eax, dword ptr[listfcts]
jmp dword ptr[eax]
NewBank ENDP
;----------------------------------------------------------------------------
InitMode PROC
mov eax, dword ptr[listfcts]
jmp dword ptr[eax+4]
InitMode ENDP
;----------------------------------------------------------------------------
END

522
LIB386/LIB_SVGA/FONT6X6.ASM Normal file
View File

@@ -0,0 +1,522 @@
Font6X6 label byte
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,000H,00FH,000H,000H,000H,00FH
db 000H,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 000H,00FH,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 000H,00FH,000H,00FH,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,000H,00FH,000H,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,00FH,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,000H,00FH,000H,00FH,00FH,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,00FH,00FH,000H,00FH,000H,000H,00FH,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,000H,00FH
db 00FH,000H,00FH,000H,00FH,000H,000H,00FH,000H,000H
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,000H,00FH,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,00FH,00FH,000H,00FH,000H
db 00FH,000H,00FH,000H,00FH,00FH,000H,000H,00FH,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 00FH,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,00FH,00FH,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,00FH,000H,00FH,00FH,00FH,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,000H
db 00FH,000H,00FH,000H,00FH,000H,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,00FH,00FH,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,00FH,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,00FH,000H,000H,00FH,00FH,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,00FH,000H
db 000H,000H,000H,000H,00FH,00FH,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,00FH,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,00FH,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,00FH,000H,00FH
db 00FH,000H,00FH,000H,00FH,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,000H,000H,00FH,000H,00FH,000H
db 00FH,000H,00FH,000H,00FH,000H,000H,00FH,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,00FH,000H
db 00FH,000H,00FH,000H,000H,00FH,000H,000H,000H,00FH
db 00FH,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,000H,00FH
db 000H,000H,000H,00FH,000H,00FH,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,00FH,000H,00FH,000H,00FH,00FH
db 000H,00FH,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,000H,00FH,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 000H,00FH,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,000H,00FH
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,00FH,000H,00FH,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,00FH,000H
db 000H,000H,00FH,000H,000H,00FH,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,000H,000H,00FH,00FH,00FH,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,00FH,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,00FH,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,00FH,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,00FH,00FH,000H,000H,000H,00FH,000H
db 000H,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,00FH,00FH
db 000H,00FH,00FH,000H,00FH,000H,00FH,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,00FH,000H,000H,00FH,000H
db 00FH,000H,00FH,000H,00FH,000H,00FH,000H,000H,00FH
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,00FH,000H
db 00FH,000H,00FH,000H,00FH,000H,000H,00FH,000H,000H
db 000H,00FH,00FH,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 00FH,000H,00FH,00FH,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,000H,00FH,00FH,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 000H,00FH,000H,000H,000H,00FH,000H,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,00FH,000H,00FH,000H
db 00FH,00FH,000H,00FH,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,00FH,000H,000H,00FH,000H,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,00FH,000H,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,00FH,000H,00FH,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,00FH,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,000H,00FH,000H,000H
db 00FH,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,00FH,000H,00FH,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,00FH,00FH,00FH,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,00FH,00FH,00FH,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,00FH,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,00FH,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,00FH,000H,00FH,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,00FH,00FH,00FH,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,00FH,00FH,00FH,00FH,000H,00FH,00FH
db 00FH,000H,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,00FH,00FH,00FH,000H,000H,000H
db 00FH,00FH,00FH,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,000H,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,000H,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,00FH,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,00FH,00FH,00FH,00FH,000H
db 00FH,00FH,00FH,000H,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,00FH,00FH,000H,000H,000H,00FH
db 000H,00FH,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,000H,00FH
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,00FH,000H,000H,000H
db 00FH,000H,000H,00FH,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,00FH,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,00FH,000H,00FH,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,00FH,00FH,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,00FH,00FH,000H,000H
db 00FH,000H,000H,000H,00FH,000H,00FH,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,00FH,00FH
db 00FH,00FH,00FH,000H,000H,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,00FH,000H,000H,00FH,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,00FH
db 00FH,00FH,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,000H,00FH
db 000H,000H,00FH,00FH,000H,00FH,00FH,000H,00FH,000H
db 000H,00FH,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,00FH,000H,000H,000H,000H
db 00FH,000H,00FH,000H,000H,00FH,00FH,000H,000H,000H
db 000H,000H,00FH,00FH,000H,000H,00FH,000H,00FH,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,000H,000H
db 000H,00FH,000H,000H,000H,000H,00FH,000H,000H,000H
db 000H,00FH,00FH,00FH,000H,000H,00FH,00FH,00FH,00FH
db 00FH,000H,00FH,000H,000H,000H,00FH,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,00FH,000H,000H
db 000H,000H,00FH,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,00FH,000H,000H,000H,000H,000H
db 00FH,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,00FH,000H,000H,000H,000H,00FH,000H
db 000H,000H,000H,00FH,00FH,00FH,000H,000H,00FH,000H
db 000H,000H,00FH,000H,000H,00FH,00FH,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,00FH
db 000H,000H,000H,000H,00FH,000H,000H,000H,00FH,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,00FH,000H
db 000H,00FH,00FH,00FH,000H,000H,000H,000H,000H,000H
db 000H,000H,00FH,000H,00FH,000H,000H,000H,000H,00FH
db 000H,00FH,000H,000H,000H,000H,000H,000H,000H,000H
db 00FH,00FH,000H,00FH,000H,000H,00FH,000H,00FH,00FH
db 000H,000H,000H,000H,000H,000H,000H,000H,00FH,000H
db 00FH,000H,000H,000H,000H,00FH,000H,00FH,000H,000H
db 000H,000H,000H,000H,000H,000H,00FH,00FH,000H,00FH
db 000H,000H,00FH,000H,00FH,00FH,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H,000H,000H,000H,000H,000H,000H
db 000H,000H,000H,000H

File diff suppressed because one or more lines are too long

216
LIB386/LIB_SVGA/FONT_A.ASM Normal file
View File

@@ -0,0 +1,216 @@
;----------------------------------------------------------------------------
;
;' Text_A.ASM 386
;' (c) Adeline 1994
;'
;
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
include \projet\lib386\lib_svga\svga.ash
ALIGN 4
PtrFont dd 0
DxFont dd ?
InterLeave dd 1
InterSpace dd 10
;----------------------------------------------------------------------------
.code
public NoLanguage CoulFont
public NoLanguage SetFont
public NoLanguage SizeFont
public NoLanguage CarFont
public NoLanguage Font
extrn NoLanguage CoulMask :PROC
extrn NoLanguage AffMask_Asm :PROC
;----------------------------------------------------------------------------
;'
CoulFont proc ,\
coul:DWORD
movzx eax, byte ptr [coul]
push eax
Call CoulMask
add esp, 4
ret
CoulFont endp
;----------------------------------------------------------------------------
;'
SetFont proc ,\
ptfont:DWORD, inle:DWORD, insp:DWORD
mov eax, ptfont
mov [PtrFont], eax
mov eax, inle
mov [InterLeave], eax
mov eax, insp
mov [InterSpace], eax
ret
SetFont endp
;----------------------------------------------------------------------------
;'
SizeFont proc uses esi edi ,\
chaine:DWORD
mov esi, [chaine]
mov edi, [PtrFont]
xor eax, eax
xor edx, edx
mov [DxFont], eax
;' --------------------------------
NextCar:
lodsb
or al, al
je short EndSizeFont
cmp al, 32
jne PlusLoin0
mov edx, [InterSpace]
add [DxFont], edx
jmp short NextCar
PlusLoin0:
mov edi, [PtrFont]
add edi, [edi+eax*4]
mov edx, [InterLeave]
add [DxFont], edx
mov dl, byte ptr[edi]
add [DxFont], edx
jmp short NextCar
;' --------------------------------
EndSizeFont:
mov eax, [DxFont]
ret
SizeFont endp
;----------------------------------------------------------------------------
CarFont proc uses esi edi ebx ebp,\
xcar:DWORD, ycar:DWORD, car:DWORD
mov eax, car
cmp eax, 32 ;' SPACE
je Space
mov ebx, xcar
mov ecx, ycar
mov esi, [PtrFont]
mov edi, [PtrFont]
add edi, [edi+eax*4]
xor edx, edx
mov dl, [edi+0]
add edx, [InterLeave]
push edx
Call AffMask_Asm
pop eax
ret
Space:
mov eax, [InterSpace]
ret
CarFont endp
;----------------------------------------------------------------------------
;'
Font proc uses esi edi ebx ebp,\
xfont:DWORD, yfont:DWORD,chaine:DWORD
cmp dword ptr [PtrFont], 0
je short EndFont
;' --------------------------------
mov esi, [chaine]
mov edi, [PtrFont]
mov ebx, [xfont]
mov ecx, [yfont]
xor eax, eax
jmp NextCar
;' --------------------------------
Space:
add ebx, [InterSpace]
NextCar:
xor eax, eax
lodsb
or al, al
je short EndFont
cmp al, 32
je Space
PasSpace: mov edi, [PtrFont]
add edi, [edi+eax*4]
xor edx, edx
mov dl, byte ptr[edi]
mov [DxFont], edx
push esi
push ebx
push ecx
mov esi, [PtrFont]
Call AffMask_Asm
pop ecx
pop ebx
pop esi
add ebx, [InterLeave]
add ebx, [DxFont]
jmp short NextCar
;' --------------------------------
EndFont:
ret
Font endp
;----------------------------------------------------------------------------
; The
End

401
LIB386/LIB_SVGA/GIF.C Normal file
View File

@@ -0,0 +1,401 @@
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º GIF = PROGRAM TO READ .GIF GRAPHICS FILES º
º º
º GIF and 'Graphics Interchange Format' are trademarks (tm) of º
º Compuserve, Incorporated, an H&R Block Company º
º º
º By Roger T. Stevens 12-9-91 º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dos.h>
#include <conio.h>
#include <ctype.h>
/*
struct ffblk {
char ff_reserved[21];
char ff_attrib;
unsigned ff_ftime;
unsigned ff_fdate;
long ff_fsize;
char ff_name[13];
};
*/
#define UP_ARROW 328
#define DOWN_ARROW 336
#define LEFT_ARROW 331
#define RIGHT_ARROW 333
#define BACKSPACE 8
void decoder(LONG fd, WORD linewidth);
WORD next_code(LONG fd);
//union REGS reg;
struct
{
char name[3] ;
char version[3] ;
short int xres ;
short int yres ;
unsigned short int packed;
char back_col_index ;
char aspect_ratio ;
} gif_header;
struct
{
char red;
char green;
char blue;
} color_table[256], loc_color_table[256];
struct
{
short int start_col ;
short int start_row ;
short int width ;
short int height ;
char packed ;
} image_descriptor;
char ch, col_tab_flag, interlace_flag ;
/*
buffer[64],
color_flag,
color_res,
dirbuf[64][13],
filename[32],
loc_sort_flag,
sort_flag;
*/
unsigned char bytes = 0, b1, display_line[640/*2049*/], file_buf[512] ;
//unsigned char last[4096], stack[4096] ;
unsigned char *last, *stack ;
// unsigned char PALETTE[17]={0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63,0};
short int bits_left = 0, code_size, clear, col_tab_size,
linewidth, loc_col_tab_size,
newcodes, rows,
slot, top ;
extern short int i, end, index ;
/*
mode,
disp_height,
active_page = 0,
column,
dir_index= 0,
done,
end,
i,index = 0,
j, k,
key,
xres;
*/
short unsigned int height, width ;
//short unsigned int link[4096] ;
short unsigned int *link ;
//FILE *fin ;
//struct ffblk ffblk ;
UBYTE *PtBuff ;
extern UBYTE *PtDest;
/*--------------------------------------------------------------------------*/
void line_out_gif( char *pt, WORD size )
{
WORD i ;
UBYTE *pts ;
pts = pt ;
PtDest = PtBuff + (rows*640) ;
for ( i = 0 ; i < size ; i++ ) *PtDest++ = *pts++ ;
rows++ ;
/*
Box( 0, 0, 160, 7, 0 ) ;
Text( 0, 0, "Ligne:%d", rows ) ;
CopyBlockPhys( 0, 0, 160, 7 ) ;
*/
}
/*--------------------------------------------------------------------------*/
// fd pointe deja sur le debut du gif sur disk
// Faire le Close a plus haut niveau !
void Read_Gif( LONG fd, UBYTE *screen, UBYTE *tabcol, UBYTE *buffers )
{
char color ;
char dummy ;
short int finished ;
PtBuff = PtDest = screen ;
// buffers doit faire au moins 16K
last = buffers ; // 4096
stack = buffers + 4096 ; // 4096
link = buffers + 8192 ; // 8192
Read( fd, &gif_header, 13L ) ;
// color_flag = (gif_header.packed & 0x80) >> 7 ;
// color_res = (gif_header.packed & 0x70) >> 4 ;
// sort_flag = (gif_header.packed & 0x08) >> 3 ;
// col_tab_size = (WORD)pow(2,(gif_header.packed & 0x07)+1.0);
col_tab_size = (WORD)(2<<(gif_header.packed & 0x07)) ;
if (col_tab_size > 0)
Read( fd, tabcol, col_tab_size *3L ) ;
/* Si image en 16 couleurs
for ( i = 0 ; i < 16 ; i++ )
{
PALETTE[i] = ((color_table[i].red & 0x40) >> 1) |
((color_table[i].red & 0x80) >> 5) |
((color_table[i].green & 0x40) >> 2) |
(color_table[i].green & 0x80) >> 6 |
((color_table[i].blue & 0x40) >> 3) |
((color_table[i].blue & 0x80) >> 7) ;
}
*/
/* Decalage en library automatique
for ( i = 0 ; i < 256 ; i++ )
{
color_table[i].red >>= 2 ;
color_table[i].green >>= 2 ;
color_table[i].blue >>= 2 ;
}
*/
rows = 0 ;
finished = 0 ;
while ( !finished )
{
Read( fd, &ch, 1L ) ;
switch ( ch )
{
case ';': /*End of .GIF data */
finished = 1 ;
break ;
case '!': /* .GIF extension block - read and discard */
Read( fd, &dummy, 1L ) ;
Read( fd, &i, 2L ) ;
Read( fd, file_buf, (LONG)i ) ;
break ;
case ',': /* read image description */
Read( fd, &image_descriptor, 9L ) ;
width = image_descriptor.width ;
linewidth = min(640,width) ;
height = image_descriptor.height ;
col_tab_flag = (image_descriptor.packed & 0x80) >> 7 ;
// interlace_flag = (image_descriptor.packed & 0x40) >> 6 ;
// loc_sort_flag = (image_descriptor.packed & 0x20) >> 5 ;
loc_col_tab_size = (WORD)pow(2,(image_descriptor.packed
& 0x07) + 1.0);
if (col_tab_flag == 1)
Read( fd,loc_color_table, loc_col_tab_size * 3L );
decoder( fd, width ) ;
break ;
default:
finished = 1 ;
break ;
}
}
}
/*--------------------------------------------------------------------------*/
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º restore_screen() = Reads and displays a file º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
void Load_Gif(char *filename, UBYTE *screen, UBYTE *tabcol)
{
LONG fd ;
UBYTE *buffers ;
fd = OpenRead( filename ) ;
buffers = Malloc( 16384 ) ;
Read_Gif( fd, screen, tabcol, buffers ) ;
Free( buffers ) ;
Close(fd) ;
}
/*--------------------------------------------------------------------------*/
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º decoder() = .GIF file decode º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
void decoder( LONG fd, WORD width )
{
short int code, fc=0, old_code=0, counter;
short int ch, size=0, ret ;
short int s_index=0 ;
short int l_index=0 ;
Read( fd, &size, 1L ) ;
code_size = size + 1 ;
top = 1 << code_size ;
clear = 1 << size ;
end = clear + 1 ;
slot = newcodes = end + 1;
counter = width ;
bits_left = 0 ;
b1 = 0 ;
bytes = 0 ;
while ((ch = next_code(fd)) != end)
{
if (ch == clear)
{
code_size = size + 1 ;
slot = newcodes ;
top = 1 << code_size ;
ch = next_code(fd) ;
old_code = fc = ch ;
display_line[l_index++] = ch;
counter-- ;
}
else
{
code = ch ;
if ( code >= slot )
{
code = old_code ;
stack[s_index++] = fc ;
}
while ( code >= newcodes )
{
stack[s_index++] = last[code] ;
code = link[code] ;
}
stack[s_index++] = code ;
if ( slot < top )
{
fc = code ;
last[slot] = code ;
link[slot++] = old_code ;
old_code = ch ;
}
if ( slot >= top )
if ( code_size < 12 )
{
top <<= 1 ;
++code_size ;
}
while ( s_index > 0 )
{
display_line[l_index++] = stack[--s_index] ;
if ( --counter == 0 )
{
line_out_gif( display_line, linewidth ) ;
if ( rows >= height )
return ;
l_index = 0 ;
counter = width ;
}
}
}
}
if ( counter != linewidth )
line_out_gif( display_line, linewidth-counter );
}
/*--------------------------------------------------------------------------*/
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º next_code(fd) = reads next code from file º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
ULONG code
UBYTE b1
UBYTE bytes
WORD bits_left
*/
WORD next_code( LONG fd )
{
short int flag=0 ;
unsigned long int code ;
if ( bits_left == 0 ) flag = 1; /* BUG */
code = (b1 >> (8 - bits_left)) ;
while ( code_size > bits_left )
{
if ( bytes <= 0 )
{
index = 0 ;
Read( fd, &bytes, 1L ) ;
Read( fd, file_buf, (LONG)bytes );
}
b1 = file_buf[index++] ;
if (flag == 1)
{
/* code = (b1 >> (8 - bits_left)) ; SUPER BUG*/
code = b1 ;
flag = 0 ; /* BUG */
}
else code |= (b1 << bits_left);
bits_left += 8 ;
--bytes ;
}
bits_left -= code_size ;
code &= ( 0xFFF >> (12 - code_size)) ;
return((WORD)(code)) ;
}
/*--------------------------------------------------------------------------*/

View File

@@ -0,0 +1,154 @@
;----------------------------------------------------------------------------
; GraphMsk.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
include \projet\lib386\lib_svga\svga.ash
comment @
DWORD TabOffset[]
Brick:
- BYTE Delta X
- BYTE Delta Y
Line(Delta Y):
- BYTE NbBlock
Block:
- 00xxxxxxb xxxxxx zeros to jump
- 01xxxxxxb xxxxxx Copy Pix
- 10xxxxxxb xxxxxx Repeat Pix
- BYTE datas[]
@
;----------------------------------------------------------------------------
.code
public NoLanguage CalcGraphMsk
;----------------------------------------------------------------------------
CalcGraphMsk proc uses esi edi ebx ebp,\
numbrick:DWORD, bankbrick:DWORD, ptmask:DWORD
mov eax, numbrick
mov esi, bankbrick
mov edi, ptmask
push edi
add esi, [esi+eax*4]; ESI = Begin Data
;-----------------------------------------------
xor edx, edx
mov ebx, [esi] ; Get DX, DY, Hot X, Hot Y
mov [edi], ebx ; Stock DX, DY, Hot X, Hot Y
add esi, 4 ; bh = NbLine
add edi, 4
;-----------------------------------------------
xor ecx, ecx ; Maz Compteur
;----------------------------------------------- Init NbBlock for this line
NextLine: xor dl, dl ; NbBlockDst = 0
xor ah, ah ; NbData = 0
mov ebp, edi ; Sauve Pos NbBlockDst
inc edi ; Jump NbBlockDst
mov bl, [esi] ; BL = Nb Block for this line
inc esi
test byte ptr [esi], 11000000b; Jump Zero ?
je SameLine ; Line MUST Begin JumpZero
;----------------------------------------------- Premier Block En Jump Zero
mov byte ptr[edi], 0
inc edi
inc dl ; NbBlockDst++
;----------------------------------------------- Manage One Line
SameLine: mov al, [esi]
inc esi ; OpCode
mov cl, al ; Sauve AL
and cl, 00111111b ; AH = Bit 0-5
inc cl ; One More Please...
;-----------------------
test al, 10000000b
jne RepeatCol
test al, 01000000b
jne CopyCol
;----------------------------------------------- 00 Jump CL Zero
or ah, ah ; NbData
je RienEnCours
;-----------------------
mov [edi], ah
inc edi
inc dl ; NbBlockDst++
xor ah, ah ; NbData=0
RienEnCours: mov [edi], cl
inc edi
inc dl ; NbBlockDst++
jmp EndLoop
;----------------------------------------------- 01 Repeat Nb Col
RepeatCol: add ah, cl ; NbData += Nb
inc esi ; pts++
jmp EndLoop
;----------------------------------------------- 10 Copy Nb Col
CopyCol: add ah, cl ; NbData += Nb
add esi, ecx ; pts += nb
;----------------------------------------------- End Loop
EndLoop: dec bl ; Nb Block--
jne SameLine ; Continue Same Line
;----------------------------------------------- Cloture Eventuelle
or ah, ah ; NbData
je PasDeCloture
;-----------------------
mov [edi], ah
inc edi
inc dl ; NbBlockDst++
;-----------------------
PasDeCloture: mov ds:[ebp], dl ; Write NbBlockDst
dec bh ; NbLine--
jne NextLine ; Next Line
;-----------------------
mov eax, edi
pop edi
sub eax, edi ; Size Mask
ret
;----------------------
CalcGraphMsk endp
;----------------------------------------------------------------------------
; The
End

358
LIB386/LIB_SVGA/GRAPH_A.ASM Normal file
View File

@@ -0,0 +1,358 @@
;----------------------------------------------------------------------------
; Graph_A.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
include \projet\lib386\lib_svga\svga.ash
FULL_OPTIMIZE equ 1
comment @
DWORD TabOffset[]
Brick:
- BYTE Delta X
- BYTE Delta Y
Line(Delta Y):
- BYTE NbBlock
Block:
- 00xxxxxxb xxxxxx zeros to jump
- 01xxxxxxb xxxxxx Copy Pix
- 10xxxxxxb xxxxxx Repeat Pix
- BYTE datas[]
@
ALIGN 4
OffsetBegin dd 0
NbPix dd 0
BufferClip db 512 dup(?)
;----------------------------------------------------------------------------
.code
public NoLanguage AffGraph
public NoLanguage GetDxDyGraph
;----------------------------------------------------------------------------
AffGraph proc uses esi edi ebx ebp,\
numbrick:DWORD, xbrick:DWORD, ybrick:DWORD, \
bankbrick:DWORD
mov eax, numbrick
mov ebx, xbrick
mov ecx, ybrick
mov esi, bankbrick
add esi, [esi+eax*4] ; ESI = Begin Data
xor eax, eax
xor edx, edx
mov al, byte ptr[esi+2] ; Hot X
add ebx, eax
mov al, byte ptr[esi+3] ; Hot Y
add ecx, eax
mov dl, [esi] ; Delta X
mov al, [esi+1] ; Nb Line ( Delta Y )
add esi, 4 ; Jump Hot X & Hot Y
;----------------------------------------------- Test Clipping
add edx, ebx
add eax, ecx
dec edx
dec eax
cmp ebx, ClipXmin
jl ClippingGraph
cmp ecx, ClipYmin
jl ClippingGraph
cmp edx, ClipXmax
jg ClippingGraph
cmp eax, ClipYmax
jg ClippingGraph
inc edx
inc eax
sub edx, ebx
sub eax, ecx
;----------------------------------------------- Calcul Offset Ecran
mov edi, Log
add edi, TabOffLine[ecx*4]
add edi, ebx
mov bh, al ; BH = NbLine
sub edx, Screen_X ; EDX = Offset Screen
neg edx ; EDX = Screen_X-edx
xor ecx, ecx ; Maz Compteur
;----------------------------------------------- Init NbBlock for this line
NextLine: mov bl, [esi] ; BL = Nb Block for this line
inc esi
;----------------------------------------------- Manage One Line
SameLine: mov al, [esi] ; OpCode
mov cl, al ; Sauve AL
and cl, 00111111b ; AH = Bit 0-5
test al, 11000000b ; AL = Bit 6-7
je JumpZero ; Incrust
inc cl ; One More Please...
test al, 01000000b ; AL = 01b
jne WriteDiffPix ; Pix Differents
;----------------------------------------------- Repeat Same Color
mov al, [esi+1] ; Color to Repeat
add esi, 2
shr ecx, 1
mov ah, al
rep stosw ; Fill
jnc nobytec
mov [edi], al
inc edi
nobytec: dec bl ; Nb Block--
jne SameLine ; Continue Same Line
add edi, edx ; EDI += Offset Screen
dec bh ; NbLine--
jne NextLine ; Next Line
ret
;----------------------------------------------- Copy Diff Pix
WriteDiffPix: inc esi
shr ecx, 1
rep movsw ; Copy Pix
jnc nobyted
mov al, [esi]
mov [edi], al
inc esi
inc edi
nobyted: dec bl ; Nb Block--
jne SameLine ; Continue Same Line
add edi, edx ; EDI += Offset Screen
dec bh ; NbLine--
jne NextLine ; Next Line
ret
;----------------------------------------------- Incrust
JumpZero: inc esi
lea edi, [edi+ecx+1]; Jump Zero (incrust)
dec bl ; Nb Block--
jne SameLine ; Continue Same Line
add edi, edx ; EDI += Offset Screen
dec bh ; NbLine--
jne NextLine ; Next Line
ret
;-------------------------------------------------------------------- Clipping
; Graph : ( EBX, ECX ) ( EDX, EAX )
ClippingGraph:
cmp ebx, ClipXmax
jg EndGraph
cmp ecx, ClipYmax
jg EndGraph
cmp edx, ClipXmin
jl EndGraph
cmp eax, ClipYmin
jl EndGraph
cmp ecx, ClipYmin
jge PasHaut
;---------------------- Clipping Haut, Saute ClipYmin-ECX Line(s)
mov ebp, eax
mov edi, ebx
mov ebx, ClipYmin
sub ebx, ecx
NextH: mov bh, [esi]
inc esi
SameH: mov al, [esi]
inc esi
test al, 11000000b
je JumpzH
xor ecx, ecx
test al, 01000000b
je AquiH
and eax, 00111111b
mov ecx, eax
AquiH: lea esi, [esi+ecx+1]
JumpzH: dec bh
jne SameH
dec bl
jne NextH
mov ecx, ClipYmin ; New Y Haut
mov eax, ebp
mov ebx, edi
;---------------------- Clipping Bas
PasHaut: cmp eax, ClipYmax
jle PasBas
mov eax, ClipYmax
;---------------------- Clipping Gauche
Pasbas: xor edi, edi
cmp ebx, ClipXmin
jge PasGauche
mov edi, ClipXmin
sub edi, ebx
PasGauche: mov OffsetBegin, edi
;---------------------- Clipping Droit
lea edi, [edi+ebx-1]
sub edi, edx
neg edi
mov NbPix, edi
sub edx, ClipXmax
jle PasDroit
sub NbPix, edx
;----------------------
PasDroit:
mov edi, Log
add edi, TabOffLine[ecx*4]
add edi, ebx
sub eax, ecx
inc al
mov bh, al ; BH NbLine
xor ecx, ecx
mov edx, edi
;----------------------------------------------
; ESI = DATAS LINE
NextL: lea edi, BufferClip ; EDI = BUFFERCLIP
mov bl, [esi]
inc esi
SameL: mov al, [esi]
inc esi
mov cl, al
and cl, 00111111b
inc cl
test al, 11000000b
je JumpL
test al, 01000000b
jne WriteDiffL
;----------------------
mov al, [esi]
inc esi
shr ecx, 1
mov ah, al
rep stosw
jnc nobyte
mov [edi], al
inc edi
dec bl
jne SameL
jmp NextLine2
;----------------------
JumpL: xor ax, ax
shr ecx, 1
rep stosw
jnc nobyte
mov [edi], al
inc edi
dec bl
jne SameL
jmp NextLine2
;----------------------
WriteDiffL: shr ecx, 1
rep movsw
jnc nobyte
mov al, [esi]
mov [edi], al
inc esi
inc edi
nobyte: dec bl
jne SameL
;----------------------
NextLine2: mov ebp, esi ; SAVE ESI
mov ecx, OffsetBegin
lea esi, [BufferClip+ecx] ; ESI = BUFFERCLIP
lea edi, [edx+ecx] ; EDI = SCREEN
mov ecx, NbPix
Again: mov al, [esi]
inc esi
or al, al
je Incrust
mov [edi], al
Incrust: inc edi
dec ecx
jnz Again
add edx, 640
mov esi, ebp
dec bh
jne NextL
;----------------------
EndGraph: ret
AffGraph endp
;----------------------------------------------------------------------------
GetDxDyGraph proc uses esi edi ebx,\
num:DWORD, ptdx:DWORD, ptdy:DWORD, bankgraph:DWORD
mov esi, bankgraph
mov eax, num
add esi, [esi+eax*4]
mov edi, ptdx
xor eax, eax
mov al, [esi]
mov dword ptr[edi], eax
mov edi, ptdy
mov al, [esi+1]
mov dword ptr[edi], eax
ret
GetDxDyGraph endp
;----------------------------------------------------------------------------
; The
End

View File

@@ -0,0 +1,50 @@
/*--------------------------------------------------------------------------*/
/* INITGRAFSVGA 386 */
/* (c) Adeline 1993 */
/*--------------------------------------------------------------------------*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <dos.h>
#include <i86.h>
#include <stdio.h>
#include <string.h>
/*--------------------------------------------------------------------------*/
void InitGraphSvga()
{
InitSvga();
Log = Malloc(640L*480L); /* 307200L */
MemoLog = Log;
}
/*--------------------------------------------------------------------------*/
void ClearGraphSvga()
{
Free(MemoLog) ;
ClearVideo() ;
}
/*--------------------------------------------------------------------------*/
void InitGraphMcga()
{
InitMcga();
Log = Malloc(320L*200L); /* 64000L */
MemoLog = Log;
}
/*--------------------------------------------------------------------------*/
void ClearGraphMcga()
{
Free(MemoLog) ;
ClearVideo() ;
}
/*--------------------------------------------------------------------------*/

View File

@@ -0,0 +1,317 @@
;----------------------------------------------------------------------------
; INITSVGA.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386p
jumps
.model FLAT, SYSCALL
;----------------------------------------------------------------------------
.data
include vesa.ash
public NoLanguage Log
public NoLanguage Phys
public NoLanguage Text_Ink
public NoLanguage Text_Paper
public NoLanguage Screen_X
public NoLanguage Screen_Y
public NoLanguage MemoLog
public NoLanguage ClipXmin
public NoLanguage ClipYmin
public NoLanguage ClipXmax
public NoLanguage ClipYmax
public NoLanguage TabOffLine
public NoLanguage OldVideo
public NoLanguage SizeCar
public NoLanguage BankChange
public NoLanguage BankCurrent
public NoLanguage InitSvgaMode
public NoLanguage NewBank
public NoLanguage Enable
ClipXmin dd 0
ClipYmin dd 0
ClipXmax dd 639
ClipYmax dd 479
MemoClipXmin dd 0
MemoClipYmin dd 0
MemoClipXmax dd 639
MemoClipYmax dd 479
TabOffLine dd 480 dup(?) ; LONG et non pas WORD comme MCGA
TabOffPhysLine dd 480 dup(?) ; LONG et non pas WORD comme MCGA
OldVideo db -1
Text_Ink db 15
Text_Paper db -1
db 0
Screen_X dd 640
Screen_Y dd 480
SizeCar dw 8 ; 6 old affstring
ALIGN 2
Save_1 dd ?
Log dd 0
Phys dd 0A0000h
MemoLog dd 0
BankChange dd ?
BankCurrent dd ?
InitSvgaMode dd offset InitModeVesa
NewBank dd offset NewBankVesa
Enable dd 0
;----------------------------------------------------------------------------
.code
InitModeVesa PROTO
NewBankVesa PROTO
extrn NoLanguage ScanLine:DWORD
public NoLanguage InitSvga
public NoLanguage InitMcga
public NoLanguage InitMcgaMode
public NoLanguage SimpleInitSvga
public NoLanguage ClearVideo
public NoLanguage SetClip
public NoLanguage UnSetClip
public NoLanguage MemoClip
public NoLanguage RestoreClip
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
; ÛÛßßß Ûßßßß ÛßßßÛ Ûßßßß Ûßßßß ÛÛÜ Û ÛÜ ÜÛ ÛßßßÛ ÛßßßÜ Ûßßßß
; ßßßßÛ ÛÛ ÛÛßÛß ÛÛßß ÛÛßß ÛÛßÛÛ ÛÛß Û ÛÛ Û ÛÛ Û ÛÛßß
; ßßßßß ßßßßß ßß ß ßßßßß ßßßßß ßß ß ßßßßß ßß ß ßßßßß ßßßß ßßßßß
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
;----------------------------------------------------------------------------
InitSvga proc
;---------------------- Save regs
pushad
;---------------------- memo video mode
mov ah, 0Fh
int 10h
mov [OldVideo], al
;---------------------- Video Mode
mov edx, [InitSvgaMode]
or edx, edx
jnz ok
mov edx, offset InitModeVESA
mov [InitSvgaMode], edx
ok:
mov eax, offset ScanLine
call edx
mov edx, [Enable]
or edx, edx
jz skip
call edx
skip:
;---------------------- Restore regs
popad
;---------------------- Table Offset Line
mov ecx, Screen_Y
xor eax, eax
mov edx, eax
Again:
mov TabOffLine[edx*4], eax
inc edx
add eax, Screen_X
dec ecx
jnz Again
mov dword ptr[BankCurrent], -1
ret
InitSvga endp
;----------------------------------------------------------------------------
SimpleInitSvga proc uses ebx
call [InitSvgaMode]
mov eax, [Enable]
or eax, eax
jz skip
call eax
skip:
mov dword ptr[BankCurrent], -1
ret
SimpleInitSvga endp
;----------------------------------------------------------------------------
ClearSvga proc
xor ax, ax
mov al, OldVideo
int 10h
ret
ClearSvga endp
;----------------------------------------------------------------------------
InitMcgaMode proc uses esi edi
mov ax, 13h
int 10h
ret
InitMcgaMode endp
;----------------------------------------------------------------------------
InitMcga proc
;---------------------- Save regs
pushad
;---------------------- memo video mode
mov ah, 0Fh
int 10h
mov [OldVideo], al
;---------------------- Video Mode
call InitMcgaMode
;---------------------- Restore regs
popad
ret
InitMcga endp
;----------------------------------------------------------------------------
ClearVideo proc
xor ax, ax
mov al, OldVideo
int 10h
ret
ClearVideo endp
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
; Ûßßßß Û Û ÛßßßÛ ÛßßßÛ Û ÛÛÜ Û Ûßßßß
; ÛÛ ÛÛ ÛÛ ÛÛßßß ÛÛßßß ÛÛ ÛÛßÛÛ ÛÛ ßÛ
; ßßßßß ßßßßß ßß ßß ßß ßß ßß ß ßßßßß
;*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
;*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
SetClip proc ,\
x0:DWORD, y0:DWORD, x1:DWORD, y1:DWORD
mov eax, x0
cmp eax, 0
jge OkLeft
xor eax, eax
OkLeft: mov ClipXmin, eax
mov eax, y0
cmp eax, 0
jge OkUp
xor eax, eax
OkUp: mov ClipYmin, eax
mov eax, x1
cmp eax, Screen_X
jl OkRight
mov eax, Screen_X
dec eax
OkRight: mov ClipXmax, eax
mov eax, y1
cmp eax, Screen_Y
jl OkDown
mov eax, Screen_Y
dec eax
OkDown: mov ClipYmax, eax
ret
SetClip endp
;----------------------------------------------------------------------------
UnSetClip proc
xor eax, eax
mov ClipXmin, eax
mov ClipYmin, eax
mov eax, Screen_X
dec eax
mov ClipXmax, eax
mov eax, Screen_Y
dec eax
mov ClipYmax, eax
ret
UnSetClip endp
;----------------------------------------------------------------------------
MemoClip proc
mov eax,ClipXmin
mov MemoClipXmin, eax
mov eax,ClipYmin
mov MemoClipYmin, eax
mov eax,ClipXmax
mov MemoClipXmax, eax
mov eax,ClipYmax
mov MemoClipYmax, eax
ret
MemoClip endp
;----------------------------------------------------------------------------
RestoreClip proc
mov eax,MemoClipXmin
mov ClipXmin, eax
mov eax,MemoClipYmin
mov ClipYmin, eax
mov eax,MemoClipXmax
mov ClipXmax, eax
mov eax,MemoClipYmax
mov ClipYmax, eax
ret
RestoreClip endp
;----------------------------------------------------------------------------
; The
End

340
LIB386/LIB_SVGA/LBM.C Normal file
View File

@@ -0,0 +1,340 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
Û ÛßßÛ ÛÜ ÜÛ
ÛÛ ÛÛßßÛ ÛÛß Û
ßßßßß ßßßßß ßß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
#define MAXBUFLIGNE 1500
#define RowByte(w) ((((w)+15)>>4) << 1)
UWORD Larg ;
WORD Lbm_Width = 640 ;
#define BUFLIGNEMAX 720
static WORD Handle ;
static ULONG rejet ;
static ULONG len ;
static BYTE head[] = "BMHD" ;
static WORD larg,haut ;
static BYTE nbr_plan ;
static BYTE flgcomp ; /* flg de compression */
static BYTE Masking ;
//static BYTE bufflig[BUFLIGNEMAX] ;
static UBYTE tabmsk[8] = { 0x01,0x02,0x04,0x08,
0x10,0x20,0x40,0x80 } ;
static LONG CptIff ;
static UBYTE *PtrIff ;
static UBYTE *BufferIff ;
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
UBYTE ReadIff()
{
if( CptIff == 0 )
{
Read( Handle, BufferIff, 64000L ) ;
CptIff = 64000L ;
PtrIff =(void *)BufferIff ;
}
CptIff-- ;
return *PtrIff++ ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void WriteIff( void *ptrin, ULONG len )
{
Write( Handle, ptrin, len );
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void WriteIffLong( ULONG data )
{
WriteIff( (void*)&((UBYTE*)&data)[3], 1L );
WriteIff( (void*)&((UBYTE*)&data)[2], 1L );
WriteIff( (void*)&((UBYTE*)&data)[1], 1L );
WriteIff( (void*)&((UBYTE*)&data)[0], 1L );
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void itoml( void *l )
{
UBYTE c ;
UBYTE *ptc ;
ptc = (char*)l ;
c = ptc[0] ;
ptc[0] = ptc[3] ;
ptc[3] = c ;
c = ptc[1] ;
ptc[1] = ptc[2] ;
ptc[2] = c ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void lit_bmhd()
{
UBYTE a,b ;
Read( Handle, &a, 1L ) ;
Read( Handle, &b, 1L ) ;
larg = ((unsigned int)a)*256 + b ;
Read( Handle, &a, 1L ) ;
Read( Handle, &b, 1L ) ;
haut = ((unsigned int)a)*256 + b ;
Read( Handle, &len, 4L ) ; /* lit 4 octets */
Read( Handle, &nbr_plan, 1L );
Read( Handle, &Masking, 1L ) ;
Read( Handle, &flgcomp, 1L );
Read( Handle, &a, 1L ) ; /* pad */
Read( Handle, &rejet, 4L ) ;
Read( Handle, &rejet, 4L ) ;
Larg = larg;
if( larg>320 ) larg = 320;
if( haut>200 ) haut = 200;
Masking &= 1;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void lit_bloc() /* on a un bloc inconnu */
{
WORD l ;
for(l = 0 ; l < (int)len ; l++)
Read(Handle, &rejet, 1L ) ; /* a jeter */
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void lit_ligne( UBYTE *ptdst, WORD nboctet )
{
UBYTE *dst;
BYTE o;
WORD nb;
UWORD i;
dst = ptdst;
if(flgcomp)
{
while(nboctet > 0)
{
o = ReadIff();
if(o >= 0)
{
nb = o + 1;
nboctet -= nb;
for ( i=0 ; i<nb ; i++) *dst++ = ReadIff();
}
else
{
if(o != -128)
{
nb = -o + 1;
nboctet -= nb;
o = ReadIff();
while(nb--) *dst++ = o;
}
}
}
}
else
while( nboctet-- ) *dst++ = ReadIff();
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void ConvertMCGA(UBYTE *bufligne, UBYTE *dst, UWORD nboctet, WORD nbplan )
{
WORD a,b,p,msk ;
UBYTE col ;
for(a = 0 ; a < nboctet ; a++)
{
for(b = 0 ; b < 8; b++)
{
col = 0;
msk = tabmsk[7-b] ;
for(p = nbplan-1 ; p >= 0 ; p--)
{
col <<= 1 ;
if(*(bufligne + p*nboctet + a) & msk) col++ ;
}
*dst++ = col;
}
}
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void lit_bodyILBM( UBYTE *ptr )
{
WORD lig,nboctet ;
UBYTE *bufligne ;
if ((bufligne = Malloc(MAXBUFLIGNE)) == 0 ) return ;
nboctet = RowByte(Larg) ;
for(lig = 0 ; lig < 200 ; lig++)
{
memset( bufligne, 0, MAXBUFLIGNE ) ;
if (lig < haut )
{
lit_ligne( bufligne,nboctet*nbr_plan ) ;
ConvertMCGA(bufligne,ptr,nboctet,nbr_plan ) ;
memset( ptr+nboctet*8,0, 320-nboctet*8 ) ;
}
else
{
memset( ptr, 0, Lbm_Width ) ;
}
ptr += Lbm_Width ;
}
Free( bufligne ) ;
}
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void lit_bodyPBM( UBYTE *ptr )
{
WORD lig ;
for(lig = 0 ; lig < 200 ; lig++)
{
lit_ligne( ptr,larg ) ;
ptr += Lbm_Width ;
}
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
Û ÛßßßÛ ÛßßßÛ ÛßßßÜ Û ÛßßÛ ÛÜ ÜÛ
ÛÛ ÛÛ Û ÛÛßßÛ ÛÛ Û ÛÛ ÛÛßßÛ ÛÛß Û
ßßßßß ßßßßß ßß ß ßßßß ßßßßß ßßßßß ßßßßß ßß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
LONG Load_Lbm( char *name, UBYTE *ptrscreen, UBYTE *ptrpal )
{
ULONG len2 ;
WORD type = 0 ; /* 0 = ILBM; 1 = PBM */
UBYTE *ptr ;
CptIff = 0;
Handle = OpenRead( name ) ;
if( !Handle ) return FALSE ;
BufferIff = Malloc( 64000 ) ;
/* printf( "%s: ", name ) ; */
Read( Handle, head, 4L ) ;
Read( Handle, &len, 4L ) ; /* lit taille */
Read( Handle, head, 4L ) ; /* lit ILBM */
if( strcmp( head, "ILBM" )!= 0 ) type = 1; /* PBM */
while( TRUE )
{
len2 = Read( Handle, head, 4L ) ;
if( len2 != 4 ) break ; /* fin de fichier */
Read( Handle, &len, 4L ) ; /* lit taille du chunk */
itoml( &len ) ;
if( len&1 ) len++ ;
if(strcmp(head,"BMHD") == 0) lit_bmhd() ;
else
if(strcmp(head,"CMAP") == 0) /* pal */
Read( Handle, ptrpal, 768 ) ;
else
if(strcmp(head,"BODY") == 0)
{
if( type==0 )
lit_bodyILBM( ptrscreen ) ;
else
lit_bodyPBM( ptrscreen ) ;
break;
}
else lit_bloc() ;/* bloc inconnu on le saute */
}
Free( BufferIff ) ;
Close( Handle ) ;
/* printf( "converted to VGA " ) ; */
return TRUE ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
ÛÛßßß ÛßßßÛ Û Û Ûßßßß Û ÛßßÛ ÛÜ ÜÛ
ßßßßÛ ÛÛßßÛ ÛÛ Üß ÛÛßß ÛÛ ÛÛßßÛ ÛÛß Û
ßßßßß ßß ß ßßß ßßßßß ßßßßß ßßßßß ßßßßß ßß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
LONG Save_Lbm( char *name, UBYTE *ptrscr, UBYTE *ptrpal )
{
UWORD nbplan=8,a=0;
UWORD resolx = 320;
UWORD resoly = 200;
UWORD y ;
UWORD ligne,colonne;
Handle = OpenWrite( name );
if ( Handle == 0) return 0 ;
WriteIff("FORM",4L);
WriteIffLong(64816L);
WriteIff("PBM ",4L);
WriteIff("BMHD",4L);
WriteIffLong(20L);
WriteIff((void *)&((UBYTE*)&resolx)[1],1L);
WriteIff((void *)&((UBYTE*)&resolx)[0],1L);
WriteIff((void *)&((UBYTE*)&resoly)[1],1L) ;
WriteIff((void *)&((UBYTE*)&resoly)[0],1L) ;
WriteIffLong(0L); /* lit 4 octets avant le, */
WriteIff(&nbplan,1L);
WriteIff(&a,1L);
a = 0; /* flg non compilee */
WriteIff(&a,1L);
WriteIff(&a,1L); /* pad */
WriteIffLong(0L);
WriteIffLong(0L);
WriteIff("CMAP",4L); /* pal */
WriteIffLong(3*256L);
WriteIff(ptrpal,3*256L);
colonne = 40;
ligne = 200;
WriteIff ("BODY",4L);
WriteIffLong ((LONG)(colonne*nbplan*ligne));
for( y=0; y<200; y++ )
{
Write( Handle, ptrscr, 320 ) ;
ptrscr += Lbm_Width ;
}
/* Write (Handle, ptrscr, 64000L ); */
Close( Handle );
return TRUE ;
}

209
LIB386/LIB_SVGA/LIB_SVGA.H Normal file
View File

@@ -0,0 +1,209 @@
/*-----------------------------------------------------------------------------
; Extern lib_svga 386
;-----------------------------------------------------------------------------*/
#ifdef WATCOM9
#pragma library ( "f:\projet\lib386\lib_svga\lb9_svga.lib" );
#else
#pragma library ( "f:\projet\lib386\lib_svga\lib_svga.lib" );
#endif
/*-----------------------------------------------------------------------------*/
#define SVGA_VESA 0 /* VESA compliant board at Adress 0xA0000 */
#define SVGA_TRIDENT 1 /* Trident 8800 & 8900 */
#define SVGA_ATI 2 /* ATI Chipset */
#define SVGA_S3 3 /* S3 Boards (expect init with VESA mode 102) */
#define SVGA_CIRRUS 4 /* Cirrus (some Genoa) (expect init with VESA mode 102) */
#define SVGA_TSENG 5 /* Tseng ET3000 & ET4000 */
#define SVGA_WESTERN 6 /* Western Digital / Paradise */
#define SVGA_GENOA 7 /* REAL Genoa (not Cirrus or ET3000) */
/*-----------------------------------------------------------------------------*/
extern WORD ClipXmin ;
extern WORD ClipYmin ;
extern WORD ClipXmax ;
extern WORD ClipYmax ;
extern ULONG TabOffLine ;
extern UBYTE *Phys ;
extern UBYTE *Log ;
extern UBYTE *MemoLog ;
extern WORD Screen_X ;
extern WORD Screen_Y ;
extern UBYTE Text_Ink ;
extern UBYTE Text_Paper ;
extern UBYTE OldVideo ;
extern WORD SizeCar ;
/*-----------------------------------------------------------------------------*/
extern WORD Svga_Card ;
extern void *BankChange ;
extern LONG BankCurrent ;
/*-----------------------------------------------------------------------------*/
extern WORD TypePoly ;
extern WORD NbPolyPoints ;
extern WORD TabPoly[] ;
extern WORD TabText[] ;
extern WORD TabVerticG[] ;
extern WORD TabVerticD[] ;
extern WORD Ymin ;
extern WORD Ymax ;
extern WORD TabCoulG[] ;
extern WORD TabCoulD[] ;
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
/* MOUSE.C */
extern volatile LONG Click ;
extern volatile LONG Mouse_X ;
extern volatile LONG Mouse_Y ;
extern LONG Mouse_X_Dep ;
extern LONG Mouse_Y_Dep ;
extern UBYTE *GphMouse ;
extern void __loadds __far click_handler(int ,int ,int );
extern void SetMouseBox(long ,long ,long ,long );
extern void SetMouseSpeed(long ,long );
extern void SetMousePos(long ,long );
extern void GetMouseDep(void);
extern void ShowMouse(long );
extern void AffMouse(void);
extern void SetMouse(short );
extern void InitMouse(void);
extern void ClearMouse(void);
/*-----------------------------------------------------------------------------*/
/* S_PAL.asm */
void PalOne( UBYTE coul, UBYTE r, UBYTE v, UBYTE b ) ;
void PalMulti( WORD startcoul, WORD nbcoul, UBYTE *pal ) ;
void Palette( void *pal ) ;
/*-----------------------------------------------------------------------------*/
/* FONT.ASM */
void CoulFont( LONG couleur ) ;
void SetFont( void *font, LONG interleave, LONG interspace ) ;
LONG SizeFont( void *chaine ) ;
LONG CarFont( LONG xcar, LONG ycar, LONG car ) ;
void Font( LONG xchaine, LONG ychaine, void *chaine ) ;
/*-----------------------------------------------------------------------------*/
/* GRAPH_A.ASM */
void AffGraph( LONG num, LONG x, LONG y, void *bank ) ;
void GetDxDyGraph( LONG num, LONG *dx, LONG *dy, void *bank ) ;
/*-----------------------------------------------------------------------------*/
/* MASK_A.ASM */
void AffMask( LONG num, LONG x, LONG y, void *bank ) ;
/*-----------------------------------------------------------------------------*/
/* InitSvga.asm */
void SetClip( LONG x0, LONG y0, LONG x1, LONG y1 ) ;
void UnSetClip( void ) ;
void MemoClip( void ) ;
void RestoreClip( void ) ;
/*-----------------------------------------------------------------------------*/
/* Box.asm */
void Box( LONG x0, LONG y0, LONG x1, LONG y1, LONG couleur ) ;
/*-----------------------------------------------------------------------------*/
/* Line.asm */
void Line( LONG x0, LONG y0, LONG x1, LONG y1, LONG couleur ) ;
/*-----------------------------------------------------------------------------*/
/* Zoom.asm */
void ScaleLine( LONG xa0, LONG xa1, void *src, LONG xb0, LONG xb1, void *dst ) ;
void ScaleBox( LONG xa0, LONG ya0, LONG xa1, LONG ya1, void *src,
LONG xb0, LONG yb0, LONG xb1, LONG yb1, void *dst ) ;
/*-----------------------------------------------------------------------------*/
/* CopyMask.asm */
void CopyMask( LONG num, LONG x, LONG y, void *bank, void* screen ) ;
/*-----------------------------------------------------------------------------*/
/* Mask_A.asm */
void CoulMask( LONG coulmask ) ;
void AffMask( LONG num, LONG x, LONG y, void *bank ) ;
void GetDxDyMask( LONG num, LONG *dx, LONG *dy, void *bank ) ;
/*-----------------------------------------------------------------------------*/
/* S_PLOT.asm.asm */
void Plot( LONG x, LONG y, LONG couleur ) ;
LONG GetPlot( LONG x, LONG y ) ;
/*-----------------------------------------------------------------------------*/
/* S_SCREEN.asm */
void Cls( void ) ;
void CopyScreen( void *src, void *dst ) ;
void Vsync( void ) ;
void Flip( void ) ;
void FlipComp( void ) ;
/*-----------------------------------------------------------------------------*/
/* S_STRING.asm */
void AffString( LONG x, LONG y, void *text ) ;
void CoulText( LONG coul0, LONG coul1 ) ;
extern UBYTE Font8X8 ;
/*-----------------------------------------------------------------------------*/
/* S_BLOCK2.asm */
void CopyBlockOnBlack( LONG x0, LONG y0, LONG x1, LONG y1, void *src, void *dst ) ;
/*-----------------------------------------------------------------------------*/
/* GRAPHMSK.asm */
LONG CalcGraphMsk( LONG num, void *bank, void *mask ) ;
/*-----------------------------------------------------------------------------*/
/* S_BLOCK.asm */
void CopyBlock( LONG x0, LONG y0, LONG x1, LONG y1, void *src,
LONG xd, LONG yd, void *dst ) ;
/*-----------------------------------------------------------------------------*/
/* S_BLOCK3.asm */
void CopyBlockIncrust( LONG x0, LONG y0, LONG x1, LONG y1, void *src,
LONG xd, LONG yd, void *dst ) ;
/*-----------------------------------------------------------------------------*/
/* S_PHYS.asm */
// void CopyBlockIncrust( LONG x0, LONG y0, LONG x1, LONG y1 ) ;
void CopyBlockPhysClip( LONG x0, LONG y0, LONG x1, LONG y1 ) ;
void CopyBlockPhys( LONG x0, LONG y0, LONG x1, LONG y1 ) ;
void SaveBlock( void *screen, void *buffer, LONG x, LONG y, LONG dx, LONG dy ) ;
void RestoreBlock( void *screen, void *buffer, LONG x, LONG y, LONG dx, LONG dy ) ;
/*-----------------------------------------------------------------------------*/
/* LBM.c 320*200 */
extern WORD Lbm_Width ; // 640 or 320 (for source format)
extern unsigned char ReadIff(void);
extern void WriteIff(void *,unsigned long );
extern void WriteIffLong(unsigned long );
extern void itoml(void *);
extern void lit_bmhd(void);
extern void lit_bloc(void);
extern void lit_ligne(unsigned char *,short );
extern void ConvertMCGA(unsigned char *,unsigned char *,unsigned short ,short );
extern void lit_bodyILBM(unsigned char *);
extern void lit_bodyPBM(unsigned char *);
extern long Load_Lbm(char *,unsigned char *,unsigned char *);
extern long Save_Lbm(char *,unsigned char *,unsigned char *);
/*-----------------------------------------------------------------------------*/
/* PCX.c 640*480 */
extern void line_out(unsigned char *);
extern unsigned char next_char(unsigned long ,unsigned char *);
extern void Load_Pcx(char *,unsigned char *,unsigned char *);
extern void Save_Pcx(char *,unsigned char *,unsigned char *);
/*-----------------------------------------------------------------------------*/
/* s_dll.c */
extern long SvgaInitDLL(char *);
/*-----------------------------------------------------------------------------*/
/* s_text.c */
extern void Text(short ,short ,char * ,... );
/*-----------------------------------------------------------------------------*/
/* s_rect.c */
extern void Rect(long ,long ,long ,long ,long );
/*-----------------------------------------------------------------------------*/
/* initmode.c */
extern void InitGraphSvga(void);
extern void ClearGraphSvga(void);
extern void InitGraphMcga(void);
extern void ClearGraphMcga(void);

66
LIB386/LIB_SVGA/MAKEFILE Normal file
View File

@@ -0,0 +1,66 @@
# name the compiler
!ifdef %HOME
!ifeq WATCOM9 yes
CC = c:\compil\watcom\bin\wcc386p
WL = c:\compil\watcom\binb\wlib
!else
CC = c:\compil\watcom10\binb\wcc386
WL = c:\compil\watcom10\binb\wlib
!endif
!else
!ifeq WATCOM9 yes
CC = f:\compil\watcom\bin\wcc386p
WL = f:\compil\watcom\binb\wlib
!else
CC = f:\compil\watcom10\binb\wcc386
WL = f:\compil\watcom10\binb\wlib
!endif
!endif
ASM = ml
!ifeq WATCOM9 yes
CFLAGS = /oeaxt /zp2 /4s /zq /s /DWATCOM9
!else
CFLAGS = /oeaxt /zp2 /5s /zq /s
!endif
LFLAGS = /c /q /b /n
#AFLAGS = /m2 /mx /z /zi /t /jMASM51 /jQUIRKS
AFLAGS = /Cx /Zm /c /W0 /Sa /DNoLanguage=SYSCALL /Djumps=;
OBJETS1 = InitMode.obj InitSvga.obj Graph_A.obj
OBJETS2 = S_Text.obj S_string.obj S_Mouse.Obj Mask_A.obj Font_A.obj
OBJETS3 = S_Screen.obj S_Block.obj S_Block2.obj S_Pal.obj
OBJETS4 = S_Plot.obj S_Box.obj S_Line.obj S_Poly.obj S_FillV.obj
OBJETS5 = S_MouseA.obj Rect.obj Zoom.obj MaskGph.obj GraphMsk.obj
OBJETS6 = S_Phys.obj texture.obj s_block3.obj Lbm.obj Pcx.obj
OBJETS7 = S_Dll.obj vesa.obj Gif.obj
!ifeq WATCOM9 yes
LIB = LB9_SVGA
!else
LIB = LIB_SVGA
!endif
$(LIB).LIB: $(OBJETS1) $(OBJETS2) $(OBJETS3) $(OBJETS4) $(OBJETS5) $(OBJETS6) $(OBJETS7)
@echo $(OBJETS1) > clibmak.rsp
@echo $(OBJETS2) >> clibmak.rsp
@echo $(OBJETS3) >> clibmak.rsp
@echo $(OBJETS4) >> clibmak.rsp
@echo $(OBJETS5) >> clibmak.rsp
@echo $(OBJETS6) >> clibmak.rsp
@echo $(OBJETS7) >> clibmak.rsp
@$(WL) $(LIBFLAGS) $(LIB) @clibmak.rsp
@del clibmak.rsp
@prntitre M "$(LIB) OK"
.asm.obj:
@PRNTITRE M "$*.ASM"
@$(ASM) $(AFLAGS) $*.ASM
.c.obj:
@PRNTITRE M "$*.C"
@$(CC) $(CFLAGS) $*

62
LIB386/LIB_SVGA/MASKGPH.C Normal file
View File

@@ -0,0 +1,62 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <i86.h>
/*-------------------------------------------------------------------------*/
ULONG CreateMaskGph( UBYTE *ptsrc, UBYTE *ptdst )
{
UBYTE *ptd ;
ULONG nbg, off;
ULONG *ptoff ;
ULONG size, i ;
ptoff = (ULONG*)ptdst ;
off = *(ULONG *)ptsrc ;/* First Offset Src */
*ptoff++ = off ;/* First Offset */
ptd = ptdst+off ;
nbg = (off-4)>>2 ;/* Nombre de Graph */
for ( i = 0 ; i < nbg ; i++ )
{
size = CalcGraphMsk( i, ptsrc, ptd ) ;
off += size ;/* Maj Offset */
*ptoff++ = off ;/* Write Offset */
ptd += size ;/* Maj Pt Dest */
}
return(off) ;
}
/*-------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

318
LIB386/LIB_SVGA/MASK_A.ASM Normal file
View File

@@ -0,0 +1,318 @@
;----------------------------------------------------------------------------
; Mask_A.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
;----------------------------------------------------------------------------
include \projet\lib386\lib_svga\svga.ash
comment @
DWORD TabOffset[]
Brick:
- BYTE Delta X
- BYTE Delta Y
Line(Delta Y):
- BYTE NbBlock
Block 0: Nb Zero to Jump
Block 1: Nb Zero to Write
Block 2: Nb Zero to Jump
etc...
@
BufferClip db 512 dup(?)
ColMask db 0 ; Noir par Defaut
ALIGN 4
OffsetBegin dd 0
NbPix dd 0
;----------------------------------------------------------------------------
.code
public NoLanguage CoulMask
public NoLanguage AffMask
public NoLanguage AffMask_Asm
public NoLanguage GetDxDyMask
;----------------------------------------------------------------------------
CoulMask proc ,\
coul:DWORD
mov eax, coul
mov byte ptr [ColMask], al
ret
CoulMask endp
;----------------------------------------------------------------------------
AffMask proc uses esi edi ebx ebp,\
nummask:DWORD, xmask:DWORD, ymask:DWORD, \
bankmask:DWORD
mov eax, nummask
mov ebx, xmask
mov ecx, ymask
mov esi, bankmask
Call AffMask_Asm
ret
AffMask endp
;----------------------------------------------------------------------------
AffMask_Asm proc
add esi, [esi+eax*4] ; ESI = Begin Data
xor eax, eax
mov al, [esi+2]
add ebx, eax ; Hot X
mov al, [esi+3]
add ecx, eax ; Hot Y
;-----------------------------------------------
xor edx, edx
mov dl, [esi] ; Delta X
mov al, [esi+1] ; Nb Line ( Delta Y )
add esi, 4 ; Jump HotX & HotY
;----------------------------------------------- Test Clipping
add edx, ebx
add eax, ecx
dec edx
dec eax
cmp ebx, ClipXmin
jl ClippingMask
cmp ecx, ClipYmin
jl ClippingMask
cmp edx, ClipXmax
jg ClippingMask
cmp eax, ClipYmax
jg ClippingMask
inc edx
inc eax
sub edx, ebx
sub eax, ecx
;----------------------------------------------- Calcul Offset Ecran
mov edi, Log
add edi, TabOffLine[ecx*4]
add edi, ebx
mov bh, al ; BH = NbLine
sub edx, Screen_X ; EDX = Offset Screen
neg edx ; EDX = Screen_X-edx
xor ecx, ecx ; Maz Compteur
mov ebp, edx ; EBP Offset Next Line
mov al, byte ptr [ColMask]; Couleur du Masque
mov ah, al
;----------------------------------------------- Init NbBlock for this line
NextLine: mov bl, [esi] ; BL = Nb Block for this line
inc esi
;----------------------------------------------- Manage One Line
SameLine: mov cl, [esi] ; Nb Zero to Jump
add edi, ecx ; Incrust
dec bl
je EndBlock
mov cl, [esi+1] ; Nb Zero to Write
add esi, 2
shr ecx, 1
rep stosw ; Write Zero
jnc nobyte
stosb
nobyte: dec bl ; Nb Block--
jne SameLine ; Continue Same Line
add edi, ebp ; EDI += Offset Next Line
dec bh ; NbLine--
jne NextLine ; Next Line
ret
EndBlock:
inc esi
add edi, ebp ; EDI += Offset Next Line
dec bh ; NbLine--
jne NextLine ; Next Line
ret
;-------------------------------------------------------------------- Clipping
; Graph : ( EBX, ECX ) ( EDX, EAX )
ClippingMask:
cmp ebx, ClipXmax
jg EndMask
cmp ecx, ClipYmax
jg EndMask
cmp edx, ClipXmin
jl EndMask
cmp eax, ClipYmin
jl EndMask
cmp ecx, ClipYmin
jge PasHaut
;---------------------- Clipping Haut, Saute ClipYmin-ECX Line(s)
sub ecx, ClipYmin
neg ecx
mov ebp, eax
;----------------------
xor eax, eax
NextH: mov al, [esi] ; NbBlock
lea esi, [esi+1+eax] ; Jump Data
dec ecx
jnz NextH
mov eax, ebp
mov ecx, ClipYmin ; New Y Haut
;---------------------- Clipping Bas
PasHaut: cmp eax, ClipYmax
jle PasBas
mov eax, ClipYmax
;---------------------- Clipping Gauche
Pasbas: mov OffsetBegin, 0
cmp ebx, ClipXmin
jge PasGauche
push eax
mov eax, ClipXmin
sub eax, ebx
mov OffsetBegin, eax
pop eax
;---------------------- Clipping Droit
PasGauche: mov ebp, edx
sub ebp, ebx
sub ebp, OffsetBegin
inc ebp
mov NbPix, ebp
cmp edx, ClipXmax
jle PasDroit
sub edx, ClipXmax
sub NbPix, edx
mov edx, ClipXmax
;----------------------
PasDroit:
mov edi, Log
add edi, TabOffLine[ecx*4]
add edi, ebx
sub eax, ecx
inc al
mov bh, al ; BH NbLine
xor ecx, ecx
mov ebp, edi
;----------------------------------------------
mov dl, byte ptr [ColMask]
mov dh, dl
; ESI = DATAS LINE
NextL: lea edi, BufferClip ; EDI = BUFFERCLIP
mov bl, [esi] ; NbBlock
inc esi
SameL: mov cl, [esi]
xor ax, ax
shr ecx, 1
rep stosw
jnc nobyte1
stosb
nobyte1: dec bl
je EndLine
mov cl, [esi+1]
add esi, 2
mov ax, dx ; ColMask
shr ecx, 1
rep stosw
jnc nobyte2
stosb
nobyte2: dec bl
jne SameL
dec esi
;----------------------
EndLine: inc esi
push esi ; SAVE ESI
mov ecx, OffsetBegin
lea edi, [ebp+ecx] ; EDI = SCREEN
lea esi, [BufferClip+ecx] ; ESI = BUFFERCLIP
mov ecx, NbPix
Again: lodsb
or al, al
je Incrust
mov [edi], al
Incrust: inc edi
dec ecx
jnz Again
add ebp, 640
pop esi
dec bh
jne NextL
;----------------------
EndMask: ret
AffMask_Asm endp
;----------------------------------------------------------------------------
GetDxDyMask proc uses esi edi ebx,\
num:DWORD, ptdx:DWORD, ptdy:DWORD, bankmask:DWORD
mov esi, bankmask
mov eax, num
add esi, [esi+eax*4]
mov edi, ptdx
xor eax, eax
mov al, [esi]
mov [edi], eax
mov edi, ptdy
mov al, [esi+1]
mov [edi], eax
ret
GetDxDyMask endp
;----------------------------------------------------------------------------
; The
End

View File

@@ -0,0 +1,4 @@
.model large,c

BIN
LIB386/LIB_SVGA/MOUSE.GPH Normal file

Binary file not shown.

BIN
LIB386/LIB_SVGA/MOUSE.PCX Normal file

Binary file not shown.

218
LIB386/LIB_SVGA/PCX.C Normal file
View File

@@ -0,0 +1,218 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dos.h>
#include <conio.h>
#include <ctype.h>
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
ÛßßßÛ Ûßßßß ßÜ Üß
ÛÛßßß ÛÛ ÜßÜ
ßß ßßßßß ß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
struct ffblk {
char ff_reserved[21];
char ff_attrib;
unsigned ff_ftime;
unsigned ff_fdate;
long ff_fsize;
char ff_name[13];
};
union REGS reg;
struct SREGS segregs;
static struct {
char password;
char version;
char encoding;
char bits_per_pixel;
short int xmin, ymin, xmax, ymax;
short int xres, yres;
unsigned char palette[48];
char reserved;
char no_of_planes;
short int bytes_per_line;
short int palette_type;
char filler[58];
} pcx_header;
short int srcseg, srcoff, destseg, destoff;
short int xres, yres, active_bank, bank;
short int attr, i, j, k, dir_index= 0, type, length[7];
short int column, end, done, level,key, start_x, start_y, start_angle,
cursor_x, cursor_y, mode;
struct ffblk ffblk;
long int col,row;
short int index = 0 ;
#define SIZE_BUF 2048L
UBYTE *PtDest ;
LONG debugline=0 ;
/*--------------------------------------------------------------------------*/
void line_out( UBYTE *pts )
{
UBYTE *pt ;
WORD i ;
pt = pts ;
for ( i = 0 ; i < 640 ; i++ ) *PtDest++ = *pt++ ;
/* Box( 0, 0, 160, 7, 0 ) ;
Text( 0, 0, "Ligne:%d", debugline++ ) ;
CopyBlockPhys( 0, 0, 160, 7 ) ;
*/
}
/*--------------------------------------------------------------------------*/
UBYTE next_char( ULONG fd, UBYTE *pt)
{
if ( index == SIZE_BUF )
{
index = 0 ;
Read( fd, pt, SIZE_BUF );
}
return(pt[index++]) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
Û ÛßßßÛ ÛßßßÛ ÛßßßÜ ÛßßßÛ Ûßßßß ßÜ Üß
ÛÛ ÛÛ Û ÛÛßßÛ ÛÛ Û ÛÛßßß ÛÛ ÜßÜ
ßßßßß ßßßßß ßß ß ßßßß ßßßßß ßß ßßßßß ß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void Load_Pcx(char *file_name, UBYTE *screen, UBYTE *tabcol)
{
ULONG fd ;
FILE *fsave ;
unsigned char ch,color,buffer[650],file_buf[SIZE_BUF] ;
short int i,j,k,m,pass,col,row,plane ;
PtDest = screen ;
fd = OpenRead( file_name ) ;
Read( fd, &pcx_header, 128L ) ;
Seek( fd, -768L, SEEK_END ) ;
Read( fd, tabcol, 768 ) ;
Seek( fd, 128L, SEEK_START ) ;
index = SIZE_BUF ;/* For Load in next_char */
for ( row=pcx_header.ymin ; row<=pcx_header.ymax ; row++ )
{
for ( col=pcx_header.xmin ; col<=pcx_header.xmax ; col++ )
{
ch = next_char( fd, file_buf ) ;
if ((ch & 0xC0) != 0xC0)
pass = 1 ;
else
{
pass = ch & 0x3F ;
ch = next_char( fd, file_buf );
}
for ( m=0 ; m<pass ; m++ )
buffer[col++] = ch ;
col--;
}
line_out( buffer ) ;
}
Close( fd ) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
ÛÛßßß ÛßßßÛ Û Û Ûßßßß ÛßßßÛ Ûßßßß ßÜ Üß
ßßßßÛ ÛÛßßÛ ÛÛ Üß ÛÛßß ÛÛßßß ÛÛ ÜßÜ
ßßßßß ßß ß ßßß ßßßßß ßßßßß ßß ßßßßß ß ß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
void Save_Pcx( char *filename, UBYTE *screen, UBYTE *ptrpalette )
{
short int index = 0, i,k,number,num_out ;
unsigned char ch, old_ch, file_buf[640*2];
ULONG handle ;
UBYTE c ;
pcx_header.password = 0x0A;
pcx_header.version = 0x05;
pcx_header.encoding = 0x01;
pcx_header.xmin = 0;
pcx_header.ymin = 0;
pcx_header.reserved = 0;
pcx_header.palette_type = 0;
/* 640 x 480 - 256 colors */
pcx_header.bits_per_pixel = 0x08;
pcx_header.xmax = 639;
pcx_header.ymax = 479;
pcx_header.xres = 640;
pcx_header.yres = 480;
pcx_header.no_of_planes = 1 ;
pcx_header.bytes_per_line = 640 ;
handle = OpenWrite( filename ) ;
Write( handle, &pcx_header, 128 ) ;
for ( k = pcx_header.ymin ; k <= pcx_header.ymax ; k++ )
{
number = 1 ;
old_ch = *( screen + 640*k ) ;
for ( i = 1 ; i <= 640; i++ )
{
if ( i == 640 ) ch = old_ch-1 ;
else ch = *( screen + 640*k + i ) ;
if (( ch == old_ch ) && number < 63 ) number++ ;
else
{
num_out = ((unsigned char) number | 0xC0);
if ((number != 1) || ((old_ch & 0xC0) == 0xC0))
file_buf[index++] = num_out;
file_buf[index++] = old_ch;
old_ch = ch;
number = 1;
}
}
Write( handle, file_buf, index );
index = 0 ;
}
c = 0x0C ;
Write( handle, &c, 1 ) ;
Write( handle, ptrpalette ,768 ) ;
Close( handle ) ;
}

17
LIB386/LIB_SVGA/RECT.C Normal file
View File

@@ -0,0 +1,17 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include <stdio.h>
#include <dos.h>
#include <i86.h>
void Rect( LONG x0, LONG y0, LONG x1, LONG y1, LONG coul )
{
Line( x0, y0, x1, y0, coul ) ;
Line( x0, y1, x1, y1, coul ) ;
Line( x0, y0, x0, y1, coul ) ;
Line( x1, y0, x1, y1, coul ) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/

108
LIB386/LIB_SVGA/SAVEPCX.C Normal file
View File

@@ -0,0 +1,108 @@
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º SAVETEST = PROGRAM TO STORE .PCX GRAPHICS FILES º
º º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <dos.h>
#include <conio.h>
/* voir pcx.c */
static struct {
char password;
char version;
char encoding;
char bits_per_pixel;
short int xmin, ymin, xmax, ymax;
short int xres, yres;
unsigned char palette[48];
char reserved;
char no_of_planes;
short int bytes_per_line;
short int palette_type;
char filler[58];
} pcx_header;
/*
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º º
º º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
*/
void PcxSave( UBYTE *filename, UBYTE *screen, UBYTE *ptrpalette )
{
short int index = 0, i,k,number,num_out ;
unsigned char ch, old_ch, file_buf[640*2];
ULONG handle ;
UBYTE c ;
pcx_header.password = 0x0A;
pcx_header.version = 0x05;
pcx_header.encoding = 0x01;
pcx_header.xmin = 0;
pcx_header.ymin = 0;
pcx_header.reserved = 0;
pcx_header.palette_type = 0;
/* 640 x 480 - 256 colors */
pcx_header.bits_per_pixel = 0x08;
pcx_header.xmax = 639;
pcx_header.ymax = 479;
pcx_header.xres = 640;
pcx_header.yres = 480;
pcx_header.no_of_planes = 1 ;
pcx_header.bytes_per_line = 640 ;
handle = OpenWrite( filename ) ;
Write( handle, &pcx_header, 128 ) ;
for ( k = pcx_header.ymin ; k <= pcx_header.ymax ; k++ )
{
number = 1 ;
old_ch = *( screen + 640*k ) ;
for ( i = 1 ; i <= 640; i++ )
{
if ( i == 640 ) ch = old_ch-1 ;
else ch = *( screen + 640*k + i ) ;
if (( ch == old_ch ) && number < 63 ) number++ ;
else
{
num_out = ((unsigned char) number | 0xC0);
if ((number != 1) || ((old_ch & 0xC0) == 0xC0))
file_buf[index++] = num_out;
file_buf[index++] = old_ch;
old_ch = ch;
number = 1;
}
}
Write( handle, file_buf, index );
index = 0 ;
}
c = 0x0C ;
Write( handle, &c, 1 ) ;
Write( handle, ptrpalette ,768 ) ;
Close( handle ) ;
}

36
LIB386/LIB_SVGA/SVGA.ASH Normal file
View File

@@ -0,0 +1,36 @@
;-----------------------------------------------------------------------------
; Extern lib_svga 386
;-----------------------------------------------------------------------------
.data
extrn NoLanguage ClipXmin :DWORD
extrn NoLanguage ClipYmin :DWORD
extrn NoLanguage ClipXmax :DWORD
extrn NoLanguage ClipYmax :DWORD
extrn NoLanguage Phys :DWORD
extrn NoLanguage Log :DWORD
extrn NoLanguage MemoLog :DWORD
extrn NoLanguage BankCurrent :DWORD
extrn NoLanguage Screen_X :DWORD
extrn NoLanguage Screen_Y :DWORD
extrn NoLanguage TabOffLine :DWORD
extrn NoLanguage SizeCar :WORD
extrn NoLanguage Text_Ink :BYTE
extrn NoLanguage Text_Paper :BYTE
extrn NoLanguage OldVideo :BYTE
POLY_TRISTE equ 0
POLY_COPPER equ 1
POLY_BOPPER equ 2
POLY_MARBRE equ 3
POLY_TELE equ 4
POLY_TRANS equ 5
POLY_TRAME equ 6
POLY_GOURAUD equ 7
POLY_DITHER equ 8

285
LIB386/LIB_SVGA/S_BLOCK.ASM Normal file
View File

@@ -0,0 +1,285 @@
;----------------------------------------------------------------------------
; S_BLOCK.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model FLAT, SYSCALL
.data
include f:\projet\lib386\lib_svga\svga.ash
;----------------------------------------------------------------------------
.code
public NoLanguage CopyBlock
public NoLanguage SaveBlock
public NoLanguage RestoreBlock
;----------------------------------------------------------------------------
; CopyBlock( x0, y0, x1, y1, *src, xd, yd, *dst )
;
CopyBlock proc uses esi edi ebx ebp,\
x0:DWORD, y0:DWORD, x1:DWORD, y1:DWORD, src:DWORD,\
xd:DWORD, yd:DWORD, dst:DWORD
mov edx, x0
mov ecx, y0
mov ebx, x1
mov eax, y1
;----------------------
mov esi, TabOffLine[ecx*4]
add esi, src
add esi, edx ; SI Offset Src
mov edi, yd
mov edi, TabOffLine[edi*4]
add edi, dst
add edi, xd ; DI Offset Dst
sub ebx, edx
inc ebx ; BX Delta Y
sub eax, ecx
inc eax ; AX Delta X
mov edx, Screen_X
sub edx, ebx ; DX Delta Screen
mov ebp, ebx
inc eax
shr ebx, 2
and ebp, 11b
shr eax, 1
jnc short odd
Again:
mov ecx, ebx
rep movsd
mov ecx, ebp
rep movsb
add esi, edx
add edi, edx
odd:
mov ecx, ebx
rep movsd
mov ecx, ebp
rep movsb
add esi, edx
add edi, edx
dec eax
jnz short Again
CopyBlock_End: ret
CopyBlock endp
comment @
CopyBlock proc uses esi edi ebx,\
x0:DWORD, y0:DWORD, x1:DWORD, y1:DWORD, src:DWORD,\
xd:DWORD, yd:DWORD, dst:DWORD
mov edx, x0
mov ecx, y0
mov ebx, x1
mov eax, y1
;----------------------
mov esi, TabOffLine[ecx*4] ; y0
add esi, src
add esi, edx ; SI Offset Src
mov edi, yd
mov edi, TabOffLine[edi*4]
add edi, dst
add edi, xd ; DI Offset Dst
sub ebx, edx
inc ebx ; BX Delta Y
sub eax, ecx
inc eax ; AX Delta X
mov edx, Screen_X
sub edx, ebx ; DX Delta Screen
Again:
mov ecx, ebx
shr ecx, 2
rep movsd
mov ecx, ebx
and ecx, 11b
rep movsb
add esi, edx
add edi, edx
dec eax
jne short Again
CopyBlock_End: ret
CopyBlock endp
@
;----------------------------------------------------------------------------
; SaveBlock( *screen, *buffer, x0, y0, dx, dy )
;
; DS:SI *screen
; ES:DI *buffer
; AX x0
; BX y0
; CX dx
; dx dy
;
SaveBlock proc uses esi edi ebx ebp,\
screen:DWORD, buffer:DWORD,\
x0:DWORD, y0:DWORD, deltax:DWORD, deltay:DWORD
mov edi, buffer
mov eax, x0
mov ebx, y0
mov ecx, deltax
mov edx, deltay
sub ecx, eax
sub edx, ebx ; DX = DeltaY
inc ecx
inc edx
mov esi, TabOffLine[ebx*4]
add esi, eax
add esi, screen ; SI Offset Src
mov ebx, ecx ; BX = DeltaX
mov eax, Screen_X
sub eax, ebx ; bp Delta Screen
mov ebp, ebx
inc edx
shr ebx, 2
and ebp, 11b
shr edx, 1
jnc short odd
Again:
mov ecx, ebx ; Delta X
rep movsd
mov ecx, ebp
rep movsb
add esi, eax
odd:
mov ecx, ebx ; Delta X
rep movsd
mov ecx, ebp
rep movsb
add esi, eax
dec edx
jne Again
ret
SaveBlock endp
comment @
SaveBlock proc uses esi edi ebx ebp,\
screen:DWORD, buffer:DWORD,\
x0:DWORD, y0:DWORD, deltax:DWORD, deltay:DWORD,\
mov edi, buffer
mov eax, x0
mov ebx, y0
mov ecx, deltax
mov edx, deltay
sub ecx, eax
sub edx, ebx ; DX = DeltaY
inc ecx
inc edx
mov esi, TabOffLine[ebx*4]
add esi, eax ; SI Offset Src
add esi, screen
mov ebx, ecx ; BX = DeltaX
mov ebp, Screen_X
sub ebp, ebx ; bp Delta Screen
Again:
mov ecx, ebx ; Delta X
shr ecx, 2
rep movsd
mov ecx, ebx
and ecx, 11b
rep movsb
add esi, ebp
dec edx
jne Again
ret
SaveBlock endp
@
;----------------------------------------------------------------------------
; RestoreBlock( *buffer, *screen, x0, y0, dx, dy )
;
; DS:SI *buffer
; ES:DI *screen
; AX x0
; BX y0
; CX x1
; dx y1
; Already Clipped
;
RestoreBlock proc uses esi edi ebx ebp,\
screen:DWORD, buffer:DWORD,\
x0:DWORD, y0:DWORD, deltax:DWORD, deltay:DWORD
mov esi, buffer
mov eax, x0
mov ebx, y0
mov ecx, deltax
mov edx, deltay
sub ecx, eax
sub edx, ebx ; DX = DeltaY
inc ecx
inc edx
mov edi, TabOffLine[ebx*4]
add edi, eax ; SI Offset Src
add edi, screen
mov ebx, ecx ; BX = DeltaX
mov ebp, Screen_X
sub ebp, ebx ; bp Delta Screen
Again:
mov ecx, ebx ; Delta X
shr ecx, 2
rep movsd
mov ecx, ebx
and ecx, 11b
rep movsb
add edi, ebp
dec edx
jne Again
ret
RestoreBlock endp
;----------------------------------------------------------------------------
; The
End

View File

@@ -0,0 +1,124 @@
;----------------------------------------------------------------------------
; S_BLOCK2.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
.data
EVEN
CptPixl dw 0
CptLine dw 0
include f:\projet\lib386\lib_svga\svga.ash
;----------------------------------------------------------------------------
.code
public NoLanguage CopyBlockOnBlack
;----------------------------------------------------------------------------
; ptsrc -> ptdst
; CopyBlockOnBlack( x0, y0, x1, y1, BufSrc, BufDst )
;
; Copy datas from BufSrc to Bufdst, but only on Black
;
CopyBlockOnBlack proc uses esi edi ebx ebp,\
x0:DWORD, y0:DWORD, x1:DWORD, y1:DWORD,\
ptsrc:DWORD, ptdst:DWORD
mov edx, x0
mov ecx, y0
mov ebx, x1
mov eax, y1
;---------------------- Compute Delta X & Y
sub ebx, edx ; EBX Delta X
sub eax, ecx ; EAX Delta Y
inc ebx ; EBX = Delta X + 1
inc eax ; EAX = Delta Y + 1
mov word ptr [CptPixl], bx
mov word ptr [CptLine], ax
;---------------------- Compute Adresse
mov eax, TabOffLine[ecx*4]
mov esi, ptsrc
mov edi, ptdst
add eax, edx
add esi, eax
add edi, eax
xor eax, eax ; Je cherche != 0
mov edx, Screen_X
sub edx, ebx ; DX Delta Screen
;----------------------
NewLine:
xor ebx, ebx
mov bx, [CptPixl]
;-----------------------------------------------------------------------------
ScanAgain:
mov ecx, ebx ; EBX Bytes to Scan
repne scasb ; Arret quand != 0
jne EndLine2 ; c'est fini!
dec edi ; EDI un peu trop loin
inc ecx ; ECX trop Petit
sub ebx, ecx ; EBX = Bytes Parcourus
add esi, ebx ; Maj ESI
mov ebx, ecx ; EBX = Bytes Restant
rep scasb ; Combien != 0 ?
je short UntilEnd ; Tous jusqu'a fin (Quick!
inc ecx ; Maj ECX
dec edi ; Maj EDI
sub ebx, ecx ; EBX = Nb Same Bytes
sub edi, ebx ; Recule EDI
xchg ecx, ebx
;-----------------------
mov ebp, ecx
shr ecx, 2
rep movsd ; movsD Plus Tard!
mov ecx, ebp
and ecx, 11b
rep movsb
;-----------------------
jmp short ScanAgain
UntilEnd:
sub edi, ebx
mov ecx, ebx
shr ecx, 2
rep movsd
mov ecx, ebx
and ecx, 11b
rep movsb
EndLine:
;-----------------------------------------------------------------------------
add edi, edx
add esi, edx
dec word ptr [CptLine]
jne short NewLine
;----------------------
ret
EndLine2:
add esi, ebx
add edi, edx
add esi, edx
dec word ptr [CptLine]
jne short NewLine
;----------------------
ret
CopyBlockOnBlack endp
;----------------------------------------------------------------------------
; The
End

View File

@@ -0,0 +1,75 @@
;----------------------------------------------------------------------------
; S_BLOCK.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386P
jumps
.model SMALL, SYSCALL
.data
include f:\projet\lib386\lib_svga\svga.ash
;----------------------------------------------------------------------------
.code
public NoLanguage CopyBlockIncrust
;----------------------------------------------------------------------------
; CopyBlockIncrust( x0, y0, x1, y1, *src, xd, yd, *dst )
;
CopyBlockIncrust proc uses esi edi ebx ebp,\
x0:DWORD, y0:DWORD, x1:DWORD, y1:DWORD, src:DWORD,\
xd:DWORD, yd:DWORD, dst:DWORD
mov edx, x0
mov ecx, y0
mov ebx, x1
mov eax, y1
;----------------------
mov esi, TabOffLine[ecx*4] ; y0
add esi, src
add esi, edx ; SI Offset Src
mov edi, yd
mov edi, TabOffLine[edi*4]
add edi, dst
add edi, xd ; DI Offset Dst
sub ebx, edx
inc ebx ; BX Delta Y
sub eax, ecx
inc eax ; AX Delta X
mov ebp, eax
mov edx, Screen_X
sub edx, ebx ; DX Delta Screen
Again:
mov ecx, ebx
loopx: lodsb
or al, al
jz incrust
mov byte ptr[edi], al
incrust: inc edi
dec ecx
jnz loopx
add esi, edx
add edi, edx
dec ebp
jne short Again
CopyBlock_End: ret
CopyBlockIncrust endp
;----------------------------------------------------------------------------
; The
End

93
LIB386/LIB_SVGA/S_BOX.ASM Normal file
View File

@@ -0,0 +1,93 @@
; S_BOX.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386p
jumps
.model SMALL, SYSCALL
.data
include svga.ash
.code
public NoLanguage Box
;----------------------------------------------------------------------------
; Box( x0, y0, x1, y1, col )
;
;
Box proc uses edi ebp ebx,\
X0:DWORD, Y0:DWORD, X1:DWORD, Y1:DWORD, Col:DWORD
;----------------------
mov eax, X0
mov ebx, Y0
mov ecx, X1
mov edx, Y1
cmp eax, ClipXmax
jg Box_End
cmp ecx, ClipXmin
jl Box_End
cmp ebx, ClipYmax
jg Box_End
cmp edx, ClipYmin
jl Box_End
TestLeft:
cmp eax, ClipXmin
jge TestRight
mov eax, ClipXmin
TestRight:
cmp ecx, ClipXmax
jle TestUp
mov ecx, ClipXmax
TestUp:
cmp ebx, ClipYmin
jge TestDown
mov ebx, ClipYmin
TestDown:
cmp edx, ClipYmax
jle OkNoClip
mov edx, ClipYmax
OkNoClip:
;----------------------
mov edi, ebx ; Y0
mov edi, TabOffLine[edi*4]
add edi, Log
add edi, eax ; EDI Offset Src
;----------------------
sub edx, ebx ; Init Delta Y
mov ebx, edx
inc ebx
mov edx, ecx ; Init Delta X
sub edx, eax
inc edx
;----------------------
mov al, byte ptr [Col]
mov ah, al ; Init Color
mov cx, ax
shl eax, 16
mov ax, cx
;----------------------
mov ebp, Screen_X
sub ebp, edx ; ebp Delta Screen
Again:
mov ecx, edx
shr ecx, 2
rep stosd
mov ecx, edx
and ecx, 11b
rep stosb
add edi, ebp
dec ebx
jne Again
Box_End:
ret
Box endp
;----------------------------------------------------------------------------
; The
End

View File

@@ -0,0 +1,346 @@
.model SMALL, SYSCALL
.code LIB_SVGA
.386
jumps
OSEG equ FS:
extrn curbk:WORD
extrn newbank:PROC
TestSVGA proc uses es ds si di,\
ptrlog:PTR
lds si, ptrlog
xor ax,ax
call newbank
mov ax,0A000h
mov es,ax
xor di,di
mov dx,100
b1:
mov ecx,80
rep movsd
add di,320
dec dx
jnz b1
mov ax,1
call newbank
xor di,di
mov dx,100
b2:
mov ecx,80
rep movsd
add di,320
dec dx
jnz b2
ret
TestSVGA endp
TestSVGA2 proc uses es ds si di,\
ptrlog:PTR
lds si, ptrlog
xor ax,ax
call newbank
mov ax,0A000h
mov es,ax
xor di,di
mov dx,200
b1:
mov bx,di
add bx,320
jnc ok1
mov cx,320
sub cx,bx
rep movsb
mov ax, OSEG[curbk]
inc ax
call newbank
mov cx,bx
rep movsb
jmp nxt
ok1:
mov ecx,80
rep movsd
nxt: mov di,bx
add di,320
dec dx
jnz b1
ret
TestSVGA2 endp
opt_stos_line macro
mov ax,cx
shr ecx, 2
rep movsd
and ax,3
mov cx,ax
;shr cx,1
;rep movsw
;rcl cx,1
rep movsb
endm
; CopyBox de MCGA vers SVGA
TestSVGA3 proc uses es ds si di,\
sox:WORD,soy:WORD,sol:WORD,soh:WORD,soptr:PTR,\
dex:WORD,dey:WORD
lds si, soptr
mov ax, soy
mov bx,ax
shl ax,2 ; *4
add ax,bx ; *5
shl ax,6 ; *320
add ax, sox
add si,ax
xor eax,eax
mov ax, dey
mov ebx,eax
shl eax,2 ; *4
add eax,ebx ; *5
shl eax,7 ; *640
mov bx, dex
add eax,ebx
mov bx,ax
shr eax,16 ; ax start bank
call newbank
mov di,bx
xor ebx,ebx
mov ax,0A000h
mov es,ax
mov ax, sol
mov cs:word ptr[patch_larg1],ax
mov cs:word ptr[patch_larg2],ax
mov cs:word ptr[patch_larg3],ax
neg ax
add ax,640
mov cs:word ptr[patch_deoff],ax
mov ax,320
sub ax, sol
mov cs:word ptr[patch_sooff],ax
jmp $+2
mov dx, soh
b1: mov bx,di
patch_larg1 equ $+2
add bx,1234h
jnc ok1
patch_larg2 equ $+1
mov cx,1234h
sub cx,bx
opt_stos_line
mov ax, OSEG[curbk]
inc ax
call newbank
mov cx,bx
opt_stos_line
jmp nxt
ok1: xor ecx,ecx
patch_larg3 equ $+1
mov cx,1234h
opt_stos_line
nxt: mov di,bx
patch_deoff equ $+2
add di,1234h
jnc ok2
mov ax, OSEG[curbk]
inc ax
call newbank
ok2:
patch_sooff equ $+2
add si,1234h
dec dx
jnz b1
ret
TestSVGA3 endp
; CopyBox de MCGA vers SVGA en incrustation coul 0
inc_line macro
local lbl1,lbl2,lbl3
jcxz lbl3
lbl1: lodsb
or al,al
jz lbl2
stosb
loop lbl1
jmp short lbl3
lbl2: inc di
loop lbl1
lbl3:
endm
TestSVGA4 proc uses es ds si di,\
sox:WORD,soy:WORD,sol:WORD,soh:WORD,soptr:PTR,\
dex:WORD,dey:WORD
lds si, soptr
mov ax, soy
mov bx,ax
shl ax,2 ; *4
add ax,bx ; *5
shl ax,6 ; *320
add ax, sox
add si,ax
xor eax,eax
mov ax, dey
mov ebx,eax
shl eax,2 ; *4
add eax,ebx ; *5
shl eax,7 ; *640
mov bx, dex
add eax,ebx
mov bx,ax
shr eax,16 ; ax start bank
call newbank
mov di,bx
xor ebx,ebx
mov ax,0A000h
mov es,ax
mov ax, sol
mov cs:word ptr[patch_larg1b],ax
mov cs:word ptr[patch_larg2b],ax
mov cs:word ptr[patch_larg3b],ax
neg ax
add ax,640
mov cs:word ptr[patch_deoffb],ax
mov ax,320
sub ax, sol
mov cs:word ptr[patch_sooffb],ax
jmp $+2
mov dx, soh
b1: mov bx,di
patch_larg1b equ $+2
add bx,1234h
jnc ok1
patch_larg2b equ $+1
mov cx,1234h
sub cx,bx
inc_line
mov ax, OSEG[curbk]
inc ax
call newbank
mov cx,bx
inc_line
jmp nxt
ok1: xor ecx,ecx
patch_larg3b equ $+1
mov cx,1234h
inc_line
nxt: mov di,bx
patch_deoffb equ $+2
add di,1234h
jnc ok2
mov ax, OSEG[curbk]
inc ax
call newbank
ok2:
patch_sooffb equ $+2
add si,1234h
dec dx
jnz b1
ret
TestSVGA4 endp
end

57
LIB386/LIB_SVGA/S_DLL.C Normal file
View File

@@ -0,0 +1,57 @@
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*
SAMP.C 386
(c) Adeline 1993
*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <i86.h>
extern void *NewBank;
extern void *InitSvgaMode;
extern void *Enable;
char *SvgaError = "Error SvgaDriver:";
/*-------------------------------------------------------------------------*/
LONG SvgaInitDLL(char *driverpathname)
{
char *dll, *drvr;
void **funcs;
//
// Load driver file
//
dll = FILE_read(driverpathname, NULL);
if (dll==NULL)
{
printf("%s Could not load driver '%s'.\n", SvgaError, driverpathname );
return FALSE ;
}
drvr = DLL_load(dll, DLLMEM_ALLOC | DLLSRC_MEM, NULL);
Free(dll);
if (drvr==NULL)
{
printf("%s Invalid DLL image.\n", SvgaError );
return FALSE ;
}
funcs = *(void ***)drvr;
InitSvgaMode = funcs[0];
NewBank = funcs[1];
Enable = funcs[2];
printf("%s", drvr+4);
return TRUE;
}
/*-------------------------------------------------------------------------*/

1118
LIB386/LIB_SVGA/S_FILLV.ASM Normal file

File diff suppressed because it is too large Load Diff

1567
LIB386/LIB_SVGA/S_FIND.ASM Normal file

File diff suppressed because it is too large Load Diff

289
LIB386/LIB_SVGA/S_LINE.ASM Normal file
View File

@@ -0,0 +1,289 @@
;----------------------------------------------------------------------------
; S_LINE.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386p
jumps
.model FLAT, SYSCALL
.data
include svga.ash
EVEN
couleur dw 00
.code
public NoLanguage Line
public NoLanguage Line_A
;----------------------------------------------------------------------------
; Line( x0, y0, x1, y1, coul )
;
Line proc uses esi edi ebp ebx,\
x0:DWORD, y0:DWORD,\
x1:DWORD, y1:DWORD,\
coul:DWORD
; X0:ax Y0:bx
; X1:cx Y1:DX
; couleur: bp
mov eax, x0
mov ebx, y0
mov ecx, x1
mov edx, y1
mov ebp, coul
call Line_A
ret
Line endp
Line_A proc
; X0:eax Y0:ebx
; X1:ecx Y1:edx
mov [couleur], bp
cmp eax, ecx ; x0 < x1
jle sensok
xchg eax, ecx
xchg ebx, edx
sensok:
; XY 0
onceagain: xor bp, bp
cmp eax, [ClipXmin] ; x0
jge ncxi
or bp, 1
jmp short ncxg
ncxi: cmp eax, [ClipXmax]
jg notseen
ncxg: cmp ebx, [ClipYmin]
jge ncyi
or bp, 8
jmp short ncya
ncyi: cmp ebx, [ClipYmax]
jle ncya
or bp, 4
ncya:
; XY 1
shl bp, 8
cmp ecx, [ClipXmin]
jl notseen
cmp ecx, [ClipXmax]
jle ncx2a
or bp, 2
ncx2a:
cmp edx, [ClipYmin]
jge ncy2i
or bp, 8
jmp short ncy2a
ncy2i: cmp edx, [ClipYmax]
jle ncy2a
or bp, 4
ncy2a:
; test
mov si, bp
shr si, 8
test si, bp
jnz notseen
or si, bp
and si, 0FFh
jz draw
mov edi, ecx
sub edi, eax ; edi delta x
mov esi, edx
sub esi, ebx ; esi delta y
test bp, 100h
jz c0
mov ebp, edx
sub eax, [ClipXmin] ; xmin - x0
neg eax
imul si ; * dy
idiv di ; / dx
movsx eax, ax
add ebx, eax ; y0 +=
mov eax, [ClipXmin] ; x0 = xmin
mov edx, ebp
jmp onceagain
c0:
test bp, 800h
jz c1
mov ebp, edx
xchg eax, ebx
sub eax, [ClipYmin] ; ymin - y0
neg eax
imul di ; * dx
idiv si ; / dy
movsx eax, ax
add eax, ebx ; x0 +=
mov ebx, [ClipYmin] ; y0 = ymin
mov edx, ebp
jmp onceagain
c1:
test bp, 400h
jz c2
mov ebp, edx
xchg eax, ebx
sub eax, [ClipYmax] ; ymax - y0
neg eax
imul di ; * dx
idiv si ; / dy
movsx eax, ax
add eax, ebx ; x0 +=
mov ebx, [ClipYmax] ; y0 = ymax
mov edx, ebp
jmp onceagain
c2:
test bp, 2
jz c3
mov ecx, eax ; save x0
mov eax, [ClipXmax]
sub eax, ecx ; xmax - x0
imul si ; * dy
idiv di ; / dx
movsx edx, ax
add edx, ebx ; + y0
mov eax, ecx ; restore x0
mov ecx, [ClipXmax]
jmp onceagain
c3:
test bp, 8
jz c4
mov ecx, eax
mov eax, ebx
sub eax, [ClipYmin] ; ymin - y0
neg eax
imul di ; * dx
idiv si ; / dy
movsx edx, ax
mov eax, ecx
add ecx, edx ; x0 +=
mov edx, [ClipYmin]
jmp onceagain
c4:
test bp, 4
jz onceagain
mov ecx, eax
mov eax, ebx
sub eax, [ClipYmax] ; ymax - y0
neg eax
imul di ; * dx
idiv si ; / dy
movsx edx, ax
mov eax, ecx
add ecx, edx
mov edx, [ClipYmax]
jmp onceagain
notseen: ret
;----------------------------------------------------------------------------
draw: mov esi, 640
sub ecx, eax
sub edx, ebx
jns descend
neg esi
neg edx
descend: mov edi, Log
add edi, TabOffLine[ ebx * 4 ]
add edi, eax
mov ax, [couleur]
cmp ecx, edx
jl vertical
horizontal: mov ebp, ecx
shl ebp, 1
mov ebx, ecx
shl edx, 1
inc ecx
jmp loopX
noovfy: dec ecx
jz exit
loopX: mov byte ptr[edi], al
inc edi
sub ebx, edx
jnc noovfy
add ebx, ebp
add edi, esi
dec ecx
jnz loopX
ret
vertical: xchg ecx, edx
mov ebp, ecx
shl ebp, 1
mov ebx, ecx
shl edx, 1
inc ecx
jmp loopY
noovfx: add edi, esi
dec ecx
jz exit
loopY: mov byte ptr[edi], al
sub ebx, edx
jnc noovfx
add ebx, ebp
adc edi, esi
dec ecx
jnz loopY
exit:
ret
Line_A endp
end

217
LIB386/LIB_SVGA/S_MODE.ASM Normal file
View File

@@ -0,0 +1,217 @@
.model SMALL, SYSCALL
include vesa.inc
;
; VGAKIT Version 5.2b
;
; Copyright 1988,89,90,91,92 John Bridges
; Free for use in commercial, shareware or freeware applications
;
; SVGAMODE.ASM
;
;
.data
extrn cirrus:byte,everex:byte,paradise:byte,tseng:byte,trident:byte
extrn t8900:byte,ativga:byte,aheada:byte,aheadb:byte
extrn oaktech:byte,video7:byte,chipstech:byte,tseng4:byte,genoa:byte
extrn ncr:byte,compaq:byte,acumos:byte,vesa:byte
extrn curbk:word,bksize:word
extrn vesafunc:dword
public maxx,maxy,scanline,ourseg
maxx dw ? ;scanline of screen in pixels
maxy dw ? ;height of screen in pixels
scanline dw ? ;actual width screen in bytes
ourseg dw ? ;segment of screen buffer
public adrtbl
adrtbl dd 1024 dup (?) ;offset and bank for each scanline
.code LIB_SVGA
public mkadrtbl
public svgamode
public txtmode
public setmany
mkadrtbl proc uses di si
mov di,offset adrtbl
mov ax,ds
mov es,ax
mov bx,[maxy]
mov ax,[bksize]
cmp ax,64
jz nobnk
mov cl,10
shl ax,cl
dec ax
mov si,ax
mov cl,9
mov ax,[bksize]
shlp: inc cl
shr ax,1
jnz shlp
xor ax,ax
xor dx,dx
lp: push ax
shr ax,cl
add dx,ax
pop ax
and ax,si
stosw
xchg ax,dx
stosw
xchg ax,dx
add ax,[scanline]
dec bx
jnz lp
ret
nobnk: xor ax,ax
xor dx,dx
mov si,[scanline]
mov cx,bx
nlp: stosw
xchg ax,dx
stosw
xchg ax,dx
add ax,si
adc dx,0
loop nlp
ret
mkadrtbl endp
svgamode proc ;Set 640x480x256 on most SVGA cards
mov [ourseg],0a000h
mov ax,640
mov [maxx],ax ;default width to 640 for now
mov [scanline],ax
cmp [vesa],0
jz novs
mov bx,101h
call vesaset
jmp godo2
novs: cmp [compaq],0
jz nocp
mov [scanline],1024
mov ax,2eh
jmp godo
nocp: cmp [genoa],0
jz nogn
mov ax,5ch
jmp godo
nogn: cmp [ncr],0
jz noncr
mov ax,5fh
jmp godo
noncr: cmp [oaktech],0
jz noak
mov ax,53h
jmp short godo
noak: cmp [aheada],0
jnz @f
cmp [aheadb],0
jz noab
@@: mov ax,61h
jmp short godo
noab: cmp [everex],0
jz noev
mov ax,70h
mov bl,30h
jmp short godo
noev: cmp [ativga],0
jz noati
mov ax,62h
jmp short godo
noati: cmp [trident],0
jz notr
mov ax,5dh
jmp short godo
notr: cmp [video7],0
jz nov7
mov ax,6f05h
mov bl,67h
jmp short godo
nov7: cmp [chipstech],0
jz noct
mov ax,79h
jmp short godo
noct: cmp [acumos],0
jnz dopd
cmp [paradise],0
jz nopd
dopd: mov ax,5fh
jmp short godo
nopd: cmp [tseng],0
jz nots
mov ax,2eh
godo: int 10h
godo2: mov [curbk],-1
mov ax,40h
mov es,ax
mov al,es:[84h] ;get height of screen
inc al
mul byte ptr es:[85h]
mov [maxy],ax
call mkadrtbl
nots: ret
svgamode endp
vesaset proc near uses di
local modebuf[260]:byte ; extra large to make up for
; bugs in some VESA VBE's
push bx
mov ax,4f02h ; set the VESA videomode
int 10h
pop cx
mov ax,ss
mov es,ax
lea di,modebuf[0] ; get the mode information
mov ax,4f01h
int 10h
mov ax,modebuf.vesamode.WinGranularity
mov [bksize],ax ; bank size from vesamode structure
mov ax,modebuf.vesamode.BytesPerLine
mov [scanline],ax ; scan line byte width from vesamode
mov ax,word ptr modebuf.vesamode.WinFuncPtr
mov word ptr [vesafunc],ax
mov ax,word ptr modebuf.vesamode.WinFuncPtr+2
mov word ptr [vesafunc+2],ax
ret
vesaset endp
txtmode proc
mov ax,3
int 10h
ret
txtmode endp
setmany proc uses es,\
palbuf:ptr byte,begcol:word,numcol:word
les dx,[palbuf]
mov bx,[begcol]
mov cx,[numcol]
mov ax,1012h
int 10h
ret
setmany endp
end

238
LIB386/LIB_SVGA/S_MOUSE.C Normal file
View File

@@ -0,0 +1,238 @@
#include "\projet\lib386\lib_sys\adeline.h"
#include "\projet\lib386\lib_sys\lib_sys.h"
#include "\projet\lib386\lib_svga\lib_svga.h"
#include <stdio.h>
#include <dos.h>
#include <i86.h>
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*
ÛÜ ÜÛ ÛßßßÛ Û Û ÛÛßßß Ûßßßß
ÛÛß Û ÛÛ Û ÛÛ Û ßßßßÛ ÛÛßß
ßß ß ßßßßß ßßßßß ßßßßß ßßßßß
*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
volatile LONG Click = 0 ;
volatile LONG Mouse_X = 0 ;
volatile LONG Mouse_Y = 0 ;
LONG Mouse_X_Dep = 0 ;
LONG Mouse_Y_Dep = 0 ;
LONG OldX0Mouse=-1, OldY0Mouse, OldX1Mouse, OldY1Mouse ;
WORD DefMouse = 0 ;
LONG FlagMouse = TRUE ;
UBYTE *GphMouse ;
UBYTE *BufferMouse ;
extern UBYTE *Log ;
extern UBYTE BinGphMouse ;
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
#pragma off (check_stack)
void _loadds far click_handler (int max, int mcx, int mdx)
{
#pragma aux click_handler parm [EAX] [ECX] [EDX]
Mouse_X = mcx>>3 ;
Mouse_Y = mdx>>3 ;
if( max & 0x02 ) Click |= 1 ;
if( max & 0x04 ) Click &= ~1 ;
if( max & 0x08 ) Click |= 2 ;
if( max & 0x10 ) Click &= ~2 ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void SetMouseBox( LONG x0, LONG y0, LONG x1, LONG y1 )
{
struct SREGS sregs ;
union REGS inregs, outregs ;
inregs.w.ax = 0x07 ;
inregs.w.cx = x0<<3 ;
inregs.w.dx = x1<<3 ;
int386 (0x33, &inregs, &outregs);
inregs.w.ax = 0x08 ;
inregs.w.cx = y0<<3 ;
inregs.w.dx = y1<<3 ;
int386 (0x33, &inregs, &outregs);
}
/*--------------------------------------------------------------------------*/
void SetMouseSpeed( LONG dx, LONG dy )
{
struct SREGS sregs ;
union REGS inregs, outregs ;
inregs.w.ax = 0x0F ;
inregs.w.cx = (UWORD)dx ;
inregs.w.dx = (UWORD)dy ;
int386 (0x33, &inregs, &outregs);
}
/*--------------------------------------------------------------------------*/
void SetMousePos( LONG x, LONG y )
{
struct SREGS sregs ;
union REGS inregs, outregs ;
inregs.w.ax = 0x04 ;
inregs.w.cx = (UWORD)x<<3 ;
inregs.w.dx = (UWORD)y<<3 ;
int386 (0x33, &inregs, &outregs);
inregs.w.ax = 0x01 ;
int386 (0x33, &inregs, &outregs);
Mouse_X = x ;
Mouse_Y = y ;
}
/*--------------------------------------------------------------------------*/
void GetMouseDep()
{
struct SREGS sregs ;
union REGS inregs, outregs ;
inregs.w.ax = 0x0B ;
int386 (0x33, &inregs, &outregs);
Mouse_X_Dep = (LONG)((WORD)outregs.w.cx) ;
Mouse_Y_Dep = (LONG)((WORD)outregs.w.dx) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void ShowMouse( LONG flag )
{
if( !flag )
{
if( FlagMouse )
{
if( OldX0Mouse != -1 )
{
CopyBlockPhys( OldX0Mouse,OldY0Mouse, OldX1Mouse, OldY1Mouse ) ;
OldX0Mouse = -1 ;
}
FlagMouse = FALSE ;
}
}
else
{
if( !FlagMouse )
{
OldX0Mouse = -1 ; /* force aff et evite restore */
AffMouse() ;
FlagMouse = TRUE ;
}
}
}
/*--------------------------------------------------------------------------*/
void AffMouse()
{
LONG dx, dy ;
LONG x0, y0 ;
LONG x1, y1 ;
if( FlagMouse )
{
x0 = Mouse_X ;
y0 = Mouse_Y ;
if( (OldX0Mouse == x0) AND (OldY0Mouse == y0) ) return ;
GetDxDyGraph( DefMouse, &dx, &dy, GphMouse ) ;
x1 = x0 + dx - 1 ;
y1 = y0 + dy - 1 ;
MemoClip() ;
SetClip( x0,y0,x1,y1 ) ;
if( OldX0Mouse != -1 )
CopyBlockPhys( OldX0Mouse,OldY0Mouse, OldX1Mouse, OldY1Mouse ) ;
SaveBlock( Log, BufferMouse, x0,y0, ClipXmax,ClipYmax ) ;
AffGraph( DefMouse, x0, y0, GphMouse ) ;
CopyBlockPhys( x0,y0, ClipXmax,ClipYmax ) ;
RestoreBlock( Log, BufferMouse, x0,y0, ClipXmax,ClipYmax ) ;
OldX0Mouse = x0 ;
OldY0Mouse = y0 ;
OldX1Mouse = ClipXmax ;
OldY1Mouse = ClipYmax ;
RestoreClip() ;
}
}
/*--------------------------------------------------------------------------*/
void SetMouse( WORD num )
{
DefMouse = num ;
OldX0Mouse = -1 ;
AffMouse() ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/
void InitMouse()
{
struct SREGS sregs ;
union REGS inregs, outregs ;
int installed = 0 ;
int orig_mode = 0 ;
int far *ptr ;
int (far *function_ptr)() ;
segread(&sregs) ;
/* check for mouse driver */
inregs.w.ax = 0 ;
int386 (0x33, &inregs, &outregs);
if( installed = (outregs.w.ax != -1) ) return ;
SetMouseBox( 0, 0, 639, 479 ) ;
SetMouseSpeed( 4, 4 ) ;
GphMouse = &BinGphMouse ;
BufferMouse = Malloc( 48*48 ) ; /* max size mouse ! */
Click = 0 ;
FlagMouse = TRUE ;
/* install click watcher */
inregs.w.ax = 0xC ;
inregs.w.cx = 0x01 | 0x02 | 0x04 | 0x08 |0x10 ;
function_ptr = click_handler ;
inregs.x.edx = FP_OFF( function_ptr ) ;
sregs.es = FP_SEG( function_ptr ) ;
int386x( 0x33, &inregs, &outregs, &sregs );
}
/*--------------------------------------------------------------------------*/
void ClearMouse()
{
struct SREGS sregs ;
union REGS inregs, outregs ;
inregs.w.ax = 0 ;
int386( 0x33, &inregs, &outregs );
FlagMouse = FALSE ;
Free( BufferMouse ) ;
}
/*ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ*/

View File

@@ -0,0 +1,153 @@
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
.386p
.model SMALL, SYSCALL
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
.data
public NoLanguage BinGphMouse
BinGphMouse LABEL WORD
db 28, 0, 0, 0, 149, 0, 0, 0, 14, 1, 0, 0, 194, 1, 0, 0
db 132, 2, 0, 0, 57, 3, 0, 0, 235, 3, 0, 0, 10, 15, 0, 0
db 2, 130, 16, 6, 2, 67, 16, 15, 15, 16, 5, 4, 64, 16, 130, 15
db 64, 16, 4, 4, 64, 16, 131, 15, 64, 16, 3, 4, 64, 16, 132, 15
db 64, 16, 2, 4, 64, 16, 133, 15, 64, 16, 1, 4, 64, 16, 134, 15
db 64, 16, 0, 3, 64, 16, 135, 15, 64, 16, 3, 64, 16, 135, 15, 64
db 16, 4, 64, 16, 133, 15, 65, 16, 16, 0, 4, 67, 16, 15, 15, 16
db 130, 15, 64, 16, 1, 5, 0, 130, 16, 131, 15, 64, 16, 0, 5, 3
db 64, 16, 130, 15, 64, 16, 0, 5, 3, 64, 16, 130, 15, 64, 16, 0
db 3, 4, 130, 16, 1, 10, 15, 0, 0, 2, 130, 14, 6, 2, 67, 14
db 12, 12, 14, 5, 4, 64, 14, 130, 12, 64, 14, 4, 4, 64, 14, 131
db 12, 64, 14, 3, 4, 64, 14, 132, 12, 64, 14, 2, 4, 64, 14, 133
db 12, 64, 14, 1, 4, 64, 14, 134, 12, 64, 14, 0, 3, 64, 14, 135
db 12, 64, 14, 3, 64, 14, 135, 12, 64, 14, 4, 64, 14, 133, 12, 65
db 14, 14, 0, 4, 67, 14, 12, 12, 14, 130, 12, 64, 14, 1, 5, 0
db 130, 14, 131, 12, 64, 14, 0, 5, 3, 64, 14, 130, 12, 64, 14, 0
db 5, 3, 64, 14, 130, 12, 64, 14, 0, 3, 4, 130, 14, 1, 14, 17
db 0, 0, 3, 3, 65, 16, 16, 7, 3, 2, 67, 16, 15, 15, 16, 6
db 3, 1, 69, 16, 15, 16, 16, 15, 16, 5, 3, 1, 69, 16, 15, 16
db 16, 15, 16, 5, 3, 1, 69, 16, 15, 16, 16, 15, 16, 5, 3, 1
db 70, 16, 15, 16, 16, 15, 16, 16, 4, 5, 1, 67, 16, 15, 16, 16
db 130, 15, 130, 16, 1, 5, 1, 70, 16, 15, 16, 16, 15, 16, 16, 130
db 15, 64, 16, 0, 2, 0, 76, 16, 15, 15, 16, 16, 15, 16, 16, 15
db 16, 16, 15, 16, 3, 67, 16, 15, 16, 15, 132, 16, 68, 15, 16, 16
db 15, 16, 3, 67, 16, 15, 16, 15, 135, 16, 65, 15, 16, 3, 65, 16
db 15, 137, 16, 65, 15, 16, 3, 65, 16, 15, 137, 16, 65, 15, 16, 3
db 65, 16, 15, 137, 16, 65, 15, 16, 4, 0, 65, 16, 15, 136, 16, 65
db 15, 16, 5, 1, 65, 16, 15, 134, 16, 65, 15, 16, 0, 3, 2, 136
db 16, 1, 15, 16, 0, 0, 3, 1, 138, 16, 1, 5, 0, 64, 16, 138
db 15, 64, 16, 0, 5, 67, 16, 15, 16, 15, 134, 16, 64, 15, 0, 65
db 15, 16, 5, 67, 16, 15, 16, 15, 134, 16, 64, 15, 0, 65, 15, 16
db 3, 67, 16, 15, 16, 15, 134, 16, 67, 15, 16, 15, 16, 3, 67, 16
db 15, 16, 15, 134, 16, 67, 15, 16, 15, 16, 3, 67, 16, 15, 16, 15
db 134, 16, 67, 15, 16, 15, 16, 3, 67, 16, 15, 16, 16, 134, 15, 67
db 16, 16, 15, 16, 3, 65, 16, 15, 138, 16, 65, 15, 16, 3, 65, 16
db 15, 138, 16, 65, 15, 16, 5, 65, 16, 15, 130, 16, 132, 15, 130, 16
db 65, 15, 16, 1, 78, 16, 15, 16, 16, 15, 16, 15, 15, 16, 16, 15
db 16, 16, 15, 16, 1, 78, 16, 15, 16, 16, 15, 16, 15, 15, 16, 16
db 15, 16, 16, 15, 16, 2, 0, 77, 16, 15, 16, 15, 16, 15, 15, 16
db 16, 15, 16, 16, 15, 16, 5, 1, 64, 16, 137, 15, 64, 16, 0, 3
db 2, 137, 16, 1, 19, 13, 0, 0, 5, 0, 131, 16, 8, 131, 16, 0
db 7, 65, 16, 16, 130, 14, 65, 16, 16, 4, 65, 16, 16, 130, 14, 65
db 16, 16, 3, 67, 16, 14, 16, 14, 138, 16, 67, 14, 16, 14, 16, 7
db 66, 16, 16, 14, 130, 16, 65, 14, 14, 130, 16, 65, 14, 14, 130, 16
db 66, 14, 16, 16, 7, 0, 66, 16, 14, 14, 130, 16, 68, 14, 14, 16
db 14, 14, 130, 16, 66, 14, 14, 16, 0, 5, 1, 68, 16, 14, 16, 14
db 16, 132, 14, 68, 16, 14, 16, 14, 16, 1, 5, 1, 68, 16, 16, 14
db 16, 16, 132, 14, 68, 16, 16, 14, 16, 16, 1, 5, 2, 64, 16, 138
db 14, 64, 16, 2, 5, 2, 64, 16, 138, 14, 64, 16, 2, 7, 2, 64
db 16, 131, 14, 130, 16, 131, 14, 64, 16, 2, 7, 3, 64, 16, 131, 14
db 64, 16, 131, 14, 64, 16, 3, 5, 4, 66, 16, 14, 14, 130, 16, 66
db 14, 14, 16, 4, 3, 5, 134, 16, 5, 19, 13, 0, 0, 5, 0, 131
db 16, 8, 131, 16, 0, 7, 65, 16, 16, 130, 14, 65, 16, 16, 4, 65
db 16, 16, 130, 14, 65, 16, 16, 3, 67, 16, 14, 16, 14, 138, 16, 67
db 14, 16, 14, 16, 7, 66, 16, 16, 14, 130, 16, 65, 14, 14, 130, 16
db 65, 14, 14, 130, 16, 66, 14, 16, 16, 7, 0, 67, 16, 14, 14, 16
db 131, 14, 64, 16, 131, 14, 67, 16, 14, 14, 16, 0, 5, 1, 66, 16
db 14, 16, 136, 14, 66, 16, 14, 16, 1, 7, 1, 66, 16, 16, 14, 130
db 16, 130, 14, 130, 16, 66, 14, 16, 16, 1, 5, 2, 64, 16, 138, 14
db 64, 16, 2, 5, 2, 64, 16, 138, 14, 64, 16, 2, 7, 2, 64, 16
db 131, 14, 130, 16, 131, 14, 64, 16, 2, 7, 3, 64, 16, 131, 14, 64
db 16, 131, 14, 64, 16, 3, 5, 4, 66, 16, 14, 14, 130, 16, 66, 14
db 14, 16, 4, 5, 5, 130, 16, 0, 130, 16, 5, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0
comment #
db 28, 0, 0, 0, 150, 0, 0, 0, 16, 1, 0, 0, 203, 1, 0, 0
db 143, 2, 0, 0, 70, 3, 0, 0, 250, 3, 0, 0, 10, 15, 2, 130
db 16, 6, 2, 67, 16, 15, 15, 16, 5, 4, 64, 16, 130, 15, 64, 16
db 4, 4, 64, 16, 131, 15, 64, 16, 3, 4, 64, 16, 132, 15, 64, 16
db 2, 5, 64, 16, 133, 15, 64, 16, 0, 0, 4, 64, 16, 134, 15, 64
db 16, 0, 3, 64, 16, 135, 15, 64, 16, 3, 64, 16, 135, 15, 64, 16
db 4, 64, 16, 133, 15, 65, 16, 16, 0, 5, 67, 16, 15, 15, 16, 130
db 15, 64, 16, 0, 0, 5, 0, 130, 16, 131, 15, 64, 16, 0, 5, 3
db 64, 16, 130, 15, 64, 16, 0, 5, 3, 64, 16, 130, 15, 64, 16, 0
db 4, 4, 130, 16, 0, 0, 10, 15, 2, 130, 14, 6, 2, 67, 14, 12
db 12, 14, 5, 4, 64, 14, 130, 12, 64, 14, 4, 4, 64, 14, 131, 12
db 64, 14, 3, 4, 64, 14, 132, 12, 64, 14, 2, 5, 64, 14, 133, 12
db 64, 14, 0, 0, 4, 64, 14, 134, 12, 64, 14, 0, 3, 64, 14, 135
db 12, 64, 14, 3, 64, 14, 135, 12, 64, 14, 4, 64, 14, 133, 12, 65
db 14, 14, 0, 5, 67, 14, 12, 12, 14, 130, 12, 64, 14, 0, 0, 5
db 0, 130, 14, 131, 12, 64, 14, 0, 5, 3, 64, 14, 130, 12, 64, 14
db 0, 5, 3, 64, 14, 130, 12, 64, 14, 0, 4, 4, 130, 14, 0, 0
db 14, 17, 3, 3, 65, 16, 16, 7, 3, 2, 67, 16, 15, 15, 16, 6
db 4, 0, 0, 69, 16, 15, 16, 16, 15, 16, 5, 4, 0, 0, 69, 16
db 15, 16, 16, 15, 16, 5, 4, 0, 0, 69, 16, 15, 16, 16, 15, 16
db 5, 4, 0, 0, 70, 16, 15, 16, 16, 15, 16, 16, 4, 7, 0, 0
db 67, 16, 15, 16, 16, 130, 15, 130, 16, 0, 0, 6, 0, 0, 70, 16
db 15, 16, 16, 15, 16, 16, 130, 15, 64, 16, 0, 2, 0, 76, 16, 15
db 15, 16, 16, 15, 16, 16, 15, 16, 16, 15, 16, 3, 67, 16, 15, 16
db 15, 132, 16, 68, 15, 16, 16, 15, 16, 3, 67, 16, 15, 16, 15, 135
db 16, 65, 15, 16, 3, 65, 16, 15, 137, 16, 65, 15, 16, 3, 65, 16
db 15, 137, 16, 65, 15, 16, 3, 65, 16, 15, 137, 16, 65, 15, 16, 4
db 0, 65, 16, 15, 136, 16, 65, 15, 16, 6, 0, 0, 65, 16, 15, 134
db 16, 65, 15, 16, 0, 4, 2, 136, 16, 0, 0, 15, 16, 5, 0, 0
db 138, 16, 0, 0, 5, 0, 64, 16, 138, 15, 64, 16, 0, 5, 67, 16
db 15, 16, 15, 134, 16, 64, 15, 0, 65, 15, 16, 5, 67, 16, 15, 16
db 15, 134, 16, 64, 15, 0, 65, 15, 16, 3, 67, 16, 15, 16, 15, 134
db 16, 67, 15, 16, 15, 16, 3, 67, 16, 15, 16, 15, 134, 16, 67, 15
db 16, 15, 16, 3, 67, 16, 15, 16, 15, 134, 16, 67, 15, 16, 15, 16
db 3, 67, 16, 15, 16, 16, 134, 15, 67, 16, 16, 15, 16, 3, 65, 16
db 15, 138, 16, 65, 15, 16, 3, 65, 16, 15, 138, 16, 65, 15, 16, 5
db 65, 16, 15, 130, 16, 132, 15, 130, 16, 65, 15, 16, 1, 78, 16, 15
db 16, 16, 15, 16, 15, 15, 16, 16, 15, 16, 16, 15, 16, 1, 78, 16
db 15, 16, 16, 15, 16, 15, 15, 16, 16, 15, 16, 16, 15, 16, 2, 0
db 77, 16, 15, 16, 15, 16, 15, 15, 16, 16, 15, 16, 16, 15, 16, 6
db 0, 0, 64, 16, 137, 15, 64, 16, 0, 4, 2, 137, 16, 0, 0, 19
db 13, 5, 0, 131, 16, 8, 131, 16, 0, 7, 65, 16, 16, 130, 14, 65
db 16, 16, 4, 65, 16, 16, 130, 14, 65, 16, 16, 3, 67, 16, 14, 16
db 14, 138, 16, 67, 14, 16, 14, 16, 7, 66, 16, 16, 14, 130, 16, 65
db 14, 14, 130, 16, 65, 14, 14, 130, 16, 66, 14, 16, 16, 7, 0, 66
db 16, 14, 14, 130, 16, 68, 14, 14, 16, 14, 14, 130, 16, 66, 14, 14
db 16, 0, 7, 0, 0, 68, 16, 14, 16, 14, 16, 132, 14, 68, 16, 14
db 16, 14, 16, 0, 0, 7, 0, 0, 68, 16, 16, 14, 16, 16, 132, 14
db 68, 16, 16, 14, 16, 16, 0, 0, 5, 2, 64, 16, 138, 14, 64, 16
db 2, 5, 2, 64, 16, 138, 14, 64, 16, 2, 7, 2, 64, 16, 131, 14
db 130, 16, 131, 14, 64, 16, 2, 7, 3, 64, 16, 131, 14, 64, 16, 131
db 14, 64, 16, 3, 5, 4, 66, 16, 14, 14, 130, 16, 66, 14, 14, 16
db 4, 3, 5, 134, 16, 5, 19, 13, 5, 0, 131, 16, 8, 131, 16, 0
db 7, 65, 16, 16, 130, 14, 65, 16, 16, 4, 65, 16, 16, 130, 14, 65
db 16, 16, 3, 67, 16, 14, 16, 14, 138, 16, 67, 14, 16, 14, 16, 7
db 66, 16, 16, 14, 130, 16, 65, 14, 14, 130, 16, 65, 14, 14, 130, 16
db 66, 14, 16, 16, 7, 0, 67, 16, 14, 14, 16, 131, 14, 64, 16, 131
db 14, 67, 16, 14, 14, 16, 0, 7, 0, 0, 66, 16, 14, 16, 136, 14
db 66, 16, 14, 16, 0, 0, 9, 0, 0, 66, 16, 16, 14, 130, 16, 130
db 14, 130, 16, 66, 14, 16, 16, 0, 0, 5, 2, 64, 16, 138, 14, 64
db 16, 2, 5, 2, 64, 16, 138, 14, 64, 16, 2, 7, 2, 64, 16, 131
db 14, 130, 16, 131, 14, 64, 16, 2, 7, 3, 64, 16, 131, 14, 64, 16
db 131, 14, 64, 16, 3, 5, 4, 66, 16, 14, 14, 130, 16, 66, 14, 14
db 16, 4, 5, 5, 130, 16, 0, 130, 16, 5, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
db 0, 0, 0, 0, 0, 0
#
.code
;ヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘヘ
; The
End

142
LIB386/LIB_SVGA/S_PAL.ASM Normal file
View File

@@ -0,0 +1,142 @@
;----------------------------------------------------------------------------
; S_PAL.ASM 386
; (c) Adeline 1993
;----------------------------------------------------------------------------
.386p
jumps
.model SMALL, SYSCALL
;----------------------------------------------------------------------------
.data
include svga.ash
MyTab db 768 dup(0)
;----------------------------------------------------------------------------
.code
public NoLanguage Palette
public NoLanguage PalMulti
public NoLanguage PalOne
;----------------------------------------------------------------------------
; Palette( (UBYTE*)PalColor )
;
Palette proc uses esi edi,\
PalColor:DWORD
;----------------------
mov esi, PalColor
lea edi, MyTab
mov ecx, 256
;----------------------
Again: mov al, [esi]
shr al, 2
mov [edi], al
mov al, [esi+1]
shr al, 2
mov [edi+1], al
mov al, [esi+2]
shr al, 2
mov [edi+2], al
add esi, 3
add edi, 3
dec ecx
jnz Again
;----------------------
lea esi, MyTab
mov dx, 03c8h
xor ax, ax
out dx, al
inc dx
mov ecx, 256
Encore:
outsb ; R
outsb ; G
outsb ; B
dec ecx
jnz Encore
;----------------------
ret
Palette endp
;----------------------------------------------------------------------------
; Palette( (UBYTE*)PalColor )
;
PalMulti proc uses esi edi ebx,\
colstart:DWORD, nbcol:DWORD, PalColor:DWORD
;----------------------
mov esi, PalColor
lea edi, MyTab
mov ecx, nbcol
;----------------------
Again: mov al, [esi]
shr al, 2
mov [edi], al
mov al, [esi+1]
shr al, 2
mov [edi+1], al
mov al, [esi+2]
shr al, 2
mov [edi+2], al
add esi, 3
add edi, 3
dec ecx
jnz Again
;----------------------
lea esi, MyTab ; Mytab + start col
mov dx, 03c8h
mov ax, word ptr[colstart]
out dx, al
inc dx
mov ecx, nbcol
Encore:
outsb ; R
outsb ; G
outsb ; B
dec ecx
jnz Encore
;----------------------
ret
PalMulti endp
;----------------------------------------------------------------------------
; PalOne( col, red, green, blue )
; ax col
; bx red
; cx, green
; dx, blue
;
PalOne proc uses ebx,\
col:DWORD, red:DWORD, green:DWORD, blue:DWORD
;----------------------
mov eax, col
mov ebx, red
mov ecx, green
mov edx, blue
shr bl, 2 ; Red >> 2
shr cl, 2 ; Green >> 2
shr dl, 2 ; Blue >> 2
mov ch, dl ; Save Blue
mov dx, 03c8h
out dx, al ; al=Num Color
inc dx
mov al, bl
out dx, al ; Red
mov al, cl
out dx, al ; Green
mov al, ch
out dx, al ; Blue
;----------------------
ret
PalOne endp
;----------------------------------------------------------------------------
; The
End

Some files were not shown because too many files have changed in this diff Show More