Author Topic: MCS-48 disassemble 8049 dump  (Read 5157 times)

0 Members and 1 Guest are viewing this topic.

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
MCS-48 disassemble 8049 dump
« on: July 05, 2020, 06:30:50 pm »
Hi
I'm trying to help a friend with a faulty AutoHelm 3000 navigation unit.
It does contain Phillips MAB8049H MPU unit with a MASK Rom program, we had some doubt if the MPU are faulty or not and my friend did try to buy another 8049 from Ebay but it's does act different so obvious different code.

Anyway back to some research it's actually possible to read out a 8049 even if it's mask programmed
https://www.sbprojects.net/projects/8049spy/index.php

I made a similar setup with an Arduino and have dumped both 8049 twice and I get same result when reading several times so I believe I might have some valid code and that the MPU actually does work correct.

So my question are if some one here does have a MSC-48 disassembler already installed and if you could try to dissemble the attache 2k hex dump to see if the code actually give any meaning or I just have garbage

Thank you
« Last Edit: November 05, 2021, 12:17:46 pm by Wiljan »
 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: MCS-48 disassemble 8049 dump
« Reply #1 on: July 05, 2020, 07:17:37 pm »
I've used DASMx in the past with a Sencore LCR meter. It's fairly dumb (isn't able to follow jump tables well), but is pretty good if you spend enough time giving it hints. It's closed source, but runs well on Windows 10.

I didn't analyze the code so much, but it looks plausible. Attached is rough disassembly based on the following simple configuration. There's one data block left, that looks mostly like unused memory.

cpu 8048

org 0x0000
numformat C

code 0x0000 reset
code 0x0003 INT
code 0x0007 timer

; Jump table
code 0x003E code_003E
code 0x0040 code_0040
code 0x0042 code_0042
code 0x0044 code_0044
code 0x0046 code_0046
code 0x0048 code_0048
code 0x004A code_004A
code 0x004C code_004C
code 0x004E code_004E
 

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #2 on: July 05, 2020, 09:03:23 pm »
pigrew, thank you. I will continue looking fora faults as if the 8049 does work correctly and if not there might be a chance to program a 8749  :-+
 

Offline pigrew

  • Frequent Contributor
  • **
  • Posts: 680
  • Country: us
Re: MCS-48 disassemble 8049 dump
« Reply #3 on: July 05, 2020, 09:22:31 pm »
pigrew, thank you. I will continue looking fora faults as if the 8049 does work correctly and if not there might be a chance to program a 8749  :-+

It looks like Ghidra can disassemble/decompile 8048, too. I barely have a clue about how to use the software.... It reported that there was an "bad instruction" in the bitstream at 0x02e5. I think it's an issue with my Ghidra setup (and not a ROM error).

NEC (and Toshiba?) also manufactured these micros (perhaps with slightly different performance than Intel). For example, the  NEC D8749HD.
 

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #4 on: July 06, 2020, 09:09:33 am »
Thank for the dasmx link works fine here as well  ( doubt any error on the 0x02E5)

I added in checksum calculation and it fits fine
I have attached the modified schematic and my Arduino code if anyone would need it

Code: [Select]
int Addr = 0; 
byte Data = 255;
int Checksum =0;

void setup() {
    Serial.begin(115200);
    Serial.println("");
    pinMode(0, OUTPUT);
    pinMode(1, OUTPUT);
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(6, OUTPUT);
    pinMode(7, OUTPUT);
    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT);
    pinMode(10, OUTPUT);
    pinMode(11, OUTPUT);
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);   

    pinMode(A0, OUTPUT);
    pinMode(A1, OUTPUT);
    pinMode(A2, OUTPUT);
    pinMode(A3, OUTPUT);
    pinMode(A4, OUTPUT);
    pinMode(A5, INPUT);   
}

void loop() {
    Serial.print("Loop");

    delay(1000);   

while (digitalRead(A5))
    {
    delay(1000);   
    Serial.println("GND A5 to start! ");
    }

//--------------Reset------
    Addr = 0;
    Checksum = 0;
    Serial.println("Start dump 8049 ");

    while (Addr < 2048)
    {
    digitalWrite(A0, LOW);
    delay(10);
   
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(6, OUTPUT);
    pinMode(7, OUTPUT);
    pinMode(8, OUTPUT);
    pinMode(9, OUTPUT);
    pinMode(10,OUTPUT);
    pinMode(11,OUTPUT);
    pinMode(12,OUTPUT);
    pinMode(13,OUTPUT);   

    digitalWrite(2, (Addr >> 0 &1)); 
    digitalWrite(3, (Addr >> 1 &1)); 
    digitalWrite(4, (Addr >> 2 &1)); 
    digitalWrite(5, (Addr >> 3 &1));; 
    digitalWrite(6, (Addr >> 4 &1)); 
    digitalWrite(7, (Addr >> 5 &1));   
    digitalWrite(8, (Addr >> 6 &1)); 
    digitalWrite(9, (Addr >> 7 &1));   
    digitalWrite(10,(Addr >> 8 &1));
    digitalWrite(11,(Addr >> 9 &1));
    digitalWrite(12,(Addr >> 10 &1));
    digitalWrite(13,(Addr >> 11 &1));;   
 
    delay(10);
    digitalWrite(A0, HIGH); 

    //---------------------------Set Address-----------

    pinMode(2, INPUT);     
    pinMode(3, INPUT);     
    pinMode(4, INPUT);     
    pinMode(5, INPUT);     
    pinMode(6, INPUT);     
    pinMode(7, INPUT);     
    pinMode(8, INPUT);     
    pinMode(9, INPUT);     

    Data = 0;
    Data |= digitalRead(2)<<0 ;
    Data |= digitalRead(3)<<1 ;
    Data |= digitalRead(4)<<2 ;
    Data |= digitalRead(5)<<3 ;
    Data |= digitalRead(6)<<4 ;
    Data |= digitalRead(7)<<5 ;
    Data |= digitalRead(8)<<6 ;
    Data |= digitalRead(9)<<7 ;

    Checksum = Checksum + Data;

    if (Data < 16) {Serial.print("0");}
    Serial.print(Data,HEX);
    Serial.println("");
 
    Addr = Addr+1;
   }

    Serial.print("Checksum: ");
    Serial.print(Checksum & 0xFFFF,HEX);
    Serial.println("");
}

I made my setup on a breadboard and jump wires directly to the Arduino

I took the 5v from the Arduino and even had a pair of jump wire connected to the board where a 11Mhz Xtal already was in place
and feed the 12 v from a external psu

Open the Serial monitor 115200 and when finished dumping,  copy / paste to a hex editor, pretty simple  :)

 

Offline jemp

  • Contributor
  • Posts: 30
  • Country: be
Re: MCS-48 disassemble 8049 dump
« Reply #5 on: October 09, 2021, 08:52:12 am »
Sublime Idea !

Do you think its possible, to read Mask Roms..
I have a 8048 from old Kenwood VFO for transceiver
I'd like to read this

Tnx for info

JP, ON7MA
 

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #6 on: October 09, 2021, 09:57:54 am »
Sublime Idea !

Do you think its possible, to read Mask Roms..
I have a 8048 from old Kenwood VFO for transceiver
I'd like to read this

Tnx for info

JP, ON7MA

Yes, I believe you can dump a 8048, with the trick where it thinks it has an external EPROM and start dumping and switch to the internal ROM continue dumping
 

Offline intabits

  • Frequent Contributor
  • **
  • Posts: 319
  • Country: au
Re: MCS-48 disassemble 8049 dump
« Reply #7 on: November 05, 2021, 12:22:08 am »
So my question are if some one here does have a MSC-48 disassembler already installed and if you could try to dissemble the attache 2k hex dump to see if the code actually give any meaning or I just have garbage
Huh?! I'm confused.
Your attachment is a JPG image, Not an Intel hex file.

I didn't analyze the code so much, but it looks plausible. Attached is rough disassembly based on the following simple configuration. There's one data block left, that looks mostly like unused memory.
So how did you disassemble it?

I've written an MCS-48 disassembler, (which is much smarter than DASM, though still in development), and I wanted to see what it made of your firmware. Can you post it again in either Intel Hex or Raw Binary?
 

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #8 on: November 05, 2021, 12:22:29 pm »
So my question are if some one here does have a MSC-48 disassembler already installed and if you could try to dissemble the attache 2k hex dump to see if the code actually give any meaning or I just have garbage
Huh?! I'm confused.
Your attachment is a JPG image, Not an Intel hex file.

I didn't analyze the code so much, but it looks plausible. Attached is rough disassembly based on the following simple configuration. There's one data block left, that looks mostly like unused memory.
So how did you disassemble it?

I've written an MCS-48 disassembler, (which is much smarter than DASM, though still in development), and I wanted to see what it made of your firmware. Can you post it again in either Intel Hex or Raw Binary?

Hi .. good spotted

Yeah it't the jpg of the pinout connection to dump it... weird I cant see how that happened back then
Anyway I have replaced it with the "AutoHelm_30000_05_22CA.hex" size 2k

I don't have the unit anymore it was not mine, so I can't test anything anymore
 

Offline intabits

  • Frequent Contributor
  • **
  • Posts: 319
  • Country: au
Re: MCS-48 disassemble 8049 dump
« Reply #9 on: November 05, 2021, 07:05:17 pm »
Yeah it't the jpg of the pinout connection to dump it... weird I cant see how that happened back then
Anyway I have replaced it with the "AutoHelm_30000_05_22CA.hex" size 2k

I don't have the unit anymore it was not mine, so I can't test anything anymore

OK, that's better! (but should be named ".bin" or ".rom", because it's the raw binary, not Intel hex format)

For interest, below is what my disassembler came up with upon loading your file. To take it any further, requires interactive work such as assigning meaningful labels, marking and splitting data areas, adding comments, and clarifying data references (all can be done using the disassembler).
But that also requires knowledge of the application, so I haven't tried to take it any further. (and it's no longer needed)

Looks like the forum software truncates long posts, screwing up the "code" formatting. (but works in preview!?)
Below is some of the output, I've put the full output on pastebin:-
https://pastebin.com/R5EQP8dk
 
Code: [Select]
           ;********************************************************************************
           ;  Disassembly of MCS-48 binary file: AutoHelm_30000_05_22CA.BIN
           ;********************************************************************************
0000 27    VResetL        CLR  A               
0001 04 09                JMP  Jmp0009         
 
0003 94 B0 VIRQL          CALL Sub04B0
0005 84 59                JMP  Jmp0459         
 
0007 04 1B VTimerL        JMP  Jmp001B         
 
0009 37    Jmp0009        CPL  A
000A 02                   OUTL BUS,A           
000B 98 7F                ANL  BUS,#$7F         
000D 27                   CLR  A               
000E B8 7F                MOV  R0,#Mem7F       
0010 B0 2B                MOV  @R0,#$2B         
0012 C8                   DEC  R0               
0013 B0 8C                MOV  @R0,#$8C         
0015 C8                   DEC  R0               
0016 A0    Bra0016        MOV  @R0,A           
0017 E8 16                DJNZ R0,Bra0016       
0019 14 75                CALL Sub0075         
001B 23 68 Jmp001B        MOV  A,#$68           
001D 62                   MOV  T,A             
001E 35                   DIS  TCNTI           
001F 55                   STRT T               
0020 B9 09                MOV  R1,#$09         
0022 27                   CLR  A               
0023 A1                   MOV  @R1,A           
0024 C9                   DEC  R1               
0025 17                   INC  A               
0026 D7                   MOV  PSW,A           
0027 B8 23                MOV  R0,#$23         
0029 23 3E                MOV  A,#$3E           
002B 60                   ADD  A,@R0           
002C 60                   ADD  A,@R0           
002D A1                   MOV  @R1,A           
002E 10                   INC  @R0             
002F F0                   MOV  A,@R0           
0030 D3 09                XRL  A,#$09           
0032 96 35                JNZ  Bra0035         
0034 A0                   MOV  @R0,A           
0035 B8 4D Bra0035        MOV  R0,#$4D         
0037 B9 24                MOV  R1,#$24         
0039 F4 E0                CALL Sub07E0         
003B 14 50                CALL Sub0050         
003D 93                   RETR                 
 
003E C4 9F                JMP  Jmp069F         
 
0040 E4 A6 D0040          DB   $E4,$A6,$E4,$BA,$E4,$C0,$E4,$A6   ;........
0048 E4 A6 ....           DB   $E4,$BA,$24,$31,$84,$B5,$44,$87   ;..$1..D.
 
0050 B8 44 Sub0050        MOV  R0,#Mem44       
0052 F0                   MOV  A,@R0           
0053 C6 8F                JZ   Bra008F         
0055 12 A5                JB0  Bra00A5         
0057 04 E3                JMP  Jmp00E3         
 
0059 B8 65 Jmp0059        MOV  R0,#Mem65       
005B F0                   MOV  A,@R0           
005C 96 68                JNZ  Bra0068         
005E B9 7E                MOV  R1,#Mem7E       
0060 F1                   MOV  A,@R1           
0061 53 7F                ANL  A,#$7F           
0063 21                   XCH  A,@R1           
0064 37                   CPL  A               
0065 F2 75                JB7  Sub0075         
0067 10                   INC  @R0             
0068 B9 64 Bra0068        MOV  R1,#$64         
006A F0                   MOV  A,@R0           
006B 12 7B                JB0  Bra007B         
006D 98 7F                ANL  BUS,#$7F         
006F F4 22                CALL Sub0722         
0071 96 7A                JNZ  Jmp007A         
0073 B0 00                MOV  @R0,#$00         
0075 23 F2 Sub0075        MOV  A,#$F2           
0077 B9 64 Jmp0077        MOV  R1,#Mem64       
0079 A1                   MOV  @R1,A           
007A 83    Jmp007A        RET                   
 
007B F4 22 Bra007B        CALL Sub0722         
007D C6 83                JZ   Bra0083         
007F 88 80                ORL  BUS,#$80         
0081 04 7A                JMP  Jmp007A         
 
0083 10    Bra0083        INC  @R0             
0084 23 F6                MOV  A,#$F6           
0086 04 77                JMP  Jmp0077         
 
0088 B9 7E Sub0088        MOV  R1,#Mem7E       
008A F1                   MOV  A,@R1           
008B 43 80                ORL  A,#$80           
008D A1                   MOV  @R1,A           
008E 83                   RET                   
 
008F B8 66 Bra008F        MOV  R0,#Mem66       
0091 B0 00                MOV  @R0,#$00         
0093 B4 34                CALL Sub0534         
0095 96 A3                JNZ  Bra00A3         
0097 FE                   MOV  A,R6             
0098 C6 A3                JZ   Bra00A3         
009A F4 22                CALL Sub0722         
009C 96 A3                JNZ  Bra00A3         
009E B1 FD Bra009E        MOV  @R1,#$FD         
00A0 19                   INC  R1               
00A1 B1 01                MOV  @R1,#$01         
00A3 04 59 Bra00A3        JMP  Jmp0059         
 
00A5 B4 34 Bra00A5        CALL Sub0534         
00A7 C6 9E                JZ   Bra009E         
00A9 F4 22                CALL Sub0722         
00AB 96 C7                JNZ  Bra00C7         
00AD B9 45                MOV  R1,#$45         
00AF FA                   MOV  A,R2             
00B0 A1                   MOV  @R1,A           
00B1 74 73                CALL Sub0373         
00B3 C6 C9                JZ   Bra00C9         
00B5 74 77                CALL Sub0377         
00B7 BB 40                MOV  R3,#$40         
00B9 C6 CB                JZ   Bra00CB         
00BB 14 88 Bra00BB        CALL Sub0088         
00BD B9 66                MOV  R1,#Mem66       
00BF B1 01                MOV  @R1,#$01         
00C1 B9 43 Jmp00C1        MOV  R1,#Mem43       
00C3 B1 B5                MOV  @R1,#$B5         
00C5 19                   INC  R1               
00C6 11                   INC  @R1             
00C7 04 59 Bra00C7        JMP  Jmp0059         
 
00C9 BB 20 Bra00C9        MOV  R3,#$20         
00CB FA    Bra00CB        MOV  A,R2             
00CC DB                   XRL  A,R3             
00CD 96 BB                JNZ  Bra00BB         
00CF B8 7E                MOV  R0,#Mem7E       
00D1 F0                   MOV  A,@R0           
00D2 D2 BB                JB6  Bra00BB         
00D4 04 C1                JMP  Jmp00C1         
 
00D6 74 77 Bra00D6        CALL Sub0377         
00D8 96 E1                JNZ  Bra00E1         
00DA B9 7E                MOV  R1,#Mem7E       
00DC F1                   MOV  A,@R1           
00DD D2 E1                JB6  Bra00E1         
00DF 24 05 Bra00DF        JMP  Jmp0105         
 
00E1 04 FA Bra00E1        JMP  Jmp00FA         
 
00E3 B4 34 Jmp00E3        CALL Sub0534         
00E5 C6 DF                JZ   Bra00DF         
00E7 F4 22                CALL Sub0722         
00E9 C6 DF                JZ   Bra00DF         
00EB FA                   MOV  A,R2             
00EC D3 40                XRL  A,#$40           
00EE C6 D6                JZ   Bra00D6         
00F0 FA                   MOV  A,R2             
00F1 D3 80                XRL  A,#$80           
00F3 00                   NOP                   
00F4 00                   NOP                   
00F5 00                   NOP                   
00F6 C6 FA                JZ   Jmp00FA         
00F8 24 11                JMP  Jmp0111         
 
00FA B8 45 Jmp00FA        MOV  R0,#$45         
00FC FA                   MOV  A,R2             
00FD A0                   MOV  @R0,A           
00FE B8 66                MOV  R0,#Mem66       
0100 F0                   MOV  A,@R0           
0101 96 05                JNZ  Jmp0105         
0103 14 88                CALL Sub0088         
0105 B8 45 Jmp0105        MOV  R0,#Mem45       
0107 F0                   MOV  A,@R0           
0108 18                   INC  R0               
0109 A0                   MOV  @R0,A           
010A B8 43                MOV  R0,#Mem43       
010C B0 FD                MOV  @R0,#$FD         
010E 18                   INC  R0               
010F B0 00                MOV  @R0,#$00         
0111 B8 46 Jmp0111        MOV  R0,#$46         
0113 74 7B                CALL Sub037B         
0115 C6 2A                JZ   Bra012A         
0117 74 73                CALL Sub0373         
0119 BB 40                MOV  R3,#$40         
011B 96 1F                JNZ  Bra011F         
011D BB 20                MOV  R3,#$20         
011F F0    Bra011F        MOV  A,@R0           
0120 DB                   XRL  A,R3             
0121 96 28                JNZ  Bra0128         
0123 F1                   MOV  A,@R1           
0124 D2 28                JB6  Bra0128         
0126 B0 00 Jmp0126        MOV  @R0,#$00         
0128 04 59 Bra0128        JMP  Jmp0059         
 
012A F0    Bra012A        MOV  A,@R0           
012B 53 80                ANL  A,#$80           
012D C6 28                JZ   Bra0128         
012F 24 26                JMP  Jmp0126         
 
0131 B9 47 D0131          DB   $B9,$47,$B8,$7B,$B4,$77,$C8,$F0   ;.G.{.w..
0139 B9 47 ....           DB   $17,$53,$03,$A0,$B9,$2B,$B4,$A6   ;WSC..+..
0141 B9 47 ....           DB   $BC,$38,$BD,$FF,$B4,$70,$D4,$29   ;.8...p.)
0149 B9 47 ....           DB   $23,$E2,$94,$3F,$F6,$51,$24,$68   ;#..?.Q$h
0151 B9 47 ....           DB   $B8,$7F,$FE,$F7,$23,$02,$E6,$5B   ;...#B.[
0159 B9 47 ....           DB   $23,$FE,$60,$AE,$03,$FB,$F2,$68   ;#.`.C..h
0161 B9 47 ....           DB   $03,$D6,$F7,$E6,$68,$FE,$A0,$B8   ;C...h...
0169 B9 47 ....           DB   $47,$B9,$2B,$D4,$50,$B8,$49,$B9   ;G.+.P.I.
0171 B9 47 ....           DB   $5C,$D4,$50,$E4,$27               ;\.P.'   
 
0176 B9 7E Jmp0176        MOV  R1,#$7E         
0178 B8 46                MOV  R0,#$46         
017A 27                   CLR  A               
017B 20                   XCH  A,@R0           
017C AD                   MOV  R5,A             
017D F1                   MOV  A,@R1           
017E 37                   CPL  A               
017F 72 84                JB3  Bra0184         
0181 FD                   MOV  A,R5             
0182 C6 8B                JZ   Bra018B         
0184 B8 4D Bra0184        MOV  R0,#Mem4D       
0186 B0 39                MOV  @R0,#$39         
0188 18                   INC  R0               
0189 B0 FC                MOV  @R0,#$FC         
018B B8 4D Bra018B        MOV  R0,#$4D         
018D F4 16                CALL Sub0716         
018F FD                   MOV  A,R5             
0190 12 B4                JB0  Bra01B4         
0192 B2 B2                JB5  Bra01B2         
0194 D2 AE                JB6  Bra01AE         
0196 F2 D3                JB7  Bra01D3         
0198 BA FD                MOV  R2,#$FD         
019A BD FE                MOV  R5,#$FE         
019C 32 B0                JB1  Bra01B0         
019E BD 02                MOV  R5,#$02         
01A0 52 B0                JB2  Bra01B0         
01A2 BA E0                MOV  R2,#$E0         
01A4 BD EC                MOV  R5,#$EC         
01A6 72 B0                JB3  Bra01B0         
01A8 BD 14                MOV  R5,#$14         
01AA 92 B0                JB4  Bra01B0         
01AC 44 6D                JMP  Bra026D         
 
01AE 44 1A Bra01AE        JMP  Jmp021A         
 
01B0 44 08 Bra01B0        JMP  Jmp0208         
 
01B2 44 02 Bra01B2        JMP  Jmp0202         
 
01B4 F1    Bra01B4        MOV  A,@R1           
01B5 72 C4                JB3  Bra01C4         
01B7 43 6C                ORL  A,#$6C           
01B9 A1                   MOV  @R1,A           
01BA B8 42                MOV  R0,#Mem42       
01BC B0 00                MOV  @R0,#$00         
01BE B9 4B                MOV  R1,#$4B         
01C0 B8 37                MOV  R0,#$37         
01C2 B4 77                CALL Sub0577         
01C4 B8 4B Bra01C4        MOV  R0,#$4B         
01C6 94 AB                CALL Sub04AB         
01C8 B9 08 Jmp01C8        MOV  R1,#$08         
01CA B8 18                MOV  R0,#R0           
01CC B0 00 Bra01CC        MOV  @R0,#$00         
01CE 18                   INC  R0               
01CF E9 CC                DJNZ R1,Bra01CC       
01D1 44 69                JMP  Jmp0269         
 
01D3 F1    Bra01D3        MOV  A,@R1           
01D4 12 DB                JB0  Bra01DB         
01D6 D3 20                XRL  A,#$20           
01D8 A1                   MOV  @R1,A           
01D9 44 69 Bra01D9        JMP  Jmp0269         
 
01DB B8 4B Bra01DB        MOV  R0,#Mem4B       
01DD F0                   MOV  A,@R0           
01DE 18                   INC  R0               
01DF 96 F7                JNZ  Bra01F7         
01E1 F0                   MOV  A,@R0           
01E2 03 6A                ADD  A,#$6A           
01E4 F6 D9                JC   Bra01D9         
01E6 C8    Bra01E6        DEC  R0               
01E7 B8 4B                MOV  R0,#Mem4B       
01E9 F0                   MOV  A,@R0           
01EA 37                   CPL  A               
01EB 53 03                ANL  A,#$03           
01ED A0                   MOV  @R0,A           
01EE 18                   INC  R0               
01EF F0                   MOV  A,@R0           
01F0 37                   CPL  A               
01F1 17                   INC  A               
01F2 03 B4                ADD  A,#$B4           
01F4 A0                   MOV  @R0,A           
01F5 44 69                JMP  Jmp0269         
 
01F7 D3 03 Bra01F7        XRL  A,#$03           
01F9 96 D9                JNZ  Bra01D9         
01FB F0                   MOV  A,@R0           
01FC 03 E2                ADD  A,#$E2           
01FE F6 E6                JC   Bra01E6         
0200 44 69                JMP  Jmp0269         
 
0202 BB 04 Jmp0202        MOV  R3,#$04         
0204 B9 47                MOV  R1,#$47         
0206 44 36                JMP  Jmp0236         
 
0208 B8 1E Jmp0208        MOV  R0,#$1E         
020A BB FF                MOV  R3,#$FF         
020C 94 10                CALL Sub0410         
020E 94 22                CALL Sub0422         
0210 B8 39                MOV  R0,#Mem39       
0212 B0 FE                MOV  @R0,#$FE         
0214 B8 4B                MOV  R0,#$4B         
0216 B4 7E                CALL Sub057E         
0218 44 69                JMP  Jmp0269         
 
021A B8 5C Jmp021A        MOV  R0,#$5C         
021C 94 00                CALL Sub0400         
021E D4 29                CALL Sub0629         
0220 94 30                CALL Sub0430         
0222 B8 5F                MOV  R0,#$5F         
0224 94 00                CALL Sub0400         
0226 D4 29                CALL Sub0629         
0228 B4 70                CALL Sub0570         
022A BC CD                MOV  R4,#$CD         
022C BD FF                MOV  R5,#$FF         
022E B4 70                CALL Sub0570         
0230 F2 6D                JB7  Bra026D         
0232 BB 05                MOV  R3,#$05         
0234 B9 49                MOV  R1,#$49         
0236 B8 7E Jmp0236        MOV  R0,#Mem7E       
0238 F0                   MOV  A,@R0           
0239 AA                   MOV  R2,A             
023A 72 3E                JB3  Bra023E         
023C 44 58                JMP  Jmp0258         
 
023E DB    Bra023E        XRL  A,R3             
023F 12 52                JB0  Bra0252         
0241 B8 42                MOV  R0,#Mem42       
0243 B0 B4                MOV  @R0,#$B4         
0245 B8 4B Jmp0245        MOV  R0,#$4B         
0247 B4 77                CALL Sub0577         
0249 B9 7E                MOV  R1,#$7E         
024B FA                   MOV  A,R2             
024C 53 C6                ANL  A,#$C6           
024E 4B                   ORL  A,R3             
024F A1                   MOV  @R1,A           
0250 24 C8                JMP  Jmp01C8         
 
0252 FA    Bra0252        MOV  A,R2             
0253 53 BF                ANL  A,#$BF           
0255 AA                   MOV  R2,A             
0256 44 45                JMP  Jmp0245         
 
0258 DB    Jmp0258        XRL  A,R3             
0259 12 52                JB0  Bra0252         
025B FA                   MOV  A,R2             
025C 37                   CPL  A               
025D D2 6D                JB6  Bra026D         
025F B8 42                MOV  R0,#Mem42       
0261 B0 FF                MOV  @R0,#$FF         
0263 B9 37                MOV  R1,#$37         
0265 B8 4B                MOV  R0,#$4B         
0267 B4 77                CALL Sub0577         
0269 B8 27 Jmp0269        MOV  R0,#Mem27       
026B B0 00                MOV  @R0,#$00         
026D B9 42 Bra026D        MOV  R1,#Mem42       
026F F1                   MOV  A,@R1           
0270 C6 7C                JZ   Bra027C         
0272 11                   INC  @R1             
0273 F1                   MOV  A,@R1           
0274 96 7C                JNZ  Bra027C         
0276 B8 7E                MOV  R0,#Mem7E       
0278 F0                   MOV  A,@R0           
0279 53 BF                ANL  A,#$BF           
027B A0                   MOV  @R0,A           
027C 64 5C Bra027C        JMP  Jmp035C         
 
027E 09    Sub027E        IN   A,P1             
027F B2 86                JB5  Bra0286         
0281 D4 19                CALL Sub0619         
0283 FE                   MOV  A,R6             
0284 37                   CPL  A               
0285 AE                   MOV  R6,A             
0286 83    Bra0286        RET                   
 
0287 9A 00                ANL  P2,#$00         
0289 BA 05                MOV  R2,#$05         
028B B9 E0 Bra028B        MOV  R1,#$E0         
028D 94 6C                CALL Sub046C         
028F EA 8B                DJNZ R2,Bra028B       
0291 74 65                CALL Sub0365         
0293 B8 54                MOV  R0,#$54         
0295 94 10                CALL Sub0410         
0297 54 7E                CALL Sub027E         
0299 B9 70                MOV  R1,#$70         
029B 94 29                CALL Sub0429         
029D B8 1C                MOV  R0,#$1C         
029F 94 10                CALL Sub0410         
02A1 B9 06                MOV  R1,#$06         
02A3 D4 6D                CALL Sub066D         
02A5 B9 04                MOV  R1,#$04         
02A7 B4 77                CALL Sub0577         
02A9 B8 18                MOV  R0,#$18         
02AB 94 10                CALL Sub0410         
02AD 94 22                CALL Sub0422         
02AF B8 1E                MOV  R0,#$1E         
02B1 F4 16                CALL Sub0716         
02B3 96 CF                JNZ  Bra02CF         
02B5 74 7B                CALL Sub037B         
02B7 C6 CF                JZ   Bra02CF         
02B9 B8 18                MOV  R0,#$18         
02BB B9 1A                MOV  R1,#$1A         
02BD D4 24                CALL Sub0624         
02BF B9 09                MOV  R1,#$09         
02C1 D4 6D                CALL Sub066D         
02C3 D4 19                CALL Sub0619         
02C5 94 10                CALL Sub0410         
02C7 94 22                CALL Sub0422         
02C9 B8 1A                MOV  R0,#$1A         
02CB B9 04                MOV  R1,#$04         
02CD B4 77                CALL Sub0577         
02CF B8 18 Bra02CF        MOV  R0,#$18         
02D1 94 00                CALL Sub0400         
02D3 94 30                CALL Sub0430         
02D5 B9 52                MOV  R1,#Mem52       
02D7 F1                   MOV  A,@R1           
02D8 A9                   MOV  R1,A             
02D9 94 B0                CALL Sub04B0         
02DB B4 70 Bra02DB        CALL Sub0570         
02DD E9 DB                DJNZ R1,Bra02DB       
02DF B9 06                MOV  R1,#$06         
02E1 D4 6D                CALL Sub066D         
02E3 B8 20                MOV  R0,#$20         
02E5 94 22                CALL Sub0422         
02E7 B9 7E                MOV  R1,#$7E         
02E9 B8 5A                MOV  R0,#$5A         
02EB 94 AB                CALL Sub04AB         
02ED 18                   INC  R0               
02EE F1                   MOV  A,@R1           
02EF 72 F7                JB3  Bra02F7         
02F1 B8 4A                MOV  R0,#$4A         
02F3 12 F7                JB0  Bra02F7         
02F5 B8 48                MOV  R0,#$48         
02F7 F4 83 Bra02F7        CALL Sub0783         
02F9 B8 40                MOV  R0,#$40         
02FB D4 2B                CALL Sub062B         
02FD D4 29                CALL Sub0629         
02FF FB                   MOV  A,R3             
0300 4A                   ORL  A,R2             
0301 C6 07                JZ   Bra0307         
0303 23 01                MOV  A,#$01           
0305 94 3F                CALL Sub043F         
0307 D4 2B Bra0307        CALL Sub062B         
0309 94 22                CALL Sub0422         
030B B8 20                MOV  R0,#$20         
030D 94 10                CALL Sub0410         
030F 94 22                CALL Sub0422         
0311 D4 29                CALL Sub0629         
0313 B8 39                MOV  R0,#$39         
0315 94 3E                CALL Sub043E         
0317 F6 1F                JC   Bra031F         
0319 B8 25 Bra0319        MOV  R0,#Mem25       
031B B0 C0                MOV  @R0,#$C0         
031D 64 51                JMP  Jmp0351         
 
031F 4A    Bra031F        ORL  A,R2             
0320 C6 19                JZ   Bra0319         
0322 54 7E                CALL Sub027E         
0324 B8 25                MOV  R0,#Mem25       
0326 B0 40                MOV  @R0,#$40         
0328 FE                   MOV  A,R6             
0329 F2 2D                JB7  Bra032D         
032B B0 80                MOV  @R0,#$80         
032D B8 70 Bra032D        MOV  R0,#$70         
032F 94 00                CALL Sub0400         
0331 D4 29                CALL Sub0629         
0333 23 C4                MOV  A,#$C4           
0335 94 3F                CALL Sub043F         
0337 F6 51                JC   Jmp0351         
0339 B8 24                MOV  R0,#Mem24       
033B B0 FD                MOV  @R0,#$FD         
033D B8 6B                MOV  R0,#$6B         
033F F4 16                CALL Sub0716         
0341 96 5C                JNZ  Jmp035C         
0343 B8 26                MOV  R0,#Mem26       
0345 B0 00                MOV  @R0,#$00         
0347 88 C0                ORL  BUS,#$C0         
0349 B4 34 Bra0349        CALL Sub0534         
034B D3 01                XRL  A,#$01           
034D 96 49                JNZ  Bra0349         
034F 04 00                JMP  VResetL         
 
0351 B8 24 Jmp0351        MOV  R0,#Mem24       
0353 B0 00                MOV  @R0,#$00         
0355 B8 6B                MOV  R0,#Mem6B       
0357 B0 C8                MOV  @R0,#$C8         
0359 18                   INC  R0               
035A B0 FB                MOV  @R0,#$FB         
035C 42    Jmp035C        MOV  A,T             
035D F2 5C                JB7  Jmp035C         
035F 23 FE                MOV  A,#$FE           
0361 62                   MOV  T,A             
0362 25                   EN   TCNTI           
0363 64 63 Jmp0363        JMP  Jmp0363         
 
0365 8A 03 Sub0365        ORL  P2,#$03         
0367 B9 11 Sub0367        MOV  R1,#$11         
0369 23 30                MOV  A,#$30           
036B 39                   OUTL P1,A             
036C 94 6C                CALL Sub046C         
036E 99 EF                ANL  P1,#$EF         
0370 94 6F                CALL Jmp046F         
0372 83                   RET                   
 
0373 23 04 Sub0373        MOV  A,#$04           
0375 64 82                JMP  Jmp0382         
 
0377 23 05 Sub0377        MOV  A,#$05           
0379 64 82                JMP  Jmp0382         
 
037B 23 0C Sub037B        MOV  A,#$0C           
037D 74 82                CALL Jmp0382         
037F 53 FE                ANL  A,#$FE           
0381 83                   RET                   
 
0382 B9 7E Jmp0382        MOV  R1,#Mem7E       
0384 D1                   XRL  A,@R1           
0385 53 0D                ANL  A,#$0D           
0387 83                   RET                   
 
0388 00 00 D0388          DB   $00,$00,$00,$00,$00,$00,$00,$00   ;........
0390 00 00 ....           DB   $00,$00,$00,$00,$00,$01,$02,$04   ;.....ABD
0398 00 00 ....           DB   $08,$10,$20,$21,$06,$38,$28       ;HP !F8(
 
039F 1C    D039F          DB   $1C                               ;\       
 
03A0 14 0E D03A0          DB   $14,$0E,$0A,$07,$00,$04,$09,$0D   ;TNJG.DIM
03A8 14 0E ....           DB   $12,$16                           ;RV     
 
03AA 1B 1F D03AA          DB   $1B,$1F,$23,$28,$2C,$31,$35,$39   ;[_#(,159
03B2 1B 1F ....           DB   $3E,$42,$46,$4B,$4F,$53,$57,$5B   ;>BFKOSW[
03BA 1B 1F ....           DB   $60,$61,$68,$6C,$70,$74,$78,$7C   ;`ahlptx|
03C2 1B 1F ....           DB   $80,$83,$87,$8B,$8F,$92,$96,$99   ;........
03CA 1B 1F ....           DB   $9D,$A0,$A4,$A7,$AB,$AE,$B1,$B4   ;........
03D2 1B 1F ....           DB   $B7,$BA,$BE,$C0,$C3,$C6,$C9,$CC   ;........
03DA 1B 1F ....           DB   $CE,$D1,$D3,$D6,$D8,$DB,$DD,$DF   ;........
03E2 1B 1F ....           DB   $E1,$E3,$E5,$E7,$E9,$EB,$EC,$EE   ;........
03EA 1B 1F ....           DB   $F0,$F1,$F3,$F4,$F5,$F6,$F7,$F8   ;........
03F2 1B 1F ....           DB   $F9,$FA,$FB,$FC,$FD,$FD,$FE,$FE   ;........
03FA 1B 1F ....           DB   $FE,$FF,$FF,$FF,$FF,$40           ;.....@ 
 
0400 F0    Sub0400        MOV  A,@R0           
0401 AA                   MOV  R2,A             
0402 18                   INC  R0               
0403 F0                   MOV  A,@R0           
0404 AB                   MOV  R3,A             
0405 4A                   ORL  A,R2             
0406 C8                   DEC  R0               
0407 83                   RET                   
 
0408 FA    Sub0408        MOV  A,R2             
0409 03 01                ADD  A,#$01           
040B AA                   MOV  R2,A             
040C E6 0F                JNC  Bra040F         
040E 1B                   INC  R3               
040F 83    Bra040F        RET                   
« Last Edit: November 05, 2021, 07:18:34 pm by intabits »
 
The following users thanked this post: Wiljan

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #10 on: November 07, 2021, 10:51:48 am »
Yeah it't the jpg of the pinout connection to dump it... weird I cant see how that happened back then
Anyway I have replaced it with the "AutoHelm_30000_05_22CA.hex" size 2k

I don't have the unit anymore it was not mine, so I can't test anything anymore

OK, that's better! (but should be named ".bin" or ".rom", because it's the raw binary, not Intel hex format)

For interest, below is what my disassembler came up with upon loading your file. To take it any further, requires interactive work such as assigning meaningful labels, marking and splitting data areas, adding comments, and clarifying data references (all can be done using the disassembler).
But that also requires knowledge of the application, so I haven't tried to take it any further. (and it's no longer needed)

Thank you a lot, sure it should be named .bin...  recall it came back when I dumped with the Arduino I just grabbed the IDE terminal dump save it as . hex (indicating to me it was the hex dump) and then later edited it (search replace) to some C formatting and then paste into a hex editor HxD and save .... here it should have been bin  :o

When looking on your disassemble on pastebin.... it for me sure look's like valid code / dump

But as mentioned I don't have the unit anymore so no more work needed.
But a great job you did  :-+

 
The following users thanked this post: intabits

Offline jemp

  • Contributor
  • Posts: 30
  • Country: be
Re: MCS-48 disassemble 8049 dump
« Reply #11 on: December 05, 2021, 04:50:20 pm »
OK, tnx

Started this project over again... could you explain this last..  anything change to code ?? for reading the maskROM ?

JP
 

Online WiljanTopic starter

  • Regular Contributor
  • *
  • Posts: 225
  • Country: dk
Re: MCS-48 disassemble 8049 dump
« Reply #12 on: December 05, 2021, 06:55:39 pm »
Hi JP

Not sure exactly what you ask for, but guess it when I talk about switching between internal / external ROM to do a dump

https://www.sbprojects.net/projects/8049spy/index.php

The original page does not respond but the wayback machine does have a copy  :)

https://web.archive.org/web/20210819052545/https://www.sbprojects.net/projects/8049spy/index.php

So basically the 8048 can run with external EPROM so if you have the code in external EPROM and control the pin which tells if it's external or internal (the code then change that pin right after the first lines ask it to dump the EPROM over serial ... so instead of dumping the external the pin flip and you now get the internal send out over serial

Hope it makes sense

Just found a link to same topic but with 8051

http://www.verycomputer.com/31_807f66c8f7d78471_1.htm

Quote
If the device is protected (8051AHP, 80C51BHP) then just forget about it.
Otherwise, there is a simple way to read internal program memory from any
51 device, including supposedly ROMless 8031 device.
You'll need any 8051 board with serial interface and external ROM
capability. Connect /EA signal over an inverter to any port pin, say
P1.0. After reset P1.0 will be high, /EA low, 8051 fetches instructions
from external memory. Now it's up to the program in external memory to
jump somewhere above 1000h, clear P1.0 (set /EA -> 8051 fetches
instructions from internal memory unless it is out of internal memory
range), read the internal code with MOVC and send it to host via serial
line.
« Last Edit: December 05, 2021, 07:37:51 pm by Wiljan »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf