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 ;-------------------------------------------------------------------------------
25 ;-------------------------------------------------------------------------------
29 ; Some greneral definitions
45 BDOS_CIN equ 1 ;Console Input
46 BDOS_COUT equ 2 ;Console Output
47 BDOS_PSTR equ 9 ;Print String
48 BDOS_CBUF equ 10 ;Read Console Buffer
49 BDOS_CSTAT equ 11 ;Get Console Status
50 BDOS_OPEN equ 15 ;Open File
51 BDOS_CLOSE equ 16 ;Close File
52 BDOS_DELETE equ 19 ;Delete File
53 BDOS_READ equ 20 ;Read Sequential
54 BDOS_WRITE equ 21 ;Write Sequential
55 BDOS_CREATE equ 22 ;Make File
56 BDOS_SETDMA equ 26 ;Set DMA Address
58 ; ddtz specific definitions
60 STACK_SIZE equ 64 ;ddtz internal stack
61 CONBUF_SIZE equ 80 ;Size of console input buffer
62 EXPR_BUF_SIZE equ 128 ;expressen buffer for conditional breakpoints
63 BP_CNT equ 12 ;Number of breakpoints
64 BP_SIZE equ 8 ;Size of a breakpoint record
65 YREG_CNT equ 10 ;Number of Y registers (0..9)
67 ;-------------------------------------------------------------------------------
79 current_cseg defl $ - current_cseg
80 .phase current_phase + current_cseg
82 db 'Symbolic DDTZ/180'
88 db 'Z80 or better required!',cr,lf,'$'
93 ds STACK_SIZE - (current_phase - signon)
169 ds CONBUF_SIZE + 3 - ($ - conbuf)
172 dw cmd_@ ;examine/substitute the displacement register @
174 dw cmd_B ;Breakpoints display/set/clear
175 dw cmd_C ;trace over Calls
176 dw cmd_D ;Display memory in hex and ascii
178 dw cmd_F ;specify Filename and command line
180 dw cmd_H ;compute Hex and other expressions
181 dw cmd_I ;Input a byte from port
184 dw cmd_L ;List disassembled code
185 dw cmd_M ;Move memory [and verify]
187 dw cmd_O ;Output a byte to port
189 dw cmd_Q ;Qery memory for byte string
190 dw cmd_R ;Read binary or hex file and/or symbol file
191 dw cmd_S ;Substitute memory
194 dw cmd_V ;Verify (compare) two memory areas
195 dw cmd_W ;Write a file to disk
196 dw cmd_X ;eXamine [and substitute] registers
197 dw cmd_Y ;examine [and substitute] Y variables
198 dw cmd_Z ;Zap (fill) memory with a byte string
206 call bp_clr_temporary
915 ld hl,tab_func_eqlege
1017 ; de: x (x shifted out, q shifted in)
1019 ; hl: r (initially 0)
1144 jr z,fact_factstring
1295 db ' !#&()*+,-/:;<=>[\]^{|}~',0
1296 t_trmchrs_len equ $ - t_trmchrs
1569 ld (trace_call_flag),a
1591 call bp_clr_condition
1632 call bp_clr_condition
1680 ; Add break points to list
1681 ; A = 1 Permanent (B command)
1682 ; A = 2 Temporary (G command)
1703 call bp_get_freeslot
1710 call bp_get_condition
1818 call bp_clr_temporary
1927 call bp_get_freeslot
2331 call get_lastarg_def
2373 call get_lastarg_def
2395 call get_lastarg_def
2454 db 01h ;swallow ldir instruction (ld bc,...)
2531 ld a,80 ;screen width
2639 db 0e6h ; and 037h (clear carry)
3038 call get_lastarg_def
3078 call read_byte ; RECORD MARK
3083 call read_hexchar ; RECLEN
3085 call read_hexchar ; LOAD ADDR H
3087 call read_hexchar ; LOAD ADDR L
3092 call read_hexchar ; RECTYP
3094 call read_hexchar ; DATA
3103 call read_hexchar ; CHKSUM
3120 db 'SYMBOLS',CR,LF+80h
3133 call read_hexbyte0 ; symval H
3135 call read_hexbyte ; symval L
3141 rs_3: call read_byte
3149 ld b,0 ; setup symlen
3152 call read_byte ; next char of symbol name
3153 call test_sym_char ; valid char?
3164 call test_symterm_ch
3206 ; test for valid character for symbols
3219 ret c ; cy == 1 --> z == 0
3224 ; check if char is in [0..9,?,@,A..Z,a..z]
3225 ; return cy if invalid
3226 ; return nc if valid alfanumeric char
3306 ld de,080h ; DMA_BUF
3337 call get_lastarg_def
3411 dw as.AND_CP_OR_SUB_XOR ;AND
3417 dw as.opc.noarg ;CCF
3419 dw as.AND_CP_OR_SUB_XOR ;CP
3423 dw gen.opc.ED2 ;CPDR
3427 dw gen.opc.ED2 ;CPIR
3429 dw as.opc.noarg ;CPL
3431 dw as.opc.noarg ;DAA
3443 dw as.opc.noarg ;EXX
3445 dw as.opc.noarg ;HALT
3455 dw gen.opc.ED2 ;INDR
3459 dw gen.opc.ED2 ;INIR
3469 dw gen.opc.ED2 ;LDDR
3473 dw gen.opc.ED2 ;LDIR
3477 dw as.opc.noarg ;NOP
3479 dw as.AND_CP_OR_SUB_XOR ;OR
3481 dw gen.opc.ED2 ;OTDR
3483 dw gen.opc.ED2 ;OTIR
3487 dw gen.opc.ED2 ;OUTD
3489 dw gen.opc.ED2 ;OUTI
3493 dw as.POP_PUSH ;PUSH
3499 dw gen.opc.ED2 ;RETI
3501 dw gen.opc.ED2 ;RETN
3505 dw as.opc.noarg ;RLA
3509 dw as.opc.noarg ;RLCA
3515 dw as.opc.noarg ;RRA
3519 dw as.opc.noarg ;RRCA
3527 dw as.opc.noarg ;SCF
3537 dw as.AND_CP_OR_SUB_XOR ;SUB
3539 dw as.AND_CP_OR_SUB_XOR ;XOR
3546 dw gen.opc.ED2 ;OTDM
3548 dw gen.opc.ED2 ;OTDMR
3550 dw gen.opc.ED2 ;OTIM
3552 dw gen.opc.ED2 ;OTIMR
3589 call arg.addr_8bit ;
3593 call arg.addr_8bit ;
3626 call arg.IDX_displcmnt
3643 call test_paren_close
3705 call arg.IDX_displcmnt
3771 call test_paren_close
3775 call test_paren_close
3822 jr as.opc.noarg ;14ca
3829 call test_paren_close
3853 call test_paren_close
3882 call test_paren_close
3904 jr nc,as.AND_CP_OR_SUB_XOR
3925 jr nc,as.AND_CP_OR_SUB_XOR
3945 as.AND_CP_OR_SUB_XOR:
3960 call arg.IDX_displcmnt
3977 call arg.IDX_displcmnt
4007 call arg.IDX_displcmnt
4248 call arg.IDX_displcmnt
4562 call disas_get_instrlen
4583 ld (isprefix_ixiy),a
4602 ld (isprefix_ixiy),a
4639 ; DD/FD 3 byte (ix+d)/(iy+d)
4709 ld a,(isprefix_ixiy)
4795 ; 1 byte opcodes (no parameters)
4796 ; Format: db opcode, t_MNEMONICS-index
4815 ; Format: db mask, match, t_MNEMONICS-index
4816 ; dw argument formating fuction
4818 db 0c0h,040h,056h ;ld r,r
4820 db 0f8h,080h,003h ;add a,r
4822 db 0f8h,088h,000h ;adc a,r
4824 db 0f8h,090h,0c9h ;sub r
4826 db 0f8h,098h,0b7h ;sbc a,r
4828 db 0f8h,0a0h,006h ;and r
4830 db 0f8h,0a8h,0cch ;xor r
4832 db 0f8h,0b0h,06ch ;or r
4834 db 0f8h,0b8h,013h ;cp r
4836 db 0c7h,0c0h,08bh ;ret cc
4838 db 0c7h,0c7h,0b4h ;rst
4840 db 0ffh,0c9h,08bh ;ret
4842 db 0cfh,0c1h,081h ;pop rr
4844 db 0cfh,0c5h,084h ;push rr
4846 db 0ffh,0e3h,034h ;ex (sp),hl
4848 db 0ffh,0e9h,052h ;jp (hl)
4850 db 0ffh,0ebh,034h ;ex de,hl
4852 db 0ffh,0f9h,056h ;ld sp,hl
4854 db 0cfh,003h,041h ;inc rr
4856 db 0cfh,00bh,029h ;dec rr
4858 db 0c7h,004h,041h ;inc r
4860 db 0c7h,005h,029h ;dec r
4862 db 0ffh,008h,034h ;ex af,af'
4864 db 0cfh,009h,003h ;add hl,rr
4866 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4868 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4874 db 0c7h,006h,056h ;ld r,nn
4876 db 0ffh,0c6h,003h ;add a,nn
4878 db 0ffh,0ceh,000h ;adc a,nn
4880 db 0ffh,0d6h,0c9h ;sub a,nn
4882 db 0ffh,0deh,0b7h ;sbc a,nn
4884 db 0ffh,0e6h,006h ;and a,nn
4886 db 0ffh,0eeh,0cch ;xor nn
4888 db 0ffh,0f6h,06ch ;or nn
4890 db 0ffh,0feh,013h ;cp a,nn
4892 db 0ffh,010h,02eh ;djnz
4894 db 0ffh,018h,054h ;jr
4896 db 0e7h,020h,054h ;jr,cc
4898 db 0ffh,0d3h,076h ;out (nn),a
4900 db 0ffh,0dbh,03fh ;in a,(nn)
4906 db 0c7h,0c2h,052h ;jp cc,mn
4908 db 0c7h,0c4h,00ch ;call cc,mn
4910 db 0cfh,001h,056h ;ld ww,mn
4912 db 0ffh,0c3h,052h ;jp mn
4914 db 0ffh,0cdh,00ch ;call mn
4916 db 0ffh,022h,056h ;ld (mn),hl
4918 db 0ffh,02ah,056h ;ld hl,(mn)
4920 db 0ffh,032h,056h ;ld (mn),a
4922 db 0ffh,03ah,056h ;ld a,(mn)
4926 ; Prefix ED + 1 byte opcode, no arguments
4927 ; Format: opcode, t_MNEMONICS index
4958 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4960 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4962 db 0ffh,078h,03fh ;in r,(c) ;r=a
4964 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4966 db 0f7h,061h,076h ;out (c),r ;r=h,l
4968 db 0ffh,079h,076h ;out (c),r ;r=a
4970 db 0cfh,042h,0b7h ;sbc hl,rr
4972 db 0cfh,04ah,000h ;adc hl,rr
4974 db 0ffh,046h,03dh ;im 0
4976 db 0ffh,056h,03dh ;im 1
4978 db 0ffh,05eh,03dh ;im 2
4980 db 0ffh,047h,056h ;ld i,a
4982 db 0ffh,057h,056h ;ld a,i
4984 db 0ffh,04fh,056h ;ld r,a
4986 db 0ffh,05fh,056h ;ld a,r
4988 db 0cfh,04ch,0d2h ;mlt rr
4990 db 0c7h,004h,0eeh ;tst r
4995 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4997 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4999 db 0ffh,038h,0cfh ;in0 a,(m)
5001 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
5003 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
5005 db 0ffh,039h,0e7h ;out0 (m),a
5007 db 0ffh,064h,0eeh ;tst m
5009 db 0ffh,074h,0f1h ;tstio m
5014 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
5016 db 0ffh,073h,056h ;ld (mn),sp
5018 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
5020 db 0ffh,07bh,056h ;ld sp,(mn)
5026 db 0f8h,000h,09bh ;rlc g
5028 db 0f8h,008h,0aah ;rrc g
5030 db 0f8h,010h,096h ;rl g
5032 db 0f8h,018h,0a5h ;rr g
5034 db 0f8h,020h,0c0h ;sla g
5036 db 0f8h,028h,0c3h ;sra g
5038 db 0f8h,038h,0c6h ;srl g
5040 db 0c0h,040h,009h ;bit b,g
5042 db 0c0h,080h,088h ;res b,g
5044 db 0c0h,0c0h,0bdh ;set b,g
5119 ld a,(isprefix_ixiy)
5260 ld a,(isprefix_ixiy)
5280 ld a,(isprefix_ixiy)
5313 ld a,(isprefix_ixiy)
5318 ld a,(isprefix_ixiy)
5350 ld a,(isprefix_ixiy)
5551 call disas_get_instrlen
5572 db 0ffh,0ddh,000h ;Prefix DD
5574 db 0ffh,0fdh,000h ;Prefix FD
5576 db 0ffh,0edh,000h ;Prefix ED
5580 db 0ffh,0cdh,000h ;call mn
5582 db 0ffh,0c3h,000h ;jp mn
5584 db 0ffh,0e9h,000h ;jp ()
5586 db 0ffh,0c9h,000h ;ret
5588 db 0ffh,0cfh,000h ;rst 8
5608 ld a,(trace_call_flag)
5673 ld a,(trace_call_flag)
5700 ld a,(trace_call_flag)
5718 ld (trace_call_flag),a
5734 call get_lastarg_def
5744 call bp_clr_temporary
5755 ld a,(trace_UW_flag)
5791 ld (trace_UW_flag),a
5806 ld (trace_UW_flag),a
5829 db 0 ;1=call, 0=trace
5831 db 0 ;0 or 'U' or 'W'
5839 ;-------------------------------------------------------------------------------
5860 current_cseg defl $ - current_cseg
5861 .phase current_phase + current_cseg
5864 LD SP,ldr_end+(stack-ddtz_base)
5865 LD DE,signon ;ldr_end+(expr_buf-ddtz_base)
5878 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
5879 ld bc,0108h ;init bit counter
5883 LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL
5887 INC DE ;size rounded up to next page boundary
5890 SBC HL,DE ;BDOS - size
5891 LD (BDOS+1),HL ;-> new BDOS entry
5906 ld b,c ;reload bit counter
5907 LD e,(HL) ;get next 8 relocation bits
5933 LD HL,conbuf+2-ddtz_base
5937 current_phase defl $
5941 ds EXPR_BUF_SIZE - ($ - expr_buf)
5995 symlen_max: ;max length of symbols read so far
6002 ddtz_size equ $-ddtz_base
6005 ;-------------------------------------------------------------------------------