Smartport.s added

This commit is contained in:
Florian Reitz 2018-05-09 21:39:02 +02:00
parent fe9ae43e09
commit 2daaa107a0
6 changed files with 80 additions and 44 deletions

View File

@ -19,6 +19,7 @@
<None Include="src\AppleIISd.s" /> <None Include="src\AppleIISd.s" />
<None Include="src\Helper.s" /> <None Include="src\Helper.s" />
<None Include="src\ProDOS.s" /> <None Include="src\ProDOS.s" />
<None Include="src\Smartport.s" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{9EA7EC3D-1771-420F-932F-231A35ED1200}</ProjectGuid> <ProjectGuid>{9EA7EC3D-1771-420F-932F-231A35ED1200}</ProjectGuid>

View File

@ -19,6 +19,9 @@
<None Include="src\ProDOS.s"> <None Include="src\ProDOS.s">
<Filter>src</Filter> <Filter>src</Filter>
</None> </None>
<None Include="src\Smartport.s">
<Filter>src</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="src"> <Filter Include="src">

View File

@ -11,22 +11,35 @@
; ;
;******************************* ;*******************************
; Memory defines ; ZP equates
SLOT16 := $2B ; $s0 -> slot * 16 SLOT16 := $2B ; $s0 -> slot * 16
SLOT := $3D ; $0s SLOT := $3D ; $0s
CMDLO := $40 CMDLO := $40
CMDHI := $41 CMDHI := $41
; ProDOS equates
DCMD := $42 ; Command code DCMD := $42 ; Command code
BUFFER := $44 ; Buffer address DNUMBER := $43 ; drive number
BLOCK := $46 ; Block number BUFFER := $44 ; buffer pointer
BLOCK := $46 ; block number
; Smartport equates
SMPARAM := $43 ; parameter count
SMUNIT := $44 ; unit number
SMBUFF := $45 ; buffer pointer
SMSTAT := $47 ; status / control code
SMBLOCK := $47 ; block number
SMCOUNT := $47 ; byte count
SMADDR := $49 ; address for read
; Ram equates
R30 := $0478 R30 := $0478
R31 := $04F8 R31 := $04F8
R32 := $0578 R32 := $0578
R33 := $05F8 R33 := $05F8
CURSLOT := $07F8 ; $Cs CURSLOT := $07F8 ; $Cs
; Slot equates
OAPPLE := $C061 ; open apple key OAPPLE := $C061 ; open apple key
DATA := $C080 DATA := $C080
CTRL := DATA+1 CTRL := DATA+1
@ -34,7 +47,6 @@ DIV := DATA+2
SS := DATA+3 SS := DATA+3
; Constants ; Constants
DUMMY = $FF DUMMY = $FF
FRX = $10 ; CTRL register FRX = $10 ; CTRL register
ECE = $04 ECE = $04

View File

@ -11,6 +11,7 @@
; ;
;******************************* ;*******************************
.import SMARTPORT
.import GETR1 .import GETR1
.import GETR3 .import GETR3
.import SDCMD .import SDCMD
@ -54,25 +55,8 @@
LDX #$03 LDX #$03
LDX #$3C LDX #$3C
; find slot nr PRODOS:
PHP SEI ; no interrupts if booting
SEI
LDA #$60 ; opcode for RTS
STA SLOT
JSR SLOT
TSX
LDA $0100,X
STA CURSLOT ; $Cs
AND #$0F
PLP
STA SLOT ; $0s
ASL A
ASL A
ASL A
ASL A
STA SLOT16 ; $s0
TAX ; X holds now SLOT16
BIT $CFFF BIT $CFFF
LDY #0 ; display copyright message LDY #0 ; display copyright message
@DRAW: LDA TEXT,Y @DRAW: LDA TEXT,Y
@ -83,10 +67,7 @@
BPL @DRAW BPL @DRAW
@OAPPLE: BIT OAPPLE ; check for OA key @OAPPLE: BIT OAPPLE ; check for OA key
BMI @NEXTSLOT ; and skip boot if pressed BPL @BOOT ; and skip boot if pressed
JSR CARDDET
BCC @INIT
@NEXTSLOT: LDA CURSLOT ; skip boot when no card @NEXTSLOT: LDA CURSLOT ; skip boot when no card
DEC A DEC A
@ -94,8 +75,6 @@
STZ CMDLO STZ CMDLO
JMP (CMDLO) JMP (CMDLO)
@INIT: JSR INIT
;******************************* ;*******************************
; ;
@ -103,23 +82,20 @@
; ;
;******************************* ;*******************************
;@BOOT: CMP #0 @BOOT: LDA #$01 ; READ
; BNE @NEXTSLOT ; init not successful
@BOOT: LDA #$01
STA DCMD ; load command STA DCMD ; load command
LDX SLOT16
STX $43 ; slot number
LDA #$08 LDA #$08
STA BUFFER+1 ; buffer hi STA BUFFER+1 ; buffer hi
STZ BUFFER ; buffer lo STZ BUFFER ; buffer lo
STZ BLOCK+1 ; block hi STZ BLOCK+1 ; block hi
STZ BLOCK ; block lo STZ BLOCK ; block lo
BIT $CFFF LDA #>DRIVER
JSR READ ; call driver JSR DRIVER ; call driver
CMP #0
BNE @NEXTSLOT ; init not successful
LDA #$01 LDA #$01 ; READ
STA DCMD ; load command STA DCMD ; load command
LDX SLOT16
STX $43 ; slot number STX $43 ; slot number
LDA #$0A LDA #$0A
STA BUFFER+1 ; buffer hi STA BUFFER+1 ; buffer hi
@ -127,8 +103,9 @@
STZ BLOCK+1 ; block hi STZ BLOCK+1 ; block hi
LDA #$01 LDA #$01
STA BLOCK ; block lo STA BLOCK ; block lo
BIT $CFFF JSR DRIVER ; call driver
JSR READ ; call driver CMP #0
BNE @NEXTSLOT ; init not successful
LDX SLOT16 LDX SLOT16
JMP $801 ; goto bootloader JMP $801 ; goto bootloader
@ -139,7 +116,8 @@
; ;
;******************************* ;*******************************
DRIVER: CLD DRIVER: BRA @SAVEZP ; jump to ProDOS entry
BRA @SMARTPORT ; jump to Smartport entry
@SAVEZP: PHA ; make room for retval @SAVEZP: PHA ; make room for retval
LDA SLOT16 ; save all ZP locations LDA SLOT16 ; save all ZP locations
@ -211,6 +189,8 @@ DRIVER: CLD
PLA ; get retval PLA ; get retval
RTS RTS
@SMARTPORT: JMP SMARTPORT
;******************************* ;*******************************
; ;

View File

@ -122,7 +122,7 @@ GETBLOCK: PHX ; save X
STZ R30,X STZ R30,X
LDA #$80 ; drive number LDA #$80 ; drive number
AND $43 AND DNUMBER
BEQ @SLOT ; D1 BEQ @SLOT ; D1
LDA #1 ; D2 LDA #1 ; D2
STA R31,X STA R31,X
@ -130,7 +130,7 @@ GETBLOCK: PHX ; save X
@SLOT: LDA SLOT @SLOT: LDA SLOT
PHA ; save SLOT PHA ; save SLOT
LDA #$70 ; slot number * 16 LDA #$70 ; slot number * 16
AND $43 AND DNUMBER
STA SLOT STA SLOT
CPY SLOT CPY SLOT
BEQ @RESTORE ; slot number = real slot? BEQ @RESTORE ; slot number = real slot?

40
src/Smartport.s Normal file
View File

@ -0,0 +1,40 @@
;*******************************
;
; Apple][Sd Firmware
; Version 1.2
; Smartport functions
;
; (c) Florian Reitz, 2017
;
; X register usually contains SLOT16
; Y register is used for counting or SLOT
;
;*******************************
.export SMARTPORT
.include "AppleIISd.inc"
.segment "SLOTROM"
;*******************************
;
; Status request
; $43 Unit number DSSS000
; $44-45 Unused
; $46-47 Unused
;
; C Clear - No error
; Set - Error
; A $00 - No error
; $2B - Card write protected
; $2F - No card inserted
; X - Blocks avail (low byte)
; Y - Blocks avail (high byte)
;
;*******************************
SMARTPORT: PLA ; pull return address
TAY