diff --git a/Apple2/Shell.asm b/Apple2/Shell.asm index e62f187..cdfe70e 100755 --- a/Apple2/Shell.asm +++ b/Apple2/Shell.asm @@ -110,12 +110,10 @@ setRow: setTop: jsr GetByte sta $22 - jsr InvertChar jmp DumpOutput setBottom: jsr GetByte sta $23 - jsr InvertChar jmp DumpOutput moveUp: dec vtab diff --git a/Apple2/Shell.bin b/Apple2/Shell.bin index 0a5856f..11f24ab 100644 Binary files a/Apple2/Shell.bin and b/Apple2/Shell.bin differ diff --git a/Apple2/Shell.lst b/Apple2/Shell.lst index 427d069..14e5359 100644 --- a/Apple2/Shell.lst +++ b/Apple2/Shell.lst @@ -58,17 +58,17 @@ Current file: Shell.asm 002000 1 20 00 C3 jsr $c300 ; force 80 columns 002003 1 2C 10 C0 bit ClearKeyboard 002006 1 A9 09 lda #ShellCommand -002008 1 20 9A 20 jsr SendByte +002008 1 20 94 20 jsr SendByte 00200B 1 20 0F 20 jsr DumpOutput 00200E 1 60 rts 00200F 1 00200F 1 DumpOutput: -00200F 1 20 B8 20 jsr GetByte +00200F 1 20 B2 20 jsr GetByte 002012 1 B0 2A bcs checkInput 002014 1 C9 00 cmp #$00 002016 1 F0 39 beq endOutput 002018 1 48 pha -002019 1 20 E1 20 jsr InvertChar +002019 1 20 DB 20 jsr InvertChar 00201C 1 68 pla 00201D 1 C9 48 cmp #'H' 00201F 1 F0 3A beq setColumn @@ -79,126 +79,124 @@ Current file: Shell.asm 002029 1 C9 54 cmp #'T' 00202B 1 F0 4A beq setTop 00202D 1 C9 42 cmp #'B' -00202F 1 F0 51 beq setBottom +00202F 1 F0 4E beq setBottom 002031 1 C9 55 cmp #'U' -002033 1 F0 58 beq moveUp +002033 1 F0 52 beq moveUp 002035 1 20 ED FD jsr PrintChar -002038 1 20 E1 20 jsr InvertChar +002038 1 20 DB 20 jsr InvertChar 00203B 1 4C 0F 20 jmp DumpOutput 00203E 1 checkInput: 00203E 1 2C 00 C0 bit Keyboard ;check for keypress 002041 1 10 CC bpl DumpOutput ;keep dumping output if no keypress 002043 1 AD 00 C0 lda Keyboard ;send keypress to RPi 002046 1 29 7F and #$7f -002048 1 20 9A 20 jsr SendByte +002048 1 20 94 20 jsr SendByte 00204B 1 2C 10 C0 bit ClearKeyboard 00204E 1 4C 0F 20 jmp DumpOutput 002051 1 endOutput: 002051 1 60 rts 002052 1 clearScreen: 002052 1 20 58 FC jsr Home -002055 1 20 E1 20 jsr InvertChar +002055 1 20 DB 20 jsr InvertChar 002058 1 4C 0F 20 jmp DumpOutput 00205B 1 setColumn: -00205B 1 20 B8 20 jsr GetByte +00205B 1 20 B2 20 jsr GetByte 00205E 1 85 24 sta htab 002060 1 8D 7B 05 sta htab80 -002063 1 20 E1 20 jsr InvertChar +002063 1 20 DB 20 jsr InvertChar 002066 1 4C 0F 20 jmp DumpOutput 002069 1 setRow: -002069 1 20 B8 20 jsr GetByte +002069 1 20 B2 20 jsr GetByte 00206C 1 85 25 sta vtab 00206E 1 20 C1 FB jsr BasCalc -002071 1 20 E1 20 jsr InvertChar +002071 1 20 DB 20 jsr InvertChar 002074 1 4C 0F 20 jmp DumpOutput 002077 1 setTop: -002077 1 20 B8 20 jsr GetByte +002077 1 20 B2 20 jsr GetByte 00207A 1 85 22 sta $22 -00207C 1 20 E1 20 jsr InvertChar -00207F 1 4C 0F 20 jmp DumpOutput -002082 1 setBottom: -002082 1 20 B8 20 jsr GetByte -002085 1 85 23 sta $23 -002087 1 20 E1 20 jsr InvertChar -00208A 1 4C 0F 20 jmp DumpOutput -00208D 1 moveUp: -00208D 1 C6 25 dec vtab -00208F 1 A5 25 lda vtab -002091 1 20 C1 FB jsr BasCalc -002094 1 20 E1 20 jsr InvertChar -002097 1 4C 0F 20 jmp DumpOutput -00209A 1 -00209A 1 SendByte: -00209A 1 48 pha -00209B 1 waitWrite: -00209B 1 AD FB C0 lda InputFlags -00209E 1 2A rol -00209F 1 2A rol -0020A0 1 B0 F9 bcs waitWrite -0020A2 1 68 pla -0020A3 1 8D FD C0 sta OutputByte -0020A6 1 A9 1E lda #$1e ; set bit 0 low to indicate write started -0020A8 1 8D F7 C0 sta OutputFlags -0020AB 1 finishWrite: -0020AB 1 AD FB C0 lda InputFlags -0020AE 1 2A rol -0020AF 1 2A rol -0020B0 1 90 F9 bcc finishWrite -0020B2 1 A9 1F lda #$1f +00207C 1 4C 0F 20 jmp DumpOutput +00207F 1 setBottom: +00207F 1 20 B2 20 jsr GetByte +002082 1 85 23 sta $23 +002084 1 4C 0F 20 jmp DumpOutput +002087 1 moveUp: +002087 1 C6 25 dec vtab +002089 1 A5 25 lda vtab +00208B 1 20 C1 FB jsr BasCalc +00208E 1 20 DB 20 jsr InvertChar +002091 1 4C 0F 20 jmp DumpOutput +002094 1 +002094 1 SendByte: +002094 1 48 pha +002095 1 waitWrite: +002095 1 AD FB C0 lda InputFlags +002098 1 2A rol +002099 1 2A rol +00209A 1 B0 F9 bcs waitWrite +00209C 1 68 pla +00209D 1 8D FD C0 sta OutputByte +0020A0 1 A9 1E lda #$1e ; set bit 0 low to indicate write started +0020A2 1 8D F7 C0 sta OutputFlags +0020A5 1 finishWrite: +0020A5 1 AD FB C0 lda InputFlags +0020A8 1 2A rol +0020A9 1 2A rol +0020AA 1 90 F9 bcc finishWrite +0020AC 1 A9 1F lda #$1f +0020AE 1 8D F7 C0 sta OutputFlags +0020B1 1 60 rts +0020B2 1 +0020B2 1 GetByte: +0020B2 1 A9 1D lda #$1d ;set read flag low 0020B4 1 8D F7 C0 sta OutputFlags -0020B7 1 60 rts -0020B8 1 -0020B8 1 GetByte: -0020B8 1 A9 1D lda #$1d ;set read flag low -0020BA 1 8D F7 C0 sta OutputFlags -0020BD 1 waitRead: -0020BD 1 AD FB C0 lda InputFlags -0020C0 1 2A rol -0020C1 1 90 0C bcc readByte -0020C3 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read -0020C6 1 10 F5 bpl waitRead -0020C8 1 A9 1F lda #$1f ;set all flags high and exit -0020CA 1 8D F7 C0 sta OutputFlags -0020CD 1 38 sec ;failure -0020CE 1 60 rts -0020CF 1 readByte: -0020CF 1 AD FE C0 lda InputByte -0020D2 1 48 pha -0020D3 1 A9 1F lda #$1f ;set all flags high -0020D5 1 8D F7 C0 sta OutputFlags -0020D8 1 finishRead: -0020D8 1 AD FB C0 lda InputFlags -0020DB 1 2A rol -0020DC 1 90 FA bcc finishRead -0020DE 1 68 pla -0020DF 1 18 clc ;success -0020E0 1 end: -0020E0 1 60 rts -0020E1 1 -0020E1 1 InvertChar: -0020E1 1 AD 7B 05 lda htab80 ;get horizontal location / 2 -0020E4 1 4A lsr -0020E5 1 A8 tay -0020E6 1 AD 55 C0 lda TextPage2 -0020E9 1 90 03 bcc invert -0020EB 1 AD 54 C0 lda TextPage1 -0020EE 1 invert: -0020EE 1 B1 28 lda (BasL),y -0020F0 1 49 80 eor #$80 -0020F2 1 91 28 sta (BasL),y -0020F4 1 AD 54 C0 lda TextPage1 -0020F7 1 screen40: -0020F7 1 60 rts -0020F8 1 -0020F8 1 HelpCommand: -0020F8 1 61 32 68 65 .byte "a2help",$00 -0020FC 1 6C 70 00 -0020FF 1 PromptCommand: -0020FF 1 61 32 70 72 .byte "a2prompt",$00 -002103 1 6F 6D 70 74 -002107 1 00 -002108 1 OldPromptChar: -002108 1 5D .byte "]" -002109 1 DrawCursor: -002109 1 80 .byte $80 -002109 1 +0020B7 1 waitRead: +0020B7 1 AD FB C0 lda InputFlags +0020BA 1 2A rol +0020BB 1 90 0C bcc readByte +0020BD 1 2C 00 C0 bit Keyboard ;keypress will abort waiting to read +0020C0 1 10 F5 bpl waitRead +0020C2 1 A9 1F lda #$1f ;set all flags high and exit +0020C4 1 8D F7 C0 sta OutputFlags +0020C7 1 38 sec ;failure +0020C8 1 60 rts +0020C9 1 readByte: +0020C9 1 AD FE C0 lda InputByte +0020CC 1 48 pha +0020CD 1 A9 1F lda #$1f ;set all flags high +0020CF 1 8D F7 C0 sta OutputFlags +0020D2 1 finishRead: +0020D2 1 AD FB C0 lda InputFlags +0020D5 1 2A rol +0020D6 1 90 FA bcc finishRead +0020D8 1 68 pla +0020D9 1 18 clc ;success +0020DA 1 end: +0020DA 1 60 rts +0020DB 1 +0020DB 1 InvertChar: +0020DB 1 AD 7B 05 lda htab80 ;get horizontal location / 2 +0020DE 1 4A lsr +0020DF 1 A8 tay +0020E0 1 AD 55 C0 lda TextPage2 +0020E3 1 90 03 bcc invert +0020E5 1 AD 54 C0 lda TextPage1 +0020E8 1 invert: +0020E8 1 B1 28 lda (BasL),y +0020EA 1 49 80 eor #$80 +0020EC 1 91 28 sta (BasL),y +0020EE 1 AD 54 C0 lda TextPage1 +0020F1 1 screen40: +0020F1 1 60 rts +0020F2 1 +0020F2 1 HelpCommand: +0020F2 1 61 32 68 65 .byte "a2help",$00 +0020F6 1 6C 70 00 +0020F9 1 PromptCommand: +0020F9 1 61 32 70 72 .byte "a2prompt",$00 +0020FD 1 6F 6D 70 74 +002101 1 00 +002102 1 OldPromptChar: +002102 1 5D .byte "]" +002103 1 DrawCursor: +002103 1 80 .byte $80 +002103 1 diff --git a/README.md b/README.md index 3c65323..40b69cd 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ The purpose of this project is to provide I/O for an Apple II series 8 bit compu So far, this is a project and not a finished product. The current prototype is on the fifth revision and a few have been assembled and tested. It is now possible for the Apple II to boot from and write to a virutal hard drive image stored on the RPi in any slot and execute simple commands on the RPi via the Apple II. The code has very few tests and is incomplete. Note that currently the firmware assumes an 80 column card is in slot 3 and than you have lowercase support. If you have a problem or idea for enhancement, log an issue [here](https://github.com/tjboldt/Apple2-IO-RPi/issues). I recommend starring/watching the project for updates on GitHub. You are welcome to fork the project and submit pull requests which I will review. ## Features -1. Boot menu which waits for RPi to be ready +1. Boot message which waits for RPi to be ready 2. ProDOS bootable drive from image stored on RPi -3. Execute Linux commands on the RPi from the Apple II (has partial VT100 emulation but is buggy and missing the cursor in apps like vim) +3. Execute Linux bash shell on the RPi from the Apple II 4. Load binary files directly from the RPi to the II 5. Update Apple II firmware in place from image on RPi 6. Supports two drive images at the same time (Note: backward compatible with previous firmware but requires firmware update in order to work with two drives) @@ -24,9 +24,8 @@ So far, this is a project and not a finished product. The current prototype is o 3. WGET - Download and save to file 2. Proper ProDOS clock driver (currently just directly sets values on block reads) 3. Bi-directional image conversion between common formats and HIRES -4. Full terminal emulation -5. Remote code execution -6. Proxy VNC connection, rendering as Apple II compatible graphics +4. Remote code execution +5. Proxy VNC connection, rendering as Apple II compatible graphics ## Setup starting from scratch 1. Have PCBs made from the gerber and drill files in the Hardware folder or email me for a blank or fully assembled board diff --git a/RaspberryPi/Apple2-IO-RPi.hdv b/RaspberryPi/Apple2-IO-RPi.hdv index e1632f3..0bcd870 100755 Binary files a/RaspberryPi/Apple2-IO-RPi.hdv and b/RaspberryPi/Apple2-IO-RPi.hdv differ diff --git a/RaspberryPi/apple2driver/a2io/vt100.go b/RaspberryPi/apple2driver/a2io/vt100.go index d566461..72a7b4e 100644 --- a/RaspberryPi/apple2driver/a2io/vt100.go +++ b/RaspberryPi/apple2driver/a2io/vt100.go @@ -87,6 +87,9 @@ func sendCharacter(comm A2Io, b byte) { if htab < 0 { htab = 0 } + if vtab > 23 { + vtab = 23 + } comm.WriteByte('H') comm.WriteByte(byte(htab)) comm.WriteByte('V') @@ -171,7 +174,7 @@ func sendCharacter(comm A2Io, b byte) { // Set/clear application mode for cursor case "^[[?1h": applicationMode = true - comm.WriteByte(0x0c) // ^L clears the screen + //comm.WriteByte(0x0c) // ^L clears the screen fmt.Printf("Start application mode: %s\n", escapeSequence) escapeSequence = "" case "^[[?1l": @@ -180,7 +183,7 @@ func sendCharacter(comm A2Io, b byte) { comm.WriteByte(0x00) comm.WriteByte('B') comm.WriteByte(0x18) - comm.WriteByte(0x0c) // ^L clears the screen + //comm.WriteByte(0x0c) // ^L clears the screen fmt.Printf("End application mode: %s\n", escapeSequence) escapeSequence = "" // Tab to home position @@ -226,7 +229,7 @@ func sendCharacter(comm A2Io, b byte) { fmt.Printf("Inverse: %s\n", escapeSequence) escapeSequence = "" case "^[[m", "^[[0m": - //comm.WriteByte(0x0e) // ^N normal video + comm.WriteByte(0x0e) // ^N normal video fmt.Printf("Normal: %s\n", escapeSequence) escapeSequence = "" }