[Home]MK14 Scmp Code

HomePage | RecentChanges | Preferences | My Website home page

Showing revision 5
Describe the new page here.

Simple try out of XOR and Accumulator math

Try out xor , GO from 0f22 , code is run and monitor displays result FF.

Some very simple hex to type in to the MK 14. It works out 0xAA xor 0x55 which equals 0x FF. It stores the result in memory just after the return to the monitor.

Z 0F22 T

or 
Z 0F21 M
C4 M
AA M
E4 M
55 M
C8 M
02 M
3F 
;now go an execute
Z 0F22
G
;
you should read:
0F29 FF


   32 0f22:             
   33 0f22:             	; load accumulator with 0xAA eor with 0x55 and store 
   34 0f22: c4 aa       	ldi	0aah
   35 0f24: e4 55       	xri	055h
   36 0f26:             	
   37 0f26: c8 02       	st	2 (0)
   38 0f28:             	; return to the monitor
   39 0f28: 3f          	xppc	3
   40 0f29:             
   41 0f29:             
   42 0f29:             	; next code is overwritten by result.

write to display

execute from 0F20. Jmp to routine. set up P1 to point to the display.

load 0xAA and write to display.

   31 0f20: 90 00       	jmp	main0
   32 0f22:             
   33 0f22:             main0:
   34 0f22:             	; reload display pointer.
   35 0f22: c4 00       	LDI	Disp.0
   36 0f24: 31          	XPAL	1
   37 0f25: c4 0d       	LDI	Disp.1
   38 0f27: 35          	XPAH	1
   39 0f28:             
   40 0f28: c4 aa       	ldi	0aah
   41 0f2a: cd 00       	st	@0(1)
   42 0f2c:             
   43 0f2c: 90 f4       	jmp	main0
   44 0f2e:             
   45 0f2e:             

code to copy pressed key, invert and write to display

assembled code to type in:-
   86 0f61:             main2:
   87 0f61:             	; reload display pointer.
   88 0f61: c4 00       	LDI	Disp.0
   89 0f63: 31          	XPAL	1
   90 0f64: c4 0d       	LDI	Disp.1
   91 0f66: 35          	XPAH	1
   92 0f67:             
   93 0f67:             	; read keyboard, invert and write to display, increment pointer to next digit
   94 0f67: c5 00       	ld	@0(1)
   95 0f69: e4 ff       	xri	0ffh
   96 0f6b: cd 01       	st	@+1(1)
   97 0f6d: 8f 04       	dly	4
   98 0f6f:             
   99 0f6f:             
  100 0f6f:             	; read keyboard, invert and write to display, increment pointer to next digit
  101 0f6f: c5 00       	ld	@0(1)
  102 0f71: e4 ff       	xri	0ffh
  103 0f73: cd 01       	st	@+1(1)
  104 0f75: 8f 04       	dly	4
  105 0f77:             
  106 0f77:             	; read keyboard, invert and write to display, increment pointer to next digit
  107 0f77: c5 00       	ld	@0(1)
  108 0f79: e4 ff       	xri	0ffh
  109 0f7b: cd 01       	st	@+1(1)
  110 0f7d: 8f 04       	dly	4
  111 0f7f:             
  112 0f7f:             	; read keyboard, invert and write to display, increment pointer to next digit
  113 0f7f: c5 00       	ld	@0(1)
  114 0f81: e4 ff       	xri	0ffh
  115 0f83: cd 01       	st	@+1(1)
  116 0f85: 8f 04       	dly	4
  117 0f87:             
  118 0f87:             	; read keyboard, invert and write to display, increment pointer to next digit
  119 0f87: c5 00       	ld	@0(1)
  120 0f89: e4 ff       	xri	0ffh
  121 0f8b: cd 01       	st	@+1(1)
  122 0f8d: 8f 04       	dly	4
  123 0f8f:             
  124 0f8f:             	; read keyboard, invert and write to display, increment pointer to next digit
  125 0f8f: c5 00       	ld	@0(1)
  126 0f91: e4 ff       	xri	0ffh
  127 0f93: cd 01       	st	@+1(1)
  128 0f95: 8f 04       	dly	4
  129 0f97:             
  130 0f97:             	; read keyboard, invert and write to display, increment pointer to next digit
  131 0f97: c5 00       	ld	@0(1)
  132 0f99: e4 ff       	xri	0ffh
  133 0f9b: cd 01       	st	@+1(1)
  134 0f9d: 8f 04       	dly	4
  135 0f9f:             
  136 0f9f:             	; read keyboard, invert and write to display, increment pointer to next digit
  137 0f9f: c5 00       	ld	@0(1)
  138 0fa1: e4 ff       	xri	0ffh
  139 0fa3: cd 01       	st	@+1(1)
  140 0fa5: 8f 04       	dly	4
  141 0fa7:             
  142 0fa7:             
  143 0fa7: 90 b8       	jmp	main2
  144 0fa9:             


HomePage | RecentChanges | Preferences | My Website home page
This page is read-only | View other revisions | View current revision
Edited July 28, 2013 9:29 am by dougrice.plus.com
Search: