Created
December 8, 2014 18:04
-
-
Save petrihakkinen/e9f96bbbc7dc5d8e3931 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const uint8_t rom[] = { | |
// clear screen | |
// screen memory starts at $c000 and is 50*25 = 1600 bytes long | |
// clear first 6*256 = 1536 bytes | |
0xa9, 32, // lda #32 'space' | |
0xa2, 0, // ldx #0 | |
//clearloop: | |
0x9d, 0x00, 0xc0, // sta $c000,x | |
0x9d, 0x00, 0xc1, // sta $c100,x | |
0x9d, 0x00, 0xc2, // sta $c200,x | |
0x9d, 0x00, 0xc3, // sta $c300,x | |
0x9d, 0x00, 0xc4, // sta $c400,x | |
0x9d, 0x00, 0xc5, // sta $c500,x | |
0xe8, // inx | |
0xd0, -21, // bne clearloop | |
// clear remaining 64 bytes | |
0xa2, 64, // ldx #64 | |
//clearloop2: | |
0xca, // dex | |
0x9d, 0x00, 0xc6, // sta $c600,x | |
0xd0, -6, // bne clearloop2 | |
// set up screen pointer in zero page | |
0xa2, 32, // ldx #32 <-- number of rows here | |
0xa9, 0x00, // lda #$00 | |
0x85, 0x00, // sta $0 | |
0xa9, 0xc0, // lda #$c0 | |
0x85, 0x01, // sta $1 | |
//ploop: | |
// print ERIC-1 (32 bytes) | |
0xa9, 5, // lda 'E' | |
0xa0, 0, // ldy #0 | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
0xa9, 18, // lda 'R' | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
0xa9, 9, // lda 'I' | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
0xa9, 3, // lda 'C' | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
0xa9, 45, // lda '-' | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
0xa9, 49, // lda '1' | |
0x91, 0x00, // sta ($0),y | |
0xc8, // iny | |
// increment pointer (13 bytes) | |
0x18, // clc | |
0xa5, 0x00, // lda $0 | |
0x69, 51, // adc #51 | |
0x85, 0x00, // sta $0 | |
0xa5, 0x01, // lda $1 | |
0x69, 0, // adc #0 | |
0x85, 0x01, // sta $1 | |
// delay (12 bytes) | |
0xda, // phx | |
0xa0, 0x80, // ldy #$80 | |
//delay1: | |
0xa2, 0xff, // ldx #$ff | |
//delay2: | |
0xca, // dex | |
0xd0, -3, // bne delay2 | |
0x88, // dey | |
0xd0, -8, // bne delay1 | |
0xfa, // plx | |
0xca, // dex | |
0xd0, -60, // bne ploop | |
0x4c, 0x00, 0xf0, // jmp $f000 jump to start of program | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment