Advertisement
plirof2

ZX Basic Other/Extra progs

Feb 7th, 2022 (edited)
3,096
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ZX basic small programs Draw etc
  2.  
  3. ______________________________
  4. 10 BORDER 0: PAPER 0: INK 7: CLS: REM black oue screen
  5. 20 LET x1=0: LET y1=0: REM start of line
  6. 30 LET c=1: REM for ink colour, starting blue
  7. 40 LET x2=INT (RND*256): LET y2=INT (RND*176):REM random finish of line
  8. 50 DRAW INK c;x2-x1,y2-y1
  9. 60 LET x1=x2: LET y1=y2: REM next line starts where last one finished
  10. 70 LET c=c+1: IF c=8 THEN LET c=1: REM new colour
  11. 80 GO TO 40
  12.  
  13. ________________________
  14. 10 REM First we draw the clock face
  15. 20 FOR n=1 TO 12
  16. 30 PRINT AT 10-10*COS (n/6*PI),16+10*SIN (n/6*PI);n
  17. 40 NEXT n
  18. 50 REM Now we start the clock
  19. 60 FOR t=0 TO 200000: REM t is the time in seconds
  20. 70 LET a=t/30*PI: REM a is the angle of the second hand in radians
  21. 80 LET sx=80*SIN a: LET sy=80*COS a
  22. 200 PLOT 128,88: DRAW OVER 1;sx,sy: REM draw second hand
  23. 210 PAUSE 42
  24. 220 PLOT 128,88: DRAW OVER 1;sx,sy: REM erase second hand
  25. 400 NEXT t
  26. ________________________
  27. 10 FOR a=32 TO 255: PRINT CHR$ a;: NEXT a
  28. ________________________
  29. 1 REM Chess Pieces -only UDG not printing them
  30. 5 LET b=BIN 01111100: LET c=BIN 00111000: LET d=BIN 00010000
  31. 10 FOR n=1 TO 6: READ p$: REM 6 pieces
  32. 20 FOR f=0 TO 7: REM read piece into 8 bytes
  33. 30 READ a: POKE USR p$+f,a
  34. 40 NEXT f
  35. 50 NEXT n
  36. 100 REM bishop
  37. 110 DATA "b",0,d, BIN 00101000,BIN 01000100
  38. 120 DATA BIN 01101100,c,b,0
  39. 130 REM king
  40. 140 DATA "k",0,d,c,d
  41. 150 DATA c, BIN 01000100,c,0
  42. 160 REM rook
  43. 170 DATA "r",0, BIN 01010100,b,c
  44. 180 DATA c,b,b,0
  45. 190 REM queen
  46. 200 DATA "q",0, BIN 01010100, BIN 00101000,d
  47. 210 DATA BIN 01101100,b,b,0
  48. 220 REM pawn
  49. 230 DATA "p",0,0,d,c
  50. 240 DATA c,d,b,0
  51. 250 REM knight
  52. 260 DATA "n",0,d,c, BIN 01111000
  53. 270 DATA BIN 00011000,c,b,0
  54.  
  55. ________________________
  56. 5 REM hangman
  57. 10 REM set up screen
  58. 20 INK 0: PAPER 7: CLS
  59. 30 LET x=240: GO SUB 1000: REM draw man
  60. 40 PLOT 238,128: DRAW 4,0: REM mouth
  61. 100 REM set up word
  62. 110 INPUT w$: REM word to guess
  63. 120 LET b=LEN w$: LET v$=" "
  64. 130 FOR n=2 TO b: LET v$=v$+" "
  65. 140 NEXT n: REM v$=word guessed so far
  66. 150 LET c=0: LET d=0: REM guess & mistake counts
  67. 160 FOR n=0 TO b-1
  68. 170 PRINT AT 20,n;" ";
  69. 180 NEXT n: REM write 's instead of letters
  70. 200 INPUT "Guess a letter ";g$
  71. 210 IF g$="" THEN GO TO 200
  72. 220 LET g$=g$(1): REM 1st letter only
  73. 230 PRINT AT 0,c;g$
  74. 240 LET c=c+1: LET u$=v$
  75. 250 FOR n=1 TO b: REM update guessed word
  76. 260 IF w$(n)=g$ THEN LET v$(n)=g$
  77. 270 NEXT n
  78. 280 PRINT AT 19,0;v$
  79. 290 IF v$=w$ THEN GO TO 500: REM word guessed
  80. 300 IF v$<>u$ THEN GO TO 200: REM guess was right
  81. 400 REM draw next part of gallows
  82. 410 IF d=8 THEN GO TO 600: REM hanged
  83. 420 LET d=d+1
  84. 430 READ x0,y0,x,y
  85. 440 PLOT x0,y0: DRAW x,y
  86. 450 GO TO 200
  87. 500 REM free man
  88. 510 OVER 1: REM rub out man
  89. 520 LET x=240: GO SUB 1000
  90. 530 PLOT 238,128: DRAW 4,0: REM mouth
  91. 540 OVER 0: REM redraw man
  92. 550 LET x=146: GO SUB 1000
  93. 560 PLOT 143,129: DRAW 6,0, PI/2: REM smile
  94. 570 GO TO 800
  95. 600 REM hang man
  96. 610 OVER 1: REM rub out floor
  97. 620 PLOT 255,65: DRAW -48,0
  98. 630 DRAW 0,-48: REM open trapdoor
  99. 640 PLOT 238,128: DRAW 4,0: REM rub out mouth
  100. 650 REM move limbs
  101. 655 REM arms
  102. 660 PLOT 255,117: DRAW -15,-15: DRAW -15,15
  103. 670 OVER 0
  104. 680 PLOT 236,81: DRAW 4,21: DRAW 4, 21
  105. 690 OVER 1: REM legs
  106. 700 PLOT 255,66: DRAW -15,15: DRAW -15,-15
  107. 710 OVER 0
  108. 720 PLOT 236,60: DRAW 4,21: DRAW 4,-21
  109. 730 PLOT 237,127: DRAW 6,0,-PI/2: REM frown
  110. 740 PRINT AT 19,0;w$
  111. 800 INPUT "again? ";a$
  112. 810 IF a$="" THEN GO TO 850
  113. 820 LET a$=a$(1)
  114. 830 IF a$="n" THEN STOP
  115. 840 IF a$(1)="N" THEN STOP
  116. 850 RESTORE: GO TO 5
  117. 1000 REM draw man at column x
  118. 1010 REM head
  119. 1020 CIRCLE x,132,8
  120. 1030 PLOT x+4,134: PLOT x-4,134: PLOT x,131
  121. 1040 REM body
  122. 1050 PLOT x,123: DRAW 0,-20
  123. 1055 PLOT x,101: DRAW 0,-19
  124. 1060 REM legs
  125. 1070 PLOT x-15,66: DRAW 15,15: DRAW 15,-15
  126. 1080 REM arms
  127. 1090 PLOT x-15,117: DRAW 15,-15: DRAW 15,15
  128. 1100 RETURN
  129. 2000 DATA 120,65,135,0,184,65,0,91
  130. 2010 DATA 168,65,16,16,184,81,16,-16
  131. 2020 DATA 184,156,68,0,184,140,16,16
  132. 2030 DATA 204,156,-20,-20,240,156,0,-16
  133. ________________________
  134.  
  135. ________________________
  136.  
  137. ________________________
  138.  
  139. ________________________
  140.  
  141. ________________________
  142.  
  143. ________________________
  144.  
  145. ________________________
  146.  
  147. ________________________
  148.  
  149. ________________________
  150.  
  151. ________________________
  152.  
  153. ________________________
  154.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement