VolksForth/sources/Apple1/tools.fb.src
2020-07-15 11:24:43 +02:00

256 lines
16 KiB
Plaintext

Screen 0 not modified
0 \ Development Tools cas 26jan06
1
2 Interactive Tracer
3
4 One-Step Debugger
5
6 Traps
7
8
9
10
11
12
13
14
15
Screen 1 not modified
0 \ TOOLS LOADSCREEN 22MAR85RE)
1
2 ONLYFORTH
3
4 \NEEDS CODE abort( Assembler is needed )
5
6 VOCABULARY TOOLS
7
8 TOOLS ALSO DEFINITIONS
9 hex
10 1 &11 +THRU
11 decimal
12 ONLYFORTH
13
14
15
Screen 2 not modified
0 \ HANDLE STEPS BP 10 02 85)
1
2 ASSEMBLER ALSO DEFINITIONS
3
4 ONLY FORTH ALSO TOOLS ALSO DEFINITIONS
5 | VARIABLE (W | VARIABLE RPT
6
7 | CODE STEP
8 RPT DEC RP X) LDA IP STA
9 RP )Y LDA IP 1+ STA RP 2INC
10 (W LDA W STA (W 1+ LDA W 1+ STA
11 W 1- JMP END-CODE
12
13 | CREATE NEXTSTEP ] STEP [
14
15
Screen 3 not modified
0 \ THROW STATUS ON R-STACK B 23JUL85RE)
1
2 | CREATE NPULL 0 ]
3 RP@ COUNT 2DUP + RP! R> SWAP CMOVE ;
4
5 : NPUSH ( ADDR LEN -)
6 R> -ROT OVER >R RP@ OVER 1+ - DUP RP! PLACE
7 NPULL >R >R ;
8
9 | : ONELINE .STATUS SPACE QUERY INTERPRET
10 -82 ALLOT RDROP ( DELETE QUIT FROM TNEXT ) ;
11
12
13
14
15
Screen 4 not modified
0 \ TRAP AND DISPLAY KS 26MAR85RE)
1 LABEL TNEXT
2 IP 2INC RP LDA RPT CMP 0<> ?[
3 [[ W 1- JMP SWAP ]?
4 RP 1+ LDA RPT 1+ CMP 0= ?]
5 LABEL DOTRACE
6 RPT INC ( DISABLE TRACER )
7 W LDA (W STA W 1+ LDA (W 1+ STA
8 ;C: R@ NEXTSTEP >R
9 INPUT PUSH KEYBOARD
10 OUTPUT PUSH DISPLAY
11 CR 2- DUP 4 U.R @ DUP 5 U.R 2 SPACES
12 >NAME .NAME 1C COL - 0 MAX SPACES .S
13 STATE PUSH BLK PUSH >IN PUSH
14 [ ' 'QUIT >BODY ] LITERAL PUSH
15 [ ' >INTERPRET >BODY ] LITERAL PUSH
Screen 5 not modified
0 \
1 #TIB PUSH TIB #TIB @ NPUSH R0 PUSH
2 RP@ R0 ! 082 ALLOT
3 ['] ONELINE IS 'QUIT QUIT ; -2 ALLOT
4
5
6
7
8
9
10
11
12
13
14
15
Screen 6 not modified
0 \ TRACER COMMANDS BP 23JUL85RE)
1
2 | CODE (TRACE TNEXT 0 100 M/MOD
3 # LDA NEXT 0C + STA
4 # LDA NEXT 0B + STA
5 04C # LDA NEXT 0A + STA NEXT JMP END-CODE
6
7 : TRACE' RP@ 2- RPT ! ' (TRACE EXECUTE END-TRACE ;
8
9 : BREAK RP@ 2+ RPT ! (TRACE ; RESTRICT
10
11 : TRACEL: CREATE , DOES> @ RPT +! ;
12
13 -6 TRACEL: +DO 6 TRACEL: -DO
14 -2 TRACEL: +R 2 TRACEL: -R
15 -6 TRACEL: +PUSH 6 TRACEL: -PUSH
Screen 7 not modified
0 \ WATCH TRAP BP 10 02 85 )
1
2 | VARIABLE WATCHPT 2 ALLOT
3
4 LABEL WNEXT IP 2INC
5 WATCHPT LDA N STA WATCHPT 1+ LDA N 1+ STA
6 N X) LDA WATCHPT 2+ CMP 0<> ?[
7 [[ RP LDA RPT STA RP 1+ LDA RPT 1+ STA
8 ( SET TO TNEXT) TNEXT 0 100 M/MOD
9 # LDA NEXT 0C + STA # LDA NEXT 0B + STA
10 DOTRACE JMP SWAP ]?
11 N )Y LDA WATCHPT 3 + CMP 0= ?] W 1- JMP END-CODE
12
13
14
15
Screen 8 not modified
0 \ WATCH COMMANDS BP 10 02 85 )
1
2 | CODE (WATCH WNEXT 0 100 M/MOD
3 # LDA NEXT 0C + STA
4 # LDA NEXT 0B + STA
5 04C # LDA NEXT 0A + STA NEXT JMP END-CODE
6
7 : WATCH' ( ADR -- )
8 DUP WATCHPT ! @ WATCHPT 2+ ! ' (WATCH EXECUTE END-TRACE ;
9
10 : CONT ( -) WATCHPT @ @ WATCHPT 2+ ! (WATCH ;
11
12 ( SYNTAX : <VARNAME> WATCH' <PROCEDURE> )
13
14
15
Screen 9 not modified
0 \ TOOLS FOR DECOMPILING, KS 4 APR 83 )
1 ( INTERACTIVE USE )
2 | : ?: DUP 4 U.R ." :" ;
3 | : @? DUP @ 6 U.R ;
4 | : C? DUP C@ 3 .R ;
5 | : BL 024 COL - 0 MAX SPACES ;
6
7 : S ( ADR - ADR+) ( PRINT LITERAL STRING)
8 ?: SPACE C? 4 SPACES DUP COUNT TYPE
9 DUP C@ + 1+ BL ; ( COUNT + RE)
10
11 : N ( ADR - ADR+2) ( PRINT NAME OF NEXT WORD BY ITS CFA)
12 ?: @? 2 SPACES DUP @ >NAME .NAME 2+ BL ;
13
14 : L ( ADR - ADR+2) ( PRINT LITERAL VALUE) ?: @? 2+ BL ;
15
Screen 10 not modified
0 \ TOOLS FOR DECOMPILING, INTERACTIVE )
1
2 : D ( ADR N - ADR+N) ( DUMP N BYTES)
3 2DUP SWAP ?: 3 SPACES SWAP 0 DO C? 1+ LOOP
4 4 SPACES -ROT TYPE BL ;
5
6 : C ( ADR - ADR+1) ( PRINT BYTE AS UNSIGNED VALUE) 1 D ;
7
8 : B ( ADR - ADR+2) ( PRINT BRANCH TARGET LOCATION )
9 ?: @? DUP @ OVER + 6 U.R 2+ BL ;
10
11 ( USED FOR : )
12 ( NAME STRING LITERAL DUMP CLIT BRANCH )
13 ( - - - - - - )
14
15
Screen 11 not modified
0 \ DEBUGGING UTILITIES BP 19 02 85 )
1
2 : UNRAVEL \ UNRAVEL PERFORM (ABORT"
3 RDROP RDROP RDROP CR ." TRACE DUMP IS " CR
4
5 BEGIN RP@ R0 @ -
6 WHILE R> DUP 8 U.R SPACE 2- @ >NAME .NAME CR
7 REPEAT (ERROR ;
8
9 ' UNRAVEL ERRORHANDLER !
10
11
12
13
14
15
Screen 12 not modified
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Screen 13 not modified
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Screen 14 not modified
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15