Dec 062017
 
Pascal Libary of programs.
File PAS_0693.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Pascal Libary of programs.
File Name File Size Zip Size Zip Type
ASCIIZ.PAS 1324 543 deflated
ASMARRAY.PAS 983 445 deflated
AVTWRITE.PAS 2584 1168 deflated
B-SPLINE.PAS 2903 1333 deflated
BEEPER.PAS 2389 1139 deflated
BGISAVE.PAS 2797 1063 deflated
BITMASKS.TXT 4194 1206 deflated
BLANKIT.PAS 2161 973 deflated
BOOTRES.PAS 4169 1576 deflated
BOOTVARS.PAS 1394 496 deflated
CAPTURE.PAS 1899 908 deflated
CDPLAY.PAS 4723 1651 deflated
CIRCLE.PAS 3758 1606 deflated
COLDBOOT.PAS 552 290 deflated
COPYIT.PAS 2169 872 deflated
CSTR.PAS 3622 1386 deflated
CSTRTEST.PAS 844 427 deflated
DETADLIB.PAS 1644 642 deflated
DIGITAL.PAS 15972 3691 deflated
DIGITEST.PAS 7263 1762 deflated
DSWRITE.PAS 4029 1708 deflated
DUMPFILE.PAS 2675 1081 deflated
DVWRITE.PAS 1369 746 deflated
EASYFOS.PAS 18276 5331 deflated
ELLIPSE.PAS 1660 777 deflated
EMS-XMS.PAS 1831 824 deflated
EMSSTUFF.PAS 3390 1160 deflated
ENDECODE.PAS 1932 893 deflated
EXEEND.PAS 2294 963 deflated
EXEGIF.PAS 3409 1410 deflated
FACTORS.PAS 1076 566 deflated
FADEOUT.PAS 2242 879 deflated
FASTVGA.PAS 1459 674 deflated
FEXISTS.PAS 1933 938 deflated
FILEMODE.TXT 3640 1410 deflated
FINDSUBR.PAS 3004 1214 deflated
FOSSIL.PAS 4278 1396 deflated
FSTPRIME.PAS 3742 998 deflated
FSTUPPER.PAS 3128 1211 deflated
FSTWRITE.PAS 2784 1216 deflated
GETLEGS.PAS 1438 683 deflated
GRAPHPRC.PAS 4917 1598 deflated
HEAPHELP.PAS 2748 1084 deflated
HIDECURS.PAS 689 339 deflated
IO.PAS 13393 3250 deflated
MAKETDRW.PAS 1041 585 deflated
MCGA-ROT.PAS 3182 1226 deflated
MOVEFILE.PAS 6744 1897 deflated
MYSHARE.PAS 3313 1141 deflated
NEWBTMAP.PAS 2201 1059 deflated
NEWVARS.PAS 1784 761 deflated
NOBOOT.PAS 2003 913 deflated
NOPAUSE.PAS 2203 945 deflated
PAS_0693.LST 5452 2045 deflated
PRIMES.PAS 1564 712 deflated
PRIMES.TXT 942 441 deflated
PROCFIND.PAS 1408 657 deflated
RANDOM.PAS 2143 960 deflated
RDASCIIZ.PAS 2806 1252 deflated
RKEYINT.TXT 11875 3956 deflated
RSANCRPT.TXT 1702 673 deflated
RTMSWAP.PAS 2007 873 deflated
SB.PAS 3942 1487 deflated
SCALCHAR.PAS 2190 998 deflated
SCBITMAP.PAS 1399 727 deflated
SCRNSAVE.PAS 3057 997 deflated
SCROLL1.PAS 1713 698 deflated
SCROLLNG.PAS 1215 633 deflated
SFECACHE.PAS 6526 1744 deflated
SHADOBOX.PAS 3237 1267 deflated
SHOWTDRW.PAS 680 433 deflated
SOUNDS.PAS 6530 2224 deflated
SPINCURS.PAS 812 421 deflated
STATKEYS.PAS 3576 1236 deflated
TBUTIL.PAS 1973 842 deflated
TCTACTOE.PAS 4814 1340 deflated
TESTDRIV.PAS 1348 558 deflated
TESTINT.PAS 2931 1399 deflated
TSKSWTCH.PAS 1789 797 deflated
TSRTEST.PAS 2018 1010 deflated
UN_CRT.PAS 4007 1753 deflated
UPPER1.PAS 797 410 deflated
UPPER2.PAS 4015 1439 deflated
UTONE.PAS 1967 865 deflated
VGADEMO.PAS 4309 1845 deflated
WHERE.PAS 3238 1278 deflated
XORSUM.PAS 1427 767 deflated

Download File PAS_0693.ZIP Here

Contents of the BITMASKS.TXT file


Fido Pascal Conference PASCAL
Msg : 286 of 360
From : Ruurd Pels 2:282/317.19 28 May 93 16:31
To : David Todd 1:259/423.0
Subj : Masking......

Howdy David!

On 21 May 93, David Todd wrote the following message to All:

DT> Can anybody tell me how to bitmask? Well here what I'm, doing. I am
DT> setting the Map Mask Register to plane 0, and writing all the data needed
DT> for plane 0 to the screen with a Movsb, samething with plane 1, and so on.
DT> Now I want to mask out any pixels that are 0 on the palette. How would I go
DT> about doing that? Do I have to do a compare for each pixel to make sure
DT> it's not a 0, before I write it or what? Well thanks to anybody who can
DT> help me...

================= S T A R T O F L E C T U R E ========================

A lecture on Boolean Algebra. Just look at bit 3, counting from 0
from the left.

==============================AND=========================================

Before : 01101110 bit 3 is ON
Mask : 00001000
---------AND
Result : 00001000 equals mask if bit 3 is ON
========

So for ANDing bits, the truth table for each bit is:


AND | 0 | 1
------+--------+--------
0 | 0 | 0
------+--------+--------
1 | 0 | 1

Read this table as:

0 AND 0 equals 0
0 AND 1 equals 0
1 AND 0 equals 0
1 AND 1 equals 1

Use: To check if a bit is set.

============================OR============================================


Before : 01100110 bit 3 is OFF
Mask : 00001000
---------OR
Result : 01101110 bit 3 is ON
========

So you switched the bit ON, regardless of its state, without
affecting the other bits. For each bit, the truth table for each bit is:


OR | 0 | 1
------+--------+--------
0 | 0 | 1
------+--------+--------
1 | 1 | 1

Use: To switch a bit on regardless of its prior state.
====================================XOR===================================

Before : 01101110 bit 3 is on
Mask : 00001000
---------XOR
Result : 01100110 bit 3 is off
Mask : 00001000
---------XOR
Result : 01101110 bit 3 is on again
========

So for XORing bits, the truth table for each bit is:


XOR | 0 | 1
------+--------+--------
0 | 0 | 1
------+--------+--------
1 | 1 | 0

Use: To toggle a bit regardless of its state
===============================NOT========================================

The effect of NOTing is inverting each bit in a variable.

Truth table:

NOT(1) --> 0
NOT(0) --> 1

So if you NOT the mask, you get:

NOT(00001000) --> 11110111

So if you want to switch a bit off, regardless of state, you do this:


Before : 01101110 bit 3 is ON}
Mask : NOT(00001000) --> 11110111
---------AND
Result 01100110 bit 3 is OFF
========

===============================NOT========================================

Keep in mind that all operators are binary, except for NOT, which is unary.

=================== E N D O F L E C T U R E ==========================

By substituting a different value for the mask, you may manipulate more than
one bit at the same time.

Grtz, RFP 😉

--- FMail 0.94
* Origin: Mail Munger (2:282/317.19)



 December 6, 2017  Add comments

Leave a Reply