A bit of rotating in Color BASIC

Sdílet
Vložit
  • čas přidán 8. 09. 2024
  • 0 REM BITROTATE.BAS
    10 DIM BT(7):FOR BT=0 TO 7:BT(BT)=2^BT:NEXT
    20 INPUT "VALUE ";V
    30 PRINT "L OR R? ";
    40 A$=INKEY$:IF A$="" THEN 40
    50 IF A$="L" THEN M=0:PRINT "LEFT":GOTO 90
    60 IF A$="R" THEN M=1:PRINT "RIGHT":GOTO 90
    80 SOUND 1,1:GOTO 40
    90 REM
    100 PRINT:PRINT " ";:Z=V:GOSUB 500
    105 FOR I=1 TO 8
    110 IF M=0 THEN PRINT "LEFT ";:NZ=V*2:IF Z AND 128 THEN Z=(NZ OR 1) AND 255 ELSE Z=NZ
    120 IF M=1 THEN PRINT "RIGHT ";:NZ=V/2:IF Z AND 1 THEN Z=NZ OR 128 ELSE Z=NZ
    140 GOSUB 500:V=Z:NEXT
    150 PRINT:GOTO 20
    500 REM SHOW Z AS BINARY
    510 FOR BT=7 TO 0 STEP-1
    520 IF Z AND BT(BT) THEN PRINT "1"; ELSE PRINT "0";
    530 NEXT
    540 PRINT:RETURN

Komentáře • 6

  • @rockyhill3
    @rockyhill3 Před 2 lety

    You can always -call on this channel for a -bit of good information, just dial the length of the video.

  • @GORF_EMPIRE
    @GORF_EMPIRE Před 2 lety

    Nice!

    • @allenhuffman
      @allenhuffman  Před 2 lety

      And now all my “recorded one evening in a hotel in Illinois” videos have been posted.

    • @GORF_EMPIRE
      @GORF_EMPIRE Před 2 lety

      @@allenhuffman What will you do next?

    • @allenhuffman
      @allenhuffman  Před 2 lety

      I know how to handle 16-bit values, so I at least need to do one on that.

    • @GORF_EMPIRE
      @GORF_EMPIRE Před 2 lety

      @@allenhuffman Perhaps how to call machine language subroutines? Then you can show how to use ASL, ASR, ROL and ROR and get those shifts and rotates done in a few cycles instead of 100's.