From a5ffaa05bd900080e3687e2429ffbb18088bae78 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Fri, 23 Feb 2024 22:03:31 +0100 Subject: [PATCH] some comments --- main.S | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/main.S b/main.S index 2a0f3d7..573cb69 100644 --- a/main.S +++ b/main.S @@ -54,9 +54,6 @@ _start: ;; initialize stack pointer with value from linker mov.w #__stack, SP - mov.w #0xaaaa, r7 - mov.w #0x5555, r8 - init: ;; configuration of GPIO Ports mov.b #BIT0|BIT1|BIT2,&P1DIR @@ -77,6 +74,14 @@ init: mov.w #OUTMOD_7,&TA1CCTL1 mov.w #OUTMOD_7,&TA1CCTL2 + ;; r4: synchronization between main loop and isr + ;; bit0 signals byte done from isr + ;; r5: data byte to be handled by isr + ;; r6: bit-counter, only used within isr + ;; r7: screen data start/next pointer + ;; r8: screen data end pointer + ;; r9: next screen data byte, prepared in mainloop + ;; initialize bit-counter for isr mov.b #0x01,r6 ;; initialize isr-sync register @@ -96,28 +101,30 @@ init: eint - - - ;; r4: synchronization between mainloop and isr - ;; r5: data byte to be handled by isr mainloop: ;; prepare next byte to handle by isr + ;; first, check whether we are already at the end of screen data cmp.w r7,r8 jnz mainloop_prepare_next_byte + ;; in that case rollover to the start again mov.w #screendata,r7 mainloop_prepare_next_byte: + ;; load the byte from the screen data next pointer mov.b @r7,r9 + ;; and increase the pointer inc.w r7 mainloop_wait_for_isr: - ;; check bit0 in sync register + ;; check bit0 in sync register, wait for the signal from + ;; the isr bit #0x01,r4 jz mainloop_wait_for_isr ;; load data mov.b r9,r5 + ;; clear the signal mov.b #0x00,r4 - ;; signal reload + ;; mark the cycle bis #BIT2,&P1OUT bic #BIT2,&P1OUT @@ -125,8 +132,6 @@ mainloop_wait_for_isr: jmp mainloop - - ; --- timer isr --- ;; r6: exclusively used by isr as bit-counter timer1_a0_isr: