home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / pdp11 / k11deb.mac < prev    next >
Text File  |  2020-01-01  |  8KB  |  374 lines

  1.     .title    k11deb    debugging support for kermit-11
  2.     .ident    /1.0.01/
  3.     .psect
  4.  
  5.  
  6. ;    21-May-84  22:07:50  Brian Nelson
  7. ;
  8. ;    Copyright (C) 1984  Change Software, Inc.
  9.  
  10.  
  11.  
  12.  
  13.  
  14.     .if ndf, K11INC
  15.     .ift
  16.     .include    /IN:K11MAC.MAC/
  17.     .endc
  18.  
  19.     .psect    $code
  20.  
  21.  
  22.     .enabl    gbl
  23.  
  24.  
  25.  
  26.     chr    =    1
  27.     int    =    2
  28.  
  29.     .psect    $addr    ,ro,d,lcl,rel,con
  30. texadr::
  31.     .psect    $addr1    ,ro,d,lcl,rel,con
  32. virtad:
  33.     .psect    $type    ,ro,d,lcl,rel,con
  34. symtyp:
  35.     .psect    $size    ,ro,d,lcl,rel,con
  36. symsiz:
  37.  
  38.     .psect    $code
  39.  
  40.  
  41.     .macro    entry    name,type,size
  42.     .save
  43.     .if b    ,name
  44.     .ift
  45.     .psect    $addr    ,ro,d,lcl,rel,con
  46.     .word    0
  47.     .iff
  48.     .dsabl    lc
  49.     .psect    $name    ,ro,d,lcl,rel,con
  50.     $$ = .
  51.     .asciz    #name#
  52.     .psect    $addr    ,ro,d,lcl,rel,con
  53.     .word    $$
  54.     .psect    $addr1    ,ro,d,lcl,rel,con
  55.     .word    name
  56.     .psect    $type    ,ro,d,lcl,rel,con
  57.     .word    type
  58.     .psect    $size    ,ro,d,lcl,rel,con
  59.     .word    size
  60.     .enabl    lc
  61.     .endc
  62.     .restore
  63.     .endm    entry
  64.  
  65.  
  66.  
  67.     .sbttl    define the symbol names
  68.  
  69.  
  70.     entry    <$image>, int, 1
  71.     entry    <albuff>, int, 1
  72.     entry    <altcon>, int, 1
  73.     entry    <argbuf>, int, 1
  74.     entry    <argpnt>, int, 1
  75.     entry    <at$acc>, int, 1
  76.     entry    <at$are>, int, 1
  77.     entry    <at$bil>, int, 1
  78.     entry    <at$bsi>, int, 1
  79.     entry    <at$cre>, int, 1
  80.     entry    <at$dis>, int, 1
  81.     entry    <at$enc>, int, 1
  82.     entry    <at$fab>, int, 15
  83.     entry    <at$for>, int, 1
  84.     entry    <at$id>,  int, 1
  85.     entry    <at$len>, int, 1
  86.     entry    <at$xle>, int, 1
  87.     entry    <at$pas>, int, 1
  88.     entry    <at$pr0>, int, 1
  89.     entry    <at$pr1>, int, 1
  90.     entry    <at$sys>, int, 2
  91.     entry    <at$typ>, int, 1
  92.     entry    <at$val>, int, 1
  93.     entry    <atrctx>, int, 1
  94.     entry    <binmod>, int, 1
  95.     entry    <bintyp>, chr, 4*40
  96.     entry    <cccnt>,  int, 1
  97.     entry    <chario>, int, 1
  98.     entry    <chksiz>, int, 1
  99.     entry    <chktyp>, int, 1
  100.     entry    <cmdadr>, int, 1
  101.     entry    <cmdbuf>, int, 1
  102.     entry    <cmdlun>, int, 1
  103.     entry    <cmdnum>, int, 1
  104.     entry    <conesc>, int, 1
  105.     entry    <conpar>, chr, 20
  106.     entry    <consts>, int, 2
  107.     entry    <do8bit>, int, 1
  108.     entry    <dolong>, int, 1
  109.     entry    <doattr>, int, 1
  110.     entry    <debug>,  int, 1
  111.     entry    <defdir>, chr, filsiz+2
  112.     entry    <doauto>, int, 1
  113.     entry    <do8bit>, int, 1
  114.     entry    <dorpt> , int, 1
  115.     entry    <duplex>, int, 1
  116.     entry    <en$siz>, int, 1
  117.     entry    <errtxt>, chr, 102
  118.     entry    <filnam>, chr, filsiz+2
  119.     entry    <handch>, int, 1
  120.     entry    <image>,  int, 1
  121.     entry    <index>,  int, 1
  122.     entry    <inopn>,  int, 1
  123.     entry    <inserv>, int, 1
  124.     entry    <jobtyp>, int, 1
  125.     entry    <kbiost>, int, 2
  126.     entry    <linkst>, int, 1
  127.     entry    <logfil>, chr, 40
  128.     entry    <logstr>, chr, 40
  129.     entry    <maxtry>, int, 1
  130.     entry    <mcrcmd>, int, 1
  131.     entry    <modem> , chr, 40
  132.     entry    <numtry>, int, 1
  133.     entry    <oldtry>, int, 1
  134.     entry    <outlun>, int, 1
  135.     entry    <outopn>, int, 1
  136.     entry    <paknum>, int, 1
  137.     entry    <parity>, int, 1
  138.     entry    <pauset>, int, 1
  139.     entry    <pcnt.r>, int, 34
  140.     entry    <pcnt.s>, int, 34
  141.     entry    <pnhead>, int, 1
  142.     entry    <procty>, int, 1
  143.     entry    <procom>, int, 1
  144.     entry    <proflg>, int, 1
  145.     entry    <prompt>, chr, 40
  146.     entry    <ranerr>, int, 1
  147.     entry    <rawfil>, int, 1
  148.     entry    <reccnt>, int, 1
  149.     entry    <recpar>, chr, 20
  150.     entry    <reclng>, int, 1
  151.     entry    <recwin>, int, 1
  152.     entry    <remote>, int, 1
  153.     entry    <rptquo>, int, 1
  154.     entry    <rsx32>    , int, 1
  155.     entry    <rtwork>, int, 10
  156.     entry    <rtflow>, int, 1
  157.     entry    <rtvol> , int, 1
  158.     entry    <sencnt>, int, 1
  159.     entry    <sendat>, int, 1
  160.     entry    <sendly>, int, 1
  161.     entry    <senlng>, int, 1
  162.     entry    <senwin>, int, 1
  163.     entry    <senpar>, chr, 20
  164.     entry    <sermod>, int, 1
  165.     entry    <sertim>, int, 1
  166.     entry    <serwai>, int, 1
  167.     entry    <setrec>, chr, 20
  168.     entry    <setsen>, chr, 20
  169.     entry    <size>,   int, 1
  170.     entry    <skipfl>, int, 1
  171.     entry    <recsop>, int, 1
  172.     entry    <sensop>, int, 1
  173.     entry    <sparsz>, int, 1
  174.     entry    <srcnam>, chr, filsiz+2
  175.     entry    <state>,  int, 1
  176.     entry    <sy.ini>, int, 1
  177.     entry    <tcdlu>,  int, 1
  178.     entry    <testc>,  int, 1
  179.     entry    <times>,  int, 4
  180.     entry    <tists>,  int, 2
  181.     entry    <tmperr>, int, 1
  182.     entry    <totp.r>, int, 34
  183.     entry    <totp.s>, int, 34
  184.     entry    <tsxflg>, int, 1
  185.     entry    <trace>,  int, 1
  186.     entry    <ttcons>, chr, 20
  187.     entry    <ttdial>, chr, 20
  188.     entry    <ttname>, chr, 20
  189.     entry    <umddef>, int, 1
  190.     entry    <vttype>, int, 1
  191.     entry    <xgottn>, int, 1
  192.     entry    <xmode>,  int, 1
  193.     entry
  194.  
  195.  
  196.  
  197.  
  198.     .sbttl    the real work comes next
  199.     .enabl    lsb
  200.     .psect    $code
  201.  
  202.  
  203. c$disp::mov    argbuf    ,r0        ; locate the symbol in directory
  204.     cmpb    @r0    ,#'0        ; /45/ Numeric ?
  205.     blo    5$            ; /45/ no
  206.     cmpb    @r0    ,#'7        ; /45/ Numeric ?
  207.     bhi    5$            ; /45/ No
  208.     calls    octval    ,<r0>        ; /45/ Yes, get the address
  209.     octout    @r1            ; /45/ Dump the data
  210.     message                ; /45/ crlf
  211.     br    100$            ; /45/ Exit
  212. 5$:    cmpb    @r0    ,#'*        ; dump everything today ?
  213.     bne    20$            ; no
  214.     clr    r0            ; yes, start with first one
  215. 10$:    tst    texadr(r0)        ; keep going until address of zero
  216.     beq    100$            ; exit
  217.     call    prtsym            ; print the symbol out
  218.     add    #2    ,r0        ; next please
  219.     message                ; a cr/lf
  220.     br    10$            ; next please
  221.  
  222. 20$:    call    findsy            ; find the symbol now
  223.     tst    r0            ; found it ?
  224.     bmi    90$            ; no
  225.     call    prtsym            ; dump it please
  226.     br    100$            ; bye
  227.  
  228. 90$:    message    <Can't find symbol in internal STB>,cr
  229. 100$:    message
  230.     return
  231.     
  232.     .dsabl    lsb
  233.  
  234.  
  235.  
  236.     .sbttl    print the contents out
  237.     .enabl    lsb
  238.  
  239. ;    input:    r0    offset
  240.  
  241.  
  242. prtsym:    save    <r0,r1,r2,r3,r4,r5>    ; save this
  243.     sub    #20    ,sp        ; allocate a small text buffer
  244.     mov    sp    ,r3        ; and a pointer
  245.     mov    r0    ,r5        ; insure we don't zap offset
  246.     print    texadr(r5)        ; print the symbol name
  247.     mov    symtyp(r5),r4        ; get the class of symbol
  248.     asl    r4            ; times 2 for word indexing
  249.     print    200$-2(r4)        ; format it a bit
  250.     deccvt    symsiz(r5),r3,#4    ; print the data item size
  251.     print    r3    ,#4        ; print that out
  252.     message                ; crlf
  253.     message                ; crlf
  254.     jsr    pc    ,@190$-2(r4)    ; call correct formatter routine
  255.     message                ; extra crlf
  256.     add    #20    ,sp
  257.     unsave    <r5,r4,r3,r2,r1,r0>
  258.     return
  259.     
  260.     
  261.  
  262.     .save
  263.     .psect    $PDATA    ,D
  264. 190$:    .word    pbyte,pint
  265. 200$:    .word    210$,220$
  266. 210$:    .asciz    /  Byte data,  size /
  267. 220$:    .asciz    /  Word data,  size /
  268.     .even
  269.     .restore
  270.  
  271.     .dsabl    lsb
  272.  
  273.  
  274.     .sbttl    format for byte and integer data
  275.     .enabl    lsb
  276.  
  277.  
  278. pbyte:    sub    #20    ,sp        ; a buffer to use today
  279.     mov    symsiz(r5),r1        ; format byte data please
  280.     beq    390$            ; exit
  281.     mov    virtad(r5),r5        ; get the base address
  282. 310$:    mov    #20    ,r3        ; maximum of 16 items per line
  283. 320$:    mov    sp    ,r2        ; pointer to local buffer
  284.     movb    #40    ,(r2)+        ; a leading space
  285.     clr    r4            ; get the next byte please
  286.     bisb    (r5)+    ,r4        ; without sign extension
  287.     mov    r4    ,r0        ; copy it
  288.     ash    #-6    ,r0        ; get the high two bits now
  289.     bic    #^C3    ,r0        ; mask the lower bits please
  290.     add    #'0    ,r0        ; convert
  291.     movb    r0    ,(r2)+        ; and copy
  292.     mov    r4    ,r0        ; copy it
  293.     ash    #-3    ,r0        ; get the high two bits now
  294.     bic    #^C7    ,r0        ; mask the lower bits please
  295.     add    #'0    ,r0        ; convert
  296.     movb    r0    ,(r2)+        ; and copy
  297.     mov    r4    ,r0        ; copy it
  298.     bic    #^C7    ,r0        ; mask the lower bits please
  299.     add    #'0    ,r0        ; convert
  300.     movb    r0    ,(r2)+        ; and copy
  301.     clrb    @r2            ; at last, .asciz
  302.     mov    sp    ,r2        ; restore buffer pointer and print
  303.     print    r2            ; simple
  304.     dec    r1            ; anything else to print
  305.     beq    330$            ; no
  306.     sob    r3    ,320$        ; yes, next on the line please
  307.     message                ; filled the line
  308.     br    310$            ; next line
  309. 330$:    message                ; a final cr/lf
  310. 390$:    add    #20    ,sp        ; release the local buffer
  311.     return                ; and exit
  312.     
  313.  
  314.  
  315. pint:    mov    symsiz(r5),r1        ; get the number of data elements
  316.     beq    490$            ; nothing to do at all
  317.     mov    virtad(r5),r2        ; get the address of what to print
  318. 410$:    mov    #5    ,r3        ; number of items per line
  319. 420$:    decout    (r2)            ; dump it
  320.     message    <(>
  321.     octout    (r2)+
  322.     message    <)>
  323.     dec    r1            ; all done yet ?
  324.     beq    430$            ; yes, exit
  325.     sob    r3    ,420$        ; not done, print next item
  326.     message                ; a cr/lf
  327.     br    410$            ; next line of printinh
  328. 430$:    message                ; last cr/lf
  329. 490$:    return                ; all done, exit
  330.  
  331.     .dsabl    lsb
  332.  
  333.  
  334.  
  335.     .sbttl    locate symbol offset in index
  336.  
  337.  
  338.  
  339.  
  340. findsy:    save    <r1,r2,r3,r4,r5>    ; save all the registers
  341.     sub    #20    ,sp        ; allocate a buffer for upcase cvt
  342.     mov    sp    ,r2        ; and allocate a pointer
  343.     copyz    r0,r2,#10        ; and copy the data over
  344.     strlen    r2            ; get the string length now
  345.     calls    cvt$$    ,<r2,r0,#40>    ; convert lower to upper case now
  346.     mov    r0    ,r4        ; anything there ?
  347.     beq    90$            ; no
  348.     
  349.     clr    r5            ; initial index here
  350. 10$:    mov    texadr(r5),r1        ; point to the text now
  351.     beq    90$            ; if eq, we hit the end of it all
  352.     strlen    r1            ; get the length of that text
  353.     cmp    r0    ,r4        ; exact match on the length ?
  354.     bne    30$            ; no, try again please
  355.     mov    r2    ,r3        ; saved pointer to text
  356. 20$:    cmpb    (r3)+    ,(r1)+        ; check for exact match on characters
  357.     bne    30$            ; no
  358.     sob    r0    ,20$        ; yes, next please
  359.     br    40$            ; a match
  360. 30$:    add    #2    ,r5        ; no match, advance to the next address
  361.     br    10$            ; next please
  362.  
  363. 40$:    mov    r5    ,r0        ; return index in r0
  364.     br    100$            ; bye
  365.  
  366. 90$:    mov    #-1    ,r0        ; no match, return index of -1
  367. 100$:    add    #20    ,sp        ; pop local buffer and exit
  368.     unsave    <r5,r4,r3,r2,r1>    ; pop all registers we used
  369.     return
  370.  
  371.  
  372.     
  373.     .end
  374.