Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/Stack/Applesoft-BASIC/stack.basic
Normal file
39
Task/Stack/Applesoft-BASIC/stack.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
100 DIM STACK$(1000)
|
||||
110 DATA "(2*A)","PI","","TO BE OR","NOT TO BE"
|
||||
120 FOR I = 1 TO 5
|
||||
130 READ ELEMENT$
|
||||
140 GOSUB 500_PUSH
|
||||
150 NEXT
|
||||
200 GOSUB 400 POP AND PRINT
|
||||
210 GOSUB 300_EMPTY AND PRINT
|
||||
220 FOR I = 1 TO 4
|
||||
230 GOSUB 400 POP AND PRINT
|
||||
240 NEXT
|
||||
250 GOSUB 300_EMPTY AND PRINT
|
||||
260 END
|
||||
300 GOSUB 700_EMPTY
|
||||
310 PRINT "STACK IS ";
|
||||
320 IF NOT EMPTY THEN PRINT "NOT ";
|
||||
330 PRINT "EMPTY"
|
||||
340 RETURN
|
||||
400 GOSUB 600 POP
|
||||
410 PRINT ELEMENT$
|
||||
420 RETURN
|
||||
500 REM
|
||||
510 REM PUSH
|
||||
520 REM
|
||||
530 LET STACK$(SP) = ELEMENT$
|
||||
540 LET SP = SP + 1
|
||||
550 RETURN
|
||||
600 REM
|
||||
610 REM POP
|
||||
620 REM
|
||||
630 IF SP THEN SP = SP - 1
|
||||
640 LET ELEMENT$ = STACK$(SP)
|
||||
650 LET STACK$(SP) = ""
|
||||
660 RETURN
|
||||
700 REM
|
||||
710 REM EMPTY
|
||||
720 REM
|
||||
730 LET EMPTY = SP = 0
|
||||
740 RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue