Added more files
This commit is contained in:
parent
daa48611c0
commit
1713b324ec
|
@ -0,0 +1,5 @@
|
||||||
|
# 6502
|
||||||
|
|
||||||
|
Various 6502 related pieces, not 100% sure on licensing, but all the bits are based on the Ben Eater youtube series at:
|
||||||
|
|
||||||
|
()[https://www.youtube.com/watch?v=LnzuMJLZRdU&list=PLowKtXNTBypFbtuVMUVXNR0z1mu7dp7eH]
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
|
||||||
|
vasm6502_oldstyle -Fbin -dotdir -o OUTPUT.bin INPUT.s
|
177
hello-world.s
177
hello-world.s
|
@ -9,6 +9,8 @@ RS = %00100000
|
||||||
|
|
||||||
.org $8000
|
.org $8000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
lda #%11111111 ; Set all pins on port B to output
|
lda #%11111111 ; Set all pins on port B to output
|
||||||
sta DDRB
|
sta DDRB
|
||||||
|
@ -17,33 +19,63 @@ reset:
|
||||||
sta DDRA
|
sta DDRA
|
||||||
|
|
||||||
lda #%00111000 ; Set 8-bit mode; 2-line display; 5x8 font
|
lda #%00111000 ; Set 8-bit mode; 2-line display; 5x8 font
|
||||||
sta PORTB
|
jsr send_inst
|
||||||
lda #0 ; Clear RS/RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #E ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #0 ; Clear RS/RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #%00001110 ; Display on; cursor on; blink off
|
lda #%00001110 ; Display on; cursor on; blink off
|
||||||
sta PORTB
|
jsr send_inst
|
||||||
lda #0 ; Clear RS/RW/E bits
|
|
||||||
sta PORTA
|
lda #%00000001 ; Reset display
|
||||||
lda #E ; Set E bit to send instruction
|
jsr send_inst
|
||||||
sta PORTA
|
|
||||||
lda #0 ; Clear RS/RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #%00000110 ; Increment and shift cursor; don't shift display
|
lda #%00000110 ; Increment and shift cursor; don't shift display
|
||||||
|
jsr send_inst
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
print:
|
||||||
|
lda message,x
|
||||||
|
beq loop
|
||||||
|
jsr send_data
|
||||||
|
inx
|
||||||
|
jmp print
|
||||||
|
|
||||||
|
loop:
|
||||||
|
jmp loop
|
||||||
|
|
||||||
|
message: .asciiz "Hello again, Kiddies!"
|
||||||
|
|
||||||
|
lcd_wait:
|
||||||
|
pha
|
||||||
|
lda #%00000000 ; PORT B to INPUT
|
||||||
|
sta DDRB
|
||||||
|
lcd_busy:
|
||||||
|
lda #RW
|
||||||
|
sta PORTA
|
||||||
|
lda #(RW | E)
|
||||||
|
sta PORTA
|
||||||
|
lda PORTB
|
||||||
|
and #%10000000
|
||||||
|
bne lcd_busy
|
||||||
|
|
||||||
|
lda #RW
|
||||||
|
sta PORTA
|
||||||
|
lda #%11111111 ; PORT B to output
|
||||||
|
sta DDRB
|
||||||
|
pla
|
||||||
|
rts
|
||||||
|
|
||||||
|
send_inst:
|
||||||
|
jsr lcd_wait
|
||||||
sta PORTB
|
sta PORTB
|
||||||
lda #0 ; Clear RS/RW/E bits
|
lda #0 ; Clear RS/RW/E bits
|
||||||
sta PORTA
|
sta PORTA
|
||||||
lda #E ; Set E bit to send instruction
|
lda #E ; Set E bit to send instruction
|
||||||
sta PORTA
|
sta PORTA
|
||||||
lda #0 ; Clear RS/RW/E bits
|
lda #0 ; Clear RS/RW/E bits
|
||||||
sta PORTA
|
sta PORTA
|
||||||
|
rts
|
||||||
|
|
||||||
lda #"H"
|
send_data:
|
||||||
|
jsr lcd_wait
|
||||||
sta PORTB
|
sta PORTB
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
sta PORTA
|
sta PORTA
|
||||||
|
@ -51,117 +83,8 @@ reset:
|
||||||
sta PORTA
|
sta PORTA
|
||||||
lda #RS ; Clear E bits
|
lda #RS ; Clear E bits
|
||||||
sta PORTA
|
sta PORTA
|
||||||
|
rts
|
||||||
|
|
||||||
lda #"e"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"l"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"l"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"o"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #","
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #" "
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"w"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"o"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"r"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"l"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"d"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
lda #"!"
|
|
||||||
sta PORTB
|
|
||||||
lda #RS ; Set RS; Clear RW/E bits
|
|
||||||
sta PORTA
|
|
||||||
lda #(RS | E) ; Set E bit to send instruction
|
|
||||||
sta PORTA
|
|
||||||
lda #RS ; Clear E bits
|
|
||||||
sta PORTA
|
|
||||||
|
|
||||||
loop:
|
|
||||||
jmp loop
|
|
||||||
|
|
||||||
.org $fffc
|
.org $fffc
|
||||||
.word reset
|
.word reset
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
PORTB = $6000
|
||||||
|
PORTA = $6001
|
||||||
|
DDRB = $6002
|
||||||
|
DDRA = $6003
|
||||||
|
|
||||||
|
E = %10000000
|
||||||
|
RW = %01000000
|
||||||
|
RS = %00100000
|
||||||
|
|
||||||
|
.org $8000
|
||||||
|
|
||||||
|
reset:
|
||||||
|
lda #%11111111 ; Set all pins on port B to output
|
||||||
|
sta DDRB
|
||||||
|
|
||||||
|
lda #%11100000 ; Set top 3 pins on port A to output
|
||||||
|
sta DDRA
|
||||||
|
|
||||||
|
lda #%00111000 ; Set 8-bit mode; 2-line display; 5x8 font
|
||||||
|
sta PORTB
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #E ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #%00001110 ; Display on; cursor on; blink off
|
||||||
|
sta PORTB
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #E ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #%00000110 ; Increment and shift cursor; don't shift display
|
||||||
|
sta PORTB
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #E ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #0 ; Clear RS/RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"H"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"e"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"l"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"l"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"o"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #","
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #" "
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"k"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"i"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"d"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"d"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"i"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"e"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"s"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
lda #"!"
|
||||||
|
sta PORTB
|
||||||
|
lda #RS ; Set RS; Clear RW/E bits
|
||||||
|
sta PORTA
|
||||||
|
lda #(RS | E) ; Set E bit to send instruction
|
||||||
|
sta PORTA
|
||||||
|
lda #RS ; Clear E bits
|
||||||
|
sta PORTA
|
||||||
|
|
||||||
|
loop:
|
||||||
|
jmp loop
|
||||||
|
|
||||||
|
.org $fffc
|
||||||
|
.word reset
|
||||||
|
.word $0000
|
|
@ -0,0 +1 @@
|
||||||
|
minipro -p AT28C256 -w OUTPUT.bin
|
Loading…
Reference in New Issue