ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

126 lines
2.4 KiB

  1. REM PURPOSE: verify user function parameters are range checked
  2. REM AUTHOR: Howard Wulf, AF5NE
  3. REM DATE: 2014-01-26
  4. REM
  5. REM Here we replace the functions not implemented on this platform
  6. REM INP(), OUT(), WAIT(), PEEK(), POKE()
  7. REM
  8. REM These should succeed without any errors
  9. let a = INP( 1 )
  10. OUT 2, 3
  11. let b = PEEK( 4 )
  12. POKE 5, 6
  13. print "a=";a
  14. print "b=";b
  15. REM These should cause ERROR 5 ' Illegal Function Call
  16. on error goto hell
  17. REM TEST 1
  18. let T = 1
  19. BeforeTest1:
  20. let a = INP( 100000 )
  21. AfterTest1:
  22. REM TEST 2
  23. let T = 2
  24. BeforeTest2:
  25. let a = INP( -100000 )
  26. AfterTest2:
  27. REM TEST 3
  28. let T = 3
  29. BeforeTest3:
  30. let X3 = 100000
  31. OUT X3, 0
  32. AfterTest3:
  33. REM TEST 4
  34. let T = 4
  35. BeforeTest4:
  36. let Y4 = 100000
  37. OUT 0, Y4
  38. AfterTest4:
  39. print "*** ALL TESTS PASSED ***"
  40. goto 999
  41. hell:
  42. if ERR = 5 then
  43. select case T
  44. case 1
  45. if ERL > BeforeTest1 and ERL < AfterTest1 then
  46. REM This is where we expect the ERROR to occur
  47. print "*** TEST 1 PASSED ***"
  48. else
  49. print "*** TEST 1 FAILED ***"
  50. stop
  51. end if
  52. case 2
  53. if ERL > BeforeTest2 and ERL < AfterTest2 then
  54. REM This is where we expect the ERROR to occur
  55. print "*** TEST 2 PASSED ***"
  56. else
  57. print "*** TEST 2 FAILED ***"
  58. stop
  59. end if
  60. case 3
  61. if ERL > BeforeTest3 and ERL < AfterTest3 then
  62. REM This is where we expect the ERROR to occur
  63. print "*** TEST 3 PASSED ***"
  64. else
  65. print "*** TEST 3 FAILED ***"
  66. stop
  67. end if
  68. case 4
  69. if ERL > BeforeTest4 and ERL < AfterTest4 then
  70. REM This is where we expect the ERROR to occur
  71. print "*** TEST 4 PASSED ***"
  72. else
  73. print "*** TEST 4 FAILED ***"
  74. stop
  75. end if
  76. case else
  77. print "Unexpected TEST code:"; T
  78. print "*** TEST FAILED ***"
  79. stop
  80. end select
  81. resume next
  82. end if
  83. print "Unexpected ERROR code:"; ERR
  84. print "*** TEST FAILED ***"
  85. stop
  86. REM ---------------------------------------------------------------
  87. REM Direct hardware access is only supported on CP/M-86 derivatives
  88. REM ---------------------------------------------------------------
  89. function INP( X% )
  90. print "Fake INP"
  91. print "X=";X%
  92. INP = 77
  93. end function
  94. sub OUT( X%, Y% )
  95. print "Fake OUT"
  96. print "X=";X%
  97. print "Y=";Y%
  98. end sub
  99. function PEEK( X% )
  100. print "Fake PEEK"
  101. print "X=";X%
  102. PEEK = 88
  103. end function
  104. sub POKE( X%, Y% )
  105. print "Fake POKE"
  106. print "X=";X%
  107. print "Y=";Y%
  108. end sub
  109. stop
  110. 999 end