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 SYMCASE_SENS equ 0 ;Symbols are case sensitive
69 SYMCASE_CONV equ 1 ;Convert case when symbols are loaded
70 SYMCASE_LOWER equ 2 ;Convert to lower case if set, else to upper case
72 ;-------------------------------------------------------------------------------
92 current_cseg defl $ - current_cseg
93 .phase current_phase + current_cseg
95 db 'Symbolic DDTZ/180'
101 db 'Z80 or better required!',cr,lf,'$'
106 ds STACK_SIZE - (current_phase - signon)
182 ds CONBUF_SIZE + 3 - ($ - conbuf)
185 dw cmd_@ ;examine/substitute the displacement register @
187 dw cmd_B ;Breakpoints display/set/clear
188 dw cmd_C ;trace over Calls
189 dw cmd_D ;Display memory in hex and ascii
191 dw cmd_F ;specify Filename and command line
193 dw cmd_H ;compute Hex and other expressions
194 dw cmd_I ;Input a byte from port
197 dw cmd_L ;List disassembled code
198 dw cmd_M ;Move memory [and verify]
200 dw cmd_O ;Output a byte to port
202 dw cmd_Q ;Qery memory for byte string
203 dw cmd_R ;Read binary or hex file and/or symbol file
204 dw cmd_S ;Substitute memory
207 dw cmd_V ;Verify (compare) two memory areas
208 dw cmd_W ;Write a file to disk
209 dw cmd_X ;eXamine [and substitute] registers
210 dw cmd_Y ;examine [and substitute] Y variables
211 dw cmd_Z ;Zap (fill) memory with a byte string
219 call bp_clr_temporary
825 jr z,error0 ;'S', but no expression following
891 ld hl,tab_func_eqlege
993 ; de: x (x shifted out, q shifted in)
995 ; hl: r (initially 0)
1123 jr z,fact_factstring
1231 ld hl,ddtz_base ;symtbl start
1251 pop hl ;inpsym ptr (discard)
1267 fs_cont: ;start over
1528 ld (trace_call_flag),a
1550 call bp_clr_condition
1591 call bp_clr_condition
1641 ; Add break points to list
1642 ; A = 1 Permanent (B command)
1643 ; A = 2 Temporary (G command)
1664 call bp_get_freeslot
1671 call bp_get_condition
1779 call bp_clr_temporary
1888 call bp_get_freeslot
2044 call c,p_align_@_sym
2297 call get_lastarg_def
2345 call get_lastarg_def
2367 call get_lastarg_def
2426 db 01h ;swallow ldir instruction (ld bc,...)
2609 db 0e6h ; and 037h (clear carry)
3009 call get_lastarg_def
3049 call read_byte ; RECORD MARK
3054 call read_hexchar ; RECLEN
3056 call read_hexchar ; LOAD ADDR H
3058 call read_hexchar ; LOAD ADDR L
3063 call read_hexchar ; RECTYP
3065 call read_hexchar ; DATA
3074 call read_hexchar ; CHKSUM
3091 db 'SYMBOLS',CR,LF+80h
3106 call read_hexbyte0 ; symval H
3108 call read_hexbyte ; symval L
3114 rs_3: call read_byte
3122 ld b,0 ; setup symlen
3125 call read_byte ; next char of symbol name
3126 call test_sym_char ; valid char?
3143 call test_symterm_ch
3186 ; test for valid character for symbols
3199 ret c ; cy == 1 --> z == 0
3204 ; check if char is in [0..9,?,@,A..Z,a..z]
3205 ; return cy if invalid
3206 ; return nc if valid alfanumeric char
3286 ld de,080h ; DMA_BUF
3317 call get_lastarg_def
3347 call nz,asemble_line
3389 dw as.AND_CP_OR_SUB_XOR ;AND
3395 dw as.opc.noarg ;CCF
3397 dw as.AND_CP_OR_SUB_XOR ;CP
3401 dw gen.opc.ED2 ;CPDR
3405 dw gen.opc.ED2 ;CPIR
3407 dw as.opc.noarg ;CPL
3409 dw as.opc.noarg ;DAA
3421 dw as.opc.noarg ;EXX
3423 dw as.opc.noarg ;HALT
3433 dw gen.opc.ED2 ;INDR
3437 dw gen.opc.ED2 ;INIR
3447 dw gen.opc.ED2 ;LDDR
3451 dw gen.opc.ED2 ;LDIR
3455 dw as.opc.noarg ;NOP
3457 dw as.AND_CP_OR_SUB_XOR ;OR
3459 dw gen.opc.ED2 ;OTDR
3461 dw gen.opc.ED2 ;OTIR
3465 dw gen.opc.ED2 ;OUTD
3467 dw gen.opc.ED2 ;OUTI
3471 dw as.POP_PUSH ;PUSH
3477 dw gen.opc.ED2 ;RETI
3479 dw gen.opc.ED2 ;RETN
3483 dw as.opc.noarg ;RLA
3487 dw as.opc.noarg ;RLCA
3493 dw as.opc.noarg ;RRA
3497 dw as.opc.noarg ;RRCA
3505 dw as.opc.noarg ;SCF
3515 dw as.AND_CP_OR_SUB_XOR ;SUB
3517 dw as.AND_CP_OR_SUB_XOR ;XOR
3524 dw gen.opc.ED2 ;OTDM
3526 dw gen.opc.ED2 ;OTDMR
3528 dw gen.opc.ED2 ;OTIM
3530 dw gen.opc.ED2 ;OTIMR
3567 call arg.addr_8bit ;
3571 call arg.addr_8bit ;
3604 call arg.IDX_displcmnt
3621 call test_paren_close
3688 call arg.IDX_displcmnt
3756 call test_paren_close
3764 call test_paren_close
3812 jr as.opc.noarg ;14ca
3820 call test_paren_close
3846 call test_paren_close
3878 call test_paren_close
3900 jr nc,as.AND_CP_OR_SUB_XOR
3922 jr nc,as.AND_CP_OR_SUB_XOR
3943 as.AND_CP_OR_SUB_XOR:
3958 call arg.IDX_displcmnt
3975 call arg.IDX_displcmnt
4005 call arg.IDX_displcmnt
4246 call arg.IDX_displcmnt
4552 ld (disas_argtype),a
4553 call disas_get_instrlen
4564 ld a,(disas_argtype)
4565 ld hl,(disas_arg_16)
4579 ld (isprefix_ixiy),a
4598 ld (isprefix_ixiy),a
4635 ; DD/FD 3 byte (ix+d)/(iy+d)
4705 ld a,(isprefix_ixiy)
4790 ; 1 byte opcodes (no parameters)
4791 ; Format: db opcode, t_MNEMONICS-index
4810 ; Format: db mask, match, t_MNEMONICS-index
4811 ; dw argument formating fuction
4813 db 0c0h,040h,056h ;ld r,r
4815 db 0f8h,080h,003h ;add a,r
4817 db 0f8h,088h,000h ;adc a,r
4819 db 0f8h,090h,0c9h ;sub r
4821 db 0f8h,098h,0b7h ;sbc a,r
4823 db 0f8h,0a0h,006h ;and r
4825 db 0f8h,0a8h,0cch ;xor r
4827 db 0f8h,0b0h,06ch ;or r
4829 db 0f8h,0b8h,013h ;cp r
4831 db 0c7h,0c0h,08bh ;ret cc
4833 db 0c7h,0c7h,0b4h ;rst
4835 db 0ffh,0c9h,08bh ;ret
4837 db 0cfh,0c1h,081h ;pop rr
4839 db 0cfh,0c5h,084h ;push rr
4841 db 0ffh,0e3h,034h ;ex (sp),hl
4843 db 0ffh,0e9h,052h ;jp (hl)
4845 db 0ffh,0ebh,034h ;ex de,hl
4847 db 0ffh,0f9h,056h ;ld sp,hl
4849 db 0cfh,003h,041h ;inc rr
4851 db 0cfh,00bh,029h ;dec rr
4853 db 0c7h,004h,041h ;inc r
4855 db 0c7h,005h,029h ;dec r
4857 db 0ffh,008h,034h ;ex af,af'
4859 db 0cfh,009h,003h ;add hl,rr
4861 db 0efh,002h,056h ;ld (rr),a ;rr=bc,de
4863 db 0efh,00ah,056h ;ld a,(rr) ;rr=bc,de
4869 db 0c7h,006h,056h ;ld r,nn
4871 db 0ffh,0c6h,003h ;add a,nn
4873 db 0ffh,0ceh,000h ;adc a,nn
4875 db 0ffh,0d6h,0c9h ;sub a,nn
4877 db 0ffh,0deh,0b7h ;sbc a,nn
4879 db 0ffh,0e6h,006h ;and a,nn
4881 db 0ffh,0eeh,0cch ;xor nn
4883 db 0ffh,0f6h,06ch ;or nn
4885 db 0ffh,0feh,013h ;cp a,nn
4887 db 0ffh,010h,02eh ;djnz
4889 db 0ffh,018h,054h ;jr
4891 db 0e7h,020h,054h ;jr cc,
4893 db 0ffh,0d3h,076h ;out (nn),a
4895 db 0ffh,0dbh,03fh ;in a,(nn)
4901 db 0c7h,0c2h,052h ;jp cc,mn
4903 db 0c7h,0c4h,00ch ;call cc,mn
4905 db 0cfh,001h,056h ;ld ww,mn
4907 db 0ffh,0c3h,052h ;jp mn
4909 db 0ffh,0cdh,00ch ;call mn
4911 db 0ffh,022h,056h ;ld (mn),hl
4913 db 0ffh,02ah,056h ;ld hl,(mn)
4915 db 0ffh,032h,056h ;ld (mn),a
4917 db 0ffh,03ah,056h ;ld a,(mn)
4921 ; Prefix ED + 1 byte opcode, no arguments
4922 ; Format: opcode, t_MNEMONICS index
4953 db 0e7h,040h,03fh ;in r,(c) ;r=b,c,d,e
4955 db 0f7h,060h,03fh ;in r,(c) ;r=h,l
4957 db 0ffh,078h,03fh ;in r,(c) ;r=a
4959 db 0e7h,041h,076h ;out (c),r ;r=b,c,d,e
4961 db 0f7h,061h,076h ;out (c),r ;r=h,l
4963 db 0ffh,079h,076h ;out (c),r ;r=a
4965 db 0cfh,042h,0b7h ;sbc hl,rr
4967 db 0cfh,04ah,000h ;adc hl,rr
4969 db 0ffh,046h,03dh ;im 0
4971 db 0ffh,056h,03dh ;im 1
4973 db 0ffh,05eh,03dh ;im 2
4975 db 0ffh,047h,056h ;ld i,a
4977 db 0ffh,057h,056h ;ld a,i
4979 db 0ffh,04fh,056h ;ld r,a
4981 db 0ffh,05fh,056h ;ld a,r
4983 db 0cfh,04ch,0d2h ;mlt rr
4985 db 0c7h,004h,0eeh ;tst r
4990 db 0e7h,000h,0cfh ;in0 r,(m) ;r=b,c,d,e
4992 db 0f7h,020h,0cfh ;in0 r,(m) ;r=h,l
4994 db 0ffh,038h,0cfh ;in0 a,(m)
4996 db 0e7h,001h,0e7h ;out0 (m),r ;r=b,c,d,e
4998 db 0f7h,021h,0e7h ;out0 (m),r ;r=h,l
5000 db 0ffh,039h,0e7h ;out0 (m),a
5002 db 0ffh,064h,0eeh ;tst m
5004 db 0ffh,074h,0f1h ;tstio m
5009 db 0efh,043h,056h ;ld (mn),ww ;ww=bc,de
5011 db 0ffh,073h,056h ;ld (mn),sp
5013 db 0efh,04bh,056h ;ld ww,(mn) ;ww=bc,de
5015 db 0ffh,07bh,056h ;ld sp,(mn)
5021 db 0f8h,000h,09bh ;rlc g
5023 db 0f8h,008h,0aah ;rrc g
5025 db 0f8h,010h,096h ;rl g
5027 db 0f8h,018h,0a5h ;rr g
5029 db 0f8h,020h,0c0h ;sla g
5031 db 0f8h,028h,0c3h ;sra g
5033 db 0f8h,038h,0c6h ;srl g
5035 db 0c0h,040h,009h ;bit b,g
5037 db 0c0h,080h,088h ;res b,g
5039 db 0c0h,0c0h,0bdh ;set b,g
5114 ld a,(isprefix_ixiy)
5160 ld (disas_argtype),a
5161 ld (disas_arg_16),hl
5257 ld a,(isprefix_ixiy)
5277 ld a,(isprefix_ixiy)
5310 ld a,(isprefix_ixiy)
5315 ld a,(isprefix_ixiy)
5347 ld a,(isprefix_ixiy)
5541 call disas_get_instrlen
5562 db 0ffh,0ddh,000h ;Prefix DD
5564 db 0ffh,0fdh,000h ;Prefix FD
5566 db 0ffh,0edh,000h ;Prefix ED
5570 db 0ffh,0cdh,000h ;call mn
5572 db 0ffh,0c3h,000h ;jp mn
5574 db 0ffh,0e9h,000h ;jp ()
5576 db 0ffh,0c9h,000h ;ret
5578 db 0ffh,0cfh,000h ;rst 8
5598 ld a,(trace_call_flag)
5663 ld a,(trace_call_flag)
5690 ld a,(trace_call_flag)
5708 ld (trace_call_flag),a
5724 call get_lastarg_def
5734 call bp_clr_temporary
5745 ld a,(trace_UW_flag)
5781 ld (trace_UW_flag),a
5796 ld (trace_UW_flag),a
5819 db 0 ;1=call, 0=trace
5821 db 0 ;0 or 'U' or 'W'
5829 ;-------------------------------------------------------------------------------
5850 current_cseg defl $ - current_cseg
5851 .phase current_phase + current_cseg
5854 LD SP,ldr_end+(stack-ddtz_base)
5855 LD DE,signon ;ldr_end+(expr_buf-ddtz_base)
5868 LD HL,ldr_end+ddtz_size ;start of reloc bitmap
5869 ld bc,0108h ;init bit counter
5873 LD (ldr_end+(ddtz_bdos+1-ddtz_base)),HL
5877 INC DE ;size rounded up to next page boundary
5880 SBC HL,DE ;BDOS - size
5881 LD (BDOS+1),HL ;-> new BDOS entry
5896 ld b,c ;reload bit counter
5897 LD e,(HL) ;get next 8 relocation bits
5923 LD HL,conbuf+2-ddtz_base
5927 current_phase defl $
5931 ds EXPR_BUF_SIZE - ($ - expr_buf)
5985 symlen_cur: ;max length of symbols read so far
5992 ddtz_size equ $-ddtz_base
5995 ;-------------------------------------------------------------------------------