-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathshowstring.py
More file actions
46 lines (41 loc) · 1.36 KB
/
showstring.py
File metadata and controls
46 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# *******************************************************************************************
# *******************************************************************************************
#
# Name : showstring.py
# Purpose : Show the string area.
# Date : 23rd September 2022
# Author : Paul Robson ([email protected])
#
# *******************************************************************************************
# *******************************************************************************************
import os,sys,re
from showstack import *
if __name__ == "__main__":
ls = LabelStore()
md = MemoryDump()
print("String Memory:")
print()
sm = ls.get("StringMemory")
stringStart = md.readWord(sm)
p = stringStart
usedSize = 0
unusedSize = 0
while md.read(p) != 0:
size = md.read(p)+3
if (md.read(p+1) & 0x80) != 0:
unusedSize += size
val = "(DELETED)"
else:
usedSize += size
val = '"'+md.readString(p+2)+'"'
print("\t@ ${0:04x} Max Size:{1} : {2}".format(p,md.read(p),val))
p = p + size
print()
print("String start ${0:04x}".format(stringStart))
print("String end ${0:04x}".format(p))
if unusedSize+usedSize > 0:
print()
print("Used space : {0} bytes".format(usedSize))
print("Unused space : {0} bytes".format(unusedSize))
pcUsed = int(usedSize/(unusedSize+usedSize)*100+0.5)
print("Percent usage : {0} %".format(pcUsed))