1 ; Disassembled ddtz.com, version "DDT/Z [8101]"
2 ; with modified relocater.
5 ; - Assemble to a .REL file with M80 or a compatible assembler.
6 ; - Use Digital Research Link-80 to generate a .PRL file (op switch).
7 ; - Cut the .PRL header (first 256 byte) end rename the result to DDTZ.COM.
9 ;-------------------------------------------------------------------------------
26 ;-------------------------------------------------------------------------------
30 ; Some greneral definitions
46 BDOS_CIN equ 1 ;Console Input
47 BDOS_COUT equ 2 ;Console Output
48 BDOS_PSTR equ 9 ;Print String
49 BDOS_CBUF equ 10 ;Read Console Buffer
50 BDOS_CSTAT equ 11 ;Get Console Status
51 BDOS_OPEN equ 15 ;Open File
52 BDOS_CLOSE equ 16 ;Close File
53 BDOS_DELETE equ 19 ;Delete File
54 BDOS_READ equ 20 ;Read Sequential
55 BDOS_WRITE equ 21 ;Write Sequential
56 BDOS_CREATE equ 22 ;Make File
57 BDOS_SETDMA equ 26 ;Set DMA Address
59 ; ddtz specific definitions
61 STACK_SIZE equ 64 ;ddtz internal stack
62 CONBUF_SIZE equ 80 ;Size of console input buffer
63 EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints
64 BP_CNT equ 12 ;Number of breakpoints
65 BP_SIZE equ 8 ;Size of a breakpoint record
66 YREG_CNT equ 10 ;Number of Y registers (0..9)
68 ;-------------------------------------------------------------------------------
80 current_cseg defl $ - current_cseg
81 .phase current_phase + current_cseg
84 db '[8101] 003',CR,LF,'$'
86 db 'Z80 or better required!',cr,lf,'$'
91 ds STACK_SIZE - (current_phase - signon)
167 ds CONBUF_SIZE + 3 - ($ - conbuf)
170 dw cmd_@ ;examine/substitute the displacement register @
172 dw cmd_B ;Breakpoints display/set/clear
173 dw cmd_C ;trace over Calls
174 dw cmd_D ;Display memory in hex and ascii
176 dw cmd_F ;specify Filename and command line
178 dw cmd_H ;compute Hex and other expressions
179 dw cmd_I ;Input a byte from port
182 dw cmd_L ;List disassembled code
183 dw cmd_M ;Move memory [and verify]
185 dw cmd_O ;Output a byte to port
187 dw cmd_Q ;Qery memory for byte string
188 dw cmd_R ;Read binary or hex file and/or symbol file
189 dw cmd_S ;Substitute memory
192 dw cmd_V ;Verify (compare) two memory areas
193 dw cmd_W ;Write a file to disk
194 dw cmd_X ;eXamine [and substitute] registers
195 dw cmd_Y ;examine [and substitute] Y variables
196 dw cmd_Z ;Zap (fill) memory with a byte string
204 call bp_clr_temporary
805 ld hl,tab_func_eqlege
907 ; de: x (x shifted out, q shifted in)
909 ; hl: r (initially 0)
1034 jr z,fact_factstring
1396 ld (trace_call_flag),a
1418 call bp_clr_condition
1459 call bp_clr_condition
1507 ; Add break points to list
1508 ; A = 1 Permanent (B command)
1509 ; A = 2 Temporary (G command)
1530 call bp_get_freeslot
1537 call bp_get_condition
1645 call bp_clr_temporary
1754 call bp_get_freeslot
2154 call get_lastarg_def
2196 call get_lastarg_def
2218 call get_lastarg_def
2277 db 01h ;swallow ldir instruction (ld bc,...)
2505 db 0e6h ; and 037h (clear carry)
2903 call get_lastarg_def
2982 db 'SYMBOLS',CR,LF+80h
2986 ;------------------------------------------------------------------------
2996 call read_hexbyte ; symval
3002 pop hl ; discard symval
3003 rs_3: call read_byte
3008 rs_4: ld hl,(BDOS+1) ;
3009 ld e,0 ; setup symlen
3026 rs_6: push de ; symlen
3062 ;------------------------------------------------------------------------
3109 ld de,080h ; DMA_BUF
3140 call get_lastarg_def
3217 dw as.AND_CP_OR_SUB_XOR ;AND
3223 dw as.opc.noarg ;CCF
3225 dw as.AND_CP_OR_SUB_XOR ;CP
3229 dw gen.opc.ED2 ;CPDR
3233 dw gen.opc.ED2 ;CPIR
3235 dw as.opc.noarg ;CPL
3237 dw as.opc.noarg ;DAA
3249 dw as.opc.noarg ;EXX
3251 dw as.opc.noarg ;HALT
3261 dw gen.opc.ED2 ;INDR
3265 dw gen.opc.ED2 ;INIR
3275 dw gen.opc.ED2 ;LDDR
3279 dw gen.opc.ED2 ;LDIR
3283 dw as.opc.noarg ;NOP
3285 dw as.AND_CP_OR_SUB_XOR ;OR
3287 dw gen.opc.ED2 ;OTDR
3289 dw gen.opc.ED2 ;OTIR
3293 dw gen.opc.ED2 ;OUTD
3295 dw gen.opc.ED2 ;OUTI
3299 dw as.POP_PUSH ;PUSH
3305 dw gen.opc.ED2 ;RETI
3307 dw gen.opc.ED2 ;RETN
3311 dw as.opc.noarg ;RLA
3315 dw as.opc.noarg ;RLCA
3321 dw as.opc.noarg ;RRA
3325 dw as.opc.noarg ;RRCA
3333 dw as.opc.noarg ;SCF
3343 dw as.AND_CP_OR_SUB_XOR ;SUB
3345 dw as.AND_CP_OR_SUB_XOR ;XOR
3352 dw gen.opc.ED2 ;OTDM
3354 dw gen.opc.ED2 ;OTDMR
3356 dw gen.opc.ED2 ;OTIM
3358 dw gen.opc.ED2 ;OTIMR
3395 call arg.addr_8bit ;
3399 call arg.addr_8bit ;
3432 call arg.IDX_displcmnt
3449 call test_paren_close
3511 call arg.IDX_displcmnt
3577 call test_paren_close
3581 call test_paren_close
3628 jr as.opc.noarg ;14ca
3635 call test_paren_close
3659 call test_paren_close
3688 call test_paren_close
3710 jr nc,as.AND_CP_OR_SUB_XOR
3731 jr nc,as.AND_CP_OR_SUB_XOR
3751 as.AND_CP_OR_SUB_XOR:
3766 call arg.IDX_displcmnt
3783 call arg.IDX_displcmnt
3813 call arg.IDX_displcmnt
4054 call arg.IDX_displcmnt
4372 call disas_get_instrlen
4393 ld (isprefix_ixiy),a
4412 ld (isprefix_ixiy),a
4449 ; DD/FD 3 byte (ix+d)/(iy+d)
4519 ld a,(isprefix_ixiy)
4605 ; 1 byte opcodes (no parameters)
4606 ; Format: db opcode, t_MNEMONICS-index
4625 ; Format: db mask, match, t_MNEMONICS-index
4626 ; dw argument formating fuction
4628 db 0c0h,040h,056h ;ld r,r
4630 db 0f8h,080h,003h ;add a,r
4632 db 0f8h,088h,000h ;adc a,r
4634 db 0f8h,090h,0c9h ;sub r
4636 db 0f8h,098h,0b7h ;sbc a,r
4638 db 0f8h,0a0h,006h ;and r
4640 db 0f8h,0a8h,0cch ;xor r
4642 db 0f8h,0b0h,06ch ;or r
4644 db 0f8h,0b8h,013h ;cp r
4646 db 0c7h,0c0h,08bh ;ret cc
4648 db 0c7h,0c7h,0b4h ;rst
4650 db 0ffh,0c9h,08bh ;ret
4652 db 0cfh,0c1h,081h ;pop rr
4654 db 0cfh,0c5h,084h ;push rr
4656 db 0ffh,0e3h,034h ;ex (sp),hl
4658 db 0ffh,0e9h,052h ;jp (hl)
4660 db 0ffh,0ebh,034h ;ex de,hl
4662 db 0ffh,0f9h,056h ;ld sp,hl
4664 db 0cfh,003h,041h ;inc rr
4666 db 0cfh,00bh,029h ;dec rr
4668 db 0c7h,004h,041h ;inc r
4670 db 0c7h,005h,029h ;dec r
4672 db 0ffh,008h,034h ;ex af,af'
4674 db 0cfh,009h,003h ;add hl,rr
4676 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4678 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4684 db 0c7h,006h,056h ;ld r,nn
4686 db 0ffh,0c6h,003h ;add a,nn
4688 db 0ffh,0ceh,000h ;adc a,nn
4690 db 0ffh,0d6h,0c9h ;sub a,nn
4692 db 0ffh,0deh,0b7h ;sbc a,nn
4694 db 0ffh,0e6h,006h ;and a,nn
4696 db 0ffh,0eeh,0cch ;xor nn
4698 db 0ffh,0f6h,06ch ;or nn
4700 db 0ffh,0feh,013h ;cp a,nn
4702 db 0ffh,010h,02eh ;djnz
4704 db 0ffh,018h,054h ;jr
4706 db 0e7h,020h,054h ;jr,cc
4708 db 0ffh,0d3h,076h ;out (nn),a
4710 db 0ffh,0dbh,03fh ;in a,(nn)
4716 db 0c7h,0c2h,052h ;jp cc,mn
4718 db 0c7h,0c4h,00ch ;call cc,mn
4720 db 0cfh,001h,056h ;ld ww,mn
4722 db 0ffh,0c3h,052h ;jp mn
4724 db 0ffh,0cdh,00ch ;call mn
4726 db 0ffh,022h,056h ;ld (mn),hl
4728 db 0ffh,02ah,056h ;ld hl,(mn)
4730 db 0ffh,032h,056h ;ld (mn),a
4732 db 0ffh,03ah,056h ;ld a,(mn)
4736 ; Prefix ED + 1 byte opcode, no arguments
4737 ; Format: opcode, t_MNEMONICS index
4768 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4770 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4772 db 0ffh,078h,03fh ;in r,(c) ;r=a
4774 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4776 db 0f7h,061h,076h ;out (c),r ;r=h,l
4778 db 0ffh,079h,076h ;out (c),r ;r=a
4780 db 0cfh,042h,0b7h ;sbc hl,rr
4782 db 0cfh,04ah,000h ;adc hl,rr
4784 db 0ffh,046h,03dh ;im 0
4786 db 0ffh,056h,03dh ;im 1
4788 db 0ffh,05eh,03dh ;im 2
4790 db 0ffh,047h,056h ;ld i,a
4792 db 0ffh,057h,056h ;ld a,i
4794 db 0ffh,04fh,056h ;ld r,a
4796 db 0ffh,05fh,056h ;ld a,r
4798 db 0cfh,04ch,0d2h ;mlt rr
4800 db 0c7h,004h,0eeh ;tst r
4805 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4807 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4809 db 0ffh,038h,0cfh ;in0 a,(m)
4811 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
4813 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
4815 db 0ffh,039h,0e7h ;out0 (m),a
4817 db 0ffh,064h,0eeh ;tst m
4819 db 0ffh,074h,0f1h ;tstio m
4824 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
4826 db 0ffh,073h,056h ;ld (mn),sp
4828 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
4830 db 0ffh,07bh,056h ;ld sp,(mn)
4836 db 0f8h,000h,09bh ;rlc g
4838 db 0f8h,008h,0aah ;rrc g
4840 db 0f8h,010h,096h ;rl g
4842 db 0f8h,018h,0a5h ;rr g
4844 db 0f8h,020h,0c0h ;sla g
4846 db 0f8h,028h,0c3h ;sra g
4848 db 0f8h,038h,0c6h ;srl g
4850 db 0c0h,040h,009h ;bit b,g
4852 db 0c0h,080h,088h ;res b,g
4854 db 0c0h,0c0h,0bdh ;set b,g
4929 ld a,(isprefix_ixiy)
5070 ld a,(isprefix_ixiy)
5090 ld a,(isprefix_ixiy)
5123 ld a,(isprefix_ixiy)
5128 ld a,(isprefix_ixiy)
5160 ld a,(isprefix_ixiy)
5364 call disas_get_instrlen
5385 db 0ffh,0ddh,000h ;Prefix DD
5387 db 0ffh,0fdh,000h ;Prefix FD
5389 db 0ffh,0edh,000h ;Prefix ED
5393 db 0ffh,0cdh,000h ;call mn
5395 db 0ffh,0c3h,000h ;jp mn
5397 db 0ffh,0e9h,000h ;jp ()
5399 db 0ffh,0c9h,000h ;ret
5401 db 0ffh,0cfh,000h ;rst 8
5421 ld a,(trace_call_flag)
5486 ld a,(trace_call_flag)
5513 ld a,(trace_call_flag)
5531 ld (trace_call_flag),a
5547 call get_lastarg_def
5557 call bp_clr_temporary
5568 ld a,(trace_UW_flag)
5604 ld (trace_UW_flag),a
5619 ld (trace_UW_flag),a
5642 db 0 ;1=call, 0=trace
5644 db 0 ;0 or 'U' or 'W'
5652 ;-------------------------------------------------------------------------------
5673 current_cseg defl $ - current_cseg
5674 .phase current_phase + current_cseg
5677 LD SP,ldr_end+(stack-ddtz_base)
5678 LD DE,signon ;ldr_end+(expr_buf-ddtz_base)
5691 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
5692 ld bc,0108h ;init bit counter
5696 LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL
5700 INC DE ;size rounded up to next page boundary
5703 SBC HL,DE ;BDOS - size
5704 LD (BDOS+1),HL ;-> new BDOS entry
5719 ld b,c ;reload bit counter
5720 LD e,(HL) ;get next 8 relocation bits
5746 LD HL,conbuf+2-ddtz_base
5750 current_phase defl $
5754 ds EXPR_BUF_SIZE - ($ - expr_buf)
5813 ddtz_size equ $-ddtz_base
5816 ;-------------------------------------------------------------------------------