pico430prog/test/test.S

145 lines
2.3 KiB
ArmAsm
Raw Normal View History

2021-10-03 15:39:32 +00:00
; vim: set ft=gas:
#define CPUOFF (1<<4)
#define GIE (1<<3)
#define IE1 0x0000
#define IFG1 0x0002
#define WDTCTL 0x0120
#define USICTL0 0x0078
#define USICTL1 0x0079
#define USICKCTL 0x007a
#define USICNT 0x007b
#define USISR 0x007c
#define BCSCTL3 0x0053
#define BCSCTL2 0x0058
#define BCSCTL1 0x0057
#define DCOCTL 0x0056
#define P2SEL2 0x0042
#define P2REN 0x002f
#define P2SEL 0x002e
#define P2IE 0x002d
#define P2IES 0x002c
#define P2IFG 0x002b
#define P2DIR 0x002a
#define P2OUT 0x0029
#define P2IN 0x0028
#define P1SEL2 0x0041
#define P1REN 0x0027
#define P1SEL 0x0026
#define P1IE 0x0024
#define P1IES 0x0024
#define P1IFG 0x0023
#define P1DIR 0x0022
#define P1OUT 0x0021
#define P1IN 0x0020
.section ".text.startup._start", "ax", %progbits
.global _start
_start:
dint
mov.b #0, &IE1
mov.w #__stack, sp
mov.b #0, &P2IE
mov.b #0, &P2SEL
mov.b #0, &P2SEL2
mov.b #0xff, &P2DIR
; TODO: configure wdt
mov.w #((0x5a<<8)|(1<<4)), &WDTCTL
mov.b #1, &IE1
eint
lockup:
; enter LPM0 for power save stuff
bis #(GIE|CPUOFF), sr
jmp lockup
.section ".text.callback", "ax", %progbits
wdt_callback:
bic.b #1, &IFG1
bis.b #1, &IE1
xor.b #1, &P2OUT
ret
.section ".vectors", "ax", %progbits
_VECTORS:
.2byte ISR_unk ; ffe0
.2byte ISR_unk ; ffe2
.2byte ISR_port1 ; ffe4
.2byte ISR_port2 ; ffe6
.2byte ISR_USI ; ffe8
.2byte ISR_unk ; ffea ; (ADC10, not on this chip)
.2byte ISR_unk ; ffec
.2byte ISR_unk ; ffee
.2byte ISR_timer0 ; fff0
.2byte ISR_timer1 ; fff2
.2byte ISR_wdt ; fff4
.2byte ISR_cmpA ; fff6
.2byte ISR_unk ; fff8
.2byte ISR_unk ; fffa
.2byte ISR_NMI ; fffc
.2byte ISR_RST ; fffe
.section ".text.isr.unk", "ax", %progbits
ISR_unk:
reti
.section ".text.isr.port1", "ax", %progbits
ISR_port1:
reti
.section ".text.isr.port2", "ax", %progbits
ISR_port2:
reti
.section ".text.isr.usi", "ax", %progbits
ISR_USI:
reti
.section ".text.isr.timer0", "ax", %progbits
ISR_timer0:
reti
.section ".text.isr.timer1", "ax", %progbits
ISR_timer1:
reti
.section ".text.isr.wdt", "ax", %progbits
ISR_wdt:
call #wdt_callback
reti
.section ".text.isr.cmpA", "ax", %progbits
ISR_cmpA:
reti
.section ".text.isr.nmi", "ax", %progbits
ISR_NMI:
reti
.section ".text.isr.rst", "ax", %progbits
ISR_RST:
jmp _start