admin can explain me the command line marked thanks

If you have something to say about LogicCircuit program or you know how to improve it please share it here.
Post Reply
ap2014
Posts: 5
Joined: Tue Jul 13, 2021 2:45 am

admin can explain me the command line marked thanks

Post by ap2014 »

admin can explain me the command line marked thanks

Code: Select all

atomic macro and	a, b	{ COP 0x0, 0x0, a, b }
atomic macro or		a, b	{ COP 0x0, 0x1, a, b }
atomic macro xor	a, b	{ COP 0x0, 0x2, a, b }
atomic macro sign	a, b	{ COP 0x0, 0x3, a, b }	                      ; extend sign
atomic macro add	a, b	{ COP 0x0, 0x4, a, b }
atomic macro sub	a, b	{ COP 0x0, 0x5, a, b }	                      ; a - b -> a
atomic macro ls		a		{ COP 0x0, 0x6, a, a }	      ; left shift
atomic macro rs		a		{ COP 0x0, 0x7, a, a }	      ; right sihft
atomic macro mr		a, b	{ COP 0x1, 0x9, a, b }	              ; move register b -> a
atomic macro zr		a		{ COP 0x1, 0xA, a, 0 }	      ; zero register
atomic macro cmp	a, b	{ COP 0x2, 0x5, a, b }	                      ; a - b
atomic macro adc	a, b	{ COP 0x0, 0xC, a, b }
atomic macro sbc	a, b	{ COP 0x0, 0xD, a, b }
atomic macro rl		a		{ COP 0x0, 0xE, a, a }	        ; rotate left
atomic macro rr		a		{ COP 0x0, 0xF, a, a }	                ; rotate right
atomic macro li		a, data { COP 0x3, 0x8, a, 0 data & 0xFFFF }	; load immediate
atomic macro ld		a, b	{ COP 0x4, 0x8, a, b }	                ; load data mem[b] -> a
atomic macro sd		a, b	{ COP 0x5, 0x0, a, b }	                ; save data a -> mem[b]
atomic macro si		r		{ COP 0x6, 0x8, r, 0 }	                ; save IP to register
atomic macro j		        r		{ COP 0x7, 0x0, 0, r }	               ; jump to address in register
atomic macro jc		r		{ COP 0x8, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro jo		r		{ COP 0x9, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro js		r		{ COP 0xA, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro jz		r		{ COP 0xB, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro jnc	       r		{ COP 0xC, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro jns	       r		{ COP 0xD, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro jnz	       r		{ COP 0xE, 0x0, 0, r }        : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
atomic macro halt			{ COP 0xF, 0x0, 0, 0 }                : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  ?
Assembler.txt Samples.2.21.07.14

Image
Attachments
anh hoi.PNG
anh hoi.PNG (76.21 KiB) Viewed 11195 times
User avatar
admin
Site Admin
Posts: 407
Joined: Sun Jun 14, 2009 10:53 pm
Contact:

Re: admin can explain me the command line marked thanks

Post by admin »

Hi,
If I am correctly understand your question, you asking what commands marked with: >>>>>>> do.
All of them are conditional jumps. The CPU checks the flag in the flag register and performs jump if the flag is 1 or 0.
So the command jc r will jump to address in register r if carry flag is set to 1. jnc r will jump if the carry flag is 0.
jo jumps if overflow flag is set. There is no jno command.
js and jns jump on sign flag,
jz and jnz on zero flag.
It is only 4 flags in the CPU.
The last command is halt will stop execution until the reset signal.
Hope this helps,
Eugene
ap2014
Posts: 5
Joined: Tue Jul 13, 2021 2:45 am

Re: admin can explain me the command line marked thanks

Post by ap2014 »

yes thanks for your help
Post Reply