Last active
June 21, 2018 23:28
-
-
Save makestuff/7448025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ # Fetch the ACME source code... | |
$ wget -qO- http://www.esw-heim.tu-clausthal.de/~marco/smorbrod/acme/current/acme093testing.tar.bz2 | bunzip2 -c | tar xf - | |
$ | |
$ # Build it... | |
$ cd acme093testing/src/ | |
$ sed -i 's/$(CC) $(LIBS)\(.*\)/$(CC)\1 $(LIBS)/g' Makefile | |
$ make -s 2>/dev/null | |
$ | |
$ # Fetch the DOS 3.1 binary disk image... | |
$ wget -q -O dos3.1.d13 'http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Software/Operating%20Systems/Apple%20DOS/Disk%20Images/Apple%20DOS%203.1%20Master.d13' | |
$ | |
$ # Fetch & view the DCBSUP subroutine, tweaked to assemble with ACME... | |
$ cp ../../dcbsup.s . | |
$ cat dcbsup.s | |
!to "dos3.1.bin", plain | |
* = $8000 | |
FCBDCB = $3505 | |
DCBLEN = $2D | |
CCBVOL = $34F3 | |
DCBVOL = $352D | |
CCBDRV = $34F4 | |
DCBDRV = $352C | |
CCBSLT = $34F5 | |
DCBSLT = $352B | |
DCBVTN = $352E | |
DCBSUP | |
LDA #0 | |
TAX | |
F01 STA FCBDCB, X ;CLEAR DCB | |
INX | |
CPX #DCBLEN | |
BNE F01 | |
;; | |
LDA CCBVOL ;MOVE VOL | |
EOR #$FF ;INVERT VOL BITS | |
STA DCBVOL | |
LDA CCBDRV ;MOVE DRIVE | |
STA DCBDRV | |
LDA CCBSLT ;GET USER SPEC SLOT | |
ASL ;SLOT*16 | |
ASL | |
ASL | |
ASL | |
TAX | |
F01A | |
STX DCBSLT | |
LDA #17 | |
STA DCBVTN | |
RTS | |
$ | |
$ # Assemble the code, producing "dos3.1.bin"... | |
$ ./acme dcbsup.s | |
$ od -A n -w1024 -tx1 dos3.1.bin | |
a9 00 aa 9d 05 35 e8 e0 2d d0 f8 ad f3 34 49 ff 8d 2d 35 ad f4 34 8d 2c 35 ad f5 34 0a 0a 0a 0a aa 8e 2b 35 a9 11 8d 2e 35 60 | |
$ | |
$ # Finally, search for this machine code in the disk image... | |
$ od -w1024 -tx1 dos3.1.d13 | grep -oba "$(od -A n -w1024 -tx1 dos3.1.bin)" | |
20002: a9 00 aa 9d 05 35 e8 e0 2d d0 f8 ad f3 34 49 ff 8d 2d 35 ad f4 34 8d 2c 35 ad f5 34 0a 0a 0a 0a aa 8e 2b 35 a9 11 8d 2e 35 60 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment