more work on pages and ressources.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
tree_t.asm
|
||||
eeprom-r.asm
|
||||
eeprom-w.asm
|
||||
ressource.asm
|
||||
</extradist>
|
||||
|
||||
</gwbuild>
|
||||
|
||||
64
avr/common/ressource.asm
Normal file
64
avr/common/ressource.asm
Normal file
@@ -0,0 +1,64 @@
|
||||
; ***************************************************************************
|
||||
; copyright : (C) 2025 by Martin Preuss
|
||||
; email : martin@libchipcard.de
|
||||
;
|
||||
; ***************************************************************************
|
||||
; * This file is part of the project "AqHome". *
|
||||
; * Please see toplevel file COPYING of that project for license details. *
|
||||
; ***************************************************************************
|
||||
|
||||
#ifndef AQH_AVR_COMMON_RESSOURCE_H
|
||||
#define AQH_AVR_COMMON_RESSOURCE_H
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; defs
|
||||
|
||||
|
||||
|
||||
; ***************************************************************************
|
||||
; code
|
||||
|
||||
.cseg
|
||||
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; @routine RES_GetRessource
|
||||
;
|
||||
; The Ressource table has one entry for every ressource handled by this table.
|
||||
; The first entry contains the number of ressource entries in the table.
|
||||
; All following entries contain byte pointer addresses (for LPM) to ressources.
|
||||
; Ressource ids start with zero.
|
||||
;
|
||||
; @param r17:r16 ressource id (starting with 0)
|
||||
; @param Z pointer to start of ressources in FLASH (byte address)
|
||||
; @return CF set if ressource found, cleared otherwise
|
||||
; @return Z if CF set: pointer to ressource (byte address)
|
||||
; @clobbers r16, r17, r18
|
||||
|
||||
RES_GetRessource:
|
||||
lpm r18, Z+ ; first entry: number of entries in table
|
||||
cp r16, r18 ; id must be < num entries
|
||||
lpm r18, Z+ ; Z points to first entry now
|
||||
cpc r17, r18
|
||||
brcc RES_GetRessource_ret
|
||||
RES_GetRessource_getRessource:
|
||||
lsl r16 ; byte address, so we need to add ressource id twice (i.e. *2)
|
||||
rol r17
|
||||
add zl, r16
|
||||
add zh, r17
|
||||
lpm r16, Z+
|
||||
lpm r17, Z+
|
||||
mov zl, r16
|
||||
mov zh, r17
|
||||
sec
|
||||
RES_GetRessource_ret:
|
||||
ret
|
||||
; @end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user