mirror of
https://github.com/Russell-S-Harper/COMMON.git
synced 2025-02-19 15:31:11 +00:00
Changing BRA to BRI to allow CMOS opcodes
This commit is contained in:
parent
6348131dcd
commit
ba7e9b0dfb
@ -5,11 +5,11 @@ system.obj: $(TGT).obj appl.obj
|
||||
cat $(TGT).obj appl.obj > system.obj
|
||||
|
||||
$(TGT).obj: rom.h $(TGT).h $(TGT).asm
|
||||
xa -C -M $(TGT).asm -l $(TGT).lbl -o $(TGT).obj
|
||||
xa -XASM $(TGT).asm -l $(TGT).lbl -o $(TGT).obj
|
||||
|
||||
appl.obj: rom.h macros.h globals.h appl.src
|
||||
cpp -P appl.src | $(XAPP) > appl.asm
|
||||
xa -C -M appl.asm -l appl.lbl -o appl.obj
|
||||
xa -XASM appl.asm -l appl.lbl -o appl.obj
|
||||
|
||||
globals.h: $(TGT).obj
|
||||
grep -E '^(FN_XR|FN_0X|PLS_1|MNS_1|ADDR)' $(TGT).lbl | sed -e 's/, 0, 0x0000//' -e 's/, / = /' -e 's/ 0x/ \x24/' > globals.h
|
||||
|
@ -33,7 +33,7 @@ _1 TST(R1)
|
||||
BRZ(_2)
|
||||
MUL(R2, R2, R1)
|
||||
DCR(R1)
|
||||
BRA(_1)
|
||||
BRI(_1)
|
||||
_2 PSH(R2)
|
||||
RTN
|
||||
|
||||
|
@ -911,14 +911,14 @@ _BRS .( ; BRS xxyy 02 yy xx PC <- PC + xxyy - branch to subroutine
|
||||
JMP _UPPCI0 ; update PC with I0 offset, let it handle the return
|
||||
.)
|
||||
|
||||
_BRA .( ; BRA xxyy 03 yy xx PC <- PC + xxyy - branch always
|
||||
_BRI .( ; BRI xxyy 03 yy xx PC <- PC + xxyy - branch invariably
|
||||
JSR _INIBR ; save the offset and update PC by the length of a branch address
|
||||
JMP _UPPCI0 ; update PC with I0 offset, let it handle the return
|
||||
.)
|
||||
|
||||
_BRX .( ; generic branch testing
|
||||
AND _F ; check the bit
|
||||
BNE _BRA ; if set, branch
|
||||
BNE _BRI ; if set, branch
|
||||
JMP _UPDPC ; not set, advance the program counter over the xxyy offset, let it handle the return
|
||||
.)
|
||||
|
||||
@ -1069,7 +1069,7 @@ _END_CMN_CD
|
||||
; beginning of ROM data
|
||||
* = CMN_DT
|
||||
|
||||
FN_0X .WORD _ESC-1, _RTN-1, _BRS-1, _BRA-1, _BRE-1, _BRG-1, _BRL-1, _BRZ-1,
|
||||
FN_0X .WORD _ESC-1, _RTN-1, _BRS-1, _BRI-1, _BRE-1, _BRG-1, _BRL-1, _BRZ-1,
|
||||
.WORD _BRP-1, _BRN-1, _BRO-1, _BRU-1, _CPR-1, _LDI-1, _SVI-1, _CMR-1
|
||||
FN_XR .WORD _SET-1, _LDD-1, _SVD-1, _PSH-1, _POP-1, _EXC-1, _INR-1,
|
||||
.WORD _DCR-1, _TST-1, _ADD-1, _SUB-1, _MUL-1, _DIV-1, _MOD-1
|
||||
|
@ -40,7 +40,7 @@
|
||||
; ESC 00 - escape back into regular assembler
|
||||
; RTN 01 - return from subroutine
|
||||
; BRS xxyy 02 yy xx PC <- PC + xxyy - branch to subroutine
|
||||
; BRA xxyy 03 yy xx PC <- PC + xxyy - branch always
|
||||
; BRI xxyy 03 yy xx PC <- PC + xxyy - branch invariably
|
||||
; BRE xxyy 04 yy xx PC <- PC + xxyy - branch if Rp = Rq (after CMR)
|
||||
; BRG xxyy 05 yy xx PC <- PC + xxyy - branch if Rp > Rq (after CMR)
|
||||
; BRL xxyy 06 yy xx PC <- PC + xxyy - branch if Rp < Rq (after CMR)
|
||||
@ -127,7 +127,7 @@ FN_FX = $300 - 2 * 16 ; list of system and user functions
|
||||
_ESC_C = $00
|
||||
_RTN_C = $01
|
||||
_BRS_C = $02
|
||||
_BRA_C = $03
|
||||
_BRI_C = $03
|
||||
_BRE_C = $04
|
||||
_BRG_C = $05
|
||||
_BRL_C = $06
|
||||
|
@ -48,7 +48,7 @@
|
||||
#define ESC .BYTE _ESC_C
|
||||
#define RTN .BYTE _RTN_C
|
||||
#define BRS(o) .BYTE _BRS_C, _BRX_M(o)
|
||||
#define BRA(o) .BYTE _BRA_C, _BRX_M(o)
|
||||
#define BRI(o) .BYTE _BRI_C, _BRX_M(o)
|
||||
#define BRE(o) .BYTE _BRE_C, _BRX_M(o)
|
||||
#define BRG(o) .BYTE _BRG_C, _BRX_M(o)
|
||||
#define BRL(o) .BYTE _BRL_C, _BRX_M(o)
|
||||
|
@ -1,43 +1,43 @@
|
||||
|
||||
RCD(UNIT_TESTS)
|
||||
|
||||
CMN
|
||||
BRS(FIBONACCI) ; #Expect FIBONACCI: 2.236 5.000
|
||||
ESC
|
||||
BRK
|
||||
|
||||
; Calculate the square root of five using this Fibonacci series identity:
|
||||
;
|
||||
; F(n) F(n-1) _
|
||||
; ------ + ------ → √5 as n → ∞
|
||||
; F(n-1) F(n)
|
||||
;
|
||||
; FIBONACCI: 2.236 5.000
|
||||
|
||||
BGN(FIBONACCI)
|
||||
|
||||
SET(R0, 1)
|
||||
CPR(R1, R0)
|
||||
_1 ADD(R2, R1, R0)
|
||||
BRO(_2)
|
||||
CPR(R0, R1)
|
||||
CPR(R1, R2)
|
||||
BRA(_1)
|
||||
_2 DIV(R2, R0, R1)
|
||||
DIV(R1, R1, R0)
|
||||
ADD(R0, R1, R2)
|
||||
MUL(R1, R0, R0)
|
||||
EXT(S1, O_FIBONACCI)
|
||||
RTN
|
||||
|
||||
END(FIBONACCI)
|
||||
|
||||
END(UNIT_TESTS)
|
||||
|
||||
RDT(_)
|
||||
|
||||
; Preset constants
|
||||
; Output D format: decimal, leading sign for negative, no padding, no thousands separators, period for decimal, three decimal places
|
||||
DEF(O_FIBONACCI, 'FIBONACCI: \eD0 \eD1\n')
|
||||
|
||||
END(_)
|
||||
|
||||
RCD(UNIT_TESTS)
|
||||
|
||||
CMN
|
||||
BRS(FIBONACCI) ; #Expect FIBONACCI: 2.236 5.000
|
||||
ESC
|
||||
BRK
|
||||
|
||||
; Calculate the square root of five using this Fibonacci series identity:
|
||||
;
|
||||
; F(n) F(n-1) _
|
||||
; ------ + ------ → √5 as n → ∞
|
||||
; F(n-1) F(n)
|
||||
;
|
||||
; FIBONACCI: 2.236 5.000
|
||||
|
||||
BGN(FIBONACCI)
|
||||
|
||||
SET(R0, 1)
|
||||
CPR(R1, R0)
|
||||
_1 ADD(R2, R1, R0)
|
||||
BRO(_2)
|
||||
CPR(R0, R1)
|
||||
CPR(R1, R2)
|
||||
BRI(_1)
|
||||
_2 DIV(R2, R0, R1)
|
||||
DIV(R1, R1, R0)
|
||||
ADD(R0, R1, R2)
|
||||
MUL(R1, R0, R0)
|
||||
EXT(S1, O_FIBONACCI)
|
||||
RTN
|
||||
|
||||
END(FIBONACCI)
|
||||
|
||||
END(UNIT_TESTS)
|
||||
|
||||
RDT(_)
|
||||
|
||||
; Preset constants
|
||||
; Output D format: decimal, leading sign for negative, no padding, no thousands separators, period for decimal, three decimal places
|
||||
DEF(O_FIBONACCI, 'FIBONACCI: \eD0 \eD1\n')
|
||||
|
||||
END(_)
|
||||
|
Loading…
x
Reference in New Issue
Block a user