some comments

This commit is contained in:
2024-02-23 22:03:31 +01:00
parent 3f7d73d2fc
commit a5ffaa05bd

27
main.S
View File

@ -54,9 +54,6 @@ _start:
;; initialize stack pointer with value from linker ;; initialize stack pointer with value from linker
mov.w #__stack, SP mov.w #__stack, SP
mov.w #0xaaaa, r7
mov.w #0x5555, r8
init: init:
;; configuration of GPIO Ports ;; configuration of GPIO Ports
mov.b #BIT0|BIT1|BIT2,&P1DIR mov.b #BIT0|BIT1|BIT2,&P1DIR
@ -77,6 +74,14 @@ init:
mov.w #OUTMOD_7,&TA1CCTL1 mov.w #OUTMOD_7,&TA1CCTL1
mov.w #OUTMOD_7,&TA1CCTL2 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 ;; initialize bit-counter for isr
mov.b #0x01,r6 mov.b #0x01,r6
;; initialize isr-sync register ;; initialize isr-sync register
@ -96,28 +101,30 @@ init:
eint eint
;; r4: synchronization between mainloop and isr
;; r5: data byte to be handled by isr
mainloop: mainloop:
;; prepare next byte to handle by isr ;; prepare next byte to handle by isr
;; first, check whether we are already at the end of screen data
cmp.w r7,r8 cmp.w r7,r8
jnz mainloop_prepare_next_byte jnz mainloop_prepare_next_byte
;; in that case rollover to the start again
mov.w #screendata,r7 mov.w #screendata,r7
mainloop_prepare_next_byte: mainloop_prepare_next_byte:
;; load the byte from the screen data next pointer
mov.b @r7,r9 mov.b @r7,r9
;; and increase the pointer
inc.w r7 inc.w r7
mainloop_wait_for_isr: mainloop_wait_for_isr:
;; check bit0 in sync register ;; check bit0 in sync register, wait for the signal from
;; the isr
bit #0x01,r4 bit #0x01,r4
jz mainloop_wait_for_isr jz mainloop_wait_for_isr
;; load data ;; load data
mov.b r9,r5 mov.b r9,r5
;; clear the signal
mov.b #0x00,r4 mov.b #0x00,r4
;; signal reload ;; mark the cycle
bis #BIT2,&P1OUT bis #BIT2,&P1OUT
bic #BIT2,&P1OUT bic #BIT2,&P1OUT
@ -125,8 +132,6 @@ mainloop_wait_for_isr:
jmp mainloop jmp mainloop
; --- timer isr --- ; --- timer isr ---
;; r6: exclusively used by isr as bit-counter ;; r6: exclusively used by isr as bit-counter
timer1_a0_isr: timer1_a0_isr: