The final topic of this chapter again. You already know that 4tH checks whether an operation is still within the Character Segment. However, sometimes you want to check this yourself.
You already know how you can obtain the size of TIB and PAD. Yes, you can using '/TIB' and '/PAD'. But TIB and PAD have their addresses too. And when you query them, you will find that PAD comes after TIB:
." Address of TIB: " tib cr ." Size of TIB : " /tib . cr ." Address of PAD: " pad . cr ." Size of PAD : " /pad . cr
And beyond PAD, what is there? Well, allocated memory of course. Things you defined using 'STRING'. There are two words which can give you information about allocated memory. First, 'LO'. 'LO' gives you the lowest address of allocated memory. Second, 'HI'. 'HI' gives you the highest valid address of the Character Segment. That means that:
0 hi c!
Is always valid and:
0 hi char+ c!
Is always invalid. It you try it, 4tH will stop executing the program with an error-message. 'LO' and 'HI' are addresses. Addresses are just numbers, so you can print and compare them. E.g.
hi char+ lo - . cr
Will print how much memory as allocated to your strings. And:
lo hi >
Will indicate whether you allocated any memory at all. If 'LO' is greater than 'HI', you didn't. If 'HI' is greater or equal to 'LO' you did. Experiment a bit with the knowledge you obtained in this chapter and continue with the next one where we will go much deeper into the secrets of the Integer Segment and Code Segment.