Apple2-IO-RPi/Apple2/CommandFirmware.lst
2021-03-28 08:12:58 -04:00

109 lines
4.2 KiB
Plaintext

ca65 V2.19 - Git 59c58ac
Main file : CommandFirmware.asm
Current file: CommandFirmware.asm
000000r 1 ;ProDOS Zero Page
000000r 1 Command = $42 ;ProDOS Command
000000r 1 Unit = $43 ;ProDOS unit (SDDD0000)
000000r 1 BufferLo = $44
000000r 1 BufferHi = $45
000000r 1 BlockLo = $46
000000r 1 BlockHi = $47
000000r 1
000000r 1 ; ProDOS Error Codes
000000r 1 IOError = $27
000000r 1 NoDevice = $28
000000r 1 WriteProtect = $2B
000000r 1
000000r 1 InputByte = $c08e+SLOT*$10
000000r 1 OutputByte = $c08d+SLOT*$10
000000r 1 InputFlags = $c08b+SLOT*$10
000000r 1 OutputFlags = $c087+SLOT*$10
000000r 1
000000r 1 ReadBlockCommand = $01
000000r 1 WriteBlockCommand = $02
000000r 1 GetTimeCommand = $03
000000r 1 ChangeDriveCommand = $04
000000r 1 ExecCommand = $05
000000r 1 LoadFileCommand = $06
000000r 1 SaveFileCommand = $07
000000r 1
000000r 1 .org SLOT*$100 + $C000
00C500 1 ;ID bytes for booting and drive detection
00C500 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
00C502 1 E0 00 cpx #$00 ; Apple Autostart ROM
00C504 1 E0 03 cpx #$03 ;
00C506 1
00C506 1 A2 50 ldx #SLOT*$10
00C508 1 86 2B stx $2b
00C50A 1 86 43 stx Unit
00C50C 1
00C50C 1 ;force EPROM to second page on boot
00C50C 1 A9 3F lda #$3f ;set all flags high and page 3 of EPROM for menu
00C50E 1 PageJump:
00C50E 1 8D D7 C0 sta OutputFlags
00C511 1 4C 19 C5 jmp Start ;this jump is only called if coming in from PageJump with A=$2f
00C514 1
00C514 1 ;entry points for ProDOS
00C514 1 DriverEntry:
00C514 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
00C516 1 8D D7 C0 sta OutputFlags
00C519 1
00C519 1 Start:
00C519 1
00C519 1 ; Put command firmware here
00C519 1 ;
00C519 1 ;
00C519 1 ;
00C519 1
00C519 1
00C519 1 SendByte:
00C519 1 48 pha
00C51A 1 waitWrite:
00C51A 1 AD DB C0 lda InputFlags
00C51D 1 2A rol
00C51E 1 2A rol
00C51F 1 B0 F9 bcs waitWrite
00C521 1 68 pla
00C522 1 8D DD C0 sta OutputByte
00C525 1 A9 0E lda #$0e ; set bit 0 low to indicate write started
00C527 1 8D D7 C0 sta OutputFlags
00C52A 1 finishWrite:
00C52A 1 AD DB C0 lda InputFlags
00C52D 1 2A rol
00C52E 1 2A rol
00C52F 1 90 F9 bcc finishWrite
00C531 1 A9 0F lda #$0f
00C533 1 8D D7 C0 sta OutputFlags
00C536 1 60 rts
00C537 1
00C537 1 GetByte:
00C537 1 A9 0D lda #$0d ;set read flag low
00C539 1 8D D7 C0 sta OutputFlags
00C53C 1 waitRead:
00C53C 1 AD DB C0 lda InputFlags
00C53F 1 2A rol
00C540 1 B0 FA bcs waitRead
00C542 1 AD DE C0 lda InputByte
00C545 1 48 pha
00C546 1 A9 0F lda #$0f ;set all flags high
00C548 1 8D D7 C0 sta OutputFlags
00C54B 1 finishRead:
00C54B 1 AD DB C0 lda InputFlags
00C54E 1 2A rol
00C54F 1 90 FA bcc finishRead
00C551 1 68 pla
00C552 1 end:
00C552 1 60 rts
00C553 1
00C553 1 00 00 00 00 .repeat 251-<end
00C557 1 00 00 00 00
00C55B 1 00 00 00 00
00C5FC 1 .byte 0
00C5FC 1 .endrepeat
00C5FC 1 00 00 .byte 0,0 ;0000 blocks = check status
00C5FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
00C5FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
00C600 1
00C600 1