home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / b / krtdeb.min < prev    next >
Text File  |  2020-01-01  |  5KB  |  312 lines

  1.     .title    KRTDEB.MIN  Examine data in memory
  2.     .ident    "V03.62"
  3.  
  4. ; /62/    31-May-93  Billy Youdelman
  5.  
  6. ;    Copyright 1984 Change Software, Inc.
  7.  
  8.     .include "IN:KRTMAC.MIN"
  9.     .iif ndf  KRTINC  .error    <; .include for IN:KRTMAC.MIN failed>
  10.  
  11.     CHR    =    1
  12.     INT    =    2
  13.  
  14.     .macro    entry    name ,type ,size
  15.     .save
  16.     .if  b    <name>
  17.     .psect    $addr
  18.     .word    0
  19.     .iff
  20.     .dsabl    lc
  21.     .psect    $name    ,ro,d,lcl,rel,con
  22.     $$ = .
  23.     .asciz    #name#
  24.     .psect    $addr
  25.     .word    $$
  26.     .psect    $addr1
  27.     .word    name
  28.     .psect    $type
  29.     .word    type
  30.     .psect    $size
  31.     .word    size
  32.     .enabl    lc
  33.     .endc
  34.     .restore
  35.     .endm    entry
  36.  
  37.  
  38.     .sbttl    Symbol name data table
  39.  
  40.     .psect    $addr    ,ro,d,lcl,rel,con
  41. texadr:
  42.     .psect    $addr1    ,ro,d,lcl,rel,con
  43. virtad:
  44.     .psect    $type    ,ro,d,lcl,rel,con
  45. symtyp:
  46.     .psect    $size    ,ro,d,lcl,rel,con
  47. symsiz:
  48.     .psect    $code
  49.     entry    <$image>, int, 1
  50.     entry    <argbuf>, int, 1
  51.     entry    <argpnt>, int, 1
  52.     entry    <asname>, chr, ln$max
  53.     entry    <at$len>, int, 1
  54.     entry    <at$sys>, chr, 2
  55.     entry    <blknum>, int, 5
  56.     entry    <buflst>, int, 5
  57.     entry    <bufp>,   int, 5
  58.     entry    <bufs>,   int, 5
  59.     entry    <chksiz>, int, 1
  60.     entry    <chktyp>, chr, 1
  61.     entry    <cmdbuf>, int, 1
  62.     entry    <conpar>, chr, 20
  63.     entry    <context>,int, 1
  64.     entry    <date.a>, int, 5
  65.     entry    <do8bit>, int, 1
  66.     entry    <dorpt> , int, 1
  67.     entry    <edists>, int, 1
  68.     entry    <ebquot>, chr, 1
  69.     entry    <errtxt>, chr, erbfsiz
  70.     entry    <filnam>, chr, ln$max
  71.     entry    <filtyp>, int, 5
  72.     entry    <image>,  int, 1
  73.     entry    <index>,  int, 1
  74.     entry    <lokdate>,int, 1
  75.     entry    <loklen>, int, 1
  76.     entry    <lokstat>,int, 1
  77.     entry    <maxtop>, int, 1
  78.     entry    <mcrcmd>, int, 1
  79.     entry    <mode>,   int, 5
  80.     entry    <numtry>, int, 1
  81.     entry    <outlun>, int, 1
  82.     entry    <outopn>, int, 1
  83.     entry    <packet>, chr, $allsiz
  84.     entry    <paknum>, int, 1
  85.     entry    <pcnt.r>, int, 2*34
  86.     entry    <pcnt.s>, int, 2*34
  87.     entry    <prexon>, int, 1
  88.     entry    <prot.a>, int, 5
  89.     entry    <qu.ini>, int, 1
  90.     entry    <restof>, int, 1
  91.     entry    <rptquo>, int, 1
  92.     entry    <rtwork>, int, 10
  93.     entry    <senpar>, chr, 20
  94.     entry    <size>,   int, 1
  95.     entry    <sizof>,  int, 5
  96.     entry    <snd8bit>,int, 1
  97.     entry    <spare1>, chr, 256.
  98.     entry    <sparsz>, int, 1
  99.     entry    <srcnam>, chr, ln$max
  100.     entry    <stklim>, chr, stksiz
  101.     entry    <totp.r>, int, 1
  102.     entry    <totp.s>, int, 1
  103.     entry    <ttbuf>,  int, ttbsiz+2
  104.     entry    <ttparm>, int, 1
  105.     entry    <ttpar2>, int, 1
  106.     entry    <undchr>, chr, 2
  107.     entry    <undlin>, chr, ln$max+2
  108.     entry
  109.  
  110.  
  111.     .sbttl    EXAMINE data in memory
  112.     .enabl    lsb
  113.  
  114. c$disp::upcase    argbuf
  115.     cmpb    @r0    ,#'0
  116.     blo    5$
  117.     cmpb    @r0    ,#'9
  118.     bhi    5$
  119.     calls    octval    ,<r0>
  120.     tst    r0
  121.     bne    93$
  122.     bic    #1    ,r1
  123.     octout    @r1
  124.     br    100$
  125.  
  126. 5$:    cmpb    @r0    ,#'*
  127.     bne    20$
  128.     clr    r0
  129. 10$:    tst    texadr(r0)
  130.     beq    101$
  131.     call    prtsym
  132.     add    #2    ,r0
  133.     .newline
  134.     br    10$
  135.  
  136. 20$:    call    findsy
  137.     tst    r0
  138.     bmi    90$
  139.     call    prtsym
  140.     br    100$
  141.  
  142. 90$:    wrtall    #300$
  143.     wrtall    #310$
  144.     br    100$
  145. 93$:    wrtall    #300$
  146.     wrtall    #320$
  147. 100$:    .newline
  148. 101$:    clr    r0
  149.     return
  150.  
  151.     .save
  152.     .psect    $pdata
  153. 300$:    .asciz    "?KRTDEB-E-"
  154. 310$:    .asciz    "Symbol not in internal STB"
  155. 320$:    .asciz    "Bad octal value"
  156.     .even
  157.     .restore
  158.  
  159.     .dsabl    lsb
  160.  
  161.  
  162.     .sbttl    Print symbol
  163.     .enabl    lsb
  164.  
  165. prtsym:    save    <r0>
  166.     sub    #20    ,sp
  167.     mov    sp    ,r3
  168.     mov    r0    ,r5
  169.     wrtall    texadr(r5)
  170.     mov    symtyp(r5),r4
  171.     asl    r4
  172.     wrtall    200$-2(r4)
  173.     deccvt    symsiz(r5),r3,#5
  174.     clrb    5(r3)
  175.     wrtall    r3
  176.     mov    #'.    ,r0
  177.     call    writ1ch
  178.     wrtall    #300$
  179.     octout    virtad(r5)
  180.     .newline
  181.     .newline
  182.     jsr    pc    ,@190$-2(r4)
  183.     add    #20    ,sp
  184.     unsave    <r0>
  185.     return
  186.  
  187.     .save
  188.     .psect    $pdata
  189. 190$:    .word    pbyte ,pint
  190. 200$:    .word    210$ ,220$
  191. 210$:    .asciz    <tab>"Byte data, size"
  192. 220$:    .asciz    <tab>"Word data, size"
  193. 300$:    .asciz    <tab>"  Starting address: "
  194.     .even
  195.     .restore
  196.  
  197.     .dsabl    lsb
  198.  
  199.  
  200.     .sbttl    Format byte data
  201.     .enabl    lsb
  202.  
  203. pbyte:    sub    #20    ,sp
  204.     mov    symsiz(r5),togo
  205.     beq    390$
  206.     mov    virtad(r5),r5
  207. 310$:    mov    #20    ,r3
  208.     mov    #ascbuf    ,r1
  209. 320$:    mov    sp    ,r2
  210.     clr    r4
  211.     bisb    (r5)+    ,r4
  212.     clrb    (r1)
  213.     bisb    r4    ,(r1)
  214.     bicb    #^c177    ,(r1)
  215.     cmpb    (r1)    ,#space
  216.     blt    321$
  217.     cmpb    (r1)    ,#177
  218.     blt    323$
  219. 321$:    movb    #'.&77    ,(r1)+
  220.     br    325$
  221. 323$:    tstb    (r1)+
  222. 325$:    mov    r4    ,r0
  223.     ash    #-6    ,r0
  224.     bic    #^c3    ,r0
  225.     add    #'0    ,r0
  226.     movb    r0    ,(r2)+
  227.     mov    r4    ,r0
  228.     ash    #-3    ,r0
  229.     bic    #^c7    ,r0
  230.     add    #'0    ,r0
  231.     movb    r0    ,(r2)+
  232.     mov    r4    ,r0
  233.     bic    #^c7    ,r0
  234.     add    #'0    ,r0
  235.     movb    r0    ,(r2)+
  236.     movb    #space    ,(r2)+
  237.     clrb    @r2
  238.     mov    sp    ,r2
  239.     wrtall    r2
  240.     dec    togo
  241.     beq    330$
  242.     sob    r3    ,320$
  243.     call    400$
  244.     br    310$
  245. 330$:    dec    r3
  246.     ble    337$
  247. 333$:    wrtall    #octpad
  248.     sob    r3    ,333$
  249. 337$:    call    400$
  250. 390$:    add    #20    ,sp
  251.     return
  252.  
  253. 400$:    movb    #cr    ,(r1)+
  254.     movb    #lf    ,(r1)+
  255.     clrb    @r1
  256.     wrtall    #ascbuf
  257.     return
  258.  
  259.  
  260.     .sbttl    Format integer data
  261.  
  262. pint:    mov    symsiz(r5),r1
  263.     beq    490$
  264.     mov    virtad(r5),r2
  265. 410$:    mov    #4    ,r3
  266. 420$:    mov    (r2)+    ,r4
  267.     decout    r4
  268.     message    <. (>
  269.     octout    r4
  270.     message    <)   >
  271.     dec    r1
  272.     beq    430$
  273.     sob    r3    ,420$
  274.     .newline
  275.     br    410$
  276. 430$:    .newline
  277. 490$:    return
  278.  
  279.     .save
  280.     .psect    $rwdata    ,rw,d,lcl,rel,con
  281. togo:    .word    0
  282. ascbuf:    .blkb    24
  283. octpad:    .asciz    "    "
  284.     .even
  285.     .restore
  286.  
  287.     .dsabl    lsb
  288.  
  289.  
  290.     .sbttl    Locate symbol offset in index
  291.  
  292. findsy:    clr    r3
  293.  
  294. 10$:    mov    texadr(r3),r1
  295.     beq    90$
  296.     mov    r0    ,r2
  297. 20$:    cmpb    (r2)+    ,(r1)+
  298.     bne    30$
  299.     tstb    (r2)
  300.     bne    20$
  301.     br    40$
  302. 30$:    add    #2    ,r3
  303.     br    10$
  304.  
  305. 40$:    mov    r3    ,r0
  306.     br    100$
  307.  
  308. 90$:    mov    #-1    ,r0
  309. 100$:    return
  310.  
  311.     .end
  312.