>MDump103/s & Source for *MDUMP by J.G.Harston + v0.10 12-Feb-1986 Original MG version (8 v1.00 10-Mar-1989 Tidied up for Micro User article 2( v1.01 23-Aug-2006 Added -80 option <4 v1.02 23-Aug-2006 Tidied up and compacted code F3 v1.03 25-Aug-2006 Ensured 4-byte Tube address P: Z7OSWRCH=&FFEE:OSNEWL=&FFE7:OSARGS=&FFDA:OSBYTE=&FFF4 d: n. mcode% &300:load%=&FFFF0900:ver$="v1.03" x: 2lptr=&AE:addr=&AB:rom=addr+2:end=&A8:tube=&27A cols=40 P=0 1 P%=load%:O%=mcode% [OPT P*3+4 .accflg:BRK .acc1 :BRK .acc2 :BRK .tempY :BRK .buff ] P%=load%:O%=mcode% [OPT P*3+4  .syntax  BRK:EQUB 220:\ accflg is &00 GEQUS "Syntax: MDump (-"+(120-cols)+") /+":BRK ": , .start% 6&LDA #1:LDY #0:LDX #lptr:JSR OSARGS @&LDA (lptr),Y:CMP #"-":BNE mdump40 J*LDA bytes: #24:STA bytes:JSR SkipPast T .mdump40 ^CMP #13:BEQ syntax h1LDX #addr:JSR GetHex:JSR SkipSpace:BEQ syntax r)CMP #"+":PHP:BNE P%+5:JSR SkipSpace1 |)LDX #end:JSR GetHex:PLP:BNE mdump:CLC "LDA addr+0:ADC end+0:STA end+0 "LDA addr+1:ADC end+1:STA end+1  .mdump (LDA end: addr: #&F0: addr:STA end : LDA #0:LDX #255:JSR OSBYTE CPX #2:BCC loop:BEQ Bplus LDA &FE34: #&F3:STA acc1  A #&0C:STA acc2:BNE set_acc  .Bplus LDA #128:STA acc2  .set_acc LDA #255:STA accflg  .loop $JSR pr_addr:JSR get_bytes:LDX #0  .loop1 &JSR PrSpace 0LDA buff,X:JSR pr_hex :INX:CPX bytes:BNE loop1 DJSR PrSpace:LDX #0 N .loop2 XLDA buff,X: #127 bCMP #32:BCS pr_char l.pr_dot LDA #"." v .pr_char CMP #127:BEQ pr_dot JSR OSWRCH INX:CPX bytes:BNE loop2 JSR OSNEWL:CLC #LDA addr+0:ADC bytes:STA addr+0  LDA addr+1:ADC #0:STA addr+1  end+1:BNE mdump2 LDA addr+0: end+0:BEQ exit  .mdump2 BIT &FF:BPL loop *LDA #124:JMP OSBYTE:\ Ack Esc and exit : .get_bytes  LDX rom:BIT tube:BMI tubeget CPX #&EF:BCC getbyte4  .getbyte1 LDA &F4:PHA  BIT accflg:BPL getbyte3 *LDA &FE34:PHA 4+LDA acc1:CPX #&EF:BNE getbyte2:LDA acc2 > .getbyte2 H STA &FE34 RCPX #&F0:BCS getbyte3 \$LDA #&8F:JSR selrom:BNE getbyte4 f .getbyte3 pLDA rom: #15:JSR selrom z .getbyte4  LDY #0 .getbyteloop LDA (addr),Y:STA buff,Y !INY:CPY bytes:BNE getbyteloop !LDA rom:CMP #&EF:BCC getbyte6 BIT accflg:BPL getbyte5 PLA:STA &FE34 .getbyte5:PLA  .selrom STA &F4:STA &FE30 .getbyte6:.exit RTS  .tubeget CPX #&EF:BCS getbyte1 #.tubeclaim \Claim tube hardware 'LDA #&C0+&10:JSR &406:BCC tubeclaim $LDX #addr:LDY #0:STY addr+3 .LDA #0:JSR &406:LDX #0 8 .tubeloop BLDY #9:\ 24ish us delay L.tube_wait VDEY:BNE tube_wait `LDA &FEE5:STA buff,X jINX:CPX bytes:BNE tubeloop t1LDA #&80+&10:JMP &406:\ Release tube hardware ~:  .pr_addr LDA rom:JSR pr_hex LDA addr+1:JSR pr_hex  LDA addr  .pr_hex PHA:LSR A:LSR A:LSR A:LSR A JSR h_first:PLA  .h_first  #15:CMP #10:BCC h_over ADC #6:.h_over ADC #48:JMP OSWRCH  .PrSpace LDA #32:JMP OSWRCH  :  .GetHex "LDA #0:STA 0,X:STA 1,X:STA 2,X ( .nextchar 2LDA (lptr),Y:JSR asc_to_bin <BCS gh_exit FASL A:ASL A:ASL A:ASL A PSTY tempY:LDY #4 Z .gh_again d!ASL A:ROL 0,X:ROL 1,X:ROL 2,X nDEY:BNE gh_again x LDY tempY INY:BNE nextchar  .gh_exit RTS : .asc_to_bin CMP #48:BCC illegal CMP #58:BCC zero_nine SBC #7:BCC illegal CMP #64:BCS illegal .zero_nine  #&0F:RTS  .illegal  SEC:RTS :  .SkipPast /INY:LDA (lptr),Y:CMP #"!":BCS SkipPast:DEY ".SkipSpace1 ,INY 6.SkipSpace @)LDA (lptr),Y:CMP #" ":BEQ SkipSpace1 JCMP #13:RTS T: ^.bytes:EQUB cols/5 h5EQUS ver$:EQUB 0:\ Ensure exactly &200 bytes long r: |]: V"*SAVE MDump "+~mcode%+" "+~O%+" "+~(start%&FFFF0000)+" "+~(load%&FFFF0000)