diff --git a/Apple2/RPi.Command.asm b/Apple2/RPi.Command.asm index 0dac1f9..56316e7 100644 --- a/Apple2/RPi.Command.asm +++ b/Apple2/RPi.Command.asm @@ -94,12 +94,12 @@ PrintString: iny bne PrintString copyDriver: - ldx #$00 + ldy #$00 copyDriverByte: - lda $2100,x - sta $0300,x - inx - cpx #$e6 + lda $2100,y + sta $0300,y + iny + cpy #$e6 bne copyDriverByte ; ; FIRST SAVE THE EXTERNAL COMMAND ADDRESS SO YOU WON'T @@ -114,14 +114,36 @@ copyDriverByte: STA EXTRNCMD+1 ; command handler in the LDA #>RPI ; external command JMP STA EXTRNCMD+2 ; vector. - RTS - ; + + lda #ExecCommand + jsr SendByte + ldy #$00 +nextCommandByte: + lda a2help, y + beq finishCommand + jsr SendByte + iny + jmp nextCommandByte +finishCommand: + lda #$00 + jsr SendByte +showVersion: + jsr GetByte + cmp #$00 + beq FinishDriver + jsr PrintChar + jmp showVersion +FinishDriver: + rts + +a2help: + .byte "a2help", $00 Text: - aschi "RPI command v000D" - .byte $8d + aschi "RPI command version: 000E" + .byte $8d end: - .byte $00 + .byte $00 .repeat 255-RPI ; external command JMP 002063 1 8D 08 BE STA EXTRNCMD+2 ; vector. -002066 1 60 RTS -002067 1 ; -002067 1 -002067 1 Text: -002067 1 D2 D0 C9 A0 aschi "RPI command v000D" -00206B 1 E3 EF ED ED -00206F 1 E1 EE E4 A0 -002078 1 8D .byte $8d -002079 1 end: -002079 1 00 .byte $00 -00207A 1 -00207A 1 00 00 00 00 .repeat 255-= 128 { file = drive2 + driveNumber = 2 } + slotNumber := driveUnit &0x7F >> 4 + block := int(blockHigh)*256 + int(blockLow) - fmt.Printf("Read block %d\n", block) + fmt.Printf("Read block %04X in slot %d, drive %d...", block, slotNumber, driveNumber) - buffer := prodos.ReadBlock(file, block) + buffer,err := prodos.ReadBlock(file, block) + if err != nil { + fmt.Printf("failed %s\n",err) + return + } err = comm.WriteBlock(buffer) if err == nil { - fmt.Printf("Read block completed\n") + fmt.Printf("succeeded\n") } else { - fmt.Printf("Failed to read block\n") + fmt.Printf("failed %s\n",err) } } @@ -60,27 +63,39 @@ func WriteBlockCommand(drive1 *os.File, drive2 *os.File) { var driveUnit byte var err error - if !oldFirmware { - driveUnit, err = comm.ReadByte() - if err != nil { - fmt.Printf("Drive unit not sent, assuming older firmware") - oldFirmware = true - } + driveUnit, err = comm.ReadByte() + if err != nil { + fmt.Printf("Failed to write block") + return } file := drive1 + driveNumber := 1 if driveUnit >= 128 { file = drive2 + driveNumber = 2 } buffer := make([]byte, 512) block := int(blockHigh)*256 + int(blockLow) - fmt.Printf("Write block %d\n", block) + slotNumber := driveUnit &0x7F >> 4 - comm.ReadBlock(buffer) - prodos.WriteBlock(file, block, buffer) - fmt.Printf("Write block completed\n") + fmt.Printf("Write block %04X in slot %d, drive %d...", block, slotNumber, driveNumber) + + err = comm.ReadBlock(buffer) + if err != nil { + fmt.Printf("failed %s\n",err) + return + } + fmt.Printf("...") + + err = prodos.WriteBlock(file, block, buffer) + if err == nil { + fmt.Printf("succeeded\n") + } else { + fmt.Printf("failed\n") + } } diff --git a/RaspberryPi/apple2driver/handlers/exec.go b/RaspberryPi/apple2driver/handlers/exec.go index 1acec00..3bc69d5 100644 --- a/RaspberryPi/apple2driver/handlers/exec.go +++ b/RaspberryPi/apple2driver/handlers/exec.go @@ -140,19 +140,26 @@ func execCommand(linuxCommand string, workingDirectory string) { } func a2version() { - comm.WriteString("\rVersion: " + info.Version + "\r") + comm.WriteString("\rDriver version: " + info.Version + "\r") } func a2help() { - comm.WriteString("\r" + - "Built-in commands:\r" + - "------------------\r" + + comm.WriteString("\rDriver version: " + info.Version + "\r" + + "\r" + + "Example from ] prompt:\r" + + "]RPI ls /home/pi\r" + + "\r" + + "Example from Applesoft BASIC:\r" + + "]10 PRINT CHR$(4)\"RPI ping apple.com\"\r" + + "]RUN\r" + + "\r" + + "Driver commands called with RPI:\r" + "a2help - display this message\r" + - "a2version - display version number\r" + + "a2version - display driver version\r" + "a2wifi - set up wifi\r" + "a2timeout - seconds to timeout commands\r" + "A2LOWER - force lowercase for II+\r" + - "a2lower - disable force lowercase for II+\r" + + "a2lower - disable force lowercase\r" + "\r") } @@ -161,14 +168,14 @@ func a2timeout(linuxCommand string) { switch len(params) { case 1: - comm.WriteString("\rCommand timeout: " + strconv.FormatInt(int64(execTimeoutSeconds),10) + "\r") + comm.WriteString("\rCommand timeout: " + strconv.FormatInt(int64(execTimeoutSeconds), 10) + "\r") case 2: timeoutSeconds, err := strconv.ParseInt(params[1], 10, 32) if err != nil { comm.WriteString("\rFailed to parse timeout\r") } else { execTimeoutSeconds = int(timeoutSeconds) - comm.WriteString("\rCommand timeout set to: " + strconv.FormatInt(int64(execTimeoutSeconds),10) + "\r") + comm.WriteString("\rCommand timeout set to: " + strconv.FormatInt(int64(execTimeoutSeconds), 10) + "\r") } default: comm.WriteString("\rToo many parameters\n") diff --git a/RaspberryPi/apple2driver/handlers/getTime.go b/RaspberryPi/apple2driver/handlers/getTime.go index a05c892..9d82baa 100644 --- a/RaspberryPi/apple2driver/handlers/getTime.go +++ b/RaspberryPi/apple2driver/handlers/getTime.go @@ -16,12 +16,12 @@ import ( // GetTimeCommand handles the request to get ProDOS time bytes func GetTimeCommand() { - fmt.Printf("Sending date/time...\n") + fmt.Printf("Sending date/time...") prodosTime := prodos.DateTimeToProDOS(time.Now()) for i := 0; i < len(prodosTime); i++ { comm.WriteByte(prodosTime[i]) } - fmt.Printf("Send time complete\n") + fmt.Printf("%02X %02X %02X %02X\n", prodosTime[0], prodosTime[1], prodosTime[2], prodosTime[3]) } diff --git a/RaspberryPi/apple2driver/info/version.go b/RaspberryPi/apple2driver/info/version.go index dacfe24..4053d2d 100644 --- a/RaspberryPi/apple2driver/info/version.go +++ b/RaspberryPi/apple2driver/info/version.go @@ -8,4 +8,4 @@ package info // Version is the hexadecimal version number that // should be incremented with each driver update -const Version = "0025" +const Version = "0026"