26 |
Notices
27 |
28 | The updated version of the 6809 emulator is hosted at
29 | http://6809.ukdragons.org.uk while the original author is un-contactable. If you know the author please
30 | get in touch!
31 |
32 |
33 | The source code for the site is held at github.com,
34 | this also includes the site wiki and issue tracking. If you find any problems please visit the issues area
35 | and enter any information you can provide on the problem.
36 |
37 |
Updates
38 |
39 | Version 1.1.11
40 | Fixes:
41 |
42 |
43 | - Updates to remove potential code vulnerabilities
44 |
45 |
46 | Version 1.1.10
47 | Fixes:
48 |
49 |
50 | - Updates to remove potential code vulnerabilities
51 |
52 |
53 | Version 1.1.9
54 | Fixes:
55 |
56 |
57 | - Updates to remove potential code vulnerabilities
58 |
59 |
60 | Version 1.1.8
61 | Fixes:
62 |
63 |
64 | - Updates to remove potential code vulnerabilities
65 |
66 |
67 | Version 1.1.7
68 | Fixes:
69 |
70 |
71 | - Fix handling of hexadecimal literal data
72 |
73 |
74 | Version 1.1.6
75 | Fixes:
76 |
77 |
78 | - Correct regex declarations
79 |
80 |
81 | Version 1.1.5
82 | Fixes:
83 |
84 |
85 | - Update dependencies due to security vulnerabilities
86 |
87 |
88 | Version 1.1.4
89 | Fixes:
90 |
91 |
92 | - Code quality improvements to facilitate CI pipeline
93 |
94 |
95 | Version 1.1.3
96 | Fixes:
97 |
98 |
99 | - Let disassembler see the list of labels
100 |
101 |
102 | Version 1.1.2
103 | Fixes:
104 |
105 |
106 | - Remedy incorrect constant index offset calculation
107 |
108 |
109 | Version 1.1.1
110 | Fixes:
111 |
112 |
113 | - Stabilise behaviour in Firefox browser
114 |
115 |
116 | Version 1.1.0
117 | Fixes:
118 |
119 |
120 | - String literals can be enclosed in single or double quotes
121 | - Post increment directives in indexed addressing now works in more operations
122 | - 6809 Assembler is now a separate object, decoupled from the emulator
123 | - Assembler now pushes status updates as events instead of writing to the host page
124 |
125 |
126 | Version 1.0.2
127 | Fixes:
128 |
129 |
130 | - Build task correctly injects all the scripts into the host html page
131 |
132 |
133 | Version 1.0.1
134 | Fixes:
135 |
136 |
137 | - The compiler now makes 3 passes instead of 2 in order to stabilise labels
138 |
139 |
Known Problems
140 |
141 | - Assembler is over-enthusiastic when decoding mnemonics and likes to include labels and data
142 | - Assembler does not know how to handle hints to force 8 bit or 16 bit offsets in indexed addressing
143 |
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/help.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
32 |
Introduction
33 |
34 | This is an online emulator designed to make it as easy as possible to get started programming the Motorola 6809 CPU in assembly language.
35 | There's the obligatory Hello World program ready for you to assemble (click the big green button marked Assemble...)
36 | and run (click the big green button marked Run (it's beneath all the dials and knobs to the left)).
37 | If all goes well you will see a greeting appear on the emulated text screen (the horrid-looking box below with all the green @ symbols).
38 |
39 |
40 | If you're familiar with the 6809 hopefully the rest is pretty self-explanatory.
41 | There are a few short programs included to help you along (move your pointer to Examples).
42 |
43 |
44 | If you know some other machine language than the 6809, then it should be easy to pick up using the documentation here.
45 | A reference book wouldn't go amiss though.
46 |
47 |
48 | Even if you know nothing of machine language, try having a go anyway.
49 | A grounding in some other programming language will certainly help. Along with one or more reference books or instructional videos.
50 | But seriously, the best introduction to assembly language I've seen on Youtube is
51 | Computerphile:- Game Physics (in Assembler), which uses the 68000 CPU.
52 |
53 |
54 |
The 6809
55 |
Motorola launched its advanced 8-bit 6809 in 1977.
56 | It was a successor to the 6800 popular in embedded systems, and was mostly source-code compatible with it while offering many extra features.
57 | Due mainly to its late arrival it was never as popular as the 6502 and Z80 micros, but it could be found in the Dragon and Tandy Coco home Computers,
58 | as well as in less visible platforms such as the Vectrex console and several arcade cabinets including Defender.
59 |
60 |
61 | The 6809 has two 8-bit accumulators (A & B), two 16-bit index registers (X & Y), and two 16-bit stack pointers (U & S) which can double as index registers.
62 | All the 8 and 16-bit user registers offer Load, Store, and Compare (fully signed) instructions across the four main addressing modes (Immediate, Direct Paged, Direct Extended, and Indexed).
63 |
64 |
65 | The 8-bit accumulators have the usual set of one and two operand arithmetic and logical instructions.
66 | They can be combined into the 16-bit D register which has basic instructions for Addition and Subtraction, and also is the destination for the unsigned Multiply of A & B.
67 |
68 |
69 | There are 16 different conditional branches which can all have either 8 or 16 bit offsets, reaching any point in memory.
70 | Subroutines can be Branched to as well as Jumped to.
71 | The indexed addressing mode includes a mode with an offset from the Program Counter (8 or 16-bit), thus there is no barrier to writing fully position independent code.
72 |
73 |
System registers are the Condition Codes (CC), Program Counter (PC) and the Direct Page register (DP).
74 | The DP provides the high 8 bits for an address specified in a single byte in Direct Paged addressing mode.
75 | The CC can have any or all bits set or reset at once with the ORCC and ANDCC immediate mode instructions.
76 | Otherwise no instructions are provided for manipulating the system registers directly.
77 | The Transfer and Exchange instructions must be used instead, which work on any pair of registers the same size.
78 | The User (U) and System (S) stacks can have any combination of registers Pushed or Pulled in a single instruction.
79 | Subroutine return addresses and interrupts use the System stack only, the User stack has no system function.
80 |
81 |
82 | As well as the standard Interrupt (IRQ) and Non-maskable Interrupt (NMI) there is the Fast Interrupt (FIRQ) which gives faster response by only stacking the CC.
83 | There are three Software Interrupts with their own user-definable vectors.
84 |
85 |
86 | Indexed addressing is very flexible, working across all four index registers with options for constant offsets (5, 8, or 16-bit), accumulator offsets (A, B or D),
87 | and automatic post-increment and pre-decrement (by 1 or 2).
88 | All indexed modes can optionally be made Indirect, where the operand provides the address of the true operand.
89 | PC relative comes under the Indexed mode umbrella so is available with indirection, and there's also a plain address Indirect mode.
90 | The Load Effective Address is used for initialising pointers to memory objects, or for performing simple arithmetic on index registers.
91 | It calculates the address of the operand as normal, but instead of loading a value from the address loads the address itself.
92 |
93 |
94 |
95 | Altogether the 6809 is a flexible and powerful programming platform that is a pleasure to use.
96 | Its weaknesses are its relatively few registers, and low clock speed and good but sub-optimal efficiency.
97 |
98 |
99 |
Back to the emulator
100 |
101 |
102 |
--------------------------------------------------------------------------------
/src/application.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Custom slider for controlling CPU step interval.
3 | */
4 | class SlideControl {
5 | #cpu;
6 | #value;
7 | #speed;
8 | #readout;
9 | #slider;
10 |
11 | /**
12 | * Inject CPU and set default interval.
13 | *
14 | * @param {CPU} cpu bound CPU
15 | * @param {number} speed default step interval
16 | */
17 | constructor(cpu, speed) {
18 | this.#cpu = cpu;
19 | this.#speed = Math.trunc(speed);
20 | this.#slider = null;
21 | this.#readout = null;
22 | this.#value = 0;
23 | }
24 |
25 | /**
26 | * Bind control to given UI elements.
27 | *
28 | * @param {String} slideElement slide control element name
29 | * @param {String} textElement text readout element name
30 | */
31 | bindId(slideElement, textElement) {
32 | this.#readout = document.getElementById(textElement);
33 | this.#slider = document.getElementById(slideElement);
34 | this.#slider.addEventListener('click', this.update.bind(this), false);
35 | this.#slider.min = 1;
36 | this.#slider.max = 10;
37 | this.#speed = Math.max(this.#slider.min, this.#speed);
38 | this.#slider.value = Math.min(this.#speed, this.#slider.max);
39 | this.#cpu.intervalMils = this.#cpu.speedMils[this.#slider.value];
40 | this.#value = parseInt(this.#slider.value);
41 | this.#readout.innerHTML = this.#value;
42 | }
43 |
44 | /**
45 | * Update CPU with new interval step.
46 | *
47 | * @param {Object} event slide control change event
48 | */
49 | update(event) {
50 | this.#value = parseInt(event.srcElement.value);
51 | this.#readout.innerHTML = this.#value;
52 | this.#cpu.setSpeed(this.#value);
53 | }
54 | }
55 |
56 | /**
57 | * Event consumer for assembly status updates.
58 | *
59 | * @param {Object} event assembly status event
60 | */
61 | function statusEventHandler(event) {
62 | const statusBox = document.getElementById('assemblyStatus');
63 | if (statusBox != null) {
64 | statusBox.innerHTML = event.detail.message;
65 | }
66 | event.preventDefault();
67 | }
68 |
69 | /**
70 | * Disassemble visible code.
71 | *
72 | * @param {String} id target elementId name
73 | */
74 | function codeDump(id) { // eslint-disable-line no-unused-vars
75 | let block;
76 | let text = '';
77 | for (block in mc6809.codeBlocks) {
78 | if (Object.prototype.hasOwnProperty.call(mc6809.codeBlocks, block)) {
79 | text += mc6809.codeBlocks[block].writeCode() + '\n';
80 | }
81 | }
82 | const element = document.getElementById(id);
83 | if (element !== null) {
84 | element.value = text;
85 | }
86 | }
87 |
88 | /**
89 | * Start assembly process.
90 | *
91 | * @param {String} id elementId name of source container
92 | */
93 | function compileRun(id) { // eslint-disable-line no-unused-vars
94 | const element = document.getElementById(id);
95 | if (element) {
96 | mc6809.assemble(element.value.split('\n'));
97 | mc6809.refresh(1);
98 | }
99 | }
100 |
101 | /**
102 | * Refresh UI with machine state.
103 | */
104 | function machineRefresh() {
105 | const refresh= document.getElementById('refreshCheck');
106 | if (refresh) {
107 | if (refresh.checked) {
108 | mc6809.refresh(1);
109 | }
110 | mc6809.refreshOn = refresh.checked;
111 | }
112 | }
113 |
114 | /**
115 | * Add watchpoint frame.
116 | *
117 | * @param {String} where address reference (EA/X/APPEND)
118 | */
119 | function addWatchpoint(where) { // eslint-disable-line no-unused-vars
120 | switch (where.toUpperCase()) {
121 | case 'EA':
122 | mc6809.watchList.addWatch(mc6809.alu.eaLast);
123 | break;
124 | case 'X':
125 | mc6809.watchList.addWatch(mc6809.registers['regX'].regValue);
126 | break;
127 | case 'APPEND':
128 | mc6809.watchList.addWatch(mc6809.watchList.lastWatch + 0x10);
129 | break;
130 | }
131 | }
132 |
133 | /**
134 | * Force CPU reset.
135 | */
136 | function machineReset() { // eslint-disable-line no-unused-vars
137 | machineInterrupt('reset');
138 | }
139 |
140 | /**
141 | * Trigger named interrupt.
142 | *
143 | * @param {String} irqName interrupt name (NMI/IRQ/FIRQ)
144 | */
145 | function machineInterrupt(irqName) {
146 | bundle.trc('machineInterrupt', irqName);
147 | mc6809.alu.interrupt(irqName);
148 | mc6809.alu.checkInterrupts();
149 | mc6809.refresh(1);
150 | mc6809.execute();
151 | }
152 |
153 | /**
154 | * Stop CPU auto-cycle.
155 | */
156 | function machineHalt() { // eslint-disable-line no-unused-vars
157 | console.dir(document.getElementById('registers-container'));
158 | mc6809.stop();
159 | mc6809.refresh(1);
160 | }
161 |
162 | /**
163 | * Start CPU auto-cycle.
164 | */
165 | function machineRun() { // eslint-disable-line no-unused-vars
166 | machineRefresh();
167 | mc6809.execute();
168 | }
169 |
170 | /**
171 | * CPU cycle callback.
172 | */
173 | function machineCycle() { // eslint-disable-line no-unused-vars
174 | mc6809.cycle();
175 | }
176 |
177 | /**
178 | * Step CPU by 1 instruction.
179 | */
180 | function machineStep() { // eslint-disable-line no-unused-vars
181 | mc6809.stop();
182 | mc6809.cycle();
183 | if (!mc6809.refreshOn) {
184 | mc6809.refresh(1);
185 | }
186 | }
187 |
188 | /**
189 | * Trigger Interrupt (IRQ).
190 | */
191 | function doIRQ() { // eslint-disable-line no-unused-vars
192 | mc6809.alu.interrupt('irq');
193 | mc6809.alu.checkInterrupts();
194 | }
195 |
196 | /**
197 | * Trigger Fast Interrupt (FIRQ).
198 | */
199 | function doFIRQ() { // eslint-disable-line no-unused-vars
200 | mc6809.alu.interrupt('firq');
201 | mc6809.alu.checkInterrupts();
202 | }
203 |
204 | /**
205 | * Refresh UI with updated program counter.
206 | *
207 | * @param {number} PC program counter
208 | * @param {boolean} force force update
209 | */
210 | function machineOrg(PC, force) { // eslint-disable-line no-unused-vars
211 | mc6809.registers['regPC'].change(PC, 0);
212 | mc6809.dsmTable.lineOn(mc6809.registers['regPC'].regValue, force);
213 | }
214 |
215 | document.addEventListener('assemblerEvent', statusEventHandler);
216 | const mc6809 = new bundle.CPU();
217 | mc6809.ready();
218 | const speed = new SlideControl(mc6809, 5);
219 | speed.bindId('speed', 'speedVal');
220 | document.getElementById('assembly-code').value =
221 | document.getElementById('demo-helloworld').value;
222 | machineInterrupt('reset');
223 | mc6809.refresh(1);
224 | mc6809.execute();
225 |
--------------------------------------------------------------------------------
/src/interface.js:
--------------------------------------------------------------------------------
1 | import {blockChars, blockClasses, Defaults} from './constants';
2 | import {inHex, trc} from './helper';
3 |
4 | /**
5 | * Generate label list element for ui.
6 | *
7 | * @param {string} id target html element id
8 | * @param {Object} owner owner reference
9 | * @constructor
10 | */
11 | function LabelList(id, owner) {
12 | this.cpu = owner;
13 | this.list = null;
14 | this.createList = function(listId) {
15 | const container = document.getElementById(listId + '-container');
16 | trc('labelList id', listId);
17 | if (container !== null) {
18 | const labels = container.childNodes;
19 | if (labels.length === 0) {
20 | trc('LabelList container', '');
21 | this.list = document.createElement('select');
22 | this.list.setAttribute('size', '30');
23 | this.list.className = 'labelsContainer';
24 | container.appendChild(this.list);
25 | } else {
26 | this.list = labels[0];
27 | }
28 | }
29 | };
30 | this.fill = function(labels) {
31 | let label;
32 | let option;
33 | trc('Labels fill', 0);
34 | for (label in labels) {
35 | if (Object.prototype.hasOwnProperty.call(labels, label)) {
36 | option = document.createElement('option');
37 | option.text = label;
38 | option.value = 1;
39 | trc('Label: ', label);
40 | option.className = 'labelList';
41 | (function(cpuOwner, optLabel) {
42 | option.onclick = function(event) {
43 | trc('reloadtable call label \'' + optLabel + '\' value',
44 | labels[optLabel]);
45 | cpuOwner.dsmTable.reloadTable(labels[optLabel]);
46 | cpuOwner.dsmTable.lineOn(cpuOwner.registers['regPC'].regValue, true,
47 | true);
48 | };
49 | }(this.cpu, label));
50 | this.list.add(option);
51 | }
52 | }
53 | };
54 | this.empty = function() {
55 | while (this.list.length > 0) {
56 | this.list.remove(this.list.length - 1);
57 | }
58 | };
59 | this.createList(id);
60 | }
61 |
62 | /**
63 | * Generate DSM window element for UI.
64 | *
65 | * @param {string} id target html element id
66 | * @param {CPU} cpu cpu reference
67 | * @param {number} rows number of rows to create
68 | * @constructor
69 | */
70 | function DSMWindow(id, cpu, rows) {
71 | this.lineMap = [];
72 | this.lineHi = null;
73 | this.table = null;
74 | this.cpuOwner = cpu;
75 | this.rowCount = rows;
76 | this.editContents = null;
77 | this.baseAddress = 0;
78 | this.codeLength = 0;
79 | this.watch = null;
80 |
81 | this.createTable = function(tableId) {
82 | let newRow;
83 | let rowNo;
84 |
85 | /**
86 | * Extend current watch with new cell.
87 | *
88 | * @param {HTMLTableRowElement} thisRow
89 | * @param {string} cellClass
90 | * @param {string} content
91 | */
92 | function newCell(thisRow, cellClass, content) {
93 | const cell = thisRow.insertCell();
94 | cell.className = cellClass;
95 | cell.innerHTML = content;
96 | }
97 |
98 | trc('createTable tableId', tableId);
99 | const container = document.getElementById(tableId + '-container');
100 | if (container !== null) {
101 | trc('Found container, rows', this.rowCount);
102 | this.table = document.createElement('table');
103 | this.table.setAttribute('id', 'tableId');
104 | this.table.style.backgroundColor = 'black';
105 | this.table.className = 'DSM';
106 | for (rowNo = 1; rowNo <= this.rowCount; rowNo++) {
107 | trc('newRow', rowNo);
108 | newRow = this.table.insertRow();
109 | newCell(newRow, 'DSM ADDR', 'addr ');
110 | newCell(newRow, 'DSM BYTES', 'bytes ');
111 | newCell(newRow, 'DSM MNEM', 'mnem ');
112 | }
113 | container.appendChild(this.table);
114 | }
115 | };
116 | this.setRow = function(rowNo, code, cpu) {
117 | let row;
118 | let address;
119 | let bytes;
120 | let mnemonic;
121 |
122 | /**
123 | * Safe jump CPU to current address in code.
124 | *
125 | * @param {Event} event
126 | * @return {boolean}
127 | */
128 | function jump(event) {
129 | event.preventDefault();
130 | if (!cpu.cellEditing) {
131 | cpu.closeEdit(false);
132 | cpu.jumpTo(cpu, code.address);
133 | }
134 | return false;
135 | }
136 |
137 | if (this.table && (rowNo < this.table.rows.length)) {
138 | row = this.table.rows[rowNo];
139 | bytes = '';
140 | if (code) {
141 | this.lineMap[code.address] = row;
142 | address = inHex(code.address, 4) + ':';
143 | for (let i = 0; i < code.maxInstructionLength; i++) {
144 | if (i < code.bytes.length) {
145 | bytes += inHex(code.bytes[i], 2) + ' ';
146 | this.codeLength++;
147 | } else {
148 | bytes += ' ';
149 | }
150 | }
151 | mnemonic = code.operation + ' ' + code.operand;
152 | } else {
153 | address = '';
154 | mnemonic = ' ';
155 | }
156 | row.cells[0].innerHTML = address;
157 | row.cells[0].oncontextmenu = function(event) {
158 | cpu.setBreakpoint(cpu, event, code.address);
159 | return false;
160 | };
161 | row.cells[0].onclick = jump;
162 | row.cells[0].style.backgroundColor = (code.address in cpu.breakpoints) ?
163 | 'red' :
164 | '';
165 | row.cells[1].innerHTML = bytes;
166 | row.cells[1].onclick = jump;
167 | row.cells[2].innerHTML = mnemonic;
168 | row.cells[2].onclick = jump;
169 | row.cells[2].oncontextmenu = function(event) {
170 | if (cpu.cellEditing) {
171 | cpu.cellEditing.input.focus();
172 | return false;
173 | }
174 | cpu.editCode(cpu, event, code.address);
175 | event.preventDefault();
176 | return false;
177 | };
178 | }
179 | };
180 | this.reloadTable = function(address) {
181 | if (this.watch != null) {
182 | this.cpuOwner.ram.removeWindow(0, 0, this.watch);
183 | this.watch = null;
184 | }
185 | this.setTable(this.cpuOwner.disassemble(address, 0x10000,
186 | this.cpuOwner.dsmTableSize));
187 | };
188 | this.lineOff = function() {
189 | if (this.lineHi) {
190 | this.lineHi.className = 'DSMlo';
191 | this.lineHi = null;
192 | }
193 | };
194 | this.lineOn = function(address, force, notRequired) {
195 | if (!(this.cpuOwner.refreshOn || force)) {
196 | return;
197 | }
198 | trc('lineOn address', inHex(address, 4));
199 | this.lineOff();
200 | if (!(address in this.lineMap)) {
201 | if (notRequired) {
202 | return;
203 | } else {
204 | this.reloadTable(address);
205 | }
206 | }
207 | this.lineHi = this.lineMap[address];
208 | this.lineHi.className = 'DSMhi';
209 | };
210 | this.setTable = function(lines) {
211 | let i;
212 | trc('setTable for code lines count', lines.length);
213 | this.lineMap = [];
214 | this.baseAddress = lines[0].address;
215 | this.codeLength = 0;
216 | if (this.table) {
217 | trc('this.table rows length', this.table.rows.length);
218 | for (i = 0; i < this.table.rows.length; i++) {
219 | // trc ("this.table row", i);
220 | this.setRow(i, (i < lines.length) ? lines[i] : null, this.cpuOwner);
221 | }
222 | this.watch = this.cpuOwner.ram.addWindow(this, this.baseAddress,
223 | this.codeLength);
224 | trc('Add DASM watch length', this.codeLength);
225 | }
226 | };
227 | this.doTrace = function() {
228 | trc('DSMWindow doTrace', 0);
229 | };
230 | this.update = function(holder, address, value) {
231 | trc('DASM window update address', inHex(address, 4));
232 | holder.doTrace();
233 | trc('Assembling', holder.cpuOwner.assembling);
234 | if ((holder.cpuOwner.cellEditing == null) &&
235 | (holder.cpuOwner.assembling == false)) {
236 | holder.reloadTable(holder.baseAddress);
237 | }
238 | };
239 | this.createTable(id);
240 | }
241 |
242 | /**
243 | * Define graphics screen element for UI.
244 | *
245 | * @param {Memory8} videoRAM ram reference
246 | * @param {number} videoBase base address
247 | * @param {number} width pixel width
248 | * @param {number} height pixel height
249 | * @param {number} colours palette size
250 | * @param {number} zoom scale
251 | * @constructor
252 | */
253 | function GraphicsScreen(videoRAM, videoBase, width, height, colours, zoom) {
254 | this.ram = videoRAM;
255 | this.base = videoBase;
256 | this.wide = width;
257 | this.high = height;
258 | this.scale = zoom;
259 | this.bitsPerPixel = 1;
260 | this.sourceBitmap = null;
261 | this.canvas = null;
262 | this.colourMap = [
263 | '#000000',
264 | '#a00000',
265 | '#00a000',
266 | '#a0a000',
267 | '#0000a0',
268 | '#a000a0',
269 | '#00a0a0',
270 | '#808080',
271 | '#404040',
272 | '#ff0000',
273 | '#00ff00',
274 | '#ffff00',
275 | '#0000ff',
276 | '#ff00ff',
277 | '#00ffff',
278 | '#ffffff'];
279 | this.palettes = [
280 | [],
281 | [0, 2],
282 | [0, 9, 2, 12],
283 | [],
284 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
285 | ];
286 | this.setMode = function(colours) {
287 | switch (colours) {
288 | case 2:
289 | this.bitsPerPixel = 1;
290 | break;
291 | case 4:
292 | this.bitsPerPixel = 2;
293 | break;
294 | case 16:
295 | this.bitsPerPixel = 4;
296 | break;
297 | default:
298 | this.bitsPerPixel = 1;
299 | break;
300 | }
301 | };
302 | this.clearScreen = function() {
303 | const ctx = this.canvas.getContext('2d');
304 | ctx.fillStyle = this.colourMap[0];
305 | ctx.fillRect(0, 0, this.wide * this.scale, this.high * this.scale);
306 | };
307 | this.clearVideoRAM = function(colourByte) {
308 | let x;
309 | for (x = this.base; x < this.base + this.high * Defaults.lineBytes; x++) {
310 | this.ram.poke(x, colourByte);
311 | }
312 | };
313 | this.update = function(holder, address, value) {
314 | let pixel;
315 | let dx;
316 | let dy;
317 | let byte = value;
318 | switch (this.bitsPerPixel) {
319 | case 1:
320 | dx = 1;
321 | dy = 1;
322 | break;
323 | case 2:
324 | dx = 2;
325 | dy = 1;
326 | break;
327 | case 4:
328 | dx = 2;
329 | dy = 2;
330 | break;
331 | }
332 | let xPos = ((address - this.base) & ((Defaults.lineBytes * dy) - 1)) *
333 | (8 / dy);
334 | const yPos = Math.trunc((address - this.base) /
335 | (Defaults.lineBytes * dy)) * dy;
336 | const ctx = this.canvas.getContext('2d');
337 | for (let i = 0; i < 8; i += this.bitsPerPixel) {
338 | byte <<= this.bitsPerPixel;
339 | pixel = byte >>> 8;
340 | byte &= 0xff;
341 | ctx.fillStyle = this.colourMap[this.palettes[this.bitsPerPixel][pixel]];
342 | ctx.fillRect(
343 | xPos * this.scale,
344 | yPos * this.scale,
345 | this.scale * dx,
346 | this.scale * dy,
347 | );
348 | xPos += dx;
349 | }
350 | };
351 | this.canvas = document.getElementById('graphicsScreen');
352 | if (this.canvas !== null) {
353 | this.setMode(colours);
354 | this.clearScreen();
355 | this.ram.addWindow(this, this.base, (this.wide * this.high) / 8);
356 | }
357 | }
358 |
359 | /**
360 | * Define text screen element for UI.
361 | *
362 | * @param {Memory8} videoRAM memory reference
363 | * @param {number} videoBase base address in memory
364 | * @param {number} width character width
365 | * @param {number} height character height
366 | * @constructor
367 | */
368 | function TextScreen(videoRAM, videoBase, width, height) {
369 | this.ram = videoRAM;
370 | this.base = videoBase;
371 | this.wide = width;
372 | this.high = height;
373 | this.charSet = '@ABCDEFGHIJKLMNO' +
374 | 'PQRSTUVWXYZ[\\]\u2191\u2190' +
375 | ' !"#$%&\'()*+,-./' +
376 | '0123456789:;<=>?';
377 | this.update = function(holder, address, value) {
378 | let cell;
379 | const element = document.getElementById('txtScreenTable');
380 | if (element) {
381 | trc('Update element found', '');
382 | // console.dir (holder);
383 | cell = element.rows[Math.floor((address - holder.base) / width)].cells[
384 | (address - holder.base) % width];
385 | if (cell) {
386 | if (value >= 0x80) {
387 | cell.innerHTML = blockChars[value & 0x0f];
388 | cell.className = blockClasses[(value & 0x70) >> 4];
389 | } else {
390 | if ((value & 0x3f) === 0x20) {
391 | cell.innerHTML = ' ';
392 | } else {
393 | cell.innerHTML = holder.charSet[value & 0x3f];
394 | }
395 | switch (value & 0x40) {
396 | case 0:
397 | cell.className = 'txtBG';
398 | break;
399 | case 0x40:
400 | cell.className = 'txtFG';
401 | break;
402 | }
403 | }
404 | }
405 | }
406 | };
407 | this.createScreenTable = function(tableId, width, height) {
408 | let rows;
409 | let cells;
410 | let newRow;
411 | let newCell;
412 | let container;
413 | let table;
414 | table = null;
415 | if (
416 | (container = document.getElementById(tableId + '-container')) !== null
417 | ) {
418 | table = document.createElement('table');
419 | table.setAttribute('id', tableId);
420 | table.setAttribute('tabindex', 0);
421 | table.className = 'txtScreen';
422 | for (rows = 0; rows < height; rows++) {
423 | newRow = document.createElement('tr');
424 | for (cells = 0; cells < width; cells++) {
425 | newCell = document.createElement('td');
426 | newCell.className = 'txtBG';
427 | newCell.innerText = '@';
428 | newRow.appendChild(newCell);
429 | }
430 | table.appendChild(newRow);
431 | table.addEventListener('keypress', keyPressHandler);
432 | }
433 | container.appendChild(table);
434 | }
435 | return table;
436 | };
437 | this.ram.addWindow(this, this.base, this.wide * this.high);
438 | this.table = this.createScreenTable('txtScreenTable', 32, 16);
439 | }
440 |
441 | /**
442 | * Capture keypress events and push to key buffer.
443 | *
444 | * @param {KeyboardEvent} event
445 | */
446 | function keyPressHandler(event) {
447 | mc6809.keyBuffer.push(event.key);
448 | event.preventDefault();
449 | }
450 |
451 | export {LabelList, DSMWindow, GraphicsScreen, TextScreen, keyPressHandler};
452 |
--------------------------------------------------------------------------------
/test/cputest.asm:
--------------------------------------------------------------------------------
1 | WARMS EQU $CD03
2 | PCRLF EQU $CD24
3 | PUTCHR EQU $CD18
4 | PSTRNG EQU $CD1E
5 | OUTDEC EQU $CD39
6 | EXTREG EQU $8000
7 | DIRPAG EQU $80
8 | DPREG EQU $00
9 | EOT EQU $4
10 |
11 | ORG $8100
12 |
13 | BEGIN BRA START
14 | VERSIO FCB 1
15 | REG161 FDB 0
16 |
17 | START CLR ERRFLG ; Clear Error flag
18 | JSR TDAA
19 | *
20 | * Test Addressing modes
21 | JSR TAD1
22 | JSR TAD2
23 | JSR TAD3
24 | JSR TAD4
25 | JSR TAD5
26 | JSR TAD6
27 | JSR TAD7
28 | JSR TAD8
29 | JSR TAD9
30 | JSR TADA
31 | JSR TADB
32 | JSR TADI1
33 | JSR TADI3
34 | JSR TADI5
35 | JSR TADI6
36 | JSR TADI7
37 | JSR TADI8
38 | JSR TADI9
39 | JSR TADIA
40 | JSR TADIB
41 | JSR TADIC
42 | * Test Instructions
43 | JSR TNEG
44 | JSR TCOM
45 | JSR TDEC
46 | JSR TINC
47 | JSR TCLR
48 | JSR TADD
49 | JSR TADDD
50 | JSR TADC
51 | JSR TMUL
52 | JSR TSEX
53 | JSR TSUB
54 | JSR TSUBD
55 | JSR TSBC
56 | JSR TDAA
57 | JSR TCMP
58 | JSR TCMPD
59 | JSR TTST
60 | JSR TBIT
61 | JSR TLSR
62 | JSR TLSL
63 | JSR TASR
64 | JSR TROL
65 | JSR TROR
66 | JSR TLD
67 | JSR TST
68 | JSR TLDD
69 | JSR TSTD
70 | JSR TLEA
71 | JSR TTFR
72 | JSR TEXG
73 | *
74 | JSR OUTSUC
75 | JMP WARMS
76 |
77 | **************************************************
78 | * Test MUL
79 | **************************************************
80 | TMUL LDU #LMUL
81 | LDX #TBMUL
82 | TMUL1 LDD ,X++
83 | MUL
84 | TFR CC,DP
85 | CMPD ,X++
86 | LBNE OUTERR
87 | TFR DP,B
88 | ANDB #$05 ; Only check Bits ZC
89 | CMPB ,X+
90 | LBNE OUTERR
91 | CMPX #LMUL
92 | LBNE TMUL1
93 | RTS
94 |
95 | TBMUL FDB $0000,$0000
96 | FCB $04
97 | FDB $8080,$4000
98 | FCB $00
99 | FDB $01FF,$00FF
100 | FCB $01
101 | FDB $FF01,$00FF
102 | FCB $01
103 | FDB $7F81,$3FFF
104 | FCB $01
105 | FDB $817F,$3FFF
106 | FCB $01
107 | FDB $C040,$3000
108 | FCB $00
109 | FDB $40C0,$3000
110 | FCB $00
111 | FDB $FFFF,$FE01
112 | FCB $00
113 | FDB $7F7F,$3F01
114 | FCB $00
115 | FDB $0101,$0001
116 | FCB $00
117 | LMUL FCC 'MUL',EOT
118 |
119 | **************************************************
120 | * Test SEX
121 | **************************************************
122 | TSEX LDU #LSEX
123 | LDX #TBSEX
124 | TSEX1 LDB ,X+
125 | SEX
126 | TFR CC,DP
127 | CMPD ,X++
128 | LBNE OUTERR
129 | TFR DP,B
130 | ANDB #$0C ; Only check Bits NZ
131 | CMPB ,X+
132 | LBNE OUTERR
133 | CMPX #LSEX
134 | LBNE TSEX1
135 | RTS
136 |
137 |
138 | TBSEX FCB $00
139 | FDB $0000
140 | FCB $04
141 | FCB $01
142 | FDB $0001
143 | FCB $00
144 | FCB $7F
145 | FDB $007F
146 | FCB $00
147 | FCB $80
148 | FDB $FF80
149 | FCB $08
150 | FCB $FF
151 | FDB $FFFF
152 | FCB $08
153 | LSEX FCC 'SEX',EOT
154 |
155 | **************************************************
156 | * Test TST
157 | **************************************************
158 | TTST LDU #LTST
159 | LDX #TBTST
160 | TTST1 LDA ,X+
161 | TSTA
162 | TFR CC,B
163 | ANDB #$0E ; Only check Bits NZV
164 | CMPB ,X+
165 | LBNE OUTERR
166 | CMPX #LTST
167 | LBNE TTST1
168 | RTS
169 |
170 | TBTST FCB $00,$04
171 | FCB $80,$08
172 | FCB $01,$00
173 | FCB $FF,$08
174 | FCB $7F,$00
175 | FCB $81,$08
176 | FCB $C0,$08
177 | FCB $40,$00
178 | LTST FCC 'TST',EOT
179 |
180 | **************************************************
181 | * Test LD
182 | **************************************************
183 | TLD LDU #LLD
184 | LDX #TBTST
185 | TLD1 LDA ,X+
186 | TFR CC,B
187 | ANDB #$0E ; Only check Bits NZV
188 | CMPB ,X+
189 | LBNE OUTERR
190 | CMPX #LTST
191 | LBNE TLD1
192 | RTS
193 | LLD FCC 'LD',EOT
194 |
195 | **************************************************
196 | * Test ST
197 | **************************************************
198 | TST: LDU #LST
199 | LDX #TBTST
200 | TST1 LDA ,X+
201 | STA EXTREG
202 | TFR CC,B
203 | ANDB #$0E ; Only check Bits NZV
204 | CMPB ,X+
205 | LBNE OUTERR
206 | CMPX #LTST
207 | LBNE TST1
208 | RTS
209 | LST FCC 'ST',EOT
210 |
211 | **************************************************
212 | * Test LDD
213 | **************************************************
214 | TLDD LDU #LLDD
215 | LDX #TBLDD
216 | TLDD1 LDD ,X++
217 | TFR CC,B
218 | ANDB #$0E ; Only check Bits NZV
219 | CMPB ,X+
220 | LBNE OUTERR
221 | CMPX #LLDD
222 | LBNE TLDD1
223 | RTS
224 | TBLDD FDB $0000
225 | FCB $04
226 | FDB $8000
227 | FCB $08
228 | FDB $0001
229 | FCB $00
230 | FDB $FFFF
231 | FCB $08
232 | FDB $7FFF
233 | FCB $00
234 | FDB $8001
235 | FCB $08
236 | FDB $C000
237 | FCB $08
238 | FDB $4000
239 | FCB $00
240 | LLDD FCC 'LDD',EOT
241 |
242 | **************************************************
243 | * Test STD
244 | **************************************************
245 | TSTD LDU #LSTD
246 | LDX #TBLDD
247 | TSTD1 LDD ,X++
248 | STD EXTREG
249 | TFR CC,B
250 | ANDB #$0E ; Only check Bits NZV
251 | CMPB ,X+
252 | LBNE OUTERR
253 | CMPX #LLDD
254 | LBNE TSTD1
255 | RTS
256 | LSTD FCC 'STD',EOT
257 |
258 | **************************************************
259 | * Test LEA
260 | **************************************************
261 | TLEA LDU #LLEA
262 | LDX #TBLEA
263 | TLEA1 LDY ,X++
264 | LEAY ,Y
265 | TFR CC,B
266 | ANDB #$04 ; Only check Bit Z
267 | CMPB ,X+
268 | LBNE OUTERR
269 | CMPX #LLEA
270 | LBNE TLEA1
271 | RTS
272 |
273 | TBLEA FDB $0000
274 | FCB $04
275 | FDB $0001
276 | FCB $00
277 | FDB $FFFF
278 | FCB $00
279 | FDB $7FFF
280 | FCB $00
281 | FDB $8000
282 | FCB $00
283 | FDB $8001
284 | FCB $00
285 | LLEA FCC 'LEA',EOT
286 |
287 | **************************************************
288 | * Test BIT
289 | **************************************************
290 | TBIT LDU #LBIT
291 | LDX #TBBIT
292 | TBIT1 LDA ,X+
293 | BITA ,X+
294 | TFR CC,B
295 | ANDB #$0E ; Only check Bits NZV
296 | CMPB ,X+
297 | LBNE OUTERR
298 | CMPX #LBIT
299 | LBNE TBIT1
300 | RTS
301 |
302 | TBBIT FCB $00,$00,$04
303 | FCB $AA,$55,$04
304 | FCB $AA,$AA,$08
305 | FCB $55,$55,$00
306 | FCB $FF,$FF,$08
307 | FCB $FF,$80,$08
308 | FCB $81,$80,$08
309 | FCB $FF,$7F,$00
310 | FCB $FF,$01,$00
311 | FCB $F0,$0F,$04
312 | LBIT FCC 'BIT',EOT
313 |
314 | **************************************************
315 | * Test DAA
316 | **************************************************
317 | TDAA LDU #LDAA
318 | LDX #TBDAA
319 | TDAA1 LDA ,X+
320 | TFR CC,B
321 | ANDB ,X+
322 | ORB ,X+
323 | TFR B,CC
324 | DAA
325 | TFR CC,B
326 | CMPA ,X+
327 | LBNE OUTERR
328 | ANDB #$0D ; Only check Bits NZC
329 | CMPB ,X+
330 | LBNE OUTERR
331 | CMPX #LDAA
332 | LBNE TDAA1
333 | RTS
334 |
335 | TBDAA
336 | * Carry: 0, Halfcarry: 0
337 | FCB $00,$DE,$00,$00,$04
338 | FCB $01,$DE,$00,$01,$00
339 | FCB $09,$DE,$00,$09,$00
340 | FCB $0A,$DE,$00,$10,$00
341 | FCB $0F,$DE,$00,$15,$00
342 | FCB $10,$DE,$00,$10,$00
343 | FCB $4A,$DE,$00,$50,$00
344 | FCB $79,$DE,$00,$79,$00
345 | FCB $7A,$DE,$00,$80,$08
346 | FCB $7F,$DE,$00,$85,$08
347 | FCB $81,$DE,$00,$81,$08
348 | FCB $99,$DE,$00,$99,$08
349 | FCB $A0,$DE,$00,$00,$05
350 | FCB $BF,$DE,$00,$25,$01
351 | FCB $F0,$DE,$00,$50,$01
352 | FCB $FF,$DE,$00,$65,$01
353 | * Carry: 1, Halfcarry: 0
354 | FCB $00,$DF,$01,$60,$01
355 | FCB $01,$DF,$01,$61,$01
356 | FCB $09,$DF,$01,$69,$01
357 | FCB $0A,$DF,$01,$70,$01
358 | FCB $0F,$DF,$01,$75,$01
359 | FCB $10,$DF,$01,$70,$01
360 | FCB $4A,$DF,$01,$B0,$09
361 | FCB $79,$DF,$01,$D9,$09
362 | FCB $7A,$DF,$01,$E0,$09
363 | FCB $7F,$DF,$01,$e5,$09
364 | FCB $81,$DF,$01,$E1,$09
365 | FCB $99,$DF,$01,$F9,$09
366 | FCB $A0,$DF,$01,$00,$05
367 | FCB $BF,$DF,$01,$25,$01
368 | FCB $F0,$DF,$01,$50,$01
369 | FCB $FF,$DF,$01,$65,$01
370 | * Carry: 0, Halfcarry: 1
371 | FCB $00,$FE,$20,$06,$00
372 | FCB $01,$FE,$20,$07,$00
373 | FCB $09,$FE,$20,$0F,$00
374 | FCB $0A,$FE,$20,$10,$00
375 | FCB $0F,$FE,$20,$15,$00
376 | FCB $10,$FE,$20,$16,$00
377 | FCB $4A,$FE,$20,$50,$00
378 | FCB $79,$FE,$20,$7F,$00
379 | FCB $7A,$FE,$20,$80,$08
380 | FCB $7F,$FE,$20,$85,$08
381 | FCB $81,$FE,$20,$87,$08
382 | FCB $99,$FE,$20,$9F,$08
383 | FCB $A0,$FE,$20,$06,$01
384 | FCB $BF,$FE,$20,$25,$01
385 | FCB $F0,$FE,$20,$56,$01
386 | FCB $FF,$FE,$20,$65,$01
387 | * Carry: 1, Halfcarry: 1
388 | FCB $00,$FF,$21,$66,$01
389 | FCB $01,$FF,$21,$67,$01
390 | FCB $09,$FF,$21,$6F,$01
391 | FCB $0A,$FF,$21,$70,$01
392 | FCB $0F,$FF,$21,$75,$01
393 | FCB $10,$FF,$21,$76,$01
394 | FCB $4A,$FF,$21,$B0,$09
395 | FCB $79,$FF,$21,$DF,$09
396 | FCB $7A,$FF,$21,$E0,$09
397 | FCB $7F,$FF,$21,$E5,$09
398 | FCB $81,$FF,$21,$E7,$09
399 | FCB $99,$FF,$21,$FF,$09
400 | FCB $A0,$FF,$21,$06,$01
401 | FCB $BF,$FF,$21,$25,$01
402 | FCB $F0,$FF,$21,$56,$01
403 | FCB $FF,$FF,$21,$65,$01
404 | LDAA FCC 'DAA',EOT
405 |
406 | **************************************************
407 | * Test NEG
408 | **************************************************
409 | TNEG LDU #LNEG
410 | LDX #TBNEG
411 | TNEG1 LDA ,X+
412 | NEGA
413 | TFR CC,B
414 | CMPA ,X+
415 | LBNE OUTERR
416 | ANDB #$0F ; Only check Bits NZVC
417 | CMPB ,X+
418 | LBNE OUTERR
419 | CMPX #LNEG
420 | LBNE TNEG1
421 | RTS
422 |
423 | TBNEG FCB $00,$00,$04
424 | FCB $80,$80,$0B
425 | FCB $01,$FF,$09
426 | FCB $FF,$01,$01
427 | FCB $7F,$81,$09
428 | FCB $81,$7F,$01
429 | FCB $C0,$40,$01
430 | FCB $40,$C0,$09
431 | LNEG FCC 'NEG',EOT
432 |
433 | **************************************************
434 | * Test COM
435 | **************************************************
436 | TCOM LDU #LCOM
437 | LDX #TBCOM
438 | TCOM1 LDA ,X+
439 | COMA
440 | TFR CC,B
441 | CMPA ,X+
442 | LBNE OUTERR
443 | ANDB #$0F ; Only check Bits NZVC
444 | CMPB ,X+
445 | LBNE OUTERR
446 | CMPX #LCOM
447 | BNE TCOM1
448 | RTS
449 |
450 |
451 | TBCOM FCB $00,$FF,$09
452 | FCB $FF,$00,$05
453 | FCB $F0,$0F,$01
454 | FCB $0F,$F0,$09
455 | FCB $55,$AA,$09
456 | FCB $AA,$55,$01
457 | FCB $01,$FE,$09
458 | FCB $FE,$01,$01
459 | FCB $80,$7F,$01
460 | FCB $7F,$80,$09
461 | LCOM FCC 'COM',EOT
462 |
463 | **************************************************
464 | * Test LSR
465 | **************************************************
466 | TLSR LDU #LLSR
467 | LDX #TBLSR
468 | TLSR1 LDA ,X+
469 | LSRA
470 | TFR CC,B
471 | CMPA ,X+
472 | LBNE OUTERR
473 | ANDB #$0F ; Only check Bits NZVC
474 | CMPB ,X+
475 | LBNE OUTERR
476 | CMPX #LLSR
477 | BNE TLSR1
478 | RTS
479 |
480 |
481 | TBLSR FCB $00,$00,$04
482 | FCB $FF,$7F,$01
483 | FCB $7F,$3F,$01
484 | FCB $3F,$1F,$01
485 | FCB $1F,$0F,$01
486 | FCB $0F,$07,$01
487 | FCB $07,$03,$01
488 | FCB $03,$01,$01
489 | FCB $01,$00,$05
490 | FCB $55,$2A,$01
491 | FCB $AA,$55,$00
492 | FCB $80,$40,$00
493 | FCB $10,$08,$00
494 | FCB $C0,$60,$00
495 | FCB $E0,$70,$00
496 | FCB $F0,$78,$00
497 | FCB $F8,$7C,$00
498 | FCB $FC,$7E,$00
499 | FCB $FE,$7F,$00
500 | LLSR FCC 'LSR',EOT
501 |
502 | **************************************************
503 | * Test LSL
504 | **************************************************
505 | TLSL LDU #LLSL
506 | LDX #TBLSL
507 | TLSL1 LDA ,X+
508 | LSLA
509 | TFR CC,B
510 | CMPA ,X+
511 | LBNE OUTERR
512 | ANDB #$0F ; Only check Bits NZVC
513 | CMPB ,X+
514 | * LBNE OUTERR
515 | CMPX #LLSL
516 | BNE TLSL1
517 | RTS
518 |
519 |
520 | TBLSL FCB $00,$00,$04
521 | FCB $FF,$FE,$01
522 | FCB $7F,$FE,$01
523 | FCB $3F,$7E,$01
524 | FCB $1F,$3E,$00
525 | FCB $0F,$1E,$00
526 | FCB $07,$0E,$00
527 | FCB $03,$06,$00
528 | FCB $01,$02,$00
529 | FCB $55,$AA,$00
530 | FCB $AA,$54,$00
531 | FCB $80,$00,$01
532 | FCB $10,$20,$01
533 | FCB $C0,$80,$01
534 | FCB $E0,$C0,$01
535 | FCB $F0,$E0,$01
536 | FCB $F8,$F0,$01
537 | FCB $FC,$F8,$01
538 | FCB $FE,$FC,$01
539 | LLSL FCC 'LSL',EOT
540 |
541 | **************************************************
542 | * Test ASR
543 | **************************************************
544 | TASR LDU #LASR
545 | LDX #TBASR
546 | TASR1 LDA ,X+
547 | ASRA
548 | TFR CC,B
549 | CMPA ,X+
550 | LBNE OUTERR
551 | ANDB #$0D ; Only check Bits NZC
552 | CMPB ,X+
553 | LBNE OUTERR
554 | CMPX #LASR
555 | BNE TASR1
556 | RTS
557 |
558 |
559 | TBASR FCB $00,$00,$04
560 | FCB $FF,$FF,$09
561 | FCB $7F,$3F,$01
562 | FCB $3F,$1F,$01
563 | FCB $1F,$0F,$01
564 | FCB $0F,$07,$01
565 | FCB $07,$03,$01
566 | FCB $03,$01,$01
567 | FCB $01,$00,$05
568 | FCB $55,$2A,$01
569 | FCB $AA,$D5,$08
570 | FCB $80,$C0,$08
571 | FCB $10,$08,$00
572 | FCB $C0,$E0,$08
573 | FCB $E0,$F0,$08
574 | FCB $F0,$F8,$08
575 | FCB $F8,$FC,$08
576 | FCB $FC,$FE,$08
577 | FCB $FE,$FF,$08
578 | LASR FCC 'ASR',EOT
579 |
580 | **************************************************
581 | * Test ROR
582 | **************************************************
583 | TROR LDU #LROR
584 | LDX #TBROR
585 | TROR1 LDA ,X+
586 | TFR CC,B
587 | ANDB ,X+
588 | ORB ,X+
589 | TFR B,CC
590 | RORA
591 | TFR CC,B
592 | CMPA ,X+
593 | LBNE OUTERR
594 | ANDB #$0D ; Only check Bits NZC
595 | CMPB ,X+
596 | LBNE OUTERR
597 | CMPX #LROR
598 | BNE TROR1
599 | RTS
600 |
601 | TBROR FCB $00,$FE,$00,$00,$04
602 | FCB $01,$FE,$00,$00,$05
603 | FCB $0F,$FE,$00,$07,$01
604 | FCB $10,$FE,$00,$08,$00
605 | FCB $7F,$FE,$00,$3F,$01
606 | FCB $80,$FE,$00,$40,$00
607 | FCB $FE,$FE,$00,$7F,$00
608 | FCB $FF,$FE,$00,$7F,$01
609 | FCB $00,$FF,$01,$80,$08
610 | FCB $01,$FF,$01,$80,$09
611 | FCB $0F,$FF,$01,$87,$09
612 | FCB $10,$FF,$01,$88,$08
613 | FCB $7F,$FF,$01,$BF,$09
614 | FCB $80,$FF,$01,$C0,$08
615 | FCB $FE,$FF,$01,$FF,$08
616 | FCB $FF,$FF,$01,$FF,$09
617 | LROR FCC 'ROR',EOT
618 |
619 | **************************************************
620 | * Test ROL
621 | **************************************************
622 | TROL LDU #LROL
623 | LDX #TBROL
624 | TROL1 LDA ,X+
625 | TFR CC,B
626 | ANDB ,X+
627 | ORB ,X+
628 | TFR B,CC
629 | ROLA
630 | TFR CC,B
631 | CMPA ,X+
632 | LBNE OUTERR
633 | ANDB #$0D ; Only check Bits NZC
634 | CMPB ,X+
635 | * LBNE OUTERR
636 | CMPX #LROL
637 | BNE TROL1
638 | RTS
639 |
640 | TBROL FCB $00,$FE,$00,$00,$04
641 | FCB $01,$FE,$00,$02,$00
642 | FCB $0F,$FE,$00,$1E,$00
643 | FCB $08,$FE,$00,$10,$00
644 | FCB $7F,$FE,$00,$FE,$08
645 | FCB $80,$FE,$00,$00,$05
646 | FCB $FE,$FE,$00,$FC,$09
647 | FCB $FF,$FE,$00,$FE,$09
648 | FCB $00,$FF,$01,$01,$00
649 | FCB $01,$FF,$01,$03,$00
650 | FCB $0F,$FF,$01,$1F,$00
651 | FCB $08,$FF,$01,$11,$00
652 | FCB $7F,$FF,$01,$FF,$08
653 | FCB $80,$FF,$01,$01,$01
654 | FCB $FE,$FF,$01,$FD,$09
655 | FCB $FF,$FF,$01,$FF,$09
656 | LROL FCC 'ROL',EOT
657 |
658 | **************************************************
659 | * Test DEC
660 | **************************************************
661 | TDEC LDU #LDEC
662 | LDX #TBDEC
663 | TDEC1 LDA ,X+
664 | DECA
665 | TFR CC,B
666 | CMPA ,X+
667 | LBNE OUTERR
668 | ANDB #$0E ; Only check Bits NZV
669 | CMPB ,X+
670 | LBNE OUTERR
671 | CMPX #LDEC
672 | BNE TDEC1
673 | RTS
674 |
675 | TBDEC FCB $01,$00,$04
676 | FCB $00,$FF,$08
677 | FCB $FF,$FE,$08
678 | FCB $80,$7F,$02
679 | FCB $7F,$7E,$00
680 | FCB $10,$0F,$00
681 | FCB $0F,$0E,$00
682 | LDEC FCC 'DEC',EOT
683 |
684 | **************************************************
685 | * Test INC
686 | **************************************************
687 | TINC LDU #LINC
688 | LDX #TBINC
689 | TINC1 LDA ,X+
690 | INCA
691 | TFR CC,B
692 | CMPA ,X+
693 | LBNE OUTERR
694 | ANDB #$0E ; Only check Bits NZV
695 | CMPB ,X+
696 | LBNE OUTERR
697 | CMPX #LINC
698 | BNE TINC1
699 | RTS
700 |
701 | TBINC FCB $00,$01,$00
702 | FCB $FE,$FF,$08
703 | FCB $FF,$00,$04
704 | FCB $7F,$80,$0A
705 | FCB $80,$81,$08
706 | FCB $0F,$10,$00
707 | FCB $10,$11,$00
708 | LINC FCC 'INC',EOT
709 |
710 | **************************************************
711 | * Test CLR
712 | **************************************************
713 | TCLR LDU #LCLR
714 | LDX #TBCLR
715 | TCLR1 LDA ,X+
716 | CLRA
717 | TFR CC,B
718 | CMPA ,X+
719 | LBNE OUTERR
720 | ANDB #$0F ; Only check Bits NZVC
721 | CMPB ,X+
722 | * LBNE OUTERR
723 | CMPX #LCLR
724 | BNE TCLR1
725 | RTS
726 |
727 | TBCLR FCB $01,$00,$04
728 | FCB $00,$00,$04
729 | FCB $FF,$00,$04
730 | FCB $80,$00,$04
731 | FCB $7F,$00,$04
732 | FCB $10,$00,$04
733 | FCB $0F,$00,$04
734 | LCLR FCC 'CLR',EOT
735 |
736 | **************************************************
737 | * Test ADDD
738 | **************************************************
739 | TADDD LDU #LADDD
740 | LDX #TBADDD
741 | TADDD1 LDD ,X++
742 | ADDD ,X++
743 | TFR CC,DP
744 | CMPD ,X++
745 | LBNE OUTERR
746 | TFR DP,A
747 | ANDA #$0F ; Only check Bits NZVC
748 | CMPA ,X+
749 | LBNE OUTERR
750 | CMPX #LADDD
751 | BNE TADDD1
752 | RTS
753 |
754 | TBADDD FDB $0000,$0000,$0000
755 | FCB $04
756 | FDB $0000,$0001,$0001
757 | FCB $00
758 | FDB $4000,$4000,$8000
759 | FCB $0A
760 | FDB $0000,$8000,$8000
761 | FCB $08
762 | FDB $8000,$8000,$0000
763 | FCB $07
764 | FDB $4000,$8000,$C000
765 | FCB $08
766 | FDB $7FFF,$7FFF,$FFFE
767 | FCB $0A
768 | FDB $7FFF,$8000,$FFFF
769 | FCB $08
770 | FDB $7FFF,$0001,$8000
771 | FCB $0A
772 | FDB $8000,$0001,$8001
773 | FCB $08
774 | FDB $4000,$C000,$0000
775 | FCB $05
776 | FDB $4000,$C001,$0001
777 | FCB $01
778 | FDB $FFFF,$FFFF,$FFFE
779 | FCB $09
780 | FDB $8001,$8000,$0001
781 | FCB $03
782 | LADDD FCC 'ADDD',EOT
783 |
784 | **************************************************
785 | * Test ADD
786 | **************************************************
787 | TADD LDU #LADD
788 | LDX #TBADD
789 | TADD1 LDB ,X+
790 | ADDB ,X+
791 | TFR CC,A
792 | CMPB ,X+
793 | LBNE OUTERR
794 | ANDA #$2F ; Only check Bits HNZVC
795 | CMPA ,X+
796 | LBNE OUTERR
797 | CMPX #LADD
798 | BNE TADD1
799 | RTS
800 |
801 | TBADD FCB $00,$00,$00,$04
802 | FCB $00,$01,$01,$00
803 | FCB $40,$40,$80,$0A
804 | FCB $00,$80,$80,$08
805 | FCB $80,$80,$00,$07
806 | FCB $40,$80,$C0,$08
807 | FCB $7F,$7F,$FE,$2A
808 | FCB $7F,$80,$FF,$08
809 | FCB $80,$7F,$FF,$08
810 | FCB $7F,$01,$80,$2A
811 | FCB $80,$01,$81,$08
812 | FCB $40,$C0,$00,$05
813 | FCB $40,$C1,$01,$01
814 | FCB $FF,$FF,$FE,$29
815 | FCB $81,$80,$01,$03
816 | LADD FCC 'ADD',EOT
817 |
818 | **************************************************
819 | * Test ADC
820 | **************************************************
821 | TADC LDU #LADC
822 | LDX #TBADC
823 | TADC1 LDA ,X+
824 | TFR CC,B
825 | ANDB ,X+
826 | ORB ,X+
827 | TFR B,CC
828 | ADCA ,X+
829 | TFR CC,B
830 | CMPA ,X+
831 | LBNE OUTERR
832 | ANDB #$2F ; Only check Bits HNZVC
833 | CMPB ,X+
834 | LBNE OUTERR
835 | CMPX #LADC
836 | BNE TADC1
837 | RTS
838 |
839 | TBADC FCB $00,$FE,$00,$00,$00,$04
840 | FCB $00,$FE,$00,$01,$01,$00
841 | FCB $40,$FE,$00,$40,$80,$0A
842 | FCB $00,$FE,$00,$80,$80,$08
843 | FCB $80,$FE,$00,$80,$00,$07
844 | FCB $40,$FE,$00,$80,$C0,$08
845 | FCB $7F,$FE,$00,$7F,$FE,$2A
846 | FCB $7F,$FE,$00,$80,$FF,$08
847 | FCB $80,$FE,$00,$7F,$FF,$08
848 | FCB $7F,$FE,$00,$01,$80,$2A
849 | FCB $80,$FE,$00,$01,$81,$08
850 | FCB $40,$FE,$00,$C0,$00,$05
851 | FCB $40,$FE,$00,$C1,$01,$01
852 | FCB $FF,$FE,$00,$FF,$FE,$29
853 | FCB $81,$FE,$00,$80,$01,$03
854 | FCB $00,$FF,$01,$00,$01,$00
855 | FCB $00,$FF,$01,$01,$02,$00
856 | FCB $40,$FF,$01,$40,$81,$0A
857 | FCB $00,$FF,$01,$80,$81,$08
858 | FCB $80,$FF,$01,$80,$01,$03
859 | FCB $40,$FF,$01,$80,$C1,$08
860 | FCB $7F,$FF,$01,$7F,$FF,$2A
861 | FCB $7F,$FF,$01,$80,$00,$25
862 | FCB $80,$FF,$01,$7F,$00,$25
863 | FCB $7F,$FF,$01,$01,$81,$2A
864 | FCB $80,$FF,$01,$01,$82,$08
865 | FCB $40,$FF,$01,$C0,$01,$01
866 | FCB $40,$FF,$01,$C1,$02,$01
867 | FCB $FF,$FF,$01,$FF,$FF,$29
868 | FCB $81,$FF,$01,$80,$02,$03
869 | LADC FCC 'ADC',EOT
870 |
871 | **************************************************
872 | * Test CMP
873 | **************************************************
874 | TCMP LDU #LCMP
875 | LDX #TBSUB
876 | TCMP1 LDB ,X+
877 | CMPB ,X+
878 | TFR CC,A
879 | LEAX 1,X ; Skip result Byte
880 | ANDA #$0F ; Only check Bits NZVC
881 | CMPA ,X+
882 | LBNE OUTERR
883 | CMPX #LSUB
884 | BNE TCMP1
885 | RTS
886 |
887 | LCMP FCC 'CMP',EOT
888 |
889 | **************************************************
890 | * Test SUB
891 | **************************************************
892 | TSUB LDU #LSUB
893 | LDX #TBSUB
894 | TSUB1 LDB ,X+
895 | SUBB ,X+
896 | TFR CC,A
897 | CMPB ,X+
898 | LBNE OUTERR
899 | ANDA #$0F ; Only check Bits NZVC
900 | CMPA ,X+
901 | LBNE OUTERR
902 | CMPX #LSUB
903 | BNE TSUB1
904 | RTS
905 |
906 | TBSUB FCB $00,$00,$00,$04
907 | FCB $00,$01,$FF,$09
908 | FCB $00,$7F,$81,$09
909 | FCB $00,$80,$80,$0B
910 | FCB $00,$FF,$01,$01
911 | FCB $01,$00,$01,$00
912 | FCB $01,$7F,$82,$09
913 | FCB $40,$41,$FF,$09
914 | FCB $40,$80,$C0,$0B
915 | FCB $40,$C0,$80,$0B
916 | FCB $40,$C1,$7F,$01
917 | FCB $7F,$00,$7F,$00
918 | FCB $7F,$01,$7E,$00
919 | FCB $7F,$7E,$01,$00
920 | FCB $7F,$7F,$00,$04
921 | FCB $7F,$80,$FF,$0B
922 | FCB $7F,$FF,$80,$0B
923 | FCB $80,$01,$7F,$02
924 | FCB $80,$40,$40,$02
925 | FCB $80,$7F,$01,$02
926 | FCB $80,$80,$00,$04
927 | FCB $80,$81,$FF,$09
928 | FCB $81,$80,$01,$00
929 | FCB $FF,$FF,$00,$04
930 | FCB $FF,$FE,$01,$00
931 | FCB $FF,$00,$FF,$08
932 | LSUB FCC 'SUB',EOT
933 |
934 | **************************************************
935 | * Test SBC
936 | **************************************************
937 | TSBC LDU #LSBC
938 | LDX #TBSBC
939 | TSBC1 LDA ,X+
940 | TFR CC,B
941 | ANDB ,X+
942 | ORB ,X+
943 | TFR B,CC
944 | SBCA ,X+
945 | TFR CC,B
946 | CMPA ,X+
947 | LBNE OUTERR
948 | ANDB #$0F ; Only check Bits NZVC
949 | CMPB ,X+
950 | LBNE OUTERR
951 | CMPX #LSBC
952 | BNE TSBC1
953 | RTS
954 |
955 | TBSBC FCB $00,$FE,$00,$00,$00,$04
956 | FCB $00,$FE,$00,$01,$FF,$09
957 | FCB $00,$FE,$00,$7F,$81,$09
958 | FCB $00,$FE,$00,$80,$80,$0B
959 | FCB $00,$FE,$00,$FF,$01,$01
960 | FCB $01,$FE,$00,$00,$01,$00
961 | FCB $01,$FE,$00,$7F,$82,$09
962 | FCB $40,$FE,$00,$41,$FF,$09
963 | FCB $40,$FE,$00,$80,$C0,$0B
964 | FCB $40,$FE,$00,$C0,$80,$0B
965 | FCB $40,$FE,$00,$C1,$7F,$01
966 | FCB $7F,$FE,$00,$00,$7F,$00
967 | FCB $7F,$FE,$00,$01,$7E,$00
968 | FCB $7F,$FE,$00,$7E,$01,$00
969 | FCB $7F,$FE,$00,$7F,$00,$04
970 | FCB $7F,$FE,$00,$80,$FF,$0B
971 | FCB $7F,$FE,$00,$FF,$80,$0B
972 | FCB $80,$FE,$00,$01,$7F,$02
973 | FCB $80,$FE,$00,$40,$40,$02
974 | FCB $80,$FE,$00,$7F,$01,$02
975 | FCB $80,$FE,$00,$80,$00,$04
976 | FCB $80,$FE,$00,$81,$FF,$09
977 | FCB $81,$FE,$00,$80,$01,$00
978 | FCB $FF,$FE,$00,$FF,$00,$04
979 | FCB $FF,$FE,$00,$FE,$01,$00
980 | FCB $FF,$FE,$00,$00,$FF,$08
981 | FCB $00,$FF,$01,$00,$FF,$09
982 | FCB $00,$FF,$01,$01,$FE,$09
983 | FCB $00,$FF,$01,$7F,$80,$09
984 | FCB $00,$FF,$01,$80,$7F,$01
985 | FCB $00,$FF,$01,$FF,$00,$05
986 | FCB $01,$FF,$01,$00,$00,$04
987 | FCB $01,$FF,$01,$7F,$81,$09
988 | FCB $40,$FF,$01,$41,$FE,$09
989 | FCB $40,$FF,$01,$80,$BF,$0B
990 | FCB $40,$FF,$01,$C0,$7F,$01
991 | FCB $40,$FF,$01,$C1,$7E,$01
992 | FCB $7F,$FF,$01,$00,$7E,$00
993 | FCB $7F,$FF,$01,$01,$7D,$00
994 | FCB $7F,$FF,$01,$7E,$00,$04
995 | FCB $7F,$FF,$01,$7F,$FF,$09
996 | FCB $7F,$FF,$01,$80,$FE,$0B
997 | FCB $7F,$FF,$01,$FF,$7F,$01
998 | FCB $80,$FF,$01,$01,$7E,$02
999 | FCB $80,$FF,$01,$40,$3F,$02
1000 | FCB $80,$FF,$01,$7F,$00,$06
1001 | FCB $80,$FF,$01,$80,$FF,$09
1002 | FCB $80,$FF,$01,$81,$FE,$09
1003 | FCB $81,$FF,$01,$80,$00,$04
1004 | FCB $FF,$FF,$01,$FF,$FF,$09
1005 | FCB $FF,$FF,$01,$FE,$00,$04
1006 | FCB $FF,$FF,$01,$00,$FE,$08
1007 | LSBC FCC 'SBC',EOT
1008 |
1009 | **************************************************
1010 | * Test SUBD
1011 | **************************************************
1012 | TSUBD LDU #LSUBD
1013 | LDX #TBSUBD
1014 | TSUBD1 LDD ,X++
1015 | SUBD ,X++
1016 | TFR CC,DP
1017 | CMPD ,X++
1018 | LBNE OUTERR
1019 | TFR DP,A
1020 | ANDA #$0F ; Only check Bits NZVC
1021 | CMPA ,X+
1022 | LBNE OUTERR
1023 | CMPX #LSUBD
1024 | BNE TSUBD1
1025 | RTS
1026 |
1027 | TBSUBD FDB $0000,$0000,$0000
1028 | FCB $04
1029 | FDB $0000,$0001,$FFFF
1030 | FCB $09
1031 | FDB $0000,$7FFF,$8001
1032 | FCB $09
1033 | FDB $0000,$8000,$8000
1034 | FCB $0B
1035 | FDB $0000,$FFFF,$0001
1036 | FCB $01
1037 | FDB $0001,$0000,$0001
1038 | FCB $00
1039 | FDB $0001,$7FFF,$8002
1040 | FCB $09
1041 | FDB $4000,$4001,$FFFF
1042 | FCB $09
1043 | FDB $4000,$8000,$C000
1044 | FCB $0B
1045 | FDB $4000,$C000,$8000
1046 | FCB $0B
1047 | FDB $4000,$C001,$7FFF
1048 | FCB $01
1049 | FDB $7FFF,$0000,$7FFF
1050 | FCB $00
1051 | FDB $7FFF,$0001,$7FFE
1052 | FCB $00
1053 | FDB $7FFF,$7FFE,$0001
1054 | FCB $00
1055 | FDB $7FFF,$7FFF,$0000
1056 | FCB $04
1057 | FDB $7FFF,$8000,$FFFF
1058 | FCB $0B
1059 | FDB $7FFF,$FFFF,$8000
1060 | FCB $0B
1061 | FDB $8000,$0001,$7FFF
1062 | FCB $02
1063 | FDB $8000,$4000,$4000
1064 | FCB $02
1065 | FDB $8000,$7FFF,$0001
1066 | FCB $02
1067 | FDB $8000,$8000,$0000
1068 | FCB $04
1069 | FDB $8000,$8001,$FFFF
1070 | FCB $09
1071 | FDB $8001,$8000,$0001
1072 | FCB $00
1073 | FDB $FFFF,$FFFF,$0000
1074 | FCB $04
1075 | FDB $FFFF,$FFFE,$0001
1076 | FCB $00
1077 | FDB $FFFF,$0000,$FFFF
1078 | FCB $08
1079 | LSUBD FCC 'SUBD',EOT
1080 |
1081 | **************************************************
1082 | * Test CMPD
1083 | **************************************************
1084 | TCMPD LDU #LCMPD
1085 | LDX #TBSUBD
1086 | TCMPD1 LDD ,X++
1087 | SUBD ,X++
1088 | TFR CC,DP
1089 | LEAX 2,X ; Skip result Word
1090 | TFR DP,A
1091 | ANDA #$0F ; Only check Bits NZVC
1092 | CMPA ,X+
1093 | LBNE OUTERR
1094 | CMPX #LSUBD
1095 | BNE TCMPD1
1096 | RTS
1097 |
1098 | LCMPD FCC 'CMPD',EOT
1099 |
1100 | **************************************************
1101 | * Test TFR
1102 | **************************************************
1103 | TTFR LDX #TBTFR
1104 | TTFR1 PSHS X
1105 | LDY ,X
1106 | JSR ,Y
1107 | PULS X
1108 | BNE FTFR
1109 | LEAX 2,X
1110 | CMPX #LTFR
1111 | BNE TTFR1
1112 | RTS
1113 | FTFR LDU #LTFR
1114 | LBRA OUTERR
1115 |
1116 | CLRREG CLRA
1117 | CLRB
1118 | LDX #0
1119 | LDY #0
1120 | LDU #0
1121 | TFR A,DP
1122 | TFR A,CC
1123 | RTS
1124 | TBTFR1 BSR CLRREG
1125 | LDD #$5678
1126 | TFR D,X
1127 | CMPX #$5678
1128 | RTS
1129 | TBTFR2 BSR CLRREG
1130 | LDX #$1234
1131 | TFR X,Y
1132 | CMPY #$1234
1133 | RTS
1134 | TBTFR3 BSR CLRREG
1135 | LDY #$5500
1136 | TFR Y,U
1137 | CMPU #$5500
1138 | RTS
1139 | TBTFR4 BSR CLRREG
1140 | LDU #$FEFF
1141 | TFR U,D
1142 | CMPD #$FEFF
1143 | RTS
1144 | TBTFR5 BSR CLRREG
1145 | LDA #$55
1146 | TFR A,B
1147 | CMPB #$55
1148 | RTS
1149 | TBTFR6 BSR CLRREG
1150 | LDB #$AA
1151 | TFR B,DP
1152 | PSHS DP
1153 | PULS A
1154 | CMPA #$AA
1155 | RTS
1156 | TBTFR7 BSR CLRREG
1157 | LDA #$03
1158 | PSHS A
1159 | CLRA
1160 | PULS DP
1161 | TFR DP,CC
1162 | PSHS CC
1163 | PULS A
1164 | CMPA #$03
1165 | RTS
1166 | TBTFR8 BSR CLRREG
1167 | LDA #$01
1168 | PSHS A
1169 | PULS CC
1170 | TFR CC,A
1171 | CMPA #$01
1172 | RTS
1173 |
1174 | TBTFR FDB TBTFR1
1175 | FDB TBTFR2
1176 | FDB TBTFR3
1177 | FDB TBTFR4
1178 | FDB TBTFR5
1179 | FDB TBTFR6
1180 | FDB TBTFR7
1181 | FDB TBTFR8
1182 | LTFR FCC 'TFR',EOT
1183 |
1184 | **************************************************
1185 | * Test EXG
1186 | **************************************************
1187 | TEXG LDX #TBEXG
1188 | TEXG1 PSHS X
1189 | LDY ,X
1190 | JSR ,Y
1191 | PULS X
1192 | BNE FEXG
1193 | LEAX 2,X
1194 | CMPX #LEXG
1195 | BNE TEXG1
1196 | RTS
1197 | FEXG LDU #LEXG
1198 | LBRA OUTERR
1199 |
1200 | TBEXG1 LBSR CLRREG
1201 | LDD #$5678
1202 | LDX #$A55A
1203 | EXG D,X
1204 | CMPX #$5678
1205 | BNE TBEXGE
1206 | CMPD #$A55A
1207 | TBEXGE RTS
1208 | TBEXG2 LBSR CLRREG
1209 | LDX #$1234
1210 | LDY #$0815
1211 | EXG X,Y
1212 | CMPY #$1234
1213 | BNE TBEXGE
1214 | CMPX #$0815
1215 | RTS
1216 | TBEXG3 LBSR CLRREG
1217 | LDY #$5500
1218 | LDU #$4711
1219 | EXG Y,U
1220 | CMPU #$5500
1221 | BNE TBEXGE
1222 | CMPY #$4711
1223 | RTS
1224 | TBEXG4 LBSR CLRREG
1225 | LDU #$FEFF
1226 | LDD #$9999
1227 | EXG U,D
1228 | CMPD #$FEFF
1229 | BNE TBEXGE
1230 | CMPU #$9999
1231 | RTS
1232 | TBEXG5 LBSR CLRREG
1233 | LDA #$55
1234 | LDB #$AA
1235 | EXG A,B
1236 | CMPB #$55
1237 | BNE TBEXGE
1238 | CMPA #$AA
1239 | RTS
1240 | TBEXG6 LBSR CLRREG
1241 | LDB #$AA
1242 | LDA #$44
1243 | PSHS A
1244 | CLRA
1245 | PULS DP
1246 | EXG B,DP
1247 | PSHS DP
1248 | PULS A
1249 | CMPA #$AA
1250 | BNE TBEXGE
1251 | CMPB #$44
1252 | RTS
1253 | TBEXG7 LBSR CLRREG
1254 | LDA #$03
1255 | PSHS A
1256 | CLRA
1257 | PULS DP
1258 | LDA #$30
1259 | PSHS A
1260 | CLRA
1261 | PULS CC
1262 | EXG DP,CC
1263 | PSHS CC
1264 | PULS A
1265 | PSHS DP
1266 | PULS B
1267 | CMPA #$03
1268 | LBNE TBEXGE
1269 | CMPB #$30
1270 | RTS
1271 | TBEXG8 LBSR CLRREG
1272 | LDA #$11
1273 | LDB #$99
1274 | PSHS B
1275 | CLRB
1276 | PULS CC
1277 | EXG CC,A
1278 | PSHS CC
1279 | PULS B
1280 | CMPA #$99
1281 | LBNE TBEXGE
1282 | CMPB #$11
1283 | RTS
1284 |
1285 | TBEXG FDB TBEXG1
1286 | FDB TBEXG2
1287 | FDB TBEXG3
1288 | FDB TBEXG4
1289 | FDB TBEXG5
1290 | FDB TBEXG6
1291 | FDB TBEXG7
1292 | FDB TBEXG8
1293 | LEXG FCC 'EXG',EOT
1294 |
1295 |
1296 | **************************************************
1297 | * Test Index Addressing modes
1298 | **************************************************
1299 | CLRMEM PSHS X
1300 | LDX #EXTREG-128
1301 | CLRA
1302 | CLRM1 CLR ,X+
1303 | INCA
1304 | BNE CLRM1
1305 | PULS X,PC
1306 |
1307 | TAD1 LDU #LAD1
1308 | LDX #EXTREG
1309 | * LDA ,X
1310 | BSR CLRMEM
1311 | LDA #$55
1312 | STA EXTREG
1313 | LDA ,X
1314 | CMPA #$55
1315 | LBNE OUTERR
1316 | * LDA 1,X
1317 | BSR CLRMEM
1318 | LDA #$12
1319 | STA EXTREG+1
1320 | LDA 1,X
1321 | CMPA #$12
1322 | LBNE OUTERR
1323 | * LDA 127,X
1324 | BSR CLRMEM
1325 | LDA #$44
1326 | STA EXTREG+127
1327 | LDA 127,X
1328 | CMPA #$44
1329 | LBNE OUTERR
1330 | * LDA -1,X
1331 | BSR CLRMEM
1332 | LDA #$34
1333 | STA EXTREG-1
1334 | LDA -1,X
1335 | CMPA #$34
1336 | LBNE OUTERR
1337 | * LDA -128,X
1338 | BSR CLRMEM
1339 | LDA #$AA
1340 | STA EXTREG-128
1341 | LDA -128,X
1342 | CMPA #$AA
1343 | LBNE OUTERR
1344 | RTS
1345 |
1346 | * LDA ,X+
1347 | TAD2 LDX #EXTREG
1348 | LDU #LAD2
1349 | BSR CLRMEM
1350 | LDD #$A55A
1351 | STD EXTREG
1352 | LDA ,X+
1353 | CMPA #$A5
1354 | LBNE OUTERR
1355 | LDA ,X+
1356 | CMPA #$5A
1357 | LBNE OUTERR
1358 | RTS
1359 |
1360 | * LDD ,X++
1361 | TAD3 LDX #EXTREG
1362 | LDU #LAD3
1363 | LBSR CLRMEM
1364 | LDD #$A55A
1365 | STD EXTREG
1366 | LDD #$789A
1367 | STD EXTREG+2
1368 | LDD ,X++
1369 | CMPD #$A55A
1370 | LBNE OUTERR
1371 | LDD ,X++
1372 | CMPD #$789A
1373 | LBNE OUTERR
1374 | RTS
1375 |
1376 | * LDA ,-X
1377 | TAD4 LDX #EXTREG
1378 | LDU #LAD4
1379 | LBSR CLRMEM
1380 | LDD #$A55A
1381 | STD EXTREG-2
1382 | LDA ,-X
1383 | CMPA #$5A
1384 | LBNE OUTERR
1385 | LDA ,-X
1386 | CMPA #$A5
1387 | LBNE OUTERR
1388 | RTS
1389 |
1390 | * LDD ,--X
1391 | TAD5 LDX #EXTREG
1392 | LDU #LAD5
1393 | LBSR CLRMEM
1394 | LDD #$A55A
1395 | STD EXTREG-2
1396 | LDD #$789A
1397 | STD EXTREG-4
1398 | LDD ,--X
1399 | CMPD #$A55A
1400 | LBNE OUTERR
1401 | LDD ,--X
1402 | CMPD #$789A
1403 | LBNE OUTERR
1404 | RTS
1405 |
1406 | * LDA A,X
1407 | TAD6 LDU #LAD6
1408 | LDX #EXTREG
1409 | LBSR CLRMEM
1410 | LDA #$12
1411 | STA EXTREG+1
1412 | LDA #1
1413 | LDA A,X
1414 | CMPA #$12
1415 | LBNE OUTERR
1416 | LBSR CLRMEM
1417 | LDA #$44
1418 | STA EXTREG+127
1419 | LDA #127
1420 | LDA A,X
1421 | CMPA #$44
1422 | LBNE OUTERR
1423 | RTS
1424 |
1425 | * LDA B,Y
1426 | TAD7 LDU #LAD7
1427 | LDY #EXTREG
1428 | LBSR CLRMEM
1429 | LDA #$34
1430 | STA EXTREG-1
1431 | LDB #-1
1432 | LDA B,Y
1433 | CMPA #$34
1434 | LBNE OUTERR
1435 | LBSR CLRMEM
1436 | LDA #$AA
1437 | STA EXTREG-128
1438 | LDB #-128
1439 | LDA B,Y
1440 | CMPA #$AA
1441 | LBNE OUTERR
1442 | RTS
1443 |
1444 | * LDD D,X
1445 | TAD8 LDU #LAD8
1446 | LDX #0
1447 | LBSR CLRMEM
1448 | LDD #$1289
1449 | STD EXTREG
1450 | LDD #EXTREG
1451 | LDD D,X
1452 | CMPD #$1289
1453 | LBNE OUTERR
1454 | LDX #$8000
1455 | LBSR CLRMEM
1456 | LDD #$2299
1457 | STD EXTREG
1458 | LDD #EXTREG-$8000
1459 | LDD D,X
1460 | CMPD #$2299
1461 | LBNE OUTERR
1462 | RTS
1463 |
1464 | * LDD n16,X
1465 | TAD9 LDU #LAD9
1466 | LDX #0
1467 | LBSR CLRMEM
1468 | LDD #$1289
1469 | STD EXTREG
1470 | LDD EXTREG,X
1471 | CMPD #$1289
1472 | LBNE OUTERR
1473 | LDX #$8000
1474 | LBSR CLRMEM
1475 | LDD #$2299
1476 | STD EXTREG
1477 | LDD EXTREG-$8000,X
1478 | CMPD #$2299
1479 | LBNE OUTERR
1480 | RTS
1481 |
1482 | * LDA n8,PC
1483 | REG81 FCB 0
1484 | TADA LDU #LADA
1485 | LBSR CLRMEM
1486 | LDA #$13
1487 | STA REG81
1488 | LDA