***************************************************************************** ToggleHex: dc.b $2E,$81,$3E dc.w PQ1-2, CodDisplay-PQ1 beq.s _Show_Hex cs:move.w #CodDisplay-PQ1, PQ1-2 cs:move.w #DissRoutine, PQ2-2 bra.s Exit_Toggle _Show_Hex: cs:move.w #HexDisplay-PQ1, PQ1-2 cs:move.w #HexRoutine, PQ2-2 Exit_Toggle: pop ax bra.w _P_Loop1 ***************************************************************************** ShowMCB: move.w #17, bx ;The length of the box. move.w #64, cx ;The width of the box. move.b #$03, ah ;The colour. bsr.w DrawBox ; ***+++++++++++++++++++++++++++++++++++++++*** move.w di, bx ;Save it. dc.b $66,$B8,$20,$1D,$20,$1D ; move.w #31, cx ; repne:stos.l ; ***+++++++++++++++++++++++++++++++++++++++*** move.w bx, di ;Reset the screen position. cs:move.w CodeSegment, ds ;Set the Data Segment. move.w #INFOLINE, dx ;The string. move.b #$1D, ah ;The colour. bsr.w Print_String ;Print it. ***+++++++++++++++++++++++++++++++++++++++*** NCB_Loop1: lea 162(bx), di ;Move down a line. cs:move.w StartMCB, bx ;Load the MCB we print first. cs:move.b #16, ch ;The line count. ***+++++++++++++++++++++++++++++++++++++++*** MCB_Loop2: push.w di ;Save DI. move.w #-1, si ; move.w bx, ds ;Going to print it... move.b #!HEX_COLA, ah ;Set colour... ***+++++++++++++++++++++++++++++++++++++++*** MCB_Next: cs:move.b #4, cl ; bsr.w Print_Hex ;Print it. lea 8(di), di ;Move... lea 2(si), si ;Move next... ds:move.w (si), bx ; cmp.w #5, si ; bne.s MCB_Next ***+++++++++++++++++++++++++++++++++++++++*** move.w ds, bx ;Save DS first! ds:add.w $0003, bx ;Calculate our next inc.w bx ;MCB block. ***+++++++++++++++++++++++++++++++++++++++*** bsr.w Get_MCB_Name ;Get the owner of the MCB. ***+++++++++++++++++++++++++++++++++++++++*** _MCB_Next: pop.w di ;Restore the line address. lea 160(di), di ;Move down a line. dec.b ch ;Decrement the count. bne.s MCB_Loop2 ;Loop again until zero. ***+++++++++++++++++++++++++++++++++++++++*** MCB_Pause: bsr.w Get_KeyStroke cmp.w #$011B, ax beq.s MCB_Exit cmp.w #$48E0, ax cmp.w #$50E0, ax bra.s MCB_Pause MCB_Exit: rts ***************************************************************************** Get_MCB_Name: ds:move.w $0001, dx ;Is this segment free? or.w dx, dx ;Is it free? bne.s Get_DOS ;No. ***+++++++++++++++++++++++++++++++++++++++*** move.w #DOSFREE, si ;The string to print instead. move.b #!INS_COL, ah ; bra.s Set_Data ***+++++++++++++++++++++++++++++++++++++++*** Get_DOS: cmp.w #8, dx ;Is it a DOS data segment. bne.s DOS_Program ; move.w #DOSDATA, si ; move.b #!BYTE_COL, ah ;Set the colour. Set_Data: cs:move.w CodeSegment, ds ;Set it as ours. move.b #255, cl ; ***+++++++++++++++++++++++++++++++++++++++*** Print_Limited: lods.b ;Load the next byte. or.b al, al ;Zero? beq.s Limit_Exit ;Print the byte to the screen. stos.w ;Print it. dec.b cl ;Decrement the maximum length. bne.s Print_Limited ;Go again if not end. Limit_Exit: rts ***+++++++++++++++++++++++++++++++++++++++*** DOS_Program: move.w ds, ax ;Get the current MCB. dec.w dx ;Move to the PSP's MCB. cmp.w ax, dx ;Does this match? bne.s DOS_Data move.w ds, dx ;Save DS. move.w #DOSPROG, si ;The string to print. move.b #21, cl ;The max print count. move.b #!WORD_COL, ah ;The colour. bra.s DOS_SPrint ***+++++++++++++++++++++++++++++++++++++++*** DOS_Data: move.w #OWNEDBY, si ;The string to print. move.b #35, cl ;The max print count. move.b #!DWORD_COL, ah ;The colour. DOS_SPrint: cs:move.w CodeSegment, ds ;set DS to the code segment. bsr.w Print_Limited ;Print it. move.w #8, si ;Restore SI. move.w dx, ds ;Set our Data Segment. bra.w Print_Limited ;Print and return. ***************************************************************************** *MCB_Next: * cs:move.w FirstMCB, ax ;Load the first MCB. * cs:move.w StartMCB, bx ;Load the top MCB. ***************************************************************************** ShowScreen: move.w #SPALETTE, si bsr.w _Set_Palette bsr.w _Show_MainScreen _Show_Loop: bsr.w Get_KeyStroke or.w ax, ax beq.s _Show_Loop move.w #PALETTE, si bsr.w _Set_Palette pop.w ax push.w #_P_Loop1 bra.w _Show_ProgScreen ***************************************************************************** PageDown: cs:move.w NextPage, ax cs:move.w CodSource, bx cs:move.w ax, CodSource sub.w bx, ax cs:add.w ax, CursorPos rts ***************************************************************************** MoveDown: cs:move.w 4(si), ax cmp.w #1, ax bne.s _MD2 _MD1: cs:inc.w CodSource cs:inc.w CursorPos rts _MD2: cs:cmp.b #1, CursorLine bne.s _MD_ok ******** _Get_Next: cs:move.w CodSource, si bsr.w Get_Inst_Forward cs:move.w ax, CodSource rts _MD_ok: cs:dec.b CursorLine rts ***************************************************************************** MoveUp: cs:move.w 4(si), ax cmp.w #1, ax bne.s _MU2 _MU1: cs:dec.w CodSource cs:dec.w CursorPos rts _MU2: cs:cmp.b #!NUM_LINES, CursorLine bne.s _MU_ok ******** cs:move.w CodSource, si bsr.w Get_Inst_Reverse cs:push.w TmpData cs:pop.w CodSource rts _MU_ok: cs:inc.b CursorLine rts ***************************************************************************** Get_Inst_Reverse: move.w #14, cx ;The maximum instruction length. _GIR_lp: move.w #4002, di ;Move beyond the screen. dec.w si ;Moving on up... push cx ;Save the counter. push si ;Save the start position. ******** push #_GIR_Pooped ;Took me 2 hours to find this bug! push di ;^Return from multiple set prefix^ push #_GIR_Check ;The return address. push si ;Must be the dissassembly address. push di ;Dummy... push di ;Dummy pushes aswell. ******** bra.w Get_Instruction ;Go and get the instruction. ******** _GIR_Check: add.w #4, sp ;Clear the stack. _GIR_Pooped: cs:move.b Size, al ;Add the instruction length. eor.b ah, ah ;Clear AH. add.w si, ax ;Add the count. cs:cmp.w ax, CursorPos ;Check if they match. pop si ;Restore SI. bgt.s _GIR_Next ; ******** cs:move.w si, TmpData ;Save it. ******** _GIR_Next: pop cx ;Restore CX. dbra _GIR_lp rts ***************************************************************************** Get_Inst_Forward: move.w #$4002, di ;The dummy write address. push #_GIF_Pooped ;They done already... push di ;Dummy... push #_GIF_Pop ;The return address. push si ;Must be the dissassembly address. push di ;Dummy... push di ;Dummy pushes aswell. ******** bra.w Get_Instruction ;Go and get the instruction. _GIF_Pop: add.w #4, sp ;Clear the stack. _GIF_Pooped: cs:move.b Size, al ;Get the size of the instruction. eor.b ah, ah ;Clear the high byte. add.w si, ax ;The start of the next instruction. rts ***************************************************************************** ByteMove: cs:move.w 4(si), ax cs:add.w ax, CodSource bra.w _P_Loop1 ***************************************************************************** CLS_Line: push cx ;Save CX. move.w #AddrCol, bx ;Where to store the colour data. move.w ds, cx ;Get the segment. cs:cmp.w cx, S_CS ;Compare with current segment. bne.s _No_Match ; cs:cmp.w S_IP, si ;Compare IP with current memory. bne.s _No_Match ; ******** _PO: dc.b $66,$B8,$00,!HM,$00,!HM ;MOV EAX move.w #10, cx _M_Loop: cs:move.b ah, (bx) inc.w bx dbra _M_Loop bra.s _Clear_Line ******** _No_Match: dc.b $66 ;32 bit extend. eor.w ax, ax ;Clear ax dc.b $66 cs:push.w DCOLOURS :Where to get the colours. dc.b $66 cs:pop.w (bx) ;Where to save them dc.b $66 cs:push.w DCOLOURS+4 :Where to get the colours. dc.b $66 cs:pop.w 4(bx) ;Where to save them cs:push.w DCOLOURS+8 cs:pop.w 8(bx) ;All done. ******** _Clear_Line: push.w di ;Save the registers. cs:move.w _OperSet-2, cx ; add.w #!LINELEN, cx ;The number of bytes to clear. shr.w #2, cx ;Divide by 4. dc.b $66,$F2,$AB ;Repeat not equal - stosd. pop.w di pop.w cx rts ***************************************************************************** ToggleReg: dc.b $2E,$81,$3E dc.w _HexRoutine-2, Nothing beq.s _Switch_2_Hex cs:move.w #Nothing, _HexRoutine-2 cs:move.w #!OPE_INDENT, _OperSet-2 rts _Switch_2_Hex: cs:move.w #MPrint_Hex, _HexRoutine-2 cs:move.w #!OPERANDS, _OperSet-2 rts ******* Nothing: pop.w di cs:move.b Size, ax cbw add.w ax, si cs:move.b #0, Debug rts ***************************************************************************** PrintRegisters: move.w #276, di ; move.w #!NUM_LINES-2, bx ; move.w #20, cx ; Draw a box on the right move.b #$02, ah ; hand side of the screen. bsr.w DrawImdBox ; lea 4(di), di ;Move to our spot. move.w #8, cx ;Count of DWORD registers move.w #InstList, si ;Where the data is stored. _P_Extend: push.w di ;Save the screen address. push.w cx ;Save the count. move.b #$0A, ah ;Set the colour. cs:move.w (si), dx ;The register name. bsr.w Print_String ;Print the register name. es:move.w #$023d, 2(di) ;Print an = sign. lea 6(di), di ;Move to data area. dc.b $66 ;Long word. cs:move.w 2(si), bx ;Get the register contents. move.b #4, cl ;Set the size. bsr.w PrintHexCol ; pop.w cx pop.w di lea 160(di), di lea 6(si), si dbra _P_Extend move.w #7, cx ;Count of WORD registers lea 2(di), di ;Align with the Dwords above. _P_Word: push.w di ;Save the screen address. push.w cx ;Save the count. move.b #$0A, ah ;Set the colour. cs:move.w (si), dx ;The register name. bsr.w Print_String ;Print the register name. es:move.w #$023d, 2(di) ;Print an = sign. lea 6(di), di ;Move to data area. dc.b $66 ;Extend... cs:move.w 2(si), bx ;Get the register contents. move.b #2, cl ;Print the whole contents. bsr.w PrintHexCol ;Print the hex in colour! pop.w cx pop.w di lea 160(di), di lea 4(si), si dbra _P_Word ***+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*** PrintFlags: eor.b bh, bh ;Clear the high byte. cs:move.w #PFlags, si ;Our list of flags. lea 156(di), di ;Move Forwards. move.w #6, cx ;Set the count & clear CH. push.w di Flag_Loop: push.w cx cs:move.b (si), cl ;Get the bit number to test. dc.b $2E,$85,$0E ; dc.w S_FLAGS ; setz.b bl ;Cool... shl.b #2, bl ;Multiply by 2. cs:move.b 1(bx,si), ah ;The colour to print. lea.w 2(bx,si), dx ;The string to print. bsr.w Print_String :Print it. lea 9(si), si ;Move next for flag check... lea 2(di), di ;Move next on the screen. pop.w cx ;Restore CX. dec.b cl ;Decrement the count. bne.s Flag_Loop ;Go again if not zero. pop.w di lea 160(di), di dc.b $66 cs:move.w S_FLAGS, bx ;Get the flags. move.b #4, cl bra.w PrintHexCol *****************************************************************************