Created
January 26, 2017 21:16
-
-
Save digarok/927493e4546c9c052fdf9457ccefef23 to your computer and use it in GitHub Desktop.
This is a disassembly of the FutureShock controller driver for AppleSoft BASIC as found in the FS.ASM file on this game disk. http://www.whatisthe2gs.apple2.org.za/futureshock-3d
This file contains hidden or 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
*** FutureShock Controller Applesoft BASIC Driver | |
*** | |
*** Disassembly by Dagen Brock 1/26/ | |
*** | |
*** This comes from the file /FUTURESHOCK/TOOLKIT/FS.ASM | |
*** Which can be found in the disk image of FutureShock for the Apple IIgs | |
*** ( You may find a copy here: http://www.whatisthe2gs.apple2.org.za/futureshock-3d ) | |
*** | |
*** This version was disassembled (with a little help) from: | |
*** The Flaming Bird Disassembler by Phoenix Team | |
*** | |
*** And has been written to be built with Merlin32 by Brutal Deluxe | |
*** | |
*** I've verified 100% binary parity with the Merlin32 binary and the original | |
*** | |
*** - peace out! | |
AMPERV = $3F6 ; BASIC Ampersand vector | |
ADDON = $D998 ; add Y to TXTPTR | |
ERROR = $D412 ; ? http://www.txbobsc.com/scsc/scdocumentor/D365.html | |
SYNERR = $DEC9 ; ? http://www.txbobsc.com/scsc/scdocumentor/DD7B.html | |
PTRGET = $DFE3 ; ? http://www.txbobsc.com/scsc/scdocumentor/DFE3.html | |
BUTN2 = $C063 ; | |
ORG $000300 | |
MX %11 | |
main LDA #entry ; set up ampersand vector for BASIC | |
sta AMPERV | |
LDA #>entry | |
sta AMPERV+1 | |
LDA #$FF | |
STA pad_result_previous | |
STA pad_result_previous+1 | |
RTS | |
entry LDY #$00 ; ampersand entry vector starts here | |
LDA ($B8),Y | |
CMP #$50 ; "P" PAD MODE | |
BNE :not_P | |
JSR read_pad_mode | |
JMP :store_in_basic_var | |
:not_P CMP #$4E ; "N" NORMALIZE MODE | |
BNE :not_N | |
JSR read_norm_mode | |
; falls through | |
:store_in_basic_var LDY #$02 ; stores result back to BASIC before returning | |
JSR ADDON | |
JSR PTRGET | |
BIT $81 | |
BPL :error | |
BIT $82 | |
BPL :error | |
LDY #$00 | |
LDA pad_result_return+1 | |
STA ($83),Y ; store in variable address | |
INY | |
LDA pad_result_return | |
STA ($83),Y | |
RTS | |
:not_N JMP SYNERR ; user did not pass "P" or "N" parameter from BASIC | |
; report syntax error | |
:error LDX #$A3 ; x=error message offset | |
JMP ERROR | |
bank_0 CLC | |
XCE | |
LDA #$00 | |
PHA | |
PLB ; set bank 0 ($00) | |
REP #$30 | |
LDA #$0000 ; set DP 0 ($0000) | |
TCD | |
RTS | |
** MAIN READ ROUTINE | |
read_pad_mode JSR bank_0 | |
MX %00 | |
SEP #$20 | |
SEI | |
LDX #$2710 ; Magic | |
:loop1 DEX | |
BMI :underflow | |
LDA BUTN2 | |
BMI :loop1 | |
:loop2 DEX | |
BMI :underflow | |
LDA BUTN2 | |
BPL :loop2 | |
LDX #$0000 | |
:loop3 INX | |
LDA BUTN2 | |
BMI :loop3 | |
:underflow REP #$20 | |
STX pad_result | |
STX pad_result_return | |
CLI | |
SEP #$30 | |
SEC | |
XCE | |
RTS | |
** THIS APPEARS TO JUST BE A SMOOTHING ROUTINE THAT CALLS THE MAIN READ ABOVE | |
read_norm_mode JSR read_pad_mode | |
JSR bank_0 | |
MX %00 | |
CLC | |
LDA pad_result | |
ADC #$0014 | |
CMP pad_result_previous | |
BCS :higher | |
STA pad_result_previous | |
:higher SEC | |
SBC pad_result_previous | |
SEC | |
SBC #$0014 | |
BPL :non_zero | |
LDA #$0000 | |
:non_zero STA pad_result_return | |
SEP #$30 | |
SEC | |
XCE | |
RTS | |
MX %11 | |
pad_result_previous dw $0000 | |
pad_result dw $0000 | |
pad_result_return dw $0000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment