Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 3,429 of 4,675    |
|    wolfgang kern to John    |
|    Re: DOS debug to com    |
|    10 Jun 18 13:36:21    |
      From: nowhere@never.at               Kerr-Mudd,John wrote:              >>> Having belatedly discovered GNU's xxd with it's -r option,       >>> I've done a version for DOS.              >>> If you can get the body of the hex into a com file, you can run the       >>> program so you never need to do it again, IYSWIM. Caters for both MS       >>> debug and grdb.              >>> Uses DOS redirection, so not much use to you, Wolfgang.       >>> (might wrap, lines are 78 long)              >> Yes even it doesn't make any sense for me, I couldn't resist to spend       >> 1/4h to translate it just for fun... and I see many branches here :)              > Well here's a version that allows for larger files.       > (it checks for a full line to 0A before processing it; if a partial line       > it copies the part line and reads another buffer amount; oflw of the       > output buffer similarly triggers a write). I could save the duplicate       > read at the expense of a check on each line)              DOS.com files occupy full 64KB (code, PSP and stack are lost for data).       A common trick to work with a total of 64KB Data is to move the stack       down (towards your code) and adjust DS/ES to point right after SS-top.              if your code + PSP + stack fit 0x400 bytes then I'd use       (perhaps better after cmdline check and text display)               mov sp,0x400 ;assume SS=CS        mov ax,cs ;0x168d        add ax,0x40 ;0x16cd == 168d:0400        mov ds,ax ;full 64K free there (ie source)        add ax,0x1000 ;0x26cd        mov es,ax ;and another free 64KB here (ie destin).              not to mention that FS and GS are available too ...       __       wolfgang              havent checked this because I have no clue what it shall do :)              > 168D:0100 BA D9 01 mov dx,01D9       > 168D:0103 81 3E 82 00 2D cmp word [0082],682D       > 68       > 168D:0109 74 6E jz 0179       > 168D:010B BE 32 D5 mov si,D532       > 168D:010E BA 00 02 mov dx,0200       > 168D:0111 B9 37 D3 mov cx,D337       > 168D:0114 31 DB xor bx,bx       > 168D:0116 B4 3F mov ah,3F       > 168D:0118 CD 21 int 21       > 168D:011A 89 D7 mov di,dx       > 168D:011C 91 xchg ax,cx       > 168D:011D E3 57 jcxzw 0176       > 168D:011F B0 2D mov al,2D       > 168D:0121 AE scasb       > 168D:0122 74 04 jz 0128       > 168D:0124 B0 3E mov al,3E       > 168D:0126 F2 AE repnz scasb       > 168D:0128 80 3D 64 cmp byte [di],64       > 168D:012B 75 49 jnz 0176       > 168D:012D B0 3A mov al,3A       > 168D:012F F2 AE repnz scasb       > 168D:0131 75 56 jnz 0189       > 168D:0133 B0 20 mov al,20       > 168D:0135 F2 AE repnz scasb       > 168D:0137 B3 31 mov bl,31       > 168D:0139 8A 05 mov al,[di]       > 168D:013B 47 inc di       > 168D:013C 3C 30 cmp al,30       > 168D:013E 72 2F jb 016F       > 168D:0140 24 4F and al,4F       > 168D:0142 D4 37 aam 37       > 168D:0144 80 F2 01 xor dl,01       > 168D:0147 75 05 jnz 014E       > 168D:0149 4E dec si       > 168D:014A 8A 24 mov ah,[si]       > 168D:014C D5 10 aad 10       > 168D:014E 88 04 mov [si],al       > 168D:0150 46 inc si       > 168D:0151 75 1C jnz 016F       > 168D:0153 80 FA 01 cmp dl,01       > 168D:0156 74 E1 jz 0139       > 168D:0158 53 push bx       > 168D:0159 51 push cx       > 168D:015A 52 push dx       > 168D:015B B3 01 mov bl,01       > 168D:015D BA 32 D5 mov dx,D532       > 168D:0160 89 F1 mov cx,si       > 168D:0162 89 D6 mov si,dx       > 168D:0164 29 D1 sub cx,dx       > 168D:0166 B4 40 mov ah,40       > 168D:0168 CD 21 int 21       > 168D:016A 5A pop dx       > 168D:016B 59 pop cx       > 168D:016C 5B pop bx       > 168D:016D E3 13 jcxzw 0182       > 168D:016F 4B dec bx       > 168D:0170 74 11 jz 0183       > 168D:0172 E2 C5 loopw 0139       > 168D:0174 EB 31 jmp 01A7       > 168D:0176 BA CB 01 mov dx,01CB       > 168D:0179 B4 09 mov ah,09       > 168D:017B CD 21 int 21       > 168D:017D B8 01 4C mov ax,4C01       > 168D:0180 CD 21 int 21       > 168D:0182 C3 ret       > 168D:0183 B0 0A mov al,0A       > 168D:0185 F2 AE repnz scasb       > 168D:0187 75 1E jnz 01A7       > 168D:0189 E3 CD jcxzw 0158       > 168D:018B 51 push cx       > 168D:018C 57 push di       > 168D:018D B0 0A mov al,0A       > 168D:018F F2 AE repnz scasb       > 168D:0191 5F pop di       > 168D:0192 59 pop cx       > 168D:0193 74 98 jz 012D       > 168D:0195 80 FE 00 cmp dh,00       > 168D:0198 74 93 jz 012D       > 168D:019A 51 push cx       > 168D:019B 56 push si       > 168D:019C 89 FE mov si,di       > 168D:019E BF 00 02 mov di,0200       > 168D:01A1 F3 A4 repz movsb       > 168D:01A3 5E pop si       > 168D:01A4 59 pop cx       > 168D:01A5 89 FA mov dx,di       > 168D:01A7 80 FE 00 cmp dh,00       > 168D:01AA 74 AC jz 0158       > 168D:01AC 51 push cx       > 168D:01AD B9 37 D3 mov cx,D337       > 168D:01B0 53 push bx       > 168D:01B1 31 DB xor bx,bx       > 168D:01B3 B4 3F mov ah,3F       > 168D:01B5 CD 21 int 21       > 168D:01B7 BA 00 02 mov dx,0200       > 168D:01BA 89 D7 mov di,dx       > 168D:01BC 91 xchg ax,cx       > 168D:01BD 09 C9 or cx,cx       > 168D:01BF 75 02 jnz 01C3       > 168D:01C1 B6 00 mov dh,00       > 168D:01C3 5B pop bx       > 168D:01C4 58 pop ax       > 168D:01C5 01 C1 add cx,ax       > 168D:01C7 E3 8F jcxzw 0158       > 168D:01C9 EB BE jmp 0189       > 1CB 'Not dbg dump',0x0D,0x0A       > 1D9 'Usage is: xxd-r |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca