Advertisement
LBASIC

AURORA.BAS

Jun 5th, 2023
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 1.83 KB | Software | 0 0
  1. '_|_|_|   AURORA.BAS
  2. '_|_|_|   Interesting visual effect using palette manipulation.
  3. '_|_|_|   No warrantee or guarantee is given or implied.
  4. '_|_|_|   Released to   PUBLIC DOMAIN   by Kurt Kuzba.  (8/23/96)
  5. DECLARE SUB DefPal (C%, R%, G%, B%)
  6. DECLARE SUB Aurora (C%)
  7. COLOR 1, 0: CLS
  8. COLOR , 7: B$ = CHR$(219)
  9. OUT &H3C7, 7: Rdef% = INP(&H3C9): Gdef% = INP(&H3C9): Bdef% = INP(&H3C9)
  10. LOCATE 9, 19: PRINT STRING$(42, B$);
  11. LOCATE 10, 19: PRINT B$; SPACE$(40); B$;
  12. LOCATE 11, 19: PRINT B$; " This is only an example of what you    "; B$;
  13. LOCATE 12, 19: PRINT B$; " can do when you are able to manipulate "; B$;
  14. LOCATE 13, 19: PRINT B$; " your palette directly. Notice that I   "; B$;
  15. LOCATE 14, 19: PRINT B$; " saved the original colors so I can     "; B$;
  16. LOCATE 15, 19: PRINT B$; " restore the default before moving on.  "; B$;
  17. LOCATE 16, 19: PRINT B$; SPACE$(40); B$;
  18. LOCATE 17, 19: PRINT STRING$(42, B$);
  19. DO: Aurora 7: LOOP WHILE INKEY$ = ""
  20. DefPal 7, Rdef%, Gdef%, Bdef%
  21. SUB Aurora (C%)
  22.    STATIC RD%, GD%, BD%
  23.    OUT &H3C7, 7: R% = INP(&H3C9): G% = INP(&H3C9): B% = INP(&H3C9)
  24.    WHILE RD% = 0: RD% = RND * 3 - 1: WEND
  25.    WHILE GD% = 0: GD% = RND * 3 - 1: WEND
  26.    WHILE BD% = 0: BD% = RND * 3 - 1: WEND
  27.    IF R% < RND * 5 + 48 THEN RD% = 1
  28.    IF G% < RND * 5 + 48 THEN GD% = 1
  29.    IF B% < RND * 5 + 48 THEN BD% = 1
  30.    IF R% > RND * 58 + 5 THEN RD% = -1
  31.    IF G% > RND * 58 + 5 THEN GD% = -1
  32.    IF B% > RND * 58 + 5 THEN BD% = -1
  33.    R% = R% + RD%: G% = G% + GD%: B% = B% + BD%
  34.    WHILE (INP(&H3DA) AND 8) = 0: WEND
  35.    WHILE (INP(&H3DA) AND 8) <> 0: WEND
  36.    OUT &H3C8, C%: OUT &H3C9, R%: OUT &H3C9, G%: OUT &H3C9, B%
  37.    WHILE (INP(&H3DA) AND 8) = 0: WEND
  38.    WHILE (INP(&H3DA) AND 8) <> 0: WEND
  39. END SUB
  40. SUB DefPal (C%, R%, G%, B%)
  41.    OUT &H3C8, C%: OUT &H3C9, R%: OUT &H3C9, G%: OUT &H3C9, B%
  42. END SUB
  43. '_|_|_|   end   AURORA.BAS
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement