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