2012-04-23 04:43:45 +00:00
|
|
|
;;
|
|
|
|
;; Output the string 'Hello, World!'
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2012-12-06 07:19:34 +00:00
|
|
|
.alias iobase $8800
|
2012-05-29 05:18:35 +00:00
|
|
|
.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
|
2012-12-06 07:19:34 +00:00
|
|
|
lda #$0b
|
2012-05-29 05:18:35 +00:00
|
|
|
sta iocmd ; Set command status
|
2012-10-15 00:56:19 +00:00
|
|
|
lda #$1a
|
|
|
|
sta ioctrl ; 0 stop bits, 8 bit word, 2400 baud
|
2012-05-29 05:18:35 +00:00
|
|
|
|
2012-10-15 00:56:19 +00:00
|
|
|
init: ldx #$00 ; Initialize index
|
2012-05-29 05:18:35 +00:00
|
|
|
|
2012-10-15 00:56:19 +00:00
|
|
|
loop: lda iostatus
|
|
|
|
and #$10 ; Is the tx register empty?
|
|
|
|
beq loop ; No, wait for it to empty
|
|
|
|
lda string,x ; Otherwise, load the string pointer
|
|
|
|
beq init ; If the char is 0, re-init
|
|
|
|
sta iobase ; Otherwise, transmit
|
2012-05-29 05:18:35 +00:00
|
|
|
|
2012-10-15 00:56:19 +00:00
|
|
|
inx ; Increment string pointer.
|
|
|
|
jmp loop ; Repeat write.
|
2012-04-23 04:43:45 +00:00
|
|
|
|
|
|
|
string: .byte "Hello, 6502 world! ", 0
|