I Stumbled Upon...

Started by
11 comments, last by LennyLen 11 years, 5 months ago
A hello world program in 6502
[source lang="bash"]a_cr = $0d ; Carriage return.
bsout = $ffd2 ; KERNAL ROM, output a character to current device.

.code

ldx #0 ; Starting index 0 in X register.
printnext:
lda text,x ; Get character from string.
beq done ; If we read a 0 we're done.
jsr bsout ; Output character.
inx ; Increment index to next character.
bne printnext ; Repeat if index doesn't overflow to 0.
done:
rts ; Return from subroutine.

.rodata

text:
.byte "Goodbye, World!", a_cr, 0[/source]

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

Advertisement
That is quite crazy, but now as crazy as I originally thought. I assumed the language looked like binary, with no english words.

Easiest way to make games, I love LÖVE && My dev blog/project

*Too lazy to renew domain, ignore above links


I assumed the language looked like binary, with no english words.


Well, all the English words in that snippet were either comments or labels.

This topic is closed to new replies.

Advertisement