Assembler


Use .asm as an extension for assembler source


In a command prompt


C:> cd \159233

C:159233> asm51 filename


Errors will be reported in the file filename.lst


Simulator


C:159233> sim51 filename


┌─── Data ───────────────────────────┬──── Code ───────────────────┬──── SFR ──┐
│00: 00 00 00 00 00 00 00 00 ........│000: 7422   MOV   A,#22      │ ACC 00    │
│08: 00 00 00 00 00 00 00 00 ........│002: E4     CLR   A          │   B 00    │
│10: 00 00 00 00 00 00 00 00 ........│003: FF     MOV   R7,A       │  SP 07    │
│18: 00 00 00 00 00 00 00 00 ........│004: FF     MOV   R7,A       │ PSW 00    │
│20: 00 00 00 00 00 00 00 00 ........│005: FF     MOV   R7,A       │  IP 00    │
│28: 00 00 00 00 00 00 00 00 ........│006: FF     MOV   R7,A       │  IE 00    │
│30: 00 00 00 00 00 00 00 00 ........│007: FF     MOV   R7,A       │  P1 FF in │
│38: 00 00 00 00 00 00 00 00 ........│008: FF     MOV   R7,A       │     FF out│
│40: 00 00 00 00 00 00 00 00 ........│009: FF     MOV   R7,A       │  P3 FF in │
│48: 00 00 00 00 00 00 00 00 ........│00A: FF     MOV   R7,A       │     FF out│
│50: 00 00 00 00 00 00 00 00 ........│00B: FF     MOV   R7,A       │SCON 00    │
│58: 00 00 00 00 00 00 00 00 ........│00C: FF     MOV   R7,A       │SBUF 00 in │
│60: 00 00 00 00 00 00 00 00 ........│00D: FF     MOV   R7,A       │     00 out│
│68: 00 00 00 00 00 00 00 00 ........│00E: FF     MOV   R7,A       │TCON 00    │
│70: 00 00 00 00 00 00 00 00 ........│00F: FF     MOV   R7,A       │TMOD 00    │
│78: 00 00 00 00 00 00 00 00 ........│010: FF     MOV   R7,A       │PCON 00    │
├────────────────────────────┬───────┼──── Flags ──────────────────┤  T0 0000  │
│    LCD                     │       │RegBank 0   C N  AC N  OV N  │  T1 0000  │
│Display                     │       │Cycles        0     PC 0000  │DPTR 0000  │
└────────────────────────────┴───────┴─────────────────────────────┴───────────┘
                                                                                
                                                                                
                                                                                
F1-RUN F2-STEP F3-STEPOVER F4-BREAK F5-RESET   Tab->next window   F10-EXIT v 1.2 

Constants


Numbers:


Can be in decimal 34

hexadecimal 22h

binary 00100010b


(use a leading zero for 0aah etc)



Characters:


Can be in quotes ‘A’

‘ABCD’

numeric 41h

mixture ‘Hello’,0dh,0ah


Expressions:


constants can be formed using expressions:

2+2

1 SHR 8

operators are:


+ - * / mod

shr shl

not and or xor

a59.203 Assembler 3 - 1