Open main menu

CDOT Wiki β

Changes

6502 Emulator Example Code

425 bytes added, 16:13, 13 September 2022
no edit summary
[[Category:6502]][[Category:Assembly Language]][[Category:SPO600]]This is a collection of simple examples of [[6502]] [[assembly language|assembly language]] code which will run in the [[6502 Emulator]]. To use this code, copy and paste one of these programs into the text box of the [http://6502.cdot.systems emulator].
'''This code is Copyright ©2020-2022 Seneca College of Applied Arts and Technology. Each of these programs is free software; you can redistribute them and/or modify them under the terms of the [https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html|GNU General Public License] as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.'''
=== Without using the ROM routines ===
define SCREEN $f000 ; location of screen memory ldy #$00 ; index value (character we're currently processing)
char: lda text,y ; get a character from address (text + Y) beq done ; if the character is NULL, branch to done sta SCREEN,y ; store character at (SCREEN + Y) iny ; increment Y (go to next character) bne char ; repeat loop
done: brk ; when we're done, break (stop the program)
text: ; this is the text message
dcb "6","5","0","2",32,"w","a","s",32,"h","e","r","e",".",00