A couple of updates to recent blog posts: I did a little more work on the Apple II Monitor port to the Apple 1, getting the source code to assemble the version that includes the Woz Monitor at the end. This version can be burned to a ROM (or EPROM or EEPROM) in the Replica 1, so you can have both the original Woz Monitor and Apple II Monitor in ROM from powerup. I confirmed that it does work when programmed into a ROM. It also works in the POM1 Apple 1 Emulator. As before, the Apple II Monitor port can be found here.
Showing posts with label Apple II. Show all posts
Showing posts with label Apple II. Show all posts
Wednesday, May 21, 2014
Tuesday, May 13, 2014
Apple II Monitor Running on Briel Replica 1
As a followup to my previous blog post, here is a transcript of running some Apple II Monitor commands on the Briel Replica 1. You can find documentation on the Monitor commands in a number of places, including here. The commands typed by the user are in bold.
Monitor prompt:
*
Dump memory:
*1000.100F
1000- A2 10 EA CA D0 FA 60 BE
1008- 00 00 4A 83 00 00 75 D7
Change memory:
*1000:01 02 03
*1000.100F
1000- 01 02 03 CA D0 FA 60 BE
1008- 00 00 4A 83 00 00 75 D7
Move Memory:
*1000<2000 .2fffm="" b="">2000>
Verify Memory:
*1000<2000 .3000v="" b="">2000>
3000-FF (00)
Disassemble:
*FF00L
FF00- D8 CLD
FF01- 58 CLI
FF02- A0 7F LDY #$7F
FF04- 8C 12 D0 STY $D012
FF07- A9 A7 LDA #$A7
FF09- 8D 11 D0 STA $D011
FF0C- 8D 13 D0 STA $D013
FF0F- C9 DF CMP #$DF
FF11- F0 13 BEQ $FF26
FF13- C9 9B CMP #$9B
FF15- F0 03 BEQ $FF1A
FF17- C8 INY
FF18- 10 0F BPL $FF29
FF1A- A9 DC LDA #$DC
FF1C- 20 EF FF JSR $FFEF
FF1F- A9 8D LDA #$8D
FF21- 20 EF FF JSR $FFEF
FF24- A0 01 LDY #$01
FF26- 88 DEY
FF27- 30 F6 BMI $FF1F
Mini-Assembler:
*7666G
!1000:LDX #$10
1000- A2 10 LDX #$10
! NOP
1002- EA NOP
! DEX
1003- CA DEX
! BNE 1000
1004- D0 FA BNE $1000
! RTS
1006- 60 RTS
Call Monitor to Disassemble:
!$1000L
1000- A2 10 LDX #$10
1002- EA NOP
1003- CA DEX
1004- D0 FA BNE $1000
1006- 60 RTS
1007- BE 00 00 LDX $0000,Y
100A- 4A LSR
100B- 83 ???
100C- 00 BRK
100D- 00 BRK
100E- 75 D7 ADC $D7,X
1010- 00 BRK
1011- 00 BRK
1012- F8 SED
1013- 87 ???
1014- 00 BRK
1015- 00 BRK
1016- B5 F6 LDA $F6,X
1018- 42 ???
1019- 00 BRK
Go back to Monitor:
!$7F65G
Single step:
*1000S
1000- A2 10 LDX #$10
A=10 X=10 Y=7D P=70 S=CA
*S
1002- EA NOP
A=10 X=10 Y=7D P=70 S=CA
*S
1003- CA DEX
A=10 X=0F Y=7D P=70 S=CA
*S
1004- D0 FA BNE $1000
A=10 X=0F Y=7D P=70 S=CA
*S
1000- A2 10 LDX #$10
A=10 X=10 Y=7D P=70 S=CA
*
Display 6502 Registers:
*^E
A=10 X=10 Y=7D P=70 S=CA
Hex arithmetic:
*12+34
=46
*FE-12
=EC
Go to BASIC:
*^B
>LIST
Monitor prompt:
*
Dump memory:
*1000.100F
1000- A2 10 EA CA D0 FA 60 BE
1008- 00 00 4A 83 00 00 75 D7
Change memory:
*1000:01 02 03
*1000.100F
1000- 01 02 03 CA D0 FA 60 BE
1008- 00 00 4A 83 00 00 75 D7
Move Memory:
*1000<2000 .2fffm="" b="">2000>
Verify Memory:
*1000<2000 .3000v="" b="">2000>
3000-FF (00)
Disassemble:
*FF00L
FF00- D8 CLD
FF01- 58 CLI
FF02- A0 7F LDY #$7F
FF04- 8C 12 D0 STY $D012
FF07- A9 A7 LDA #$A7
FF09- 8D 11 D0 STA $D011
FF0C- 8D 13 D0 STA $D013
FF0F- C9 DF CMP #$DF
FF11- F0 13 BEQ $FF26
FF13- C9 9B CMP #$9B
FF15- F0 03 BEQ $FF1A
FF17- C8 INY
FF18- 10 0F BPL $FF29
FF1A- A9 DC LDA #$DC
FF1C- 20 EF FF JSR $FFEF
FF1F- A9 8D LDA #$8D
FF21- 20 EF FF JSR $FFEF
FF24- A0 01 LDY #$01
FF26- 88 DEY
FF27- 30 F6 BMI $FF1F
Mini-Assembler:
*7666G
!1000:LDX #$10
1000- A2 10 LDX #$10
! NOP
1002- EA NOP
! DEX
1003- CA DEX
! BNE 1000
1004- D0 FA BNE $1000
! RTS
1006- 60 RTS
Call Monitor to Disassemble:
!$1000L
1000- A2 10 LDX #$10
1002- EA NOP
1003- CA DEX
1004- D0 FA BNE $1000
1006- 60 RTS
1007- BE 00 00 LDX $0000,Y
100A- 4A LSR
100B- 83 ???
100C- 00 BRK
100D- 00 BRK
100E- 75 D7 ADC $D7,X
1010- 00 BRK
1011- 00 BRK
1012- F8 SED
1013- 87 ???
1014- 00 BRK
1015- 00 BRK
1016- B5 F6 LDA $F6,X
1018- 42 ???
1019- 00 BRK
Go back to Monitor:
!$7F65G
Single step:
*1000S
1000- A2 10 LDX #$10
A=10 X=10 Y=7D P=70 S=CA
*S
1002- EA NOP
A=10 X=10 Y=7D P=70 S=CA
*S
1003- CA DEX
A=10 X=0F Y=7D P=70 S=CA
*S
1004- D0 FA BNE $1000
A=10 X=0F Y=7D P=70 S=CA
*S
1000- A2 10 LDX #$10
A=10 X=10 Y=7D P=70 S=CA
*
Display 6502 Registers:
*^E
A=10 X=10 Y=7D P=70 S=CA
Hex arithmetic:
*12+34
=46
*FE-12
=EC
Go to BASIC:
*^B
>LIST
Labels:
6502,
Apple 1,
Apple II,
Briel Replica 1,
Monitor
Sunday, May 11, 2014
Apple II Monitor Ported to Apple 1
As announced here, a cassette tape was found that contains a port of the Apple II Monitor to the Apple 1. It was done by Winston Gayler. Additional work was done by Wendell Sander, who posted documentation, cassette tape sound files and Woz Mon binaries here .
I've tested the code on a Briel Replica 1 and it works quite well. The only issue I found on the Replica 1 is that the commands that require Control keys do not work as the Replica 1 does not emulate Control keys when using a PS/2 keyboard. They will work if entered from the serial port.
This weekend I went a little further adapted the original monitor source from the "Red Book" to build under the CA65 assembler, then applied the changes for the Apple 1. The result is code that can be assembled from source and easily relocated.
References:
I've tested the code on a Briel Replica 1 and it works quite well. The only issue I found on the Replica 1 is that the commands that require Control keys do not work as the Replica 1 does not emulate Control keys when using a PS/2 keyboard. They will work if entered from the serial port.
This weekend I went a little further adapted the original monitor source from the "Red Book" to build under the CA65 assembler, then applied the changes for the Apple 1. The result is code that can be assembled from source and easily relocated.
References:
- www.apple1notes.com/old_apple/Monitor_II_on_1.html
- www.applefritter.com/content/apple-ii-monitor-ported-apple-1
- github.com/jefftranter/6502/tree/master/asm/Apple%5D%5BMonitor
Thursday, March 13, 2014
Building Apple II DOS From Source Code
I am currently reading the book Sophistication & Simplicity: The Life and Times of the Apple II Computer by Steven Weyhrich. It is a fascinating history of the Apple II series of computers, from the beginnings with the Apple I up to the present time.
Many of the books and historical articles about Apple do not give enough credit to the Apple II for getting the company started and generating the revenue and size of company that was need to develop later products like the Lisa, Macintosh, and iPhone.
Reading about Apple DOS reminded me that, recently, the original Apple II DOS source code was publicly released. It has quite an interesting history, which is covered both in the Steven Weyrich book as well as the Computer History Museum site where the materials can be downloaded.
There is both PDF format scans of the original assembler listing as well as a Microsoft Word file with the source code. I thought it would be fun to try to get the code to build using the CC65 assembler.
An evening's work was enough to get both the low-level disk routines source file as well as the full DOS source cross-compiled on a Linux system using CC65. Since I do not own an Apple II I am not able to test it. but the files assemble and appear to be correct.
I did not check every instruction in detail against the PDF source listing but the length of the code is correct and I checked a good number of the addresses. The Microsoft Word version was very helpful and was used as a starting point, but it did contain a number of errors which were resolved by looking at the scan of the assembly listing. Interestingly enough, the original source code assembler listing reports one assembly error in the code, which I believe I fixed correctly.
If you are interested in the ported code, it can be found here.
After doing the port, I found out that Scott LaBombard had also got the code built and even running on an Apple II. I plan to compare my binaries to his and see if there are any errors in my version that I missed.
I don't plan to do more with this, at least not unless I get my hands on an Apple II (I had an Apple //e and an Apple ][+ in the past but they were damaged a number of years ago in a basement flood).
References:
Tuesday, May 15, 2012
Book Review: Beyond Games: Systems Software for your 6502
Title: "Beyond Games: Systems Software for your 6502"
Author: Ken Skier
Publisher: Byte Publications, 1981, 433 pages
This is a used book I purchased recently on ebay. There were many books on 6502 programming of this era but not many on tools to help writing and debugging programs, like machine language monitors and disassembler.
This book provides an introduction to 6502 machine and assembly language programming, and then quickly moves to specific programs, including:
- a "visible" machine language monitor
- two hex dump programs
- a disassembler
- a move utility
- a simple text editor
It describes the design of the programs and shows source code. In the appendices it provides complete assembler listings as well as binaries in the form of BASIC DATA statements than can be loaded into memory using a provided BASIC program.
The programs are mostly portable, and the author provides a set of interfaces or "data blocks" that adapt the code to run on the popular 6502-based systems of that era: the Ohio Scientific C-1P, Commodore PET 2001, Apple II, and Atari 800.
There is a brief chapter on each machine describing it's video memory layout.
I found it a very interesting and useful book, and intend to adapt some of the code to the Apple Replica 1.
Interestingly, the design of the table driven disassembler uses some of the same approaches that I used for the one I wrote recently.
Overall the code is clean, well documented, and clearly written. The author purposely avoided using tricks that would obscure the clarity of the code.
The book is long out of print but is available on sources for used books if you search hard enough for it.
Labels:
6502,
Apple II,
Atari 800.,
Commodore PET 2001,
Ken Skier,
Ohio Scientific C-1P,
programming
Subscribe to:
Posts (Atom)