2012-04-23 04:43:45 +00:00
|
|
|
;;
|
|
|
|
;; Output the string 'Hello, World!'
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2012-05-29 05:18:35 +00:00
|
|
|
.alias iobase $c000
|
|
|
|
.alias iostatus [iobase + 1]
|
|
|
|
.alias iocmd [iobase + 2]
|
|
|
|
.alias ioctrl [iobase + 3]
|
2012-04-23 04:43:45 +00:00
|
|
|
|
|
|
|
.org $0300
|
|
|
|
|
2012-05-29 05:18:35 +00:00
|
|
|
start: cli
|
|
|
|
lda #$09
|
|
|
|
sta iocmd ; Set command status
|
|
|
|
lda #$16
|
|
|
|
sta ioctrl ; 0 stop bits, 8 bit word, 300 baud
|
|
|
|
ldx #$00 ; Initialize index
|
|
|
|
|
2012-04-23 04:43:45 +00:00
|
|
|
loop: lda string,x
|
|
|
|
beq start ; If A is 0, loop back and start again
|
2012-05-29 05:18:35 +00:00
|
|
|
|
|
|
|
write: lda iostatus
|
|
|
|
and #$10 ; Load ACIA status. Is output buffer empty?
|
|
|
|
beq write ; If not, loop back and try again,
|
|
|
|
lda string,x
|
|
|
|
sta iobase ; Otherwise, write to output.
|
|
|
|
|
|
|
|
inx
|
2012-04-23 04:43:45 +00:00
|
|
|
jmp loop ; Repeat.
|
|
|
|
|
|
|
|
string: .byte "Hello, 6502 world! ", 0
|