From 9e4aeae669d5046804933ae864c0766531369db8 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sun, 28 Feb 2010 19:56:48 -0500 Subject: [PATCH] Move target/ to avr-libc built in progmem.h --- target/asm.S | 12 ------------ target/main.c | 4 +++- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/target/asm.S b/target/asm.S index 7f9c5dc..8289b5f 100644 --- a/target/asm.S +++ b/target/asm.S @@ -2,24 +2,12 @@ #include #include - .global readsongbyte .global watchdogoff .global __vector_14 .extern lastsample .extern noiseseed .extern osc - .extern songdata - -readsongbyte: - ldi r30, lo8(songdata) - add r30, r24 - ldi r31, hi8(songdata) - adc r31, r25 - lpm - mov r24, r0 - mov r25, r1 - ret watchdogoff: wdr diff --git a/target/main.c b/target/main.c index cd2b668..3b1690f 100644 --- a/target/main.c +++ b/target/main.c @@ -1,5 +1,6 @@ #include #include +#include #define TRACKLEN 32 @@ -75,8 +76,9 @@ u16 resources[16 + MAXTRACK]; struct unpacker songup; -u8 readsongbyte(u16 offset); void watchdogoff(); +extern u8 songdata[] __ATTR_PROGMEM__; +#define readsongbyte(x) pgm_read_byte_near(&songdata[x]); static void initup(struct unpacker *up, u16 offset) { up->nextbyte = offset; -- 2.50.1