Advertisement
kamilnowinski

memory.bas

Jan 2nd, 2012
1,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. '--pamiec.bas--Raczej-inteligentny-program--(;
  2. 'by Kamil Nowinski
  3. 'enjoy!
  4. '--------------------------------------------------------------
  5.  
  6. $regfile = "m8def.dat"
  7. $crystal = 1000000
  8.  
  9. Config Portd = Output
  10.         Portd = &B00000000
  11. Config Portb = Input
  12.         Portb = &B00000000
  13.  
  14.  
  15. Sw_a Alias Portb.0
  16. Sw_b Alias Portb.1
  17. Sw_c Alias Portb.2
  18. Sw_d Alias Portb.3
  19. Zatwierdz Alias Portb.4
  20. Restart Alias Portb.5
  21.  
  22.  
  23. Dioda Alias Portd.0
  24.  
  25.  
  26. Dim Pamiec As Byte
  27. Pamiec = &B00000000
  28. Dim Pamiec_a As Byte
  29. Pamiec_a = &B00000000
  30.  
  31.  
  32. Do
  33.  
  34. If Sw_a = 1 Then
  35. Pamiec = &B00000001
  36. End If
  37. If Sw_b = 1 Then
  38. Pamiec = Pamiec + &B00000010
  39. End If
  40. If Sw_c = 1 Then
  41. Pamiec = Pamiec + &B00000100
  42. End If
  43. If Sw_d = 1 Then
  44. Pamiec = Pamiec + &B00001000
  45. End If
  46.  
  47.   If Restart = 1 Then
  48.   Pamiec_a = &B00000000
  49.   Pamiec = &B00000000
  50.   End If
  51.  
  52.  
  53.  
  54. If Zatwierdz = 1 Then
  55. Gosub Pisz
  56. End If
  57.  
  58.  
  59. Loop
  60.  
  61. End
  62.  
  63.  
  64. Pisz:
  65.  
  66. Do
  67.  
  68.   If Sw_a = 1 Then
  69.   Pamiec_a = Pamiec_a + &B00000001
  70.   End If
  71.  
  72.   If Sw_b = 1 Then
  73.   Pamiec_a = Pamiec_a + &B00000010
  74.   End If
  75.  
  76.   If Sw_c = 1 Then
  77.   Pamiec_a = Pamiec_a + &B00000100
  78.   End If
  79.  
  80.   If Sw_d = 1 Then
  81.   Pamiec_a = Pamiec_a + &B00001000
  82.   End If
  83.  
  84.  
  85.  
  86.  
  87.   If Zatwierdz = 1 Then
  88.   Gosub Sprawdzaj
  89.   End If
  90.  
  91. Loop
  92.  
  93. End
  94.  
  95. Sprawdzaj:
  96.  
  97. Do
  98.  
  99.  
  100.   If Pamiec = Pamiec_a Then
  101.   Dioda = 1
  102.   Wait 2
  103.   End If
  104.  
  105.  
  106.   If Restart = 1 Then
  107.   Pamiec_a = &B00000000
  108.   Pamiec = &B00000000
  109.   End If
  110.  
  111.   If Restart = 1 Then Return
  112.  
  113.  
  114. Loop
  115.  
  116. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement