Compare commits

...

3 Commits

Author SHA1 Message Date
John Snape 7dff84abb3
Delete lessons directory 2023-04-07 21:41:44 -07:00
John Snape f4898c9d1f
Update README.md 2023-04-07 21:40:31 -07:00
John Snape fe45becb49
Add files via upload 2023-04-07 21:38:49 -07:00
3 changed files with 161 additions and 53 deletions

View File

@ -1,3 +1,3 @@
# 6502code
Code I've collected while creating my Udemy 6502 Assembly Programming course.
Code I've collected while creating videos.
Also, two fonts I created that replicate the Apple II screen font and their official manual font.

View File

@ -1,52 +0,0 @@
08FC-00 09 6 .DA PROG_BEGIN
08FE-50 00 7 .DA PROG_END-PROG_BEGIN
FDF0- 8 cout .eq $fdf0
0900- 9
0900- 10 PROG_BEGIN
0900- 11 * part 1
0900-A9 C1 12 lda #"A" ; spelling out "APPLE"
0902-20 F0 FD 13 jsr cout ; and outputting using
0905-A9 F0 14 lda #"p" ; the built-in monitor
0907-20 F0 FD 15 jsr cout ; routines
090A-20 F0 FD 16 jsr cout ; directly printing
090D-A9 EC 17 lda #"l" ; one letter at a time
090F-20 F0 FD 18 jsr cout
0912-A9 E5 19 lda #"e"
0914-20 F0 FD 20 jsr cout
0917-60 21 rts
0918- 22
0918- 23 * part 2
0918-A2 05 24 ldx #$05 ; the number of letters
091A-BD 23 09 25 more2 lda text-1,x ; place in acc like before
091D-20 F0 FD 26 jsr cout ; print it
0920-CA 27 dex ; decrease x-index register by one (1)
0921-D0 F7 28 bne more2 ; still have more to print
0923-60 29 done rts
0924-E5 EC F0 F0
C1 30 text .hs e5ecf0f0c1 ; elppA (backwards Apple)
0929- 31
0929- 32 * part 3
0929-A2 00 33 ldx #$00 ; load our index with zero
092B-BD 36 09 34 more3 lda text2,x ; grab the text form below
092E-F0 F3 35 beq done ; if it's 00, no more text
0930-20 F0 FD 36 jsr cout ; print it
0933-E8 37 inx ; get next letter
0934-D0 F5 38 bne more3 ; branch if x is not equal to zero (0)
0936-C1 F0 F0 EC
E5 00 39 text2 .hs c1f0f0ece500 ; text in order (Apple)
093C- 40 ; with trailing zero (0)
093C- 41 * part 4
0000- 42 zploc .eq $00 ; define our zero-page address
093C-A9 36 43 lda #text2 ; put the pointer in zero-page
093E-85 00 44 sta zploc ; lower byte --> zero page
0940-A9 09 45 lda /text2 ; grab higher byte of address
0942-85 01 46 sta zploc+1 ; higher byte --> zero page
0944-A0 00 47 ldy #$00 ; set index to zero (0)
0946-B1 00 48 more4 lda (zploc),y ; grab indirect index to our text
0948-F0 D9 49 beq done ; if zero (0) then exit
094A-20 F0 FD 50 jsr cout ; print it!
094D-C8 51 iny ; increment our index to get the next letter
094E-D0 F6 52 bne more4 ; branch of y is not zero (0)
0950- 53
0950- 54 PROG_END

160
source/block_000.txt Normal file
View File

@ -0,0 +1,160 @@
xc
org $800
* Equates
cold equ $1200
key equ $c000
strobe equ $c010
home equ $fc58
cout equ $fded
mainread equ $C002
auxread equ $C003
mainwrite equ $C004
auxwrite equ $C005
* Code
hex 01
txa ; #$50 = %0101 0000
pha
lsr ; > 0010 1000
lsr ; > 0001 0100
lsr ; > 0000 1010
lsr ; > 0000 0101
ora #$C0 ; > #$C5
pha
sta reboot+2 ; in case we need to reboot
sta a1+2 ; fix entry address for ProDOS PC entry
sta a3+2 ; fix call address for PC entry
a1 lda $FFFF ; > $C5FF
clc
adc #3 ; get PC entry low byte
sta a3+1 ; set PC entry byte
* Check for 128K
jsr chk80
bcs error
* Check for 65C02 processor
lda #$99
clc
sed
adc #1
cld
bpl a2 ; success!
* Error routine
error lda #<msg1 ;4C 00 20
sta pr1+1
lda #>msg1
sta pr1+2
jsr print
sta strobe
restart lda key
bpl restart
sta strobe
reboot jmp $FF00
* Load blocks 000000-000018
a2 lda #<msg2
sta pr1+1
lda #>msg2
sta pr1+2
jsr print
a3 jsr $FFFF ; call PC
hex 01 ; read block
da rdblock
bcs error
inc rbuffer+1
inc rbuffer+1
inc rblock
* read equivalent of three tracks (24 blocks)
lda rblock
cmp #25 ; $19
bcc a3 ; blocks 0-24 > $1000-3FFF
pla ; $Cx
sta $fe
pla ; $x0
sta $ff
ldx $ff
txs
jmp cold
* print message routine
print jsr home ; home/clear screen
ldy #0
pr1 lda $ffff,y
beq pr2
jsr cout ; print ASCII char on screen
iny
bne pr1
pr2 rts
* check for 128K memory
chk80 clc
ldx #rend-routine
move lda routine,x
sta $100,x
dex
bpl move
jmp $0100
* routine from ProDOS 8
routine lda #$ee
sta auxread ; loads in aux $0200-BFFF
sta auxwrite
sta $0c00
sta $7c00
lda $0c00
cmp #$ee ; first check
bne noaux
asl $0c00
asl
cmp $0c00 ; second check
bne noaux
cmp $7c00 ; third check
bne auxil
noaux sec
bcs r1
auxil clc
r1 sta mainread
sta mainwrite
rts
rend equ *
* Messages
msg1 asc "ERROR LOADING.",8d
asc "PRESS ANY KEY TO RESTART:",00
msg2 asc "FIFTH programming language v0.01a",8d
asc "Just a moment...",00
* PC call block
rdblock hex 03 ; parameter count
hex 01 ; unit number
rbuffer hex 0010 ; $1000
rblock hex 000000 ; block number to read
xc
org $1200
cout equ $fded
monz equ $ff69 ; call-151
ldy #msgend-msg
loop lda msg,y
jsr cout
dey
bpl loop
jmp monz
msg rev "Reached $1200, second stage boot"
msgend equ *