This time a few examples to reverse or flip a byte using Commodore Basic.
See full source examples on my blog. [ Ссылка ]
You can type them in on a real Commodore 64 or use, for example, the vice emulator on a pc.
One of the examples created is the following code which uses a for Next loop.
10 b=int(rnd(1)*255) : r$="" :o$="00000000" :sb=.
20 for n=0to7:if b and 2^n then r = r+2^(7-n) : sb=1
60 r$=r$+mid$("01",1+sb,1):o$=left$(o$,7-n)+mid$("01",1+sb,1)+right$(o$,1+n)
70 sb=.:next:?"original byte value:" b,left$(o$,8):?"reversed byte value:"r,r$
Ещё видео!