Fix a bug with the branch instructions not being able to move backward (offsets were unsigned)
parent
05fcb7b7f7
commit
ecc7b9b73f
@ -1,37 +1,31 @@
|
|||||||
# Load string into memory at the output address
|
|
||||||
0xA2, b'H', # LDX H
|
; hello world example
|
||||||
0x86, output_addr, # STX
|
; for win2c64 by Aart Bik
|
||||||
0xA2, b'e', # LDX e
|
; http://www.aartbik.com/
|
||||||
0x86, output_addr + 1, # STX
|
|
||||||
0xA2, b'l', # LDX l
|
; Adapted for the RE6502 emulator simple test machine
|
||||||
0x86, output_addr + 2, # STX
|
|
||||||
0xA2, b'l', # LDX l
|
strout .equ $00A0 ; console output address
|
||||||
0x86, output_addr + 3, # STX
|
print_flag .equ $009E ; console output address
|
||||||
0xA2, b'o', # LDX o
|
|
||||||
0x86, output_addr + 4, # STX
|
main .org $0200 ; program load address for the simple test machine
|
||||||
|
ldx #0
|
||||||
0xA2, b' ', # LDX ' '
|
loop lda text,x
|
||||||
0x86, output_addr + 5, # STX
|
sta strout,x
|
||||||
|
inx
|
||||||
0xA2, b'w', # LDX w
|
cpx #11
|
||||||
0x86, output_addr + 6, # STX
|
bne loop
|
||||||
0xA2, b'o', # LDX o
|
|
||||||
0x86, output_addr + 7, # STX
|
; null terminate the string
|
||||||
0xA2, b'r', # LDX r
|
lda #0
|
||||||
0x86, output_addr + 8, # STX
|
sta strout,x
|
||||||
0xA2, b'l', # LDX l
|
|
||||||
0x86, output_addr + 9, # STX
|
; Set flag to do the print
|
||||||
0xA2, b'd', # LDX d
|
ldx #1 ; 0xA2, 0x01,
|
||||||
0x86, output_addr + 10, # STX
|
stx print_flag ; 0x86, 0x9E, ; Print string flag is at 0x9E
|
||||||
0xA2, b'!', # LDX !
|
|
||||||
0x86, output_addr + 11, # STX
|
; End the program
|
||||||
|
rts ; 0x60
|
||||||
0xA2, 0x00, # LDX 0
|
|
||||||
0x86, output_addr + 12, # STX
|
; Variables
|
||||||
|
text .byte "HELLO WORLD"
|
||||||
# Set flag to do the print
|
|
||||||
0xA2, 0x01, # LDX 1
|
|
||||||
0x86, print_flag_addr, # STX
|
|
||||||
|
|
||||||
# End the program
|
|
||||||
0x60 # RTS
|
|
||||||
Loading…
Reference in New Issue