I need some help modifying the program below to display a digital clock on the L
ID: 1813294 • Letter: I
Question
I need some help modifying the program below to display a digital clock on the LCD of the Fox 11 Trainer board. I also need the dip switches, when switched on, too add an hour to the clock. Kind of like changing time zones. Here is the program that requires modification.
TEN_MS: equ 2500
STACK: equ $8FFF
; The following 3 routines are included in BUFFALO monitor ver. 3.47
org $FF70
lcd_ini: rmb 3 ; initializes 16x2 LCD module
lcd_line1: rmb 3 ; displays 16 char on the first line
lcd_line2: rmb 3 ; displays 16 char on the second line
org $D000
jmp start
*
delay_10ms:
pshx
ldx #TEN_MS ; 2500 x 8 = 20,000 cycles = 10ms
del1: dex ; 3 cycles
nop ; 2 cycle
bne del1 ; 3 cycles
pulx
rts
*
start: lds #STACK
jsr delay_10ms ; delay 20ms during power up
jsr delay_10ms
jsr lcd_ini ; initialize LCD
back: ldx #MSG1 ; MSG1 for line1, x points to MSG1
jsr lcd_line1
*
ldx #MSG2 ; MSG2 for line2, x points to MSG2
jsr lcd_line2
swi ; go back to BUFFALO monitor
MSG1: FCC " FOX11 TRAINER "
MSG2: FCC "(C)2002, EVBPLUS"
end
Here is a link to the programmers guide
http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11ERG.pdf
Explanation / Answer
section .text global _start ;must be declared for linker (ld) _start: ;tells linker entry point mov edx,len ;message length mov ecx,msg ;message to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data msg db 'Hello, world!', 0xa ;our dear string len equ $ - msg ;length of our dear string