forked from Apple-2-HW/Apple2-IO-RPi
Partial fix for command execution
This commit is contained in:
parent
3176e6112e
commit
8d62b0c57e
@ -1,12 +1,12 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
ca65 Driver.asm --listing Driver.lst
|
ca65 Driver.asm --listing Driver.lst
|
||||||
ld65 Driver.o -o Driver.bin -t none
|
ld65 Driver.o -o Driver.bin -t none
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c000 -o Slot0.o
|
ca65 Firmware.asm -D STARTSLOT=\$c000 -o Slot0.o
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c100 -o Slot1.o
|
ca65 Firmware.asm -D STARTSLOT=\$c100 -o Slot1.o --listing Firmware1.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c200 -o Slot2.o
|
ca65 Firmware.asm -D STARTSLOT=\$c200 -o Slot2.o --listing Firmware2.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c300 -o Slot3.o
|
ca65 Firmware.asm -D STARTSLOT=\$c300 -o Slot3.o --listing Firmware3.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c400 -o Slot4.o
|
ca65 Firmware.asm -D STARTSLOT=\$c400 -o Slot4.o --listing Firmware4.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c500 -o Slot5.o
|
ca65 Firmware.asm -D STARTSLOT=\$c500 -o Slot5.o --listing Firmware5.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c600 -o Slot6.o
|
ca65 Firmware.asm -D STARTSLOT=\$c600 -o Slot6.o --listing Firmware6.lst
|
||||||
ca65 Firmware.asm -D STARTSLOT=\$c700 -o Slot7.o
|
ca65 Firmware.asm -D STARTSLOT=\$c700 -o Slot7.o --listing Firmware7.lst
|
||||||
ld65 Slot0.o Slot1.o Slot2.o Slot3.o Slot4.o Slot5.o Slot6.o Slot7.o -o Firmware.bin -t none
|
ld65 Slot0.o Slot1.o Slot2.o Slot3.o Slot4.o Slot5.o Slot6.o Slot7.o -o Firmware.bin -t none
|
||||||
|
@ -113,13 +113,22 @@ func handleWriteBlockCommand(file *os.File) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func handleExecCommand() {
|
func handleExecCommand() {
|
||||||
|
fmt.Printf("Reading command to execute...\n")
|
||||||
linuxCommand,err := readString()
|
linuxCommand,err := readString()
|
||||||
|
fmt.Printf("Command to run: %s\n", linuxCommand)
|
||||||
cmd := exec.Command("bash", "-c", linuxCommand)
|
cmd := exec.Command("bash", "-c", linuxCommand)
|
||||||
cmdOut, err := cmd.Output()
|
cmdOut, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Failed to execute command\n")
|
fmt.Printf("Failed to execute command\n")
|
||||||
|
writeString("Failed to execute command")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Printf("Command output: %s\n", cmdOut)
|
||||||
|
err = writeString(string(cmdOut))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Failed to send command output\n")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
writeString(cmdOut)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleGetTimeCommand() {
|
func handleGetTimeCommand() {
|
||||||
@ -210,10 +219,10 @@ func dumpBlock(buffer []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func readString() (string, error) {
|
func readString() (string, error) {
|
||||||
inByte := byte(0)
|
inByte := byte(255)
|
||||||
var inBytes bytes.Buffer
|
var inBytes bytes.Buffer
|
||||||
var err error
|
var err error
|
||||||
for inByte == 0 {
|
for inByte != 0 {
|
||||||
inByte,err = readByte()
|
inByte,err = readByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
@ -223,10 +232,12 @@ func readString() (string, error) {
|
|||||||
return string(inBytes.Bytes()), nil
|
return string(inBytes.Bytes()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeString(outBytes []byte) error {
|
func writeString(outString string) error {
|
||||||
for outByte := range outBytes {
|
for _, character := range outString {
|
||||||
err := writeByte(byte(outByte))
|
fmt.Printf("Out: %s\n", character);
|
||||||
|
err := writeByte(byte(character)|128)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Printf("Failed to write string\n")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user