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\Helper.s" />
<None Include="src\ProDOS.s" />
<None Include="src\Smartport.s" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9EA7EC3D-1771-420F-932F-231A35ED1200}</ProjectGuid>

View File

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

View File

@ -11,22 +11,35 @@
;
;*******************************
; Memory defines
; ZP equates
SLOT16 := $2B ; $s0 -> slot * 16
SLOT := $3D ; $0s
CMDLO := $40
CMDHI := $41
; ProDOS equates
DCMD := $42 ; Command code
BUFFER := $44 ; Buffer address
BLOCK := $46 ; Block number
DNUMBER := $43 ; drive 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
R31 := $04F8
R32 := $0578
R33 := $05F8
CURSLOT := $07F8 ; $Cs
; Slot equates
OAPPLE := $C061 ; open apple key
DATA := $C080
CTRL := DATA+1
@ -34,7 +47,6 @@ DIV := DATA+2
SS := DATA+3
; Constants
DUMMY = $FF
FRX = $10 ; CTRL register
ECE = $04

View File

@ -11,6 +11,7 @@
;
;*******************************
.import SMARTPORT
.import GETR1
.import GETR3
.import SDCMD
@ -54,25 +55,8 @@
LDX #$03
LDX #$3C
; find slot nr
PHP
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
PRODOS:
SEI ; no interrupts if booting
BIT $CFFF
LDY #0 ; display copyright message
@DRAW: LDA TEXT,Y
@ -83,10 +67,7 @@
BPL @DRAW
@OAPPLE: BIT OAPPLE ; check for OA key
BMI @NEXTSLOT ; and skip boot if pressed
JSR CARDDET
BCC @INIT
BPL @BOOT ; and skip boot if pressed
@NEXTSLOT: LDA CURSLOT ; skip boot when no card
DEC A
@ -94,8 +75,6 @@
STZ CMDLO
JMP (CMDLO)
@INIT: JSR INIT
;*******************************
;
@ -103,23 +82,20 @@
;
;*******************************
;@BOOT: CMP #0
; BNE @NEXTSLOT ; init not successful
@BOOT: LDA #$01
@BOOT: LDA #$01 ; READ
STA DCMD ; load command
LDX SLOT16
STX $43 ; slot number
LDA #$08
STA BUFFER+1 ; buffer hi
STZ BUFFER ; buffer lo
STZ BLOCK+1 ; block hi
STZ BLOCK ; block lo
BIT $CFFF
JSR READ ; call driver
LDA #>DRIVER
JSR DRIVER ; call driver
CMP #0
BNE @NEXTSLOT ; init not successful
LDA #$01
LDA #$01 ; READ
STA DCMD ; load command
LDX SLOT16
STX $43 ; slot number
LDA #$0A
STA BUFFER+1 ; buffer hi
@ -127,8 +103,9 @@
STZ BLOCK+1 ; block hi
LDA #$01
STA BLOCK ; block lo
BIT $CFFF
JSR READ ; call driver
JSR DRIVER ; call driver
CMP #0
BNE @NEXTSLOT ; init not successful
LDX SLOT16
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
LDA SLOT16 ; save all ZP locations
@ -211,6 +189,8 @@ DRIVER: CLD
PLA ; get retval
RTS
@SMARTPORT: JMP SMARTPORT
;*******************************
;

View File

@ -122,7 +122,7 @@ GETBLOCK: PHX ; save X
STZ R30,X
LDA #$80 ; drive number
AND $43
AND DNUMBER
BEQ @SLOT ; D1
LDA #1 ; D2
STA R31,X
@ -130,7 +130,7 @@ GETBLOCK: PHX ; save X
@SLOT: LDA SLOT
PHA ; save SLOT
LDA #$70 ; slot number * 16
AND $43
AND DNUMBER
STA SLOT
CPY 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