mirror of
https://github.com/tjboldt/Apple2-IO-RPi.git
synced 2024-11-25 06:31:22 +00:00
194 lines
7.4 KiB
Plaintext
194 lines
7.4 KiB
Plaintext
ca65 V2.18 - N/A
|
|
Main file : MenuFirmware.asm
|
|
Current file: MenuFirmware.asm
|
|
|
|
000000r 1 ; Copyright Terence J. Boldt (c)2020-2022
|
|
000000r 1 ; Use of this source code is governed by an MIT
|
|
000000r 1 ; license that can be found in the LICENSE file.
|
|
000000r 1
|
|
000000r 1 ; This file contains the source for the firmware
|
|
000000r 1 ; that displays the copyright message on boot
|
|
000000r 1 ; and checks for the RPi status to be ready before
|
|
000000r 1 ; attempting to boot
|
|
000000r 1
|
|
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 ResetCommand = $00
|
|
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 MenuCommand = $08
|
|
000000r 1
|
|
000000r 1 Wait = $fca8
|
|
000000r 1 PrintChar = $fded
|
|
000000r 1 Home = $fc58
|
|
000000r 1 ReadChar = $fd0c
|
|
000000r 1 BasCalc = $fbc1
|
|
000000r 1 htab = $24
|
|
000000r 1 vtab = $25
|
|
000000r 1 BasL = $28
|
|
000000r 1 htab80 = $057b
|
|
000000r 1
|
|
000000r 1 .org SLOT*$100 + $C000
|
|
00C700 1 ;ID bytes for booting and drive detection
|
|
00C700 1 E0 20 cpx #$20 ;ID bytes for ProDOS and the
|
|
00C702 1 E0 00 cpx #$00 ; Apple Autostart ROM
|
|
00C704 1 E0 03 cpx #$03 ;
|
|
00C706 1
|
|
00C706 1 A2 70 ldx #SLOT*$10
|
|
00C708 1 86 2B stx $2b
|
|
00C70A 1 86 43 stx Unit
|
|
00C70C 1
|
|
00C70C 1 ;force EPROM to second page on boot
|
|
00C70C 1 A9 3F lda #$3f ;set all flags high and page 1 of EPROMi
|
|
00C70E 1 PageJump:
|
|
00C70E 1 8D F7 C0 sta OutputFlags
|
|
00C711 1 4C 19 C7 jmp Start
|
|
00C714 1
|
|
00C714 1 ;entry points for ProDOS
|
|
00C714 1 DriverEntry:
|
|
00C714 1 A9 0F lda #$0f ;set all flags high and page 0 of EPROM
|
|
00C716 1 8D F7 C0 sta OutputFlags
|
|
00C719 1 ;since the firmware page changes to 0, this falls through to the driver
|
|
00C719 1
|
|
00C719 1 Start:
|
|
00C719 1 A9 F0 lda #$f0 ;restore COUT after PR# called
|
|
00C71B 1 85 36 sta $36
|
|
00C71D 1 A9 FD lda #$fd
|
|
00C71F 1 85 37 sta $37
|
|
00C721 1 ;jsr Home ;clear screen and show menu options
|
|
00C721 1 A9 10 lda #$10
|
|
00C723 1 85 25 sta vtab
|
|
00C725 1 20 C1 FB jsr BasCalc
|
|
00C728 1 A0 00 ldy #$00
|
|
00C72A 1 PrintString:
|
|
00C72A 1 B9 B4 C7 lda Text,y
|
|
00C72D 1 F0 08 beq WaitForRPi
|
|
00C72F 1 09 80 ora #$80
|
|
00C731 1 20 ED FD jsr PrintChar
|
|
00C734 1 C8 iny
|
|
00C735 1 D0 F3 bne PrintString
|
|
00C737 1
|
|
00C737 1 WaitForRPi:
|
|
00C737 1 AD FB C0 lda InputFlags
|
|
00C73A 1 2A rol
|
|
00C73B 1 B0 0D bcs Reset
|
|
00C73D 1 A9 FF lda #$ff
|
|
00C73F 1 20 A8 FC jsr Wait
|
|
00C742 1 A9 AE lda #'.'+$80
|
|
00C744 1 20 ED FD jsr PrintChar
|
|
00C747 1 4C 37 C7 jmp WaitForRPi
|
|
00C74A 1
|
|
00C74A 1 Reset:
|
|
00C74A 1 A9 DF lda #'_'|$80
|
|
00C74C 1 20 ED FD jsr PrintChar
|
|
00C74F 1 A9 00 lda #ResetCommand
|
|
00C751 1 20 7A C7 jsr SendByte
|
|
00C754 1 A9 88 lda #$88
|
|
00C756 1 20 ED FD jsr PrintChar
|
|
00C759 1 A9 AE lda #'.'|$80
|
|
00C75B 1 20 ED FD jsr PrintChar
|
|
00C75E 1 20 98 C7 jsr GetByte
|
|
00C761 1 F0 03 beq Ok
|
|
00C763 1 4C 4A C7 jmp Reset
|
|
00C766 1
|
|
00C766 1 Ok:
|
|
00C766 1 A9 8D lda #$8D
|
|
00C768 1 20 ED FD jsr PrintChar
|
|
00C76B 1 A9 CF lda #'O'|$80
|
|
00C76D 1 20 ED FD jsr PrintChar
|
|
00C770 1 A9 CB lda #'K'|$80
|
|
00C772 1 20 ED FD jsr PrintChar
|
|
00C775 1
|
|
00C775 1 Boot:
|
|
00C775 1 A9 0F lda #$0f
|
|
00C777 1 4C 0E C7 jmp PageJump
|
|
00C77A 1
|
|
00C77A 1 SendByte:
|
|
00C77A 1 48 pha
|
|
00C77B 1 waitWrite:
|
|
00C77B 1 AD FB C0 lda InputFlags
|
|
00C77E 1 2A rol
|
|
00C77F 1 2A rol
|
|
00C780 1 B0 F9 bcs waitWrite
|
|
00C782 1 68 pla
|
|
00C783 1 8D FD C0 sta OutputByte
|
|
00C786 1 A9 3E lda #$3e ; set bit 0 low to indicate write started
|
|
00C788 1 8D F7 C0 sta OutputFlags
|
|
00C78B 1 finishWrite:
|
|
00C78B 1 AD FB C0 lda InputFlags
|
|
00C78E 1 2A rol
|
|
00C78F 1 2A rol
|
|
00C790 1 90 F9 bcc finishWrite
|
|
00C792 1 A9 3F lda #$3f
|
|
00C794 1 8D F7 C0 sta OutputFlags
|
|
00C797 1 60 rts
|
|
00C798 1
|
|
00C798 1 GetByte:
|
|
00C798 1 A9 3D lda #$3d ;set read flag low
|
|
00C79A 1 8D F7 C0 sta OutputFlags
|
|
00C79D 1 waitRead:
|
|
00C79D 1 AD FB C0 lda InputFlags
|
|
00C7A0 1 2A rol
|
|
00C7A1 1 B0 FA bcs waitRead
|
|
00C7A3 1 AD FE C0 lda InputByte
|
|
00C7A6 1 48 pha
|
|
00C7A7 1 A9 3F lda #$3f ;set all flags high
|
|
00C7A9 1 8D F7 C0 sta OutputFlags
|
|
00C7AC 1 finishRead:
|
|
00C7AC 1 AD FB C0 lda InputFlags
|
|
00C7AF 1 2A rol
|
|
00C7B0 1 90 FA bcc finishRead
|
|
00C7B2 1 68 pla
|
|
00C7B3 1 end:
|
|
00C7B3 1 60 rts
|
|
00C7B4 1
|
|
00C7B4 1 ; NOTE: The text below exactly fills the remaining 256 bytes of firmware
|
|
00C7B4 1 Text:
|
|
00C7B4 1 41 70 70 6C .byte "Apple2-IO-RPi",$8d
|
|
00C7B8 1 65 32 2D 49
|
|
00C7BC 1 4F 2D 52 50
|
|
00C7C0 1 69 8D
|
|
00C7C2 1 28 63 29 32 .byte "(c)2020-2022 Terence J. Boldt",$8d
|
|
00C7C6 1 30 32 30 2D
|
|
00C7CA 1 32 30 32 32
|
|
00C7CE 1 20 54 65 72
|
|
00C7D2 1 65 6E 63 65
|
|
00C7D6 1 20 4A 2E 20
|
|
00C7DA 1 42 6F 6C 64
|
|
00C7DE 1 74 8D
|
|
00C7E0 1 8D .byte $8d
|
|
00C7E1 1 57 61 69 74 .byte "Waiting for RPi FW:000F...",$00
|
|
00C7E5 1 69 6E 67 20
|
|
00C7E9 1 66 6F 72 20
|
|
00C7ED 1 52 50 69 20
|
|
00C7F1 1 46 57 3A 30
|
|
00C7F5 1 30 30 46 2E
|
|
00C7F9 1 2E 2E 00
|
|
00C7FC 1
|
|
00C7FC 1 00 00 .byte 0,0 ;0000 blocks = check status
|
|
00C7FE 1 07 .byte 7 ;bit set(0=status 1=read 2=write) unset(3=format, 4/5=number of volumes, 6=interruptable, 7=removable)
|
|
00C7FF 1 14 .byte DriverEntry&$00FF ;low byte of entry
|
|
00C800 1
|
|
00C800 1
|