stuffy 6502
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
; count.asm - prints "0123456789" then a newline and halts.
|
||||
; Exercises ADC, CMP, branches and a loop.
|
||||
|
||||
.export start
|
||||
|
||||
start:
|
||||
lda #'0'
|
||||
loop:
|
||||
sta $F001
|
||||
clc
|
||||
adc #$01
|
||||
cmp #$3A ; '9' + 1
|
||||
bne loop
|
||||
lda #$0A ; newline
|
||||
sta $F001
|
||||
lda #$00
|
||||
sta $F003
|
||||
rts
|
||||
@@ -0,0 +1,24 @@
|
||||
; hello.asm - single-object demo.
|
||||
; Prints "Hello, World!" through the memory-mapped terminal at $F001,
|
||||
; then writes to the halt register at $F003.
|
||||
|
||||
.export start
|
||||
.org $0600
|
||||
|
||||
jmp start
|
||||
|
||||
msg:
|
||||
.asciiz "Hello, World!"
|
||||
|
||||
start:
|
||||
ldx #0
|
||||
loop:
|
||||
lda msg,x
|
||||
beq done
|
||||
sta $F001
|
||||
inx
|
||||
jmp loop
|
||||
done:
|
||||
lda #$00
|
||||
sta $F003
|
||||
rts
|
||||
@@ -0,0 +1,23 @@
|
||||
; main.asm - cross-object demo, part 2.
|
||||
; Imports `putc` from putc.wo and prints "Hello, 6502!".
|
||||
|
||||
.export start
|
||||
.import putc
|
||||
|
||||
jmp start
|
||||
|
||||
msg:
|
||||
.asciiz "Hello, 6502!"
|
||||
|
||||
start:
|
||||
ldx #0
|
||||
loop:
|
||||
lda msg,x
|
||||
beq done
|
||||
jsr putc
|
||||
inx
|
||||
jmp loop
|
||||
done:
|
||||
lda #$00
|
||||
sta $F003
|
||||
rts
|
||||
@@ -0,0 +1,9 @@
|
||||
; putc.asm - cross-object demo, part 1.
|
||||
; Exports `putc`: write the byte in A to the terminal and return.
|
||||
; This object is relocatable; the linker places it at the load address.
|
||||
|
||||
.export putc
|
||||
|
||||
putc:
|
||||
sta $F001
|
||||
rts
|
||||
Reference in New Issue
Block a user