home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / emulation / qlsource / romsrc / sys / dbugtbls_asm < prev    next >
Encoding:
Text File  |  1997-02-23  |  6.4 KB  |  332 lines

  1. */beginfile DBUGTBLS_asm
  2. ; --------------------------------------------------------------
  3. ; DBUGTBLS_asm - QDOS debugging messages
  4. ;          - last modified 18/12/96
  5. ; QDOS-Amiga sources by Rainer Kowallik
  6. ;    ...latest changes by Mark J Swift
  7. ; --------------------------------------------------------------
  8. ;*/beginoverlay
  9.  
  10. ; -------------------------------------------------------------
  11. ;    print long word d0.l as HEX to channel with id a0
  12.  
  13. HEX20:
  14.     swap    d0
  15.     bsr    HEX10
  16.     swap    d0
  17.     bsr    HEX10
  18.     rts
  19.  
  20. ; -------------------------------------------------------------
  21. ;    print word d0.w as HEX to channel with id a0
  22.  
  23. HEX10:
  24.     ror.w    #8,d0
  25.     bsr    HEX08
  26.     rol.w    #8,d0
  27.     bsr    HEX08
  28.     rts
  29.  
  30. ; -------------------------------------------------------------
  31. ;    print byte d0.b as HEX to channel with id a0
  32.  
  33. HEX08:
  34.     ror.b    #4,d0
  35.     bsr    HEX04
  36.  
  37.     rol.b    #4,d0
  38.     bsr    HEX04
  39.  
  40.     rts
  41.  
  42. ; -------------------------------------------------------------
  43. ;    print nibble d0.b as HEX to channel with id a0
  44.  
  45. HEX04:
  46.     movem.l    d0/a1,-(a7)
  47.  
  48.     and.b    #$F,d0
  49.     add.b    #'0',d0
  50.     cmp.b    #'9',d0
  51.     ble.s    HEX04a
  52.     add.b    #7,d0
  53.  
  54. HEX04a:
  55.     asl.w    #8,d0
  56.     move.w    d0,-(a7)
  57.     move.w    #1,-(a7)
  58.     move.l    a7,a1
  59.     bsr    IOSTRG
  60.     addq    #4,a7
  61.  
  62.     movem.l    (a7)+,d0/a1
  63.     rts
  64.  
  65. ; -------------------------------------------------------------
  66. ;    print string at (a1) to channel with id a0
  67.  
  68. IOSTRG:
  69.     movem.l    d0-d3/a1-a2,-(a7)
  70.  
  71.     ifnd     serdbg
  72.  
  73.     moveq    #-1,d3        ; time-out
  74.     move.w    (a1)+,d2     ; get length
  75.     moveq    #IO.SSTRG,d0
  76.     andi    #$F8FF,sr    ; enable interrupts
  77.     trap    #3        ; send string
  78.  
  79.     tst.l    d0
  80.     beq.s    IOSTRGX
  81.  
  82.     move.l    BV_CHBAS(a6),d1    ; get ptr to BASICs # table
  83.     move.l    #-1,0(a6,d1.l)    ; otherwise close BASICs' #0
  84.     moveq    #IO.CLOSE,d0
  85.     trap    #2        ; close channel
  86.     bsr    CH_ZERO
  87.  
  88.     endif
  89.  
  90.     ifd    serdbg
  91.  
  92.     MOVE.B    #%10000000,$BFD000  ; DTR low (1) not ready to receive
  93.                   ; RTS high (0) ready to send
  94.  
  95.     move.w    (a1)+,d2
  96.     bra.s    SER_S1
  97.  
  98. SER_LOOP:
  99.     moveq    #0,d1
  100.     move.b    (a1)+,d1
  101.  
  102.     or.w    #$300,d1     ; set two stop bits
  103.     move.w    D1,$DFF030    ; write data to SERDAT
  104.  
  105. SER_S0:
  106.     move.w    $DFF01E,d3    ; read INTREQR
  107.     btst    #0,d3        ; interrupt from buff empty?
  108.     beq    SER_S0        ; nope, try again
  109.  
  110. SER_S1:
  111.     btst    #4,$BFD000    ; test CTS bit in CIAB_PRA
  112.     bne.s    SER_S1        ; loop if not ready
  113.  
  114.     move.w    #%0000000000000001,$DFF09C ; reset TBE int in INTREQ
  115.  
  116.     dbra    d2,SER_LOOP
  117.  
  118.     endif
  119.  
  120. IOSTRGX:
  121.     movem.l    (a7)+,d0-d3/a1-a2
  122.     rts
  123.  
  124.  
  125. ; --------------------------------------------------------------
  126. ;  Find channel ID of BASICs #0 - open a CON if #0 is closed
  127. ;
  128. ;  return A6 = BASICs A6
  129. ;     A5 = Address of system variables
  130. ;     A4 = JCB of JOB
  131. ;     D6 = JOBs RELA6 flag
  132.  
  133. CH_ZERO:
  134.  
  135.     move.l    a7,d0        ; Calculate start of
  136.     andi.w    #-$8000,d0    ; system variables
  137.     move.l    d0,a5
  138.  
  139.     move.l    SV_JBBAS(a5),a4    ; Pointer to base of job table
  140.     move.l    (a4),a4        ; JCB of BASIC
  141.     lea    JB_END(a4),a6    ; get BASICs A6
  142.  
  143.     move.l    SV_JBPNT(a5),a4    ; Ptr to entry in JOB table
  144.     move.l    (a4),a4        ; JCB of current JOB
  145.  
  146.     move.b    JB_RELA6(a4),d6    ; save JB_RELA6
  147.     bclr    #7,JB_RELA6(a4)    ; addresses not a6 relative
  148.  
  149. CH_ZERLUP:
  150.     move.l    BV_CHBAS(a6),d0    ; get ptr to BASICs # table
  151.     move.l    0(a6,d0.l),d0    ; get ID for #0
  152.  
  153.     bge.s    NO_PANIK     ; branch if #0 open
  154.  
  155.     lea    WIN_MON0(pc),a1    ; otherwise open #0 afresh
  156.     moveq    #0,d4
  157.     bsr    OPEN_CON_asd4
  158.  
  159.     bra.s    CH_ZERLUP    ; ...try again
  160.  
  161. NO_PANIK:
  162.     move.l    d0,a0        ; return with ID in a0
  163.  
  164.     rts
  165.  
  166. ; -------------------------------------------------------------
  167. ;    find keyboard queue for channel a0
  168.  
  169. ;    entry: a0 = channel
  170. ;       a5 = sys vars
  171. ;    exit:  a2 = Q for channel or zero.
  172.  
  173. CH_KEYQ:
  174.  
  175.     ifnd    serdbg
  176.  
  177.     sub.l    a2,a2        ; assume no Q
  178.  
  179.     movea.l    SV_CHBAS(a5),a3    ; Ptr to base of chan tabl
  180.     move.l    a0,d0
  181.     asl.w    #2,d0
  182.     move.l    0(a3,d0.w),d0    ; pointer to chan def block
  183.  
  184.     blt.s    CH_KQX        ; exit if #0 is closed
  185.  
  186.     movea.l    d0,a3
  187.     move.l    (a3),a1        ; length of chan
  188.     add.l    a3,a1        ; addr of end of chan def
  189.  
  190.     move.l    SV_KEYQ(a5),d0
  191.     beq.s    CH_KQX        ; exit if no Q's
  192.  
  193.     move.l    d0,a2        ; current Q to d1
  194.  
  195. CH_KQLUP:
  196.     cmp.l    a3,a2        ; check if Q is within
  197.     blt.s    CH_KQNXT     ; current chan def block
  198.  
  199.     cmp.l    a2,a1
  200.     bgt.s    CH_KQX        ; ...and exit if so
  201.  
  202. CH_KQNXT:
  203.     movea.l    (a2),a2        ; next queue
  204.  
  205.     cmpa.l    SV_KEYQ(a5),a2    ; Current key Q
  206.     bne.s    CH_KQLUP     ; next Q <> this Q
  207.  
  208.     sub.l    a2,a2        ; ...eek, not in list
  209.  
  210. CH_KQX:
  211.     move.l    a2,d0        ; set flags
  212.     rts
  213.  
  214.     endif
  215.  
  216.     ifd    serdbg
  217.     moveq    #-1,d0
  218.     rts
  219.     endif
  220.  
  221. ; --------------------------------------------------------------
  222. TXTC    DC.B    0,11,'CODE error ',0
  223.  
  224. TXTR    DC.B    0,11,'READ error ',0
  225. TXTW    DC.B    0,12,'WRITE error '
  226.  
  227. TXTI    DC.B    0,26,'processing INSTRUCTION in '
  228. TXTX    DC.B    0,24,'processing EXCEPTION in '
  229.  
  230. TXTTBL    DC.W    TXTUNK-TXTUDS,TXTUDS-TXTUDS,TXTUPS-TXTUDS,TXTUNK-TXTUDS
  231.     DC.W    TXTUNK-TXTUDS,TXTSDS-TXTUDS,TXTSPS-TXTUDS,TXTACK-TXTUDS
  232.  
  233. TXTUDS    DC.B    0,10,'USER DATA '
  234. TXTUPS    DC.B    0,13,'USER PROGRAM ',0
  235. TXTSDS    DC.B    0,16,'SUPERVISOR DATA '
  236. TXTSPS    DC.B    0,19,'SUPERVISOR PROGRAM ',0
  237. TXTACK    DC.B    0,14,'INTERRUPT ACK '
  238. TXTUNK    DC.B    0,8,'UNKNOWN '
  239.  
  240. TXTG    DC.B    0,11,'at ADDRESS ',0
  241. TXTH    DC.B    0,19,' after INSTRUCTION ',0
  242.  
  243. TXTSR:
  244.     DC.B    0,3,'SR=',0
  245. TXTPC:
  246.     DC.B    0,4,' PC='
  247.  
  248. TXTREG1:
  249.     DC.B    0,6,10,'d0-d7'
  250. TXTREG2:
  251.     DC.B    0,6,10,'a0-a7'
  252.  
  253. TXTREGD:
  254.     DC.B    0,1,'d',0
  255. TXTREGA:
  256.     DC.B    0,1,'a',0
  257. TXTEQU:
  258.     DC.B    0,1,'=',0
  259. TXTSPC:
  260.     DC.B    0,1,' ',0
  261. TXTRTN:
  262.     DC.B    0,2,13,10
  263.  
  264. TXTTMSG:
  265.     DC.B    0,8,'VECTOR: '
  266.  
  267. TXTTTBL:
  268.     DC.W    TXT00-TXT00,TXT04-TXT00,TXT08-TXT00,TXT0C-TXT00
  269.     DC.W    TXT10-TXT00,TXT14-TXT00,TXT18-TXT00,TXT1C-TXT00
  270.     DC.W    TXT20-TXT00,TXT24-TXT00,TXT28-TXT00,TXT2C-TXT00
  271.  
  272. TXT00:
  273.     DC.B    0,4,'(??)'
  274. TXT04:
  275.     DC.B    0,7,'(RESET)',0
  276. TXT08:
  277.     DC.B    0,9,'(BUS ERR)',0
  278. TXT0C:
  279.     DC.B    0,13,'(ADDRESS ERR)',0
  280. TXT10:
  281.     DC.B    0,15,'(ILLEGAL INSTR)',0
  282. TXT14:
  283.     DC.B    0,13,'(ZERO DIVIDE)',0
  284. TXT18:
  285.     DC.B    0,20,'(UNDEFINED CHK TRAP)'
  286. TXT1C:
  287.     DC.B    0,25,'(TRAPV, TRAPcc, cpTRAPcc)',0
  288. TXT20:
  289.     DC.B    0,15,'(PRIVILEGE ERR)',0
  290. TXT24:
  291.     DC.B    0,7,'(TRACE)',0
  292. TXT28:
  293.     DC.B    0,8,'(LINE-A)'
  294. TXT2C:
  295.     DC.B    0,8,'(LINE-F)'
  296.  
  297. TXTFMSG:
  298.     DC.B    0,13,'FORMAT CODE: ',0
  299.  
  300. TXTFTBL:
  301.     DC.W    TXT0000-TXT0000,TXT0001-TXT0000,TXT0010-TXT0000,TXTUNKN-TXT0000
  302.     DC.W    TXTUNKN-TXT0000,TXTUNKN-TXT0000,TXTUNKN-TXT0000,TXTUNKN-TXT0000
  303.     DC.W    TXTUNKN-TXT0000,TXT1001-TXT0000,TXT1010-TXT0000,TXT1011-TXT0000
  304.     DC.W    TXTUNKN-TXT0000,TXTUNKN-TXT0000,TXTUNKN-TXT0000,TXTUNKN-TXT0000
  305.  
  306. TXT0000:
  307.     DC.B    0,9,' (4-WORD)',0
  308. TXT0001:
  309.     DC.B    0,12,' (THROWAWAY)'
  310. TXT0010:
  311.     DC.B    0,9,' (6-WORD)',0
  312. TXT1001:
  313.     DC.B    0,16,' (C/P MID-INSTR)'
  314. TXT1010:
  315.     DC.B    0,18,' (SHORT BUS CYCLE)'
  316. TXT1011:
  317.     DC.B    0,17,' (LONG BUS CYCLE)',0
  318. TXTUNKN:
  319.     DC.B    0,10,' (UNKNOWN)'
  320.  
  321. ; --------------------------------------------------------------
  322. IPC9:
  323.     DC.B    $09
  324.     DC.B    $01
  325.     DC.L    $00000000
  326.     DC.B    $01
  327.     DC.B    $02
  328.  
  329. ;*/endoverlay
  330. ; --------------------------------------------------------------
  331. ;*/endfile
  332.