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 SYMCASE_SENS equ 1 ;Symbols are case sensitive
68 SYMCASE_CONV equ 2 ;Convert case when symbols are loaded
69 SYMCASE_LOWER equ 4 ;Convert to lower case if set, else to upper case
71 ;-------------------------------------------------------------------------------
90 current_cseg defl $ - current_cseg
91 .phase current_phase + current_cseg
93 db 'Symbolic DDTZ/180'
99 db 'Z80 or better required!',cr,lf,'$'
104 ds STACK_SIZE - (current_phase - signon)
180 ds CONBUF_SIZE + 3 - ($ - conbuf)
183 dw cmd_@ ;examine/substitute the displacement register @
185 dw cmd_B ;Breakpoints display/set/clear
186 dw cmd_C ;trace over Calls
187 dw cmd_D ;Display memory in hex and ascii
189 dw cmd_F ;specify Filename and command line
191 dw cmd_H ;compute Hex and other expressions
192 dw cmd_I ;Input a byte from port
195 dw cmd_L ;List disassembled code
196 dw cmd_M ;Move memory [and verify]
198 dw cmd_O ;Output a byte to port
200 dw cmd_Q ;Qery memory for byte string
201 dw cmd_R ;Read binary or hex file and/or symbol file
202 dw cmd_S ;Substitute memory
205 dw cmd_V ;Verify (compare) two memory areas
206 dw cmd_W ;Write a file to disk
207 dw cmd_X ;eXamine [and substitute] registers
208 dw cmd_Y ;examine [and substitute] Y variables
209 dw cmd_Z ;Zap (fill) memory with a byte string
217 call bp_clr_temporary
811 jr z,error0 ;'S', but no expression following
877 ld hl,tab_func_eqlege
979 ; de: x (x shifted out, q shifted in)
981 ; hl: r (initially 0)
1106 jr z,fact_factstring
1214 ld hl,ddtz_base ;symtbl start
1234 pop hl ;inpsym ptr (discard)
1250 fs_cont: ;start over
1511 ld (trace_call_flag),a
1533 call bp_clr_condition
1574 call bp_clr_condition
1624 ; Add break points to list
1625 ; A = 1 Permanent (B command)
1626 ; A = 2 Temporary (G command)
1647 call bp_get_freeslot
1654 call bp_get_condition
1762 call bp_clr_temporary
1871 call bp_get_freeslot
2027 call c,p_align_@_sym
2280 call get_lastarg_def
2328 call get_lastarg_def
2350 call get_lastarg_def
2409 db 01h ;swallow ldir instruction (ld bc,...)
2592 db 0e6h ; and 037h (clear carry)
2992 call get_lastarg_def
3032 call read_byte ; RECORD MARK
3037 call read_hexchar ; RECLEN
3039 call read_hexchar ; LOAD ADDR H
3041 call read_hexchar ; LOAD ADDR L
3046 call read_hexchar ; RECTYP
3048 call read_hexchar ; DATA
3057 call read_hexchar ; CHKSUM
3074 db 'SYMBOLS',CR,LF+80h
3087 call read_hexbyte0 ; symval H
3089 call read_hexbyte ; symval L
3095 rs_3: call read_byte
3103 ld b,0 ; setup symlen
3106 call read_byte ; next char of symbol name
3107 call test_sym_char ; valid char?
3118 call test_symterm_ch
3160 ; test for valid character for symbols
3173 ret c ; cy == 1 --> z == 0
3178 ; check if char is in [0..9,?,@,A..Z,a..z]
3179 ; return cy if invalid
3180 ; return nc if valid alfanumeric char
3260 ld de,080h ; DMA_BUF
3291 call get_lastarg_def
3321 call nz,asemble_line
3363 dw as.AND_CP_OR_SUB_XOR ;AND
3369 dw as.opc.noarg ;CCF
3371 dw as.AND_CP_OR_SUB_XOR ;CP
3375 dw gen.opc.ED2 ;CPDR
3379 dw gen.opc.ED2 ;CPIR
3381 dw as.opc.noarg ;CPL
3383 dw as.opc.noarg ;DAA
3395 dw as.opc.noarg ;EXX
3397 dw as.opc.noarg ;HALT
3407 dw gen.opc.ED2 ;INDR
3411 dw gen.opc.ED2 ;INIR
3421 dw gen.opc.ED2 ;LDDR
3425 dw gen.opc.ED2 ;LDIR
3429 dw as.opc.noarg ;NOP
3431 dw as.AND_CP_OR_SUB_XOR ;OR
3433 dw gen.opc.ED2 ;OTDR
3435 dw gen.opc.ED2 ;OTIR
3439 dw gen.opc.ED2 ;OUTD
3441 dw gen.opc.ED2 ;OUTI
3445 dw as.POP_PUSH ;PUSH
3451 dw gen.opc.ED2 ;RETI
3453 dw gen.opc.ED2 ;RETN
3457 dw as.opc.noarg ;RLA
3461 dw as.opc.noarg ;RLCA
3467 dw as.opc.noarg ;RRA
3471 dw as.opc.noarg ;RRCA
3479 dw as.opc.noarg ;SCF
3489 dw as.AND_CP_OR_SUB_XOR ;SUB
3491 dw as.AND_CP_OR_SUB_XOR ;XOR
3498 dw gen.opc.ED2 ;OTDM
3500 dw gen.opc.ED2 ;OTDMR
3502 dw gen.opc.ED2 ;OTIM
3504 dw gen.opc.ED2 ;OTIMR
3541 call arg.addr_8bit ;
3545 call arg.addr_8bit ;
3578 call arg.IDX_displcmnt
3595 call test_paren_close
3662 call arg.IDX_displcmnt
3730 call test_paren_close
3738 call test_paren_close
3786 jr as.opc.noarg ;14ca
3794 call test_paren_close
3820 call test_paren_close
3852 call test_paren_close
3874 jr nc,as.AND_CP_OR_SUB_XOR
3896 jr nc,as.AND_CP_OR_SUB_XOR
3917 as.AND_CP_OR_SUB_XOR:
3932 call arg.IDX_displcmnt
3949 call arg.IDX_displcmnt
3979 call arg.IDX_displcmnt
4220 call arg.IDX_displcmnt
4526 ld (disas_argtype),a
4527 call disas_get_instrlen
4538 ld a,(disas_argtype)
4539 ld hl,(disas_arg_16)
4553 ld (isprefix_ixiy),a
4572 ld (isprefix_ixiy),a
4609 ; DD/FD 3 byte (ix+d)/(iy+d)
4679 ld a,(isprefix_ixiy)
4764 ; 1 byte opcodes (no parameters)
4765 ; Format: db opcode, t_MNEMONICS-index
4784 ; Format: db mask, match, t_MNEMONICS-index
4785 ; dw argument formating fuction
4787 db 0c0h,040h,056h ;ld r,r
4789 db 0f8h,080h,003h ;add a,r
4791 db 0f8h,088h,000h ;adc a,r
4793 db 0f8h,090h,0c9h ;sub r
4795 db 0f8h,098h,0b7h ;sbc a,r
4797 db 0f8h,0a0h,006h ;and r
4799 db 0f8h,0a8h,0cch ;xor r
4801 db 0f8h,0b0h,06ch ;or r
4803 db 0f8h,0b8h,013h ;cp r
4805 db 0c7h,0c0h,08bh ;ret cc
4807 db 0c7h,0c7h,0b4h ;rst
4809 db 0ffh,0c9h,08bh ;ret
4811 db 0cfh,0c1h,081h ;pop rr
4813 db 0cfh,0c5h,084h ;push rr
4815 db 0ffh,0e3h,034h ;ex (sp),hl
4817 db 0ffh,0e9h,052h ;jp (hl)
4819 db 0ffh,0ebh,034h ;ex de,hl
4821 db 0ffh,0f9h,056h ;ld sp,hl
4823 db 0cfh,003h,041h ;inc rr
4825 db 0cfh,00bh,029h ;dec rr
4827 db 0c7h,004h,041h ;inc r
4829 db 0c7h,005h,029h ;dec r
4831 db 0ffh,008h,034h ;ex af,af'
4833 db 0cfh,009h,003h ;add hl,rr
4835 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4837 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4843 db 0c7h,006h,056h ;ld r,nn
4845 db 0ffh,0c6h,003h ;add a,nn
4847 db 0ffh,0ceh,000h ;adc a,nn
4849 db 0ffh,0d6h,0c9h ;sub a,nn
4851 db 0ffh,0deh,0b7h ;sbc a,nn
4853 db 0ffh,0e6h,006h ;and a,nn
4855 db 0ffh,0eeh,0cch ;xor nn
4857 db 0ffh,0f6h,06ch ;or nn
4859 db 0ffh,0feh,013h ;cp a,nn
4861 db 0ffh,010h,02eh ;djnz
4863 db 0ffh,018h,054h ;jr
4865 db 0e7h,020h,054h ;jr cc,
4867 db 0ffh,0d3h,076h ;out (nn),a
4869 db 0ffh,0dbh,03fh ;in a,(nn)
4875 db 0c7h,0c2h,052h ;jp cc,mn
4877 db 0c7h,0c4h,00ch ;call cc,mn
4879 db 0cfh,001h,056h ;ld ww,mn
4881 db 0ffh,0c3h,052h ;jp mn
4883 db 0ffh,0cdh,00ch ;call mn
4885 db 0ffh,022h,056h ;ld (mn),hl
4887 db 0ffh,02ah,056h ;ld hl,(mn)
4889 db 0ffh,032h,056h ;ld (mn),a
4891 db 0ffh,03ah,056h ;ld a,(mn)
4895 ; Prefix ED + 1 byte opcode, no arguments
4896 ; Format: opcode, t_MNEMONICS index
4927 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4929 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4931 db 0ffh,078h,03fh ;in r,(c) ;r=a
4933 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4935 db 0f7h,061h,076h ;out (c),r ;r=h,l
4937 db 0ffh,079h,076h ;out (c),r ;r=a
4939 db 0cfh,042h,0b7h ;sbc hl,rr
4941 db 0cfh,04ah,000h ;adc hl,rr
4943 db 0ffh,046h,03dh ;im 0
4945 db 0ffh,056h,03dh ;im 1
4947 db 0ffh,05eh,03dh ;im 2
4949 db 0ffh,047h,056h ;ld i,a
4951 db 0ffh,057h,056h ;ld a,i
4953 db 0ffh,04fh,056h ;ld r,a
4955 db 0ffh,05fh,056h ;ld a,r
4957 db 0cfh,04ch,0d2h ;mlt rr
4959 db 0c7h,004h,0eeh ;tst r
4964 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4966 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4968 db 0ffh,038h,0cfh ;in0 a,(m)
4970 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
4972 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
4974 db 0ffh,039h,0e7h ;out0 (m),a
4976 db 0ffh,064h,0eeh ;tst m
4978 db 0ffh,074h,0f1h ;tstio m
4983 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
4985 db 0ffh,073h,056h ;ld (mn),sp
4987 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
4989 db 0ffh,07bh,056h ;ld sp,(mn)
4995 db 0f8h,000h,09bh ;rlc g
4997 db 0f8h,008h,0aah ;rrc g
4999 db 0f8h,010h,096h ;rl g
5001 db 0f8h,018h,0a5h ;rr g
5003 db 0f8h,020h,0c0h ;sla g
5005 db 0f8h,028h,0c3h ;sra g
5007 db 0f8h,038h,0c6h ;srl g
5009 db 0c0h,040h,009h ;bit b,g
5011 db 0c0h,080h,088h ;res b,g
5013 db 0c0h,0c0h,0bdh ;set b,g
5088 ld a,(isprefix_ixiy)
5134 ld (disas_argtype),a
5135 ld (disas_arg_16),hl
5231 ld a,(isprefix_ixiy)
5251 ld a,(isprefix_ixiy)
5284 ld a,(isprefix_ixiy)
5289 ld a,(isprefix_ixiy)
5321 ld a,(isprefix_ixiy)
5515 call disas_get_instrlen
5536 db 0ffh,0ddh,000h ;Prefix DD
5538 db 0ffh,0fdh,000h ;Prefix FD
5540 db 0ffh,0edh,000h ;Prefix ED
5544 db 0ffh,0cdh,000h ;call mn
5546 db 0ffh,0c3h,000h ;jp mn
5548 db 0ffh,0e9h,000h ;jp ()
5550 db 0ffh,0c9h,000h ;ret
5552 db 0ffh,0cfh,000h ;rst 8
5572 ld a,(trace_call_flag)
5637 ld a,(trace_call_flag)
5664 ld a,(trace_call_flag)
5682 ld (trace_call_flag),a
5698 call get_lastarg_def
5708 call bp_clr_temporary
5719 ld a,(trace_UW_flag)
5755 ld (trace_UW_flag),a
5770 ld (trace_UW_flag),a
5793 db 0 ;1=call, 0=trace
5795 db 0 ;0 or 'U' or 'W'
5803 ;-------------------------------------------------------------------------------
5824 current_cseg defl $ - current_cseg
5825 .phase current_phase + current_cseg
5828 LD SP,ldr_end+(stack-ddtz_base)
5829 LD DE,signon ;ldr_end+(expr_buf-ddtz_base)
5842 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
5843 ld bc,0108h ;init bit counter
5847 LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL
5851 INC DE ;size rounded up to next page boundary
5854 SBC HL,DE ;BDOS - size
5855 LD (BDOS+1),HL ;-> new BDOS entry
5870 ld b,c ;reload bit counter
5871 LD e,(HL) ;get next 8 relocation bits
5897 LD HL,conbuf+2-ddtz_base
5901 current_phase defl $
5905 ds EXPR_BUF_SIZE - ($ - expr_buf)
5959 symlen_cur: ;max length of symbols read so far
5966 ddtz_size equ $-ddtz_base
5969 ;-------------------------------------------------------------------------------