News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Video Pages

Started by dncprogrammer, March 02, 2006, 06:12:22 PM

Previous topic - Next topic

dncprogrammer

Michael,
Thank you for the clarification. I wrote a little, dskpatch inspired, memroy dump program today. Don't worry, I didn't steal any code. I wrote my own. I have been working on my library of routines for quite some time and writing heavier programs is so much easier now. I used PgUp and PgDn to display 300 and some bytes of memory (hex on left, and ASCII on right - how original) starting with 0000:0000 and incrementing or decrementing on each screen. On the far left I also display the offset for each line of each page of information. I should already know this but Im getting a bit confused on my hex numbering. I can show memory from 0000 to FFFFh and then my program zeros back to 0000. No problem. How do I increment to the next byte after 0000:FFFFh. Do I allow the program to begin incrementing the "segment" value each time I hit FFFFh on the offset value? ex.

0000:FFFFh then next line would be 0001:FFFFh and so on? Im sorry for such a question but examples bring everything together for me.

jon

MichaelW

I think the best method would depend on the purpose of the dump. For dumping real-mode memory I can't really see any good reason to cross segment boundaries, when everything is by necessity split up into segments. The dump would be easier to code and easier to understand if the dump segment were fixed, and only the offset address varied. For protected or big-real mode, assuming a flat address space, I think the memory should be addressed by absolute address.

eschew obfuscation

dncprogrammer

Ok Michael,
I agree with your opinion on functionality. Remember Im doing these projects as experiments and I guess my question is more like this: If I wanted my program to run past the absolute FFFFh, in Real-Mode, to the next byte then what would be my increment at the "add  ax, ??"

             xor   bx, bx
             mov  es, bx                     ; start at 0000:0000

ALoop:    mov ah, BYTE [es:bx]      ; grab byte
              call   DisplayAhChar          ; update display
              inc   bx                          ; inc to next byte
              cmp bx, FFFFh                ; check for end of seg
              jbe   ALoop                    ; < or = loop for next char
SegInc:   mov  ax, es                     ; > trans es into ax
              add  ax, ??                      ; inc segment value
              cmp  ax, FFFFh                ; valiid?
              jg     Rset                       ; no, reset values
Set:        mov  es, ax                     ; yes, assign new value to es
              xor   bx, bx                     ;        reset offset vaule
              jbe    ALoop                    ;        loop back for bytes
Rset:       xor    bx, bx                    ; reset to 0
              mov   es, bx                    ; "
              jmp   ALoop                    ; loop back


jon


MichaelW

Assuming you want to progress through the absolute addresses without repeating any address, you should add 1000h to the segment address when you reset the offset to zero. Perhaps I should add that to generate an absolute address the processor (effectively) shifts the segment address left by four bit positions (equivalent to one hex digit) and adds the offset address.

0000:0000 = 00000
...
0000:FFFF = 0FFFF
1000:0000 = 10000
...
1000:FFFF = 1FFFF
2000:0000 = 20000
...

eschew obfuscation