home *** CD-ROM | disk | FTP | other *** search
/ Boldly Go Collection / version40.iso / TS / 25D / SETMEM.ZIP / SETMEM.ASM next >
Encoding:
Assembly Source File  |  1992-04-03  |  1.7 KB  |  108 lines

  1. ; This program fills memory from the end of the program to 9FFFF with
  2. ;  specified values.  This can help when trying to track down uninitialized
  3. ;  variable problems.  The syntax is:
  4. ;  SETMEM [{hex number of any even length} {"any string"}]...
  5. ;   if a number is specified, memory is filled with that pattern, otherwise
  6. ;    memory is set to zeros.  Example: SETMEM 01 ff "j" 1523 fills memory
  7. ;     with a repeating 01 ff 6a 15 23 pattern.
  8. ; This program is public domain.
  9. ;  Joe Ahlgren  92/04/03  BBS 703-241-7980  CSID 70461,2340
  10. ;
  11. ;
  12.  assume cs:cseg,ds:cseg,es:cseg,ss:cseg
  13. cseg segment para public 'code'
  14. setmem proc near
  15.  mov si,81h
  16.  mov di,si
  17.  mov cl,ds:[80h]
  18.  mov ch,0
  19.  xor ax,ax
  20.  xor bx,bx
  21.  cld
  22.  jcxz checklist
  23. setloop:
  24.  lodsb
  25.  test bx,08000h
  26.  jnz QuoteString
  27.  cmp al,022h
  28.  je StartQuote
  29.  sub al,'0'
  30.  jb nochar
  31.  cmp al,9
  32.  jbe gotchar
  33.  sub al,'A'-'0'
  34.  jb nochar
  35.  cmp al,5
  36.  jbe gotalpha
  37.  sub al,'a'-'A'
  38.  jb nochar
  39.  cmp al,5
  40.  ja nochar
  41. gotalpha:
  42.  add al,10
  43. gotchar:
  44.  test bx,1
  45.  jz nopair
  46.  or al,ah
  47.  stosb
  48.  mov al,0
  49. nopair:
  50.  shl al,1
  51.  shl al,1
  52.  shl al,1
  53.  shl al,1
  54.  mov ah,al
  55.  inc bx
  56.  jmp short nochar
  57. StartQuote:
  58.  or bx,08000h
  59.  jmp short nochar
  60. QuoteString:
  61.  cmp al,022h
  62.  jne QuoteOK
  63.  and bx,07ffeh
  64.  jmp short nochar
  65. QuoteOK:
  66.  stosb
  67.  inc bx
  68.  inc bx
  69. nochar:
  70.  loop setloop
  71. ;
  72. checklist:
  73.  and bx,07ffeh
  74.  shr bx,1
  75.  jnz ParamSpec
  76.  xor ax,ax
  77.  stosb
  78.  inc bx
  79. ParamSpec:
  80.  mov si,81h
  81.  add bx,si
  82.  mov cx,es
  83.  add cx,(LastByte-Setmem+255+15)/16
  84. NextPara:
  85.  xor di,di
  86.  mov es,cx
  87. OnePara:
  88.  movsb
  89.  cmp si,bx
  90.  jb MoreSource
  91.  mov si,81h
  92. MoreSource:
  93.  cmp di,16
  94.  jb OnePara
  95.  inc cx
  96.  cmp cx,0a000h
  97.  jb NextPara
  98. ;
  99.  mov ax,4c00h
  100.  int 21h
  101. LastByte dw 0
  102. setmem endp
  103. cseg ends
  104.  end
  105.  
  106.  
  107.  
  108.