| ... | ... |
@@ -69,13 +69,14 @@ |
| 69 | 69 |
) |
| 70 | 70 |
|
| 71 | 71 |
%asma-IF-ERROR { ;asma/error LDA2 ORA }
|
| 72 |
-%asma-LOG { #01 }
|
|
| 72 |
+%asma-LOG { #09 }
|
|
| 73 | 73 |
( |
| 74 | 74 |
asma-LOG is a log-level parameter for helping to debug stuff. |
| 75 |
- It's value is the bitwise OR of all the following output types: |
|
| 75 |
+ Its value is the bitwise OR of all the following output types: |
|
| 76 | 76 |
#01 prints the number of lines in the source code, |
| 77 |
- #02 prints tokens as they are processed, and |
|
| 78 |
- #04 dumps all defined labels at end. |
|
| 77 |
+ #02 prints tokens as they are processed, |
|
| 78 |
+ #04 dumps all defined labels at end, and |
|
| 79 |
+ #08 prints the heap usage. |
|
| 79 | 80 |
) |
| 80 | 81 |
%asma-DEO2 { asma-LOG AND #00 EQU JMP DEO2k POP POP2 }
|
| 81 | 82 |
%asma-DEO { asma-LOG AND #00 EQU JMP DEOk POP2 }
|
| ... | ... |
@@ -100,7 +101,8 @@ |
| 100 | 101 |
asma-IF-ERROR ,&error JCN |
| 101 | 102 |
|
| 102 | 103 |
;asma-trees/labels ;asma-print-labels JSR2 ( DEBUG ) |
| 103 |
- ;asma-print-linecount JSR2 ( DEBUG ) |
|
| 104 |
+ ;asma-print-line-count JSR2 ( DEBUG ) |
|
| 105 |
+ ;asma-print-heap-usage JSR2 ( DEBUG ) |
|
| 104 | 106 |
JMP2r |
| 105 | 107 |
|
| 106 | 108 |
&error |
| ... | ... |
@@ -121,7 +123,6 @@ |
| 121 | 123 |
#20 .Console/char DEO |
| 122 | 124 |
;asma/orig-token LDA2 .Console/string DEO2 |
| 123 | 125 |
;&line .Console/string DEO2 |
| 124 |
- ( FIXME it would be nicer if line numbers were in decimal ) |
|
| 125 | 126 |
;asma/line LDA2 .Console/short DEO2 |
| 126 | 127 |
#2e .Console/char DEO |
| 127 | 128 |
#0a .Console/char DEO |
| ... | ... |
@@ -129,13 +130,22 @@ |
| 129 | 130 |
|
| 130 | 131 |
&line 20 "on 20 "line 20 00 |
| 131 | 132 |
|
| 132 |
-@asma-print-linecount ( -- ) |
|
| 133 |
- ( FIXME it would be nicer if line numbers were in decimal ) |
|
| 133 |
+@asma-print-line-count ( -- ) |
|
| 134 | 134 |
;asma/line LDA2 .Console/short #01 asma-DEO2 |
| 135 | 135 |
;&lines .Console/string #01 asma-DEO2 |
| 136 | 136 |
JMP2r |
| 137 | 137 |
|
| 138 |
- &lines [ 20 "lines 20 "in 20 "total. 0a 00 ] |
|
| 138 |
+ &lines [ 20 "lines 20 "of 20 "source 20 "code. 0a 00 ] |
|
| 139 |
+ |
|
| 140 |
+@asma-print-heap-usage ( -- ) |
|
| 141 |
+ ;asma/heap LDA2 ;asma-heap SUB2 .Console/short #08 asma-DEO2 |
|
| 142 |
+ ;&str1 .Console/string #08 asma-DEO2 |
|
| 143 |
+ ;asma-heap/end ;asma/heap LDA2 SUB2 .Console/short #08 asma-DEO2 |
|
| 144 |
+ ;&str2 .Console/string #08 asma-DEO2 |
|
| 145 |
+ JMP2r |
|
| 146 |
+ |
|
| 147 |
+ &str1 [ 20 "bytes 20 "of 20 "heap 20 "used, 20 00 ] |
|
| 148 |
+ &str2 [ 20 "bytes 20 "free. 0a 00 ] |
|
| 139 | 149 |
|
| 140 | 150 |
@asma-print-sublabels ( incoming-ptr* -- ) |
| 141 | 151 |
LDA2 |
| ... | ... |
@@ -640,7 +650,7 @@ |
| 640 | 650 |
,&new-label JCN |
| 641 | 651 |
|
| 642 | 652 |
( label already exists ) |
| 643 |
- ( FIXME check label address ) |
|
| 653 |
+ ( FIXME check label address hasn't changed (label defined twice) ) |
|
| 644 | 654 |
#01 JMP2r |
| 645 | 655 |
|
| 646 | 656 |
&new-label ( incoming-ptr* ) |