; Freeware, Program: hello51.asm ; ; ; (1) On J51 simulator set "CPU" to j51.intel.P8051 ; (2) File --> Load --> hello51.hex ; (3) Go ; (7) Peripheral output should say: Hello, World and Goodbye ; (5) Stop ; (6) File --> Exit ; ; (7) In order to assmble this program: as31 -l hello51.asm ; will output a listing file and a intel hex file: hello51.l ; 0000: .org 0h start: 0000: 75 89 20 mov TMOD, #20h ; set timer 1 for auto reload 0003: 75 88 41 mov TCON, #41h ; run counter 1 edge trig 0006: 75 8D FD mov TH1, #0FDh ; 9600 baud 0009: 75 98 50 mov SCON,#50h ; 8-bit data mode 1 000C: 90 00 30 mov dptr,#msg1 000F: 12 00 1A lcall puts 0012: 90 00 3E mov dptr,#msg2 0015: 12 00 1A lcall puts 0018: 80 FE idle: sjmp idle puts: 001A: E4 clr a 001B: 93 movc a,@a+dptr 001C: 60 11 jz putret 001E: C2 99 clr TI 0020: F5 99 mov SBUF, A 0022: 30 99 FD puts1: jnb TI,puts1 0025: A3 inc dptr 0026: 80 F2 sjmp puts putchar: 0028: C2 99 clr TI 002A: F5 99 mov SBUF, A putchar1: 002C: 30 99 FD jnb TI, putchar1 002F: 22 putret:ret 0030: 48 65 6C 6C 6F 2C 20 msg1: .byte 'H','e','l','l','o',',',' ' 0037: 57 6F 72 6C 64 0A 00 .byte 'W','o','r','l','d',0x0a, 0 003E: 47 6F 6F 64 62 79 65 0A 00 msg2: .byte 'G','o','o','d','b','y','e',0x0a,0 0047: .end