mirror of
https://github.com/Russell-S-Harper/COMMON.git
synced 2024-11-21 20:31:02 +00:00
Merge pull request #50 from Russell-S-Harper/development
Cleaning up sections.
This commit is contained in:
commit
a1c7602652
@ -78,22 +78,24 @@
|
|||||||
#define EXT(f) .BYTE _EXT_C + (f)
|
#define EXT(f) .BYTE _EXT_C + (f)
|
||||||
|
|
||||||
; header for fixed code or data
|
; header for fixed code or data
|
||||||
#define HARD(l) .BYTE _SM_FXD:.WORD l, _END_##l - l:* = * - 5:l .(
|
#define FIXED(l) .BYTE _SM_FXD:.WORD l, _END_##l - l:* = * - 5:l .(
|
||||||
|
|
||||||
; header for relocatable code: l(abel), s(tart) => starting offset, length of code
|
; header for relocatable code: l(abel) => starting offset, length of code
|
||||||
#define CODE(l, s) .BYTE _RLC_CD:.WORD s - l, _END_##l - l: * = * -5:l .(
|
#define CODE(l) .BYTE _RLC_CD:.WORD _start - l, _END_##l - l: * = * -5:l .(
|
||||||
|
#define START &_start
|
||||||
|
|
||||||
; header for relocatable data: l(abel), s(tart) of zeroed data, => length of zeroed data, length of preset data
|
; header for relocatable data: l(abel) => length of zeroed data, length of preset data
|
||||||
#define DATA(l, s) .BYTE _RLC_DT:.WORD _END_##l - s, s - l: * = * - 5:l .(
|
#define DATA(l) .BYTE _RLC_DT:.WORD _END_##l - _zero, _zero - l: * = * - 5:l .(
|
||||||
|
#define ZERO &_zero
|
||||||
|
|
||||||
; initialize memory
|
; initialize v(alue)
|
||||||
#define INIT(v) .BYTE _SET_V(#v)
|
#define VALUE(v) .BYTE _SET_V(#v)
|
||||||
|
|
||||||
; reserve c(ount)
|
; reserve c(ount)
|
||||||
#define ZERO(c) .DSB c * 4, 0
|
#define RESERVE(c) * = * + c * 4
|
||||||
|
|
||||||
; common begin and end
|
; common begin and end
|
||||||
#define BGN(l) l .(
|
#define BEGIN(l) l .(
|
||||||
#define END(l) .):_END_##l
|
#define END(l) .):_END_##l
|
||||||
|
|
||||||
#endif /* __MACROS_H */
|
#endif /* __MACROS_H */
|
||||||
|
@ -2,13 +2,15 @@
|
|||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
* = 0
|
* = $1000 ; any address outside of page zero is okay
|
||||||
|
|
||||||
CODE(DEMO, DEMO)
|
CODE(DEMO)
|
||||||
|
START
|
||||||
CMN
|
CMN
|
||||||
SET(R0, 9.4662)
|
SET(R0, 9.4662)
|
||||||
SET(R1, 0)
|
SET(R1, 2)
|
||||||
LDI(R7, R1)
|
LDI(R7, R1)
|
||||||
|
MUL(R7, R7, R7)
|
||||||
SVI(R1, R0)
|
SVI(R1, R0)
|
||||||
PSH(R0)
|
PSH(R0)
|
||||||
BRS(FACTORIAL)
|
BRS(FACTORIAL)
|
||||||
@ -18,9 +20,9 @@ CODE(DEMO, DEMO)
|
|||||||
ESC
|
ESC
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
BGN(FACTORIAL)
|
BEGIN(FACTORIAL)
|
||||||
POP(R1)
|
POP(R1)
|
||||||
SET(R2, 1)
|
SET(R2, 3)
|
||||||
MOD(R3, R1, R2)
|
MOD(R3, R1, R2)
|
||||||
SUB(R1, R1, R3)
|
SUB(R1, R1, R3)
|
||||||
_1 TST(R1)
|
_1 TST(R1)
|
||||||
@ -34,7 +36,9 @@ END(FACTORIAL)
|
|||||||
|
|
||||||
END(DEMO)
|
END(DEMO)
|
||||||
|
|
||||||
DATA(WORKING, EXTRA)
|
DATA(WORKING)
|
||||||
+PI INIT(3.1415926535)
|
PI VALUE(3.14159)
|
||||||
+EXTRA ZERO(2)
|
E VALUE(2.71828)
|
||||||
|
SQRT2 VALUE(1.41421)
|
||||||
|
ZERO RESERVE(2)
|
||||||
END(WORKING)
|
END(WORKING)
|
||||||
|
Loading…
Reference in New Issue
Block a user