-
Notifications
You must be signed in to change notification settings - Fork 1
/
mem.asm
92 lines (87 loc) · 3.05 KB
/
mem.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
;****************************************************************************
;
; MC70 - Firmware for the Motorola MC micro trunking radio
; to use it as an Amateur-Radio transceiver
;
; Copyright (C) 2004 - 2012 Felix Erckenbrecht, DG1YFE
;
; This file is part of MC70.
;
; MC70 is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; MC70 is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with MC70. If not, see <http://www.gnu.org/licenses/>.
;
;
;
;****************************************************************************
;************************************************
; M E M O R Y
;************************************************
;
; Memory related Subroutines
;
; mem_fill - Füllt einen Speicherbereich von maximal 256 Bytes mit dem angegebenen Wert
; ( B - Füllwert, A - Bytecount, X - Startadresse | nix )
; mem_trans - Kopiert Daten im RAM ( D - Zieladresse, X - Quelladresse, Stack - Bytecount | nix )
;
;
;
;
;
;************************
; M E M T R A N S
;************************
;
; Kopiert Daten im RAM.
; Speicherbereiche dürfen sich nicht überlappen wenn Zieladresse>Quelladresse!
;
; Parameter : D - Zieladresse
; X - Quelladresse
; Stack (Word) - Bytecount
;
; Ergebnis : Nichts
;
; changed Regs : A,B,X
;
;
mem_trans
pshb
psha
pshx
tsx
ldx 2+4,x ; Bytecount
beq mem_trans_ret ; Wenn 0 Bytes zu kopieren sind -> Ende
mem_trans_loop
pshx ; Bytecount speichern
tsx
ldx 2,x ; Get source address from stack
ldab 0,x
pshb ; store byte on stack
inx ; Increment source address
xgdx
tsx
std 2+1,x ; store new source address
ldx 4+1,x ; get destination address
pulb ; get byte to transfer from stack
stab 0,x ; store byte to destination
inx ; increment destination address
xgdx
tsx
std 4,x ; store destination address
pulx ; get bytecount
dex ; increment bytecount
bne mem_trans_loop
mem_trans_ret
pulx
pula
pulb
rts