class TightData
sys dat
macro mGet(w,n)
((dat>>n) and w)
end macro
macro mClear(w,n)
mov edx,w
mov cl,n
shl edx,cl
not edx
dat and=edx
end macro
macro mSet(w,n)
mov edx,w
mov cl,n
shl edx,cl
dat or=edx
end macro
macro mSave(b,w,n)
mClear w,n
b and=w
if b then mSet b,n
end macro
'===
method GetBit(sys n) as sys
return mGet 1,n
end method
method PutBit(sys b,n)
mSave b,1,n
end method
method GetNybble(sys n) as sys
return mGet 15,n
end method
method PutNybble(sys b,n)
mSave b,15,n
end method
method GetByte(sys n) as sys
return mGet 255,n
end method
method PutByte(sys b,n)
mSave b,255,n
end method
method GetBits(sys w,n) as sys
return mGet w,n
end method
method PutBits(sys b,w,n)
mSave b,w,n
end method
end class
'#recordof TightData
TightData t
t.dat=0x44332211
print hex t.getNybble 16
t.PutNybble 0xA,16
print hex t.getNybble 16
print hex t.dat