57
|
1 6809 Simulator/Emulator with os9 level1/level2
|
|
2 Shini KONO (kono@ie.u-ryukyu.ac.jp) Mon Jul 23 10:59:06 JST 2018
|
|
3
|
|
4 using nitros9
|
|
5 hg clone http://hg.code.sf.net/p/nitros9/code nitros9-code
|
|
6
|
|
7 This emulator support vrbf ( simulate unix directory as a rbf disk ) and
|
|
8 ROM based boot.
|
|
9
|
|
10 make clean; make
|
|
11
|
|
12 to run lv1 or lv2
|
|
13
|
|
14 make lv1
|
|
15 or
|
|
16 make lv2
|
|
17
|
|
18 =======================
|
|
19
|
|
20 sbc09 stands for Lennart Benschop 6809 Single Board Computer.
|
|
21 It contains a assembler and simulator for the Motorola M6809 processor.
|
|
22
|
|
23 copyleft (c) 1994-2014 by the sbc09 team, see AUTHORS for more details.
|
|
24 license: GNU General Public License version 2, see LICENSE for more details.
|
|
25
|
|
26
|
|
27 Forum thread: http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4880
|
|
28 Project: https://github.com/6809/sbc09
|
|
29
|
|
30
|
|
31 For the usage of the assembler a09 and 6809 single board system v09
|
|
32 read doc/sbc09.creole!
|
|
33
|
|
34
|
|
35 This distribution includes two different kinds of simulators:
|
|
36 1. The old sim6809 based "simple" simulator built as v09s, v09st
|
|
37 2. The 6809 single board system as a stand alone environment built as v09
|
|
38
|
|
39
|
|
40
|
|
41 Structure
|
|
42 ---------
|
|
43
|
|
44 src/
|
|
45 Source for the developement tools and virtual machines ...
|
|
46
|
|
47 a09.c
|
|
48 The 6809 assembler. It's fairly portable (ANSI) C. It works on both
|
|
49 Unix and DOS (TC2.0).
|
|
50
|
|
51 Features of the assembler:
|
|
52 - generates binary file starting at the first address
|
|
53 where code is actually generated. So an initial block of RMB's
|
|
54 (maybe at a different ORG) is not included in the file.
|
|
55 - Accepts standard syntax.
|
|
56 - full expression evaluator.
|
|
57 - Statements SET, MACRO, PUBLIC, EXTERN IF/ELSE/ENDIF INCLUDE not yet
|
|
58 implemented. Some provisions are already made internally for macros
|
|
59 and/or relocatable objects.
|
|
60
|
|
61 v09s.c
|
|
62 The (old) 6809 simulator. Loads a binary image (from a09) at adress $100
|
|
63 and starts executing. SWI2 and SWI3 are for character output/input.
|
|
64 SYNC stops simulation. When compiling set -DBIG_ENDIAN if your
|
|
65 computer is big-endian. Set TERM_CONTROL for a crude single character
|
|
66 (instead of ANSI line-by-line) input. Works on Unix.
|
|
67
|
|
68 v09stc.c
|
|
69 Same as v09s.c but for Turbo C. Has its own term control.
|
|
70
|
|
71 v09.c
|
|
72 engine.c
|
|
73 io.c
|
|
74 The 6809 single board simulator/emulator v09.
|
|
75
|
|
76 mon2.asm
|
|
77 Monitor progam, alternative version of monitor.asm
|
|
78 (used in ROM image alt09.rom)
|
|
79
|
|
80 monitor.asm
|
|
81 Monitor progam (used in ROM image v09.rom for v09)
|
|
82
|
|
83 makerom.c
|
|
84 Helper tool to generate ROM images for v09.
|
|
85
|
|
86
|
|
87 basic/
|
|
88 Basic interpreters ...
|
|
89
|
|
90 basic.asm
|
|
91 Tiny Basic
|
|
92 fbasic.asm
|
|
93 Tiny Basic with Lennarts floating point routines.
|
|
94
|
|
95
|
|
96 doc/
|
|
97 Documentation ...
|
|
98
|
|
99
|
|
100 examples/
|
|
101 Several test and benchmark programs, simple routines and some bigger stuff
|
|
102 like a Forth system (ef09).
|
|
103
|
|
104 ef09.asm Implementation of E-Forth, a very rudimentary and portable Forth.
|
|
105 Type WORDS to see what words you have. You can evaluate RPN integer
|
|
106 expressions, like "12 34 + 5 * . " You can make new words like
|
|
107 " : SQUARED DUP * ; " etc.
|
|
108
|
|
109
|
|
110 examples_forth/
|
|
111 Forth environment with examples.
|
|
112 For the 6809 single board system.
|
|
113
|
|
114
|
|
115
|
|
116
|
|
117 Notes on Linux Fedora Core 6
|
|
118 ----------------------------
|
|
119 2012-06-04
|
|
120
|
|
121 Compiling v09s, v09st:
|
|
122
|
|
123 * BIG_ENDIAN (already used by LINUX itself, changed to CPU_BIG_ENDIAN)
|
|
124 Now automatically set according to BIG_ENDIAN and BYTE_ORDER
|
|
125 if existing.
|
|
126
|
|
127 * If TERM_CONTROL mode is active the keyboard is not really in raw mode -
|
|
128 keyboard signals are still allowed.
|
|
129
|
|
130 * A tracefilter based on register values can be placed in the TRACE area to
|
|
131 get tracing output triggered by special states
|
|
132
|
|
133
|
|
134
|
|
135 a09 Assembler
|
|
136 -------------
|
|
137
|
|
138 Bugfixes:
|
|
139 * addres modes a,INDEXREG b,INDEXREG d,INDEXREG now known
|
|
140 as *legal*!
|
|
141
|
|
142 Extended version:
|
|
143 http://lennartb.home.xs4all.nl/A09.c
|
|
144 (see above)
|
|
145
|
|
146 * options -x and -s produces output in Intel Binary/Srecord format,
|
|
147 contains the above mentioned bugfixes (but fixed by the original
|
|
148 author).
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153 v09s* Simulator
|
|
154 ---------------
|
|
155
|
|
156 ### CC register
|
|
157
|
|
158 E F H I N Z V C Flag
|
|
159 8 7 6 5 4 3 2 1 Bit
|
|
160 | | | | | | | |
|
|
161 | | | | | | | +- $01
|
|
162 | | | | | | +--- $02
|
|
163 | | | | | +----- $04
|
|
164 | | | | +------- $08
|
|
165 | | | +--------- $10
|
|
166 | | +----------- $20
|
|
167 | +------------- $40
|
|
168 +--------------- $80
|
|
169
|
|
170
|
|
171 # differences from real 6809:
|
|
172
|
184
|
173 ldd #$0fc9
|
|
174 addb #$40 ; $C9+$40 -> $09 -> C=1
|
|
175 adca #$00 ; $0F+C -> $10 -> H=1
|
|
176
|
|
177 Should Set the half-carry!
|
|
178
|
|
179 For this example the half-carry is set on a real 6809, also correctly
|
|
180 emulated on the VCC. v09s does the same.
|
|
181
|
|
182 According to "Motorola 6809 and Hitachi 6309 Programmer's Reference"
|
|
183 the half-carry is only properly set for ADD and ADC (on 8-bit accumulators).
|
|
184 For ASR, ASL (= LSL), CMP, SBC, SUB this condition flag is undefined.
|
|
185 The v09s simulator calculates the half-carry also for ASR and ASL.
|
|
186
|
|
187 ASL does the following:
|
|
188 * sets H if bit 4 was set.
|
|
189 * clears H if bit was not set.
|
|
190
|
|
191 ASR (=LSR) does the following:
|
|
192 * xxx1 xxxx --- (LSR|ASR) ---> xxxx 1xxx => H=1
|
|
193 * xxx0 xxxx --- (LSR|ASR) ---> xxxx 0xxx => H=0
|
|
194
|
|
195
|
|
196 But note: LSR never touches the half-carry!
|
|
197
|
|
198
|
|
199 ## TFR/EXG with unaligned register sizes
|
57
|
200
|
184
|
201 See http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=5512
|
|
202 Points to the 6309 behavior which is not compatible to 6809!
|
|
203
|
|
204 tfr x,b ; 6809,6309: b low byte of x, a unchanged
|
|
205 tfr x,a ; 6809, a low byte of x, b unchanged
|
|
206 ; on a 6309: a high(!) byte of x, b unchanged
|
|
207
|
|
208 Might be used to get the low byte out of an index register without harm
|
|
209 the A register:
|
|
210
|
|
211 instead of
|
|
212 pushs a
|
|
213 tfr x,d
|
|
214 andb #$1f
|
|
215 it could be used
|
|
216 tfr x,b
|
|
217 andb #$1f ; a left untouched!
|
|
218
|
|
219 REF: http://www.6809.org.uk/dragon/illegal-opcodes.shtml
|
|
220 REF: http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4886
|
|
221
|
|
222 tfr a,x ; low byte of x has value of a, high byte is $FF
|
|
223 tfr b,x ; low byte of x has value of b, high byte is $FF
|
|
224
|
|
225 exg a,x ; low byte of x has value of a, high byte is $FF
|
|
226 exg b,x ; low byte of x has value of b, high byte is $FF
|
|
227
|
|
228 According to Motorola 6809 and Hitachi 6309 Programmer's Reference
|
|
229
|
|
230 Except for the case where the first operand is 8 bit and register CC or DP:
|
|
231 In this case the 16-bit register has the value of the 8-bit register in
|
|
232 high and low byte!
|
57
|
233
|
|
234
|
|
235 ### special behavior
|
|
236
|
|
237 swi2 output character (STDOUT) in register B
|
|
238 swi3 read character from keyboard into register B
|
|
239 sync exit simulator
|
|
240
|
|
241
|
|
242 ### start program
|
|
243 v09s BINARY
|
|
244
|
|
245 ### start program with tracing output on STDOUT
|
|
246 v09st BINARY
|
|
247
|
|
248 ### run program and leave memory dump (64k)
|
|
249
|
|
250 # memory dump in file dump.v09
|
|
251 v09s -d BINARY
|
|
252
|
|
253
|
|
254
|
|
255 ### Bugfixes
|
|
256
|
|
257 * static int index;
|
|
258 otherwise the global C library function index() is referenced!
|
|
259 Write access on it leads to a core dump.
|
|
260
|
|
261 * BIG_ENDIAN is not useable in FLAG because (POSIX?) Unix
|
|
262 (especially Linux) defines its byte order.
|
|
263 If BIG_ENDIAN == BYTE_ORDER -> architecture is big endian!
|
|
264 Changed to CPU_BIG_ENDIAN, which is refering BIG_ENDIAN and
|
|
265 BYTE_ORDER automatically (if existent).
|
|
266
|
|
267
|
|
268
|
|
269
|
|
270
|
|
271
|
|
272 eForth
|
|
273 ------
|
|
274
|
|
275 Source:
|
|
276
|
|
277 ef09.asm
|
|
278
|
|
279 Backspace character changed from 127 to 8.
|
|
280
|
|
281
|
|
282 Memory-Layout:
|
|
283
|
|
284 0100 At this address the binary is placed to, the Forth entry point
|
|
285 03C0 USER area start
|
|
286 4000 Memory TOP
|
|
287
|
|
288
|
|
289 I/O:
|
|
290 Keyboard input:
|
|
291 * ^H or BSP deletes character
|
|
292 * RETURN -> interrupts (long) output
|
|
293
|
|
294 Start:
|
|
295
|
|
296 ../v09s ef09
|
|
297
|
|
298
|
|
299 Bugs:
|
|
300 SEE ;
|
|
301 STAR (*) : * UM* DROP ; ... wrong,
|
|
302 : * M* DROP ; ... correct (sign!)
|
|
303
|
|
304 Typical commands:
|
|
305
|
|
306 Commands alway in upper case!!!
|
|
307
|
|
308 WORD list of defined words of the current vocabulary
|
|
309
|
|
310 BYE exit Forth (back to shell)
|
|
311 DUMP hex memory dump
|
|
312 SEE HL-word decompiler, corrected:
|
|
313 * stops at EXIT
|
|
314 * handles more special primitives (literals, strings,
|
|
315 variable, constants))
|
|
316 * handles Direct Threading
|
|
317 * output line by line with address
|
|
318 .S shows the content of the parameter stack
|
|
319
|
|
320 count FOR ... NEXT
|
|
321 replacement for
|
|
322 hi lo DO ... I ... LOOP
|
|
323 hi lo - 1+ FOR ... R@ lo + ... NEXT
|
|
324
|
|
325
|
|
326
|
|
327
|
|
328 Extensions:
|
|
329
|
|
330 ZEQUAL 0= Primitive
|
|
331 PLUS1 1+ Primitive, added
|
|
332 2012-06-07
|
|
333 ROLL ROLL HL, added
|
|
334 CONST CONSTANT HL, added
|
|
335 doCONST Primitive, added
|
|
336
|
|
337 2012-06-08
|
|
338 TWOSTAR 2* Primtive, added
|
|
339 TWOSLASH 2/ Primtive, added
|
|
340 MINUS1 1- Primtive, added
|
|
341 SWAPHL >< Primtive, added
|
|
342 STAR256 256* Primtive, added
|
|
343 SLASH256 256/ Primtive, added
|
|
344 CMOVE CMOVE Primtive
|
|
345 FILL FILL Primtive
|
|
346 2012-06-09
|
|
347 ULESS U< Primitive
|
|
348 LESS < Primitive
|
|
349 DO DO HL, added
|
|
350 QDO ?DO HL, added
|
|
351 DODO (DO) Primitive, added
|
|
352 DOQDO (?DO) Primitive, added
|
|
353 LOOP LOOP HL, added
|
|
354 PLOOP +LOOP HL, added
|
|
355 DOLOOP (LOOP) Primitive, added
|
|
356 DOPLOOP (+LOOP) Primitive, added
|
|
357
|
|
358 2012-06-11
|
|
359 NEGAT NEGATE Primitive, alternative added
|
|
360 UMSTA UM* Primitive, but without MUL
|
|
361 LSHIFT LSHIFT Primitive, added
|
|
362 RSHIFT RSHIFT Primitive, added
|
|
363 2012-06-12
|
|
364 LEAVE LEAVE Primitive, added (fig Forth)
|
|
365 MDO -DO HL, added
|
|
366 DOMDO (-DO) Primitive, added
|
|
367 I I Primitive, added (same as R@)
|
|
368 CMOVEW CMOVE Primitive, other implementation
|
|
369 STAR * korr.: uses M* (instead UM*)
|
|
370 BLANK BL Constant
|
|
371
|
|
372 2012-06-19
|
|
373 USLASH U/ Primitive, same as UM/MOD
|
|
374 UM/MOD uses USLASH
|
|
375
|
|
376 2012-06-20
|
|
377 DPLUS D+ Primitive
|
|
378 DSUB D- HL
|
|
379 ZERO 0 Constant
|
|
380 ONE 1 Constant
|
|
381 TWO 2 Constant
|
|
382 MONE -1 Constant
|
|
383 DOCLIT doCLIT Primitive
|
|
384 2012-06-21
|
|
385 SEE SEE extended: handles LIT, CLIT
|
|
386 2012-06-22
|
|
387 SEE SEE extended: handles
|
|
388 BRANCH,?BRANCH,?DO,-DO,LOOP,+LOOP,."..."
|
|
389
|
|
390 2012-09-07
|
|
391 SEE SEE ABORT", (DO) added, remarks corrected.
|
|
392
|
|
393 TODO:
|
|
394 * XXX marks points to open issues.
|
|
395 * SEE command:
|
|
396 handling of
|
|
397 - [COMPILE]
|
|
398 - DOCONST, DOVAR, DOUSE
|
|
399
|
|
400
|
|
401 TEST:
|
|
402
|
|
403 HEX ok
|
|
404 0 8000 8001 U/ . . FFFE 2 ok
|
|
405 FFFE 8001 U* . . U* ? ok
|
|
406 FFFE 8001 UM* . . 7FFF FFFE ok
|
|
407 FFFE 8001 UM* 2 0 D+ . . 8000 0 ok
|
|
408
|
|
409 0 8000 7FFF U/ . . FFFF FFFF ok
|
|
410 0 FFFF FFFF U/ . . FFFF FFFF ok
|
|
411 0 FFFE FFFF U/ . . FFFE FFFE ok
|
|
412 FFFF FFFF UM* . . FFFE 1 ok
|
|
413 FFFF FFFE FFFF U/ . . FFFF FFFE ok
|
|
414
|
|
415
|
|
416
|
|
417
|
|
418
|
|
419 Links/References
|
|
420 ================
|
|
421
|
|
422
|
|
423 Project:
|
|
424 https://github.com/6809/sbc09
|
|
425 Maintained by the original author and others.
|
|
426
|
|
427 Source:
|
|
428 http://groups.google.com/group/alt.sources/browse_thread/thread/8bfd60536ec34387/94a7cce3fdc5df67
|
|
429 Autor: Lennart Benschop lennart@blade.stack.urc.tue.nl,
|
|
430 lennartb@xs4all.nl (Webpage, Subject must start with "Your Homepage"!)
|
|
431
|
|
432 Newsgroups: alt.sources
|
|
433 From: lennart@blade.stack.urc.tue.nl (Lennart Benschop)
|
|
434 Date: 3 Nov 1993 15:21:16 GMT
|
|
435 Local: Mi 3 Nov. 1993 17:21
|
|
436 Subject: 6809 assembler and simulator (examples) 2/2
|
|
437
|
|
438
|
|
439 Homepage/Download links of Lennart Benschop:
|
|
440 http://lennartb.home.xs4all.nl/m6809.html
|
|
441 http://lennartb.home.xs4all.nl/sbc09.tar.gz
|
|
442 http://lennartb.home.xs4all.nl/A09.c
|
|
443
|
|
444
|
|
445 Emulator for 6809 written in Python, can run sbc09 ROM:
|
|
446 https://github.com/jedie/DragonPy/
|
|
447
|
|
448
|
|
449 Newer posting in alt.sources (1994):
|
|
450
|
|
451 Newsgroups: alt.sources
|
|
452 From: lenn...@blade.stack.urc.tue.nl (Lennart Benschop)
|
|
453 Date: 17 May 1994 08:13:25 GMT
|
|
454 Local: Di 17 Mai 1994 10:13
|
|
455 Subject: 6809 assembler/simulator (3 of 3)
|
|
456
|
|
457
|
|
458 Referenced by:
|
|
459
|
|
460 http://foldoc.org/6809
|
|
461 Reference points to posting with buggy version from 1993.
|
|
462
|
|
463 http://lennartb.home.xs4all.nl/m6809.html
|
|
464 BAD LINK: http://www.sandelman.ocunix.on.ca/People/Alan_DeKok/interests/6809.html
|
|
465 -> http://www.sandelman.ottawa.on.ca/People/Alan_DeKok/interests/
|
|
466 6809 specific site will be redirected, but does not exist.
|
|
467
|
|
468 Internet-Archiv:
|
|
469 https://web.archive.org/web/20070112041235/http://www.striker.ottawa.on.ca/6809/
|
|
470 2014-05-01: Lennart B. lennartb@xs4all.nl has been informed.
|
|
471
|
|
472 http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4308&start=60#p9750
|