lDebug symbolic debugging support

2019-04-03T22:01:21+02:00 Wed 1462:0111 mov bx, 1 1462:0114 xor ax, ax 1462:0116 jcxz 180 1462:0118 lodsb 1462:0119 mov dx, bx 1462:011B push cx 1462:011C mov cl, 5 1462:011E shl bx, cl 1462:0120 pop cx 1462:0121 sub bx, dx 1462:0123 add bx, ax 1462:0125 loop 118 mov bx, 1 xor ax, ax jcxz .end .loop: lodsb mov dx, bx push cx mov cl, 5 shl bx, cl pop cx sub bx, dx add bx, ax loop .loop .end: 2019-04-03T23:26:18+02:00 Wed mov bx, 1 jcxz .end .loop: xor ax, ax lodsb sub ax, bx push cx mov cl, 5 shl bx, cl pop cx add bx, ax loop .loop .end: sym_storage: ; The following are subject to be used as paragraph-indices ; into an XMS-allocated memory block once that is implemented. ; For now, they are always 86M-segment values. .main.start: dw 0 ; => SYMMAIN array .str.start: dw 0 ; => SYMSTR heap .hash.start: dw 0 ; => SYMHASH array .hashlist.start: dw 0 ; => SYMHASHLIST heap ; The following are SYMMAIN array paragraph indices. .main.free: dw 0 ; => SYMMAIN array free entry .main.end: dw 0 ; => SYMMAIN array behind end .main.loaded_first: dw 0 ; => SYMMAIN entry which was loaded first .main.loaded_last: dw 0 ; => SYMMAIN entry which was loaded last ; The following are SYMSTR heap word indices. .str.free: dw 0 ; -> first free entry .str.end: dw 0 ; -> behind end ; The following are SYMHASH array dword indices. .hash.free: dw 0 ; -> first free entry .hash.end: dw 0 ; -> behind end ; The following are SYMHASHLIST heap word indices. .hashlist.free: dw 0 ; -> first free entry .hashlist.end: dw 0 ; -> behind end 12345678901234567890123456789012345678901234567890123456789012345678901234567890 ; Note: SYMMAINs are stored as an array, which is sorted ; on the smLinear value. Therefore, binary search can ; be used to find an entry in the entire array. struc SYMMAIN smName1: resw 1 ; -> first string part (SYMSTR heap word index) smName2: resw 1 ; -> second part (SYMSTR heap word index) smFlags: resw 1 ; flags smLoadedNext: resw 1 ; => SYMMAIN entry which was loaded next smLinear: resd 1 ; linear address of symbol (if flag says so) smOffset: resd 1 ; offset of symbol endstruc struc SYMSTR ssRefCount: resb 1 ; how often this string is referenced ssLength: resb 1 ; how long this string is (only ssString) ssString: ; actual string content ; Note that if the string has an odd size, a NUL byte is ; appended to insure that the SYMSTR structure is padded to ; an even size, as SYMSTRs are referred to by word indices. ; Therefore, the size of a SYMSTR record is obtained by ; calculating (byte [ssLength] + ssString + 1) & ~1. endstruc ; Note: SYMHASHs are stored as an array, which is sorted ; on the shHash value. Therefore, binary search can ; be used to find an entry in the entire array. ; ; The hash value is computed by hashing the entire name ; string (ie, both smName1 and smName2 string contents) ; with the algorithm as such: ; ; for (hash = 1, index = 0; index < length; index += 1) ; hash = hash * 31 + name[index]; struc SYMHASH shHash: resw 1 ; hash value shListIndex: resw 1 ; -> SYMHASHLIST entry belonging to this bucket endstruc ;2345678901234567890123456789012345678901234567890123456789012345678901234567890 ; SYMHASHLISTs are stored in an unsorted heap. As every ; SYMHASHLIST occupies an even number of bytes, a ; SYMHASHLIST entry is referenced by a word-index word. struc SYMHASHLIST shlCount: resw 1 ; how many words are given shlMainIndices: ; as many words as indicated by shlCount ; This specifies SYMMAIN array paragraph indices. endstruc 2019-04-03T23:26:21+02:00 Wed