Émulateur Motorola 6809 en ligne
En attendant que je configure une chaîne d'outillage pour développer sur MO5, je fais mes premiers pas en assembleur sur ce simulateur en ligne.
Et voici un petit "hello world" graphique à copier/coller/assembler/executer :
(edit : corrigé pour utiliser ABX au lieu de leax d,x)
Code : Tout sélectionner
;
; Enter your 6809 assembly language program here
; Press the Assemble button below
;
; No errors? Press Run in the panel to the left
; The CPU will stop on breakpoints (in red)
; Press Run to continue
;
const textscreenbase=$0400
const graphscreenbase=$0600
const nextline=$20
start:
leax helloworld,pcr
ldy #graphscreenbase
leay nextline,y
leay nextline,y
leay nextline,y
leay nextline,y
leay 11,y
jsr draw_glyphes
rts
**Draw a run of glyphes.
* --->
* @param x ptr to null terminated string of chars (US ASCII encoding)
* @param y ptr to first byte of display
* <---
* @no_change
* ----
draw_glyphes:
pshs a,b,x,y
draw_glyphes_loop:
ldb ,x+ ; b = next char
beq draw_glyphes_done
; ptr glyph_map[a] = glyph_map + 2*a
lslb
pshs x ;--> setup call
leax glyph_map,pcr
abx
ldx ,x
bsr draw_glyph
puls x ;<-- tear down call
leay 1,y
bra draw_glyphes_loop
draw_glyphes_done:
puls a,b,x,y
rts
**Draw a glyph.
* --->
* @param x ptr to glyph data
* @param y ptr to first byte of display
* <---
* @no_change
* ----
draw_glyph:
pshs a,b,x,y
ldb #8
draw_glyph_loop:
lda ,x+
sta ,y
leay nextline,y
decb
bne draw_glyph_loop
draw_glyph_done:
puls a,b,x,y
rts
helloworld:
fcb "HELLO WORLD",0
glyph_nul:
fcb $7f,$41,$41,$41,$41,$41,$7f,$00
glyph_spc:
fcb $00,$00,$00,$00,$00,$00,$00,$00
glyph_d:
fcb $7c,$66,$66,$66,$66,$66,$7c,$00
glyph_e:
fcb $7e,$60,$60,$78,$60,$60,$7e,$00
glyph_h:
fcb $66,$66,$66,$7e,$66,$66,$66,$00
glyph_l:
fcb $60,$60,$60,$60,$60,$60,$7e,$00
glyph_o:
fcb $3c,$66,$66,$66,$66,$66,$3c,$00
glyph_r:
fcb $7c,$66,$66,$7c,$66,$66,$63,$00
glyph_w:
fcb $63,$6b,$6b,$6b,$7f,$36,$22,$00
glyph_map:
; 0 to 15
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
; 16 to 31
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
; 32 to 47
fdb glyph_spc,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
; 48 to 63
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
; 64 to 79
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_d ,glyph_e ,glyph_nul,glyph_nul
fdb glyph_h ,glyph_nul,glyph_nul,glyph_nul
fdb glyph_l ,glyph_nul,glyph_nul,glyph_o
; 80 to 95
fdb glyph_nul,glyph_nul,glyph_r ,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_w
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
; 96 to 111
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_d ,glyph_e ,glyph_nul,glyph_nul
fdb glyph_h ,glyph_nul,glyph_nul,glyph_nul
fdb glyph_l ,glyph_nul,glyph_nul,glyph_o
; 112 to 127
fdb glyph_nul,glyph_nul,glyph_r ,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_w
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul
fdb glyph_nul,glyph_nul,glyph_nul,glyph_nul