mirror of
https://github.com/david-schmidt/AII2048.git
synced 2024-06-14 02:29:27 +00:00
Initial import
This commit is contained in:
parent
607922ebcc
commit
edc883d6fc
9
build/AII2048-default.properties
Normal file
9
build/AII2048-default.properties
Normal file
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# ADTProBuild-default.properties
|
||||
#
|
||||
# Create a copy of this file in the same build directory and name it
|
||||
# ADTProBuild.properties. That will allow you to change locations of
|
||||
# support files for local builds.
|
||||
#
|
||||
# assemblerPath defines the place where the ca65 executable lives.
|
||||
assemblerPath=c:/dev/cc65/2.13.3/bin
|
BIN
build/AII2048Base.DSK
Normal file
BIN
build/AII2048Base.DSK
Normal file
Binary file not shown.
BIN
build/AII2048Basea.dsk
Normal file
BIN
build/AII2048Basea.dsk
Normal file
Binary file not shown.
119
build/build.xml
Normal file
119
build/build.xml
Normal file
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project name="AII2048" default="all" basedir="..">
|
||||
<property name="projdir" value="${basedir}" />
|
||||
<property name="builddir" value="${basedir}/build" />
|
||||
<property name="distName" value="AII2048" />
|
||||
<property name="diskName" value="AII2048" />
|
||||
<property name="volName" value="AII2048" />
|
||||
<property file="${builddir}/AII2048.properties"/>
|
||||
<property file="${builddir}/AII2048-default.properties"/>
|
||||
<property name="acJarVersion" value="1.3.5.13-ac" />
|
||||
<property name="acJarPath" value="${builddir}/lib/AppleCommander" />
|
||||
<property name="acJar" value="AppleCommander-${acJarVersion}.jar" />
|
||||
<taskdef name="appleCommander" classname="com.webcodepro.applecommander.ui.AntTask" classpath="${projdir};${acJarPath}/${acJar}"/>
|
||||
<echo message="${distName} building on ${os.name}."/>
|
||||
<condition property="isOSX">
|
||||
<os name="Mac OS X"/>
|
||||
</condition>
|
||||
|
||||
<target name="all" depends="prodos, sos" description="Scorched-Earth Build From Source" >
|
||||
</target>
|
||||
|
||||
<!--
|
||||
============================================================================================
|
||||
ProDOS section
|
||||
============================================================================================
|
||||
-->
|
||||
<target name="prodos" depends="prodos-AII2048-image-prep, common" description="Orchestrate Overall Build for ProDOS" >
|
||||
<echo message="Assembling ProDOS code..."/>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l prodos/prodossupport.asm" />
|
||||
</exec>
|
||||
<echo message="Linking ProDOS AII2048..."/>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ld65" failonerror="true">
|
||||
<arg line="-o AII2048.SYSTEM -m AII2048.map -C prodos/AII2048.cfg AII2048.o prodos/prodossupport.o" />
|
||||
</exec>
|
||||
<echo message="Copying AII2048 to disk image..."/>
|
||||
<appleCommander command="p" input="${projdir}/src/AII2048.SYSTEM" imagename="${builddir}/${distName}/disks/${diskName}.DSK" filename="AII2048.SYSTEM" type="sys" address="8192"/>
|
||||
<delete file="${projdir}/src/AII2048.SYSTEM"/>
|
||||
</target>
|
||||
|
||||
<target name="prodos-AII2048-image-prep" description="Start Empty ProDOS Disk Image">
|
||||
<!--
|
||||
Start Empty ProDOS disk images containing the release number
|
||||
-->
|
||||
<echo message="Prepping ProDOS disk images..."/>
|
||||
<delete file="${builddir}/${distName}/disks/${diskName}.DSK"/>
|
||||
<copy file="${builddir}/AII2048Base.dsk" tofile="${builddir}/${distName}/disks/${diskName}.DSK" />
|
||||
<appleCommander command="n" imagename="${builddir}/${distName}/disks/${diskName}.DSK" volname="${volName}"/>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
============================================================================================
|
||||
SOS section
|
||||
============================================================================================
|
||||
-->
|
||||
<target name="sos" depends="prodos-AII2048-image-prep, common" description="Orchestrate Overall Client Build for SOS" >
|
||||
<echo message="Assembling SOS code..."/>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l sos/sossupport.asm" />
|
||||
</exec>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l sos/rawio.asm" />
|
||||
</exec>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l sos/interp.asm" />
|
||||
</exec>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l sos/asmend.asm" />
|
||||
</exec>
|
||||
<echo message="Linking SOS AII2048..."/>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ld65" failonerror="true">
|
||||
<arg line="-o SOS.INTERP -m sos/AII2048.map -C sos/AII2048.cfg sos/interp.o AII2048.o sos/sossupport.o sos/rawio.o sos/asmend.o" />
|
||||
</exec>
|
||||
<echo message="Copying SOS.INTERP to disk image..."/>
|
||||
<appleCommander command="p" input="${projdir}/src/SOS.INTERP" imagename="${builddir}/${distName}/disks/${diskName}.DSK" filename="SOS.INTERP" type="sos" address="0000"/>
|
||||
<delete file="${projdir}/src/SOS.INTERP"/>
|
||||
</target>
|
||||
|
||||
<!--
|
||||
============================================================================================
|
||||
Common section
|
||||
============================================================================================
|
||||
-->
|
||||
<target name="common" description="Code common to all architectures">
|
||||
<echo message="Assembling common AII2048..."/>
|
||||
<exec dir="${projdir}/src" executable="${assemblerPath}/ca65" failonerror="true">
|
||||
<arg line="-t none -I . -l AII2048.asm" />
|
||||
</exec>
|
||||
</target>
|
||||
<!--
|
||||
============================================================================================
|
||||
Cleanup section
|
||||
============================================================================================
|
||||
-->
|
||||
<target name="clean" depends="wipe" description="Delete Generated Resources" >
|
||||
<!--
|
||||
Clean up everything
|
||||
-->
|
||||
<delete file="${projdir}/client/src/messages.asm" />
|
||||
<delete file="${builddir}/${distName}.tar.gz" />
|
||||
<delete file="${builddir}/${distName}.zip" />
|
||||
<delete file="${builddir}/${distName}.dmg" />
|
||||
<delete file="${builddir}/${distName}/disks/${diskName}.DSK" />
|
||||
<delete>
|
||||
<fileset dir="${projdir}/src" includes="**/*.o"/>
|
||||
<fileset dir="${projdir}/src" includes="**/*.map"/>
|
||||
<fileset dir="${projdir}/src" includes="**/*.lst"/>
|
||||
<fileset dir="${projdir}/src" includes="**/*.lib"/>
|
||||
</delete>
|
||||
</target>
|
||||
<target name="wipe" description="Delete the Distribution Directory" >
|
||||
<!--
|
||||
Really, really clean up everything
|
||||
-->
|
||||
<delete dir="${builddir}/${distName}" />
|
||||
</target>
|
||||
|
||||
</project>
|
BIN
build/lib/AppleCommander/AppleCommander-1.3.5.13-ac.jar
Normal file
BIN
build/lib/AppleCommander/AppleCommander-1.3.5.13-ac.jar
Normal file
Binary file not shown.
1489
src/AII2048.asm
Normal file
1489
src/AII2048.asm
Normal file
File diff suppressed because it is too large
Load Diff
62
src/applechr.i
Normal file
62
src/applechr.i
Normal file
|
@ -0,0 +1,62 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2006 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
; Define an ASCII charcter with no attributes (high bit set).
|
||||
.define _(char) char | $80
|
||||
|
||||
; Define an ASCII character with the inverse attribute
|
||||
.define _I(char) char & $3f
|
||||
|
||||
; Define an ASCII string with no attributes
|
||||
.macro asc Arg
|
||||
.repeat .strlen(Arg), I
|
||||
.byte .strat(Arg, I) | $80
|
||||
.endrep
|
||||
.endmacro
|
||||
|
||||
.define asc2(Arg) asc Arg
|
||||
|
||||
.macro ascz Arg
|
||||
.repeat .strlen(Arg), I
|
||||
.byte .strat(Arg, I) | $80
|
||||
.endrep
|
||||
.byte $00
|
||||
.endmacro
|
||||
|
||||
.macro asccr Arg
|
||||
.repeat .strlen(Arg), I
|
||||
.byte .strat(Arg, I) | $80
|
||||
.endrep
|
||||
.byte $8d
|
||||
.endmacro
|
||||
|
||||
; Define an ASCII string with the inverse attribute
|
||||
.macro inv Arg
|
||||
.repeat .strlen(Arg), I
|
||||
.byte .strat(Arg, I) & $3f
|
||||
.endrep
|
||||
.endmacro
|
||||
|
||||
.macro invcr Arg
|
||||
.repeat .strlen(Arg), I
|
||||
.byte .strat(Arg, I) & $3f
|
||||
.endrep
|
||||
.byte $8d
|
||||
.endmacro
|
191
src/const.i
Normal file
191
src/const.i
Normal file
|
@ -0,0 +1,191 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2006 - 2011 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
;---------------------------------------------------------
|
||||
; ProDOS/SOS call number equates
|
||||
;---------------------------------------------------------
|
||||
OS_REQUEST_SEG = $40
|
||||
OS_FIND_SEG = $41
|
||||
OS_CHANGE_SEG = $42
|
||||
OS_GET_SEG_INFO = $43
|
||||
OS_GET_SEG_NUM = $44
|
||||
OS_RELEASE_SEG = $45
|
||||
|
||||
OS_QUIT = $65
|
||||
|
||||
OS_READBLOCK = $80
|
||||
OS_WRITEBLOCK = $81
|
||||
OS_GET_TIME = $82
|
||||
OS_D_STATUS = $82
|
||||
OS_D_CONTROL = $83
|
||||
OS_GET_DEV_NUM = $84
|
||||
OS_D_INFO = $85
|
||||
|
||||
OS_CREATE = $C0
|
||||
OS_DESTROY = $C1
|
||||
OS_RENAME = $C2
|
||||
OS_SET_FILE_INFO = $C3
|
||||
OS_GET_FILE_INFO = $C4
|
||||
OS_ONL = $C5 ; ONLINE call for ProDOS; VOLUME call for SOS
|
||||
OS_SET_PREFIX = $C6
|
||||
OS_GET_PREFIX = $C7
|
||||
OS_OPEN = $C8
|
||||
OS_NEWLINE = $C9
|
||||
OS_READFILE = $CA
|
||||
OS_WRITEFILE = $CB
|
||||
OS_CLOSE = $CC
|
||||
OS_FLUSH = $CD
|
||||
OS_SET_MARK = $CE
|
||||
OS_GET_MARK = $CF
|
||||
OS_SET_EOF = $D0
|
||||
OS_GET_EOF = $D1
|
||||
OS_SET_LEVEL = $D2
|
||||
OS_GET_LEVEL = $D3
|
||||
|
||||
;---------------------------------------------------------
|
||||
; ProDOS/SOS error numbers
|
||||
;---------------------------------------------------------
|
||||
BADSCNUM = $01
|
||||
BADCZPAGE = $02
|
||||
BADXBYTE = $03
|
||||
BADSCPCNT = $04
|
||||
BADSCBNDS = $05
|
||||
|
||||
DNFERR = $10
|
||||
BADDNUM = $11
|
||||
BADREQCODE = $20
|
||||
BADCTLCODE = $21
|
||||
BADCTLPARM = $22
|
||||
NOTOPEN = $23
|
||||
NORESRC = $24
|
||||
BADOP = $25
|
||||
IOERROR = $27
|
||||
NOWRITE = $2B
|
||||
DISKSW = $2E
|
||||
|
||||
BADPATH = $40
|
||||
CFCBFULL = $41
|
||||
FCBFULL = $42
|
||||
BADREFNUM = $43
|
||||
PATHNOTFND = $44
|
||||
VNFERR = $45
|
||||
FNFERR = $46
|
||||
DUPERR = $47
|
||||
OVRERR = $48
|
||||
DIRFULL = $49
|
||||
CPTERR = $4A
|
||||
TYPERR = $4B
|
||||
EOFERR = $4C
|
||||
POSNERR = $4D
|
||||
ACCSERR = $4E
|
||||
BTSERR = $4F
|
||||
FILBUSY = $50
|
||||
DIRERR = $51
|
||||
NOTNATIVE = $52 ; NOTSOS/NOTPRODOS
|
||||
BADLSTCNT = $53
|
||||
BUFTBLFULL = $55
|
||||
BADSYSBUF = $56
|
||||
DUPVOL = $57
|
||||
NOTBLKDEV = $58
|
||||
LVLERR = $59
|
||||
BITMAPADR = $5A
|
||||
|
||||
BADBPKG = $E0
|
||||
SEGRQDN = $E1
|
||||
SEGTBLFULL = $E2
|
||||
BADSEGNUM = $E3
|
||||
SEGNOTFND = $E4
|
||||
BADSRCHMODE = $E5
|
||||
BADCHGMODE = $E6
|
||||
BADPGCNT = $E7
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Language card soft switches
|
||||
;---------------------------------------------------------
|
||||
LC2RD = $C080
|
||||
LC2WR = $C081 ; Read twice to enable write
|
||||
ROMONLY2 = $C082
|
||||
LC2RW = $C083 ; Read twice to enable write
|
||||
LC1WR = $C089
|
||||
LC1RW = $C08B ; Read twice to enable write
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Disk II soft switches
|
||||
;---------------------------------------------------------
|
||||
DRVSM0OFF = $C080 ; Phase 0 off Stepper motor
|
||||
DRVSM1OFF = $C082 ; Phase 1 off
|
||||
DRVSM2OFF = $C084 ; Phase 2 off
|
||||
DRVSM3OFF = $C086 ; Phase 3 off
|
||||
DRVSM0ON = $C081 ; Phase 0 on Stepper motor
|
||||
DRVSM1ON = $C083 ; Phase 1 on
|
||||
DRVSM2ON = $C085 ; Phase 2 on
|
||||
DRVSM3ON = $C087 ; Phase 3 on
|
||||
DRVON = $C089 ; drive on
|
||||
DRVSEL = $C08A ; drive selection
|
||||
DRVRD = $C08C ; Strobe input
|
||||
DRVRDM = $C08E ; switch on READ mode
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Characters
|
||||
;---------------------------------------------------------
|
||||
CHR_BLK = $20
|
||||
CHR_SP = _' '
|
||||
CHR_DOT = _'.'
|
||||
CHR_A = _'A'
|
||||
CHR_B = _'B'
|
||||
CHR_C = _'C'
|
||||
CHR_D = _'D'
|
||||
CHR_E = _'E'
|
||||
CHR_F = _'F'
|
||||
CHR_G = _'G'
|
||||
CHR_H = _'H'
|
||||
CHR_I = _'I'
|
||||
CHR_J = _'J'
|
||||
CHR_K = _'K'
|
||||
CHR_L = _'L'
|
||||
CHR_M = _'M'
|
||||
CHR_N = _'N'
|
||||
CHR_O = _'O' ; The letter O
|
||||
CHR_P = _'P'
|
||||
CHR_Q = _'Q'
|
||||
CHR_R = _'R'
|
||||
CHR_S = _'S'
|
||||
CHR_T = _'T'
|
||||
CHR_U = _'U'
|
||||
CHR_V = _'V'
|
||||
CHR_W = _'W'
|
||||
CHR_X = _'X'
|
||||
CHR_Y = _'Y'
|
||||
CHR_Z = _'Z'
|
||||
CHR_0 = _'0' ; Zero
|
||||
CHR_1 = _'1'
|
||||
CHR_2 = _'2'
|
||||
CHR_3 = _'3'
|
||||
CHR_4 = _'4'
|
||||
CHR_5 = _'5'
|
||||
CHR_6 = _'6'
|
||||
CHR_7 = _'7'
|
||||
CHR_8 = _'8'
|
||||
CHR_9 = _'9'
|
||||
CHR_ESC = $9b
|
||||
CHR_ENQ = $05
|
||||
CHR_ACK = $06
|
||||
CHR_NAK = $15
|
||||
CHR_CAN = $18
|
44
src/macros.i
Normal file
44
src/macros.i
Normal file
|
@ -0,0 +1,44 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.macro define_msg MESSAGE_DATA_LENGTH, d1, d2, d3, d4, d5, d6
|
||||
.local MESSAGE_DATA_START, MESSAGE_DATA_END
|
||||
|
||||
MESSAGE_DATA_LENGTH:
|
||||
.byte MESSAGE_DATA_END-MESSAGE_DATA_START
|
||||
MESSAGE_DATA_START:
|
||||
.byte d1
|
||||
.ifnblank d2
|
||||
.byte d2
|
||||
.endif
|
||||
.ifnblank d3
|
||||
.byte d3
|
||||
.endif
|
||||
.ifnblank d4
|
||||
.byte d4
|
||||
.endif
|
||||
.ifnblank d5
|
||||
.byte d5
|
||||
.endif
|
||||
.ifnblank d6
|
||||
.byte d6
|
||||
.endif
|
||||
MESSAGE_DATA_END:
|
||||
.endmacro
|
9
src/prodos/AII2048.cfg
Normal file
9
src/prodos/AII2048.cfg
Normal file
|
@ -0,0 +1,9 @@
|
|||
MEMORY {
|
||||
RAM: start = $2000, size = $6500, define = yes, file = %O;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
CODE: load = RAM, type = ro;
|
||||
RODATA: load = RAM, type = ro;
|
||||
BSS: load = RAM, type = bss;
|
||||
}
|
115
src/prodos/prodosconst.i
Normal file
115
src/prodos/prodosconst.i
Normal file
|
@ -0,0 +1,115 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 - 2010 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.include "applechr.i" ; ASCII string productions
|
||||
.include "const.i"
|
||||
|
||||
.export DELAY, HOME, PRBYTE, CH, CV, VTAB
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Zero page locations (all unused by ProDOS,
|
||||
; Applesoft, Disk Drivers and the Monitor)
|
||||
;---------------------------------------------------------
|
||||
|
||||
; $6-$9, $19-$1e are free
|
||||
ZP = $06 ; ($01 byte)
|
||||
UTILPTR = $07 ; ($02 bytes) Used for printing messages
|
||||
COL_SAV = $09 ; ($01 byte)
|
||||
RLEPREV = $19 ; ($01 byte)
|
||||
UDPI = $1a ; ($01 byte) Used by UDP SEND and RECEIVE
|
||||
BLKPTR = $1b ; ($02 bytes) Used by SEND and RECEIVE
|
||||
synccnt = $1d ; ($02 bytes) Used by nibble/halftrack
|
||||
CRC = $1d ; ($02 bytes) Used by ONLINE, SEND and RECEIVE
|
||||
Buffer = $1d ; ($02 bytes) Address pointer for FORMAT data
|
||||
CRCY = $8a ; ($01 byte) Used by UDP SEND
|
||||
TMOT = $8b ; ($01 byte) Timeout indicator
|
||||
NIBPCNT = $8c ; ($01 byte) Counts nibble pages
|
||||
|
||||
;---------------------------------------------------------
|
||||
; ProDOS specific stuff
|
||||
;---------------------------------------------------------
|
||||
OS_CALL_OFFSET = 4 ; Offset to the MLI call type/opcode byte
|
||||
CHR_RETURN = $8d ; Carriage return
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Passive addresses (not written to)
|
||||
;---------------------------------------------------------
|
||||
RSHIMEM = $BEFB
|
||||
GETBUFR = $BEF5
|
||||
FREEBUFR = $BEF8
|
||||
PRODOS_MLI = $BF00
|
||||
MLIADDR = $BF10
|
||||
DEVADR01 = $BF10 ; Slot 0 reserved
|
||||
DEVADR11 = $BF12 ; Slot 1, drive 1
|
||||
DEVADR21 = $BF14 ; Slot 2, drive 1
|
||||
DEVADR31 = $BF16 ; Slot 3, drive 1
|
||||
DEVADR41 = $BF18 ; Slot 4, drive 1
|
||||
DEVADR51 = $BF1A ; Slot 5, drive 1
|
||||
DEVADR61 = $BF1C ; Slot 6, drive 1
|
||||
DEVADR71 = $BF1E ; Slot 7, drive 1
|
||||
DEVADR02 = $BF20 ; Slot 0 reserved
|
||||
DEVADR12 = $BF22 ; Slot 1, drive 2
|
||||
DEVADR22 = $BF24 ; Slot 2, drive 2
|
||||
DEVADR32 = $BF26 ; Slot 3, drive 2
|
||||
DEVADR42 = $BF28 ; Slot 4, drive 2
|
||||
DEVADR52 = $BF2A ; Slot 5, drive 2
|
||||
DEVADR62 = $BF2C ; Slot 6, drive 2
|
||||
DEVADR72 = $BF2E ; Slot 7, drive 2
|
||||
DEVICE = $BF30 ; last drive+slot used, DSSS0000
|
||||
DEVCNT = $BF31 ; Count (minus 1) of active devices
|
||||
DEVLST = $BF32 ; List of active devices (Slot, drive, id =DSSSIIII)
|
||||
BITMAP = $BF58 ; bitmap of low 48k of memory
|
||||
DATE = $BF90 ; Date storage
|
||||
TIME = $BF92 ; Time storage
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Monitor equates
|
||||
;---------------------------------------------------------
|
||||
CH = $24 ; Character horizontal position
|
||||
CV = $25 ; Character vertical position
|
||||
BASL = $28 ; Base Line Address Lo
|
||||
BASH = $28 ; Base Line Address Hi
|
||||
INVFLG = $32 ; Inverse flag
|
||||
A1L = $3c
|
||||
A1H = $3d
|
||||
A2L = $3e
|
||||
A2H = $3f
|
||||
A4L = $42
|
||||
A4H = $43
|
||||
KEYBUFF = $0280 ; Keyboard buffer
|
||||
BASCALC = $FBC1 ; Calculate screen line
|
||||
CLREOL = $FC9C ; Clear to end of line
|
||||
CLREOP = $FC42 ; Clear to end of screen
|
||||
HOME = $FC58 ; Clear screen
|
||||
TABV = $FB5B ; Set BASL from Accumulator
|
||||
VTAB = $FC22 ; SET BASL FROM CV
|
||||
RDKEY = $FD0C ; Character input
|
||||
NXTCHAR = $FD75 ; Line input
|
||||
COUT = $FDED ; Character output routine (print to screen)
|
||||
COUT1 = $FDF0 ; Character output
|
||||
CROUT = $FD8E ; Output return character
|
||||
PRDEC = $ED24 ; Print pointer as decimal
|
||||
DELAY = $FCA8 ; Monitor delay: # cycles = (5*A*A + 27*A + 26)/2
|
||||
MEMMOVE = $FE2C ; Perform memory move: A1-A2 TO A4
|
||||
VERSION = $FBB3 ; Version byte
|
||||
ROM = $C082 ; Enables rom
|
||||
IN_BUF = $200 ; Keyboard input buffer
|
||||
CLRLN = $FC9C ; Clear Line routine
|
||||
PRBYTE = $FDDA ; Print Byte routine (HEX value)
|
75
src/prodos/prodosmacros.i
Normal file
75
src/prodos/prodosmacros.i
Normal file
|
@ -0,0 +1,75 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 - 2014 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.include "macros.i"
|
||||
|
||||
.macro CALLOS Arg1, Arg2
|
||||
clc
|
||||
jsr PRODOS_MLI ; Which ought to be $BF00
|
||||
.byte Arg1
|
||||
.addr Arg2
|
||||
.endmacro
|
||||
|
||||
.macro CALLOS_CHECK_POS
|
||||
bcc :+ ; Branch on success
|
||||
.endmacro
|
||||
|
||||
.macro CALLOS_CHECK_NEG
|
||||
bcs :+ ; Branch on failure
|
||||
.endmacro
|
||||
|
||||
.macro CONDITION_KEYPRESS
|
||||
and #$DF ; Convert to upper case
|
||||
.endmacro
|
||||
|
||||
.macro LDA_CH
|
||||
lda CH
|
||||
.endmacro
|
||||
|
||||
.macro LDA_CV
|
||||
lda CV
|
||||
.endmacro
|
||||
|
||||
.macro SET_HTAB
|
||||
sta CH
|
||||
.endmacro
|
||||
|
||||
.macro GO_FAST
|
||||
; Nothing to see here...
|
||||
.endmacro
|
||||
|
||||
.macro GO_SLOW
|
||||
; Nothing to see here...
|
||||
.endmacro
|
||||
|
||||
.macro JSR_GET_PREFIX
|
||||
jsr GET_PREFIX
|
||||
.endmacro
|
||||
|
||||
.macro CONDITION_CR
|
||||
; Nothing to see here...
|
||||
.endmacro
|
||||
|
||||
.macro COUT_MAYBE_INVERSE_SOS
|
||||
jsr COUT
|
||||
.endmacro
|
||||
|
||||
.define INV_BLOCK $20 ; ASCII for an inverse space - is different on SOS
|
||||
.define NRM_BLOCK $A0 ; ASCII for a normal space - is different on SOS
|
125
src/prodos/prodossupport.asm
Normal file
125
src/prodos/prodossupport.asm
Normal file
|
@ -0,0 +1,125 @@
|
|||
.include "prodos/prodosconst.i"
|
||||
.include "prodos/prodosmacros.i"
|
||||
|
||||
.importzp CellTable, GameState, RestartLatch, P0ScoreBCD
|
||||
.export READ_CHAR, DisplayBoard, DisplayState, InitScreen
|
||||
|
||||
InitScreen:
|
||||
jsr HOME
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------
|
||||
; READ_CHAR - Read a single character, no cursor
|
||||
;---------------------------------------------------------
|
||||
READ_CHAR:
|
||||
lda $C000 ; Read keyboard
|
||||
bit $c010
|
||||
cmp #$a0
|
||||
bne :+
|
||||
pha
|
||||
lda #$01
|
||||
sta RestartLatch
|
||||
pla
|
||||
: rts
|
||||
|
||||
DisplayBoard:
|
||||
; Home cursor
|
||||
lda #$00
|
||||
sta CH
|
||||
sta CV
|
||||
jsr VTAB
|
||||
; Paint top border
|
||||
lda #$20
|
||||
ldx #$0d
|
||||
: jsr COUT
|
||||
dex
|
||||
bne :-
|
||||
jsr CROUT
|
||||
; Paint first data row
|
||||
lda #$20
|
||||
jsr COUT
|
||||
ldy #$05
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$09
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$0e
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$13
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$18
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
ldx #$0d
|
||||
: jsr COUT
|
||||
dex
|
||||
bne :-
|
||||
lda #$14
|
||||
sta CH
|
||||
lda #$01
|
||||
sta CV
|
||||
jsr VTAB
|
||||
lda P0ScoreBCD
|
||||
jsr PRBYTE
|
||||
lda P0ScoreBCD+1
|
||||
jsr PRBYTE
|
||||
lda P0ScoreBCD+2
|
||||
jsr PRBYTE
|
||||
rts
|
||||
|
||||
DisplayState:
|
||||
pha
|
||||
lda #$25
|
||||
sta CH
|
||||
lda #$00
|
||||
sta CV
|
||||
jsr VTAB
|
||||
lda GameState
|
||||
jsr PRBYTE
|
||||
pla
|
||||
rts
|
9
src/sos/AII2048.cfg
Normal file
9
src/sos/AII2048.cfg
Normal file
|
@ -0,0 +1,9 @@
|
|||
MEMORY {
|
||||
RAM: start = $1FF2, size = $6500, define = yes, file = %O;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
CODE: load = RAM, type = ro;
|
||||
RODATA: load = RAM, type = ro;
|
||||
BSS: load = RAM, type = bss;
|
||||
}
|
2
src/sos/asmend.asm
Normal file
2
src/sos/asmend.asm
Normal file
|
@ -0,0 +1,2 @@
|
|||
.export ASMEND
|
||||
ASMEND:
|
32
src/sos/interp.asm
Normal file
32
src/sos/interp.asm
Normal file
|
@ -0,0 +1,32 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
; Header for SOS interpreter
|
||||
|
||||
.import ASMEND
|
||||
|
||||
.ORG $2000-14 ; START ADDRESS
|
||||
|
||||
.BYTE $53,$4f,$53,$20,$4e,$54,$52,$50 ; "SOS NTRP"
|
||||
.ADDR $0000 ; No extra header
|
||||
.ADDR ASMBEGIN ; Tell 'em where it starts
|
||||
.ADDR ASMEND ; Tell 'em where it ends
|
||||
|
||||
ASMBEGIN:
|
657
src/sos/rawio.asm
Normal file
657
src/sos/rawio.asm
Normal file
|
@ -0,0 +1,657 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2014 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.export PRBYTE, COUT, CROUT, HOME, CH, CV, VTAB, SETUP, COL40
|
||||
|
||||
KBDATA := $57
|
||||
LMARGIN := $0058
|
||||
RMARGIN := $0059
|
||||
WINTOP := $005A
|
||||
WINBTM := $005B
|
||||
CH := $005C
|
||||
CV := $005D
|
||||
BAS4L := $005E
|
||||
BASL := BAS4L ; Compatibility with II ROM
|
||||
BAS4H := $005F
|
||||
BASH := BAS4H ; Compatibility with II ROM
|
||||
BAS8L := $0060
|
||||
BAS8H := $0061
|
||||
TBAS4L := $0062
|
||||
TBAS4H := $0063
|
||||
TBAS8L := $0064
|
||||
TBAS8H := $0065
|
||||
FORGND := $0066
|
||||
BKGND := $0067
|
||||
MODES := $0068
|
||||
CURSOR := $0069
|
||||
STACK := $006A
|
||||
PROMPT := $006B
|
||||
TEMPX := $006C
|
||||
TEMPY := $006D
|
||||
CSWL := $006E
|
||||
CSWH := $006F
|
||||
KSWL := $0070
|
||||
KSWH := $0071
|
||||
PCL := $0072
|
||||
PCH := $0073
|
||||
A1L := $0074
|
||||
A1H := $0075
|
||||
A2L := $0076
|
||||
A2H := $0077
|
||||
A3L := $0078
|
||||
A3H := $0079
|
||||
A4L := $007A
|
||||
A4H := $007B
|
||||
STATE := $007C
|
||||
YSAV := $007D
|
||||
INBUF := $007E
|
||||
TWOMEG := $007F
|
||||
HRDERRS := $0080
|
||||
RDTEMP := $0080
|
||||
L03F8 := $03F8
|
||||
Q6L := $C08C
|
||||
Q6H := $C08D
|
||||
Q7L := $C08E
|
||||
ACIASTAT := $C0F1
|
||||
|
||||
SETUP: cld
|
||||
ldx #$03
|
||||
@Loop: lda HOOKS,x
|
||||
sta CSWL,x
|
||||
lda VBOUNDS,x
|
||||
sta LMARGIN,x
|
||||
dex
|
||||
bpl @Loop
|
||||
lda #$00
|
||||
sta INBUF
|
||||
lda #$1e
|
||||
sta INBUF+1
|
||||
lda #$BF
|
||||
sta MODES
|
||||
rts
|
||||
ENTRY: tsx
|
||||
stx STACK
|
||||
MON: cld
|
||||
jsr BELL
|
||||
MONZ: ldx STACK
|
||||
txs
|
||||
lda #$DF
|
||||
sta PROMPT
|
||||
jsr GETLN
|
||||
SCAN: jsr ZSTATE
|
||||
NXTINP: jsr GETNUM
|
||||
sty YSAV
|
||||
ldy #$12
|
||||
CMDSRCH:
|
||||
dey
|
||||
bmi MON
|
||||
cmp CMDTAB,y
|
||||
bne CMDSRCH
|
||||
jsr TOSUB
|
||||
ldy YSAV
|
||||
jmp NXTINP
|
||||
GETNUM: ldx #$00
|
||||
stx A2L
|
||||
stx A2H
|
||||
NXTCHR: lda (INBUF),y
|
||||
iny
|
||||
eor #$B0
|
||||
cmp #$0A
|
||||
bcc DIGIT
|
||||
adc #$88
|
||||
cmp #$FA
|
||||
bcc DIGRET
|
||||
DIGIT: ldx #$03
|
||||
asl a
|
||||
asl a
|
||||
asl a
|
||||
asl a
|
||||
NXTBIT: asl a
|
||||
rol A2L
|
||||
rol A2H
|
||||
dex
|
||||
bpl NXTBIT
|
||||
NXTBAS: lda STATE
|
||||
bne NXTBS2
|
||||
lda A2H,x
|
||||
sta A1H,x
|
||||
sta A3H,x
|
||||
NXTBS2: inx
|
||||
beq NXTBAS
|
||||
bne NXTCHR
|
||||
TOSUB: lda #$FA
|
||||
pha
|
||||
lda CMDVEC,y
|
||||
pha
|
||||
lda STATE
|
||||
ZSTATE: ldy #$00
|
||||
sty STATE
|
||||
DIGRET: rts
|
||||
CMDTAB: .byte $00,$03,$06,$EB,$EC,$EE,$EF,$F0
|
||||
.byte $F1,$99,$9B,$A0,$93,$A7,$A8,$95
|
||||
.byte $C6
|
||||
CMDVEC: .byte $90,$8E,$3F,$D3,$08,$8B,$4E,$D6
|
||||
.byte $2C,$B7,$1A,$1C,$CB,$CB,$AD,$A4
|
||||
.byte $39
|
||||
NXTA4: inc A4L
|
||||
bne NXTA1
|
||||
inc A4H
|
||||
NXTA1: inc A1L
|
||||
bne TSTA1
|
||||
inc A1H
|
||||
sec
|
||||
beq RETA1
|
||||
TSTA1: lda A1L
|
||||
sec
|
||||
sbc A2L
|
||||
sta HRDERRS
|
||||
lda A1H
|
||||
sbc A2H
|
||||
ora HRDERRS
|
||||
bne RETA1
|
||||
clc
|
||||
RETA1: rts
|
||||
PRBYTE: pha
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
jsr PRHEXZ
|
||||
pla
|
||||
PRHEX: and #$0F
|
||||
PRHEXZ: ora #$B0
|
||||
cmp #$BA
|
||||
bcc PRHEX2
|
||||
adc #$06
|
||||
PRHEX2: jmp COUT
|
||||
PRBYCOL:jsr PRBYTE
|
||||
PRCOLON:lda #$BA
|
||||
bne PRHEX2
|
||||
TST80WID:
|
||||
lda #$07
|
||||
bit MODES
|
||||
bvc SVMASK
|
||||
lda #$0F
|
||||
SVMASK: sta CURSOR
|
||||
rts
|
||||
A1PC: txa
|
||||
beq OLDPC
|
||||
A1PC1: lda A1L,x
|
||||
sta PCL,x
|
||||
dex
|
||||
bpl A1PC1
|
||||
OLDPC: rts
|
||||
ASCII1: sta CURSOR
|
||||
ASCII2: ldy YSAV
|
||||
lda (INBUF),y
|
||||
inc YSAV
|
||||
ldy #$00
|
||||
cmp #$A2
|
||||
bne ASCII3
|
||||
lda CURSOR
|
||||
bpl BITON
|
||||
rts
|
||||
ASCII3: cmp #$A7
|
||||
bne CRCHK
|
||||
lda CURSOR
|
||||
bmi BITOFF
|
||||
rts
|
||||
CRCHK: cmp #$8D ; Carriage Return Check
|
||||
beq ASCDONE
|
||||
and CURSOR
|
||||
jsr STOR1
|
||||
bne ASCII2
|
||||
ASCDONE:rts
|
||||
SEARCH: lda (A1L),y
|
||||
cmp A4L
|
||||
bne SRCH1
|
||||
jsr PRINTA1
|
||||
jsr CROUT
|
||||
SRCH1: jsr NXTA1
|
||||
bcc SEARCH
|
||||
rts
|
||||
ASCII: sec
|
||||
.byte $90
|
||||
ASCII0: clc
|
||||
CKMDE: tax
|
||||
stx STATE
|
||||
eor #$BA
|
||||
bne MON_ERROR
|
||||
BITON: lda #$FF
|
||||
bcs ASCII1
|
||||
BITOFF: lda #$7F
|
||||
bpl ASCII1
|
||||
REPEAT: bit $C000
|
||||
bpl REPEAT1
|
||||
jmp KEYIN
|
||||
REPEAT1:pla
|
||||
LFA36: pla
|
||||
jmp SCAN
|
||||
CRMON: jsr BL1
|
||||
jmp MONZ
|
||||
MOVE: jsr TSTA1
|
||||
bcs MON_ERROR
|
||||
MOVNXT: lda (A1L),y
|
||||
sta (A4L),y
|
||||
jsr NXTA4
|
||||
bcc MOVNXT
|
||||
rts
|
||||
VRFY: jsr TSTA1
|
||||
bcs MON_ERROR
|
||||
VRFY1: lda (A1L),y
|
||||
cmp (A4L),y
|
||||
beq VRFY2
|
||||
jsr MISMATCH
|
||||
jsr CROUT
|
||||
VRFY2: jsr NXTA4
|
||||
bcc VRFY1
|
||||
rts
|
||||
MISMATCH:
|
||||
lda A4H
|
||||
jsr PRBYTE
|
||||
lda A4L
|
||||
jsr PRBYCOL
|
||||
lda (A4L),y
|
||||
jsr PRBYTSP
|
||||
PRINTA1:jsr PRSPC
|
||||
lda A1H
|
||||
jsr PRBYTE
|
||||
lda A1L
|
||||
jsr PRBYCOL
|
||||
PRA1BYTE:
|
||||
lda (A1L),y
|
||||
PRBYTSP:jsr PRBYTE
|
||||
PRSPC: lda #$A0
|
||||
jmp COUT
|
||||
USER: jmp L03F8
|
||||
JUMP: pla
|
||||
pla
|
||||
GO: jsr A1PC
|
||||
jmp (PCL)
|
||||
RWERROR:jsr PRBYTE
|
||||
lda #$A1
|
||||
jsr COUT
|
||||
ERROR2: jsr NOSTOP
|
||||
MON_ERROR:
|
||||
jmp MON
|
||||
DEST: lda A2L
|
||||
sta A4L
|
||||
lda A2H
|
||||
sta A4H
|
||||
rts
|
||||
SEP: jsr SPCE
|
||||
tya
|
||||
beq SETMDZ
|
||||
BL1: dec YSAV
|
||||
beq DUMP8
|
||||
SPCE: dex
|
||||
bne SETMDZ
|
||||
cmp #$BA
|
||||
bne TSTDUMP
|
||||
STOR: sta STATE
|
||||
lda A2L
|
||||
STOR1: sta (A3L),y
|
||||
inc A3L
|
||||
bne DUMMY
|
||||
inc A3H
|
||||
DUMMY: rts
|
||||
SETMODE:ldy YSAV
|
||||
dey
|
||||
lda (INBUF),y
|
||||
SETMDZ: sta STATE
|
||||
rts
|
||||
READ: lda #$01
|
||||
.byte $2C
|
||||
WRTE: rts
|
||||
DUMP8: lda A1H
|
||||
sta A2H
|
||||
jsr TST80WID
|
||||
ora A1L
|
||||
sta A2L
|
||||
bne DUMP0
|
||||
TSTDUMP:lsr a
|
||||
ERROR1: bcs MON_ERROR
|
||||
DUMP: jsr TST80WID
|
||||
DUMP0: lda A1L
|
||||
sta A4L
|
||||
lda A1H
|
||||
sta A4H
|
||||
jsr TSTA1
|
||||
bcs ERROR1
|
||||
DUMP1: jsr PRINTA1
|
||||
DUMP2: jsr NXTA1
|
||||
bcs DUMPASC
|
||||
lda A1L
|
||||
and CURSOR
|
||||
bne DUMP3
|
||||
jsr DUMPASC
|
||||
bne DUMP1
|
||||
DUMP3: jsr PRA1BYTE
|
||||
bne DUMP2
|
||||
DUMPASC:lda A4L
|
||||
sta A1L
|
||||
lda A4H
|
||||
sta A1H
|
||||
jsr PRSPC
|
||||
ASC1: ldy #$00
|
||||
lda (A1L),y
|
||||
ora #$80
|
||||
cmp #$A0
|
||||
bcs ASC2
|
||||
lda #$AE
|
||||
ASC2: jsr COUT
|
||||
jsr NXTA4
|
||||
bcs ASC3
|
||||
lda A1L
|
||||
and CURSOR
|
||||
bne ASC1
|
||||
ASC3: jmp CROUT
|
||||
COL80: sec
|
||||
lda $C053
|
||||
bcs SET80
|
||||
COL40: clc
|
||||
lda $C052
|
||||
SET80: lda MODES
|
||||
ora #$40
|
||||
bcs SET80A
|
||||
and #$BF
|
||||
SET80A: sta MODES
|
||||
ora #$7F
|
||||
and #$A0
|
||||
sta FORGND
|
||||
bcs SET80B
|
||||
lda #$F0
|
||||
SET80B: sta BKGND
|
||||
HOME:
|
||||
CLSCRN: lda LMARGIN
|
||||
sta CH
|
||||
lda WINTOP
|
||||
sta CV
|
||||
CLREOP:
|
||||
CLEOP: lda CH
|
||||
pha
|
||||
lda CV
|
||||
pha
|
||||
jsr SETCV
|
||||
CLEOP1: jsr CLEOL
|
||||
lda LMARGIN
|
||||
sta CH
|
||||
jsr CURDOWN
|
||||
bcc CLEOP1
|
||||
pla
|
||||
tay
|
||||
pla
|
||||
sta CH
|
||||
tya
|
||||
bcs SETCV
|
||||
CLREOL:
|
||||
CLEOL: lda CH
|
||||
jmp CLEOL1
|
||||
CONTROL:cmp #$80
|
||||
bcc DISPLAYX
|
||||
TSTCR: cmp #$8D
|
||||
bne TSTBACK
|
||||
CARRAGE:
|
||||
jsr CLEOL
|
||||
jsr SETCHZ
|
||||
jmp NXTLIN
|
||||
CURUP: lda CV
|
||||
dec CV
|
||||
cmp WINTOP
|
||||
bne CURUP1
|
||||
lda WINBTM
|
||||
CURUP1: sec
|
||||
sbc #$01
|
||||
VTAB:
|
||||
TABV:
|
||||
SETCV: sta CV
|
||||
BASCALC:lda CV
|
||||
bpl BASCALC1
|
||||
CURIGHT:inc CH
|
||||
lda CH
|
||||
cmp RMARGIN
|
||||
SETCHZ: lda LMARGIN
|
||||
bcc CTRLRET
|
||||
SETCVH: sta CH
|
||||
CURDOWN:inc CV
|
||||
lda CV
|
||||
cmp WINBTM
|
||||
bcc BASCALC
|
||||
lda WINTOP
|
||||
bcs SETCV
|
||||
TSTBACK:cmp #$88
|
||||
bne TSTBELL
|
||||
CURLEFT:dec CH
|
||||
bmi LEFTUP
|
||||
lda CH
|
||||
cmp LMARGIN
|
||||
bpl CTRLRET
|
||||
LEFTUP: jsr CURUP
|
||||
lda RMARGIN
|
||||
sta CH
|
||||
bne CURLEFT
|
||||
COUT2: cmp #$A0
|
||||
bcc CONTROL
|
||||
bit MODES
|
||||
bmi DISPLAYX
|
||||
and #$7F
|
||||
DISPLAYX:
|
||||
jsr DISPLAY
|
||||
INCHORZ:jsr CURIGHT
|
||||
NXTLIN: bcs SCROLL
|
||||
rts
|
||||
BASCALC1:
|
||||
php
|
||||
pha
|
||||
lsr a
|
||||
and #$03
|
||||
ora #$04
|
||||
sta BAS4H
|
||||
eor #$0C
|
||||
sta BAS8H
|
||||
pla
|
||||
and #$18
|
||||
bcc BSCLC2
|
||||
adc #$7F
|
||||
BSCLC2: sta BAS4L
|
||||
asl a
|
||||
asl a
|
||||
ora BAS4L
|
||||
sta BAS4L
|
||||
sta BAS8L
|
||||
plp
|
||||
CTRLRET:rts
|
||||
COUT: pha
|
||||
sty TEMPY
|
||||
stx TEMPX
|
||||
jsr COUT1
|
||||
ldy TEMPY
|
||||
ldx TEMPX
|
||||
pla
|
||||
rts
|
||||
COUT1: jmp (CSWL)
|
||||
TSTBELL:cmp #$87
|
||||
bne LNFD
|
||||
BELL: ldx $C040
|
||||
rts
|
||||
LNFD: cmp #$8A
|
||||
bne CTRLRET
|
||||
jsr CURDOWN
|
||||
bcc CTRLRET
|
||||
SCROLL: lda WINTOP
|
||||
pha
|
||||
jsr SETCV
|
||||
SCRL1: ldx #$03
|
||||
SCRL2: lda BAS4L,x
|
||||
sta TBAS4L,x
|
||||
dex
|
||||
bpl SCRL2
|
||||
pla
|
||||
clc
|
||||
adc #$01
|
||||
cmp WINBTM
|
||||
bcs LASTLN
|
||||
pha
|
||||
jsr SETCV
|
||||
lda RMARGIN
|
||||
lsr a
|
||||
tay
|
||||
SCRL3: dey
|
||||
bmi SCRL1
|
||||
lda (BAS4L),y
|
||||
sta (TBAS4L),y
|
||||
lda (BAS8L),y
|
||||
sta (TBAS8L),y
|
||||
bcc SCRL3
|
||||
LASTLN: lda LMARGIN
|
||||
CLEOL1:
|
||||
tay
|
||||
lda FORGND
|
||||
sta (BAS4L),y
|
||||
iny
|
||||
tya
|
||||
cmp RMARGIN
|
||||
bcc CLEOL1
|
||||
rts
|
||||
DISPLAY:
|
||||
pha
|
||||
lda CH
|
||||
tay
|
||||
pla
|
||||
sta (BAS4L),y
|
||||
rts
|
||||
NOTCR: lda (INBUF),y
|
||||
jsr COUT
|
||||
cmp #$88
|
||||
beq BKSPCE
|
||||
cmp #$98
|
||||
beq CANCEL
|
||||
inc RDTEMP
|
||||
lda RDTEMP
|
||||
cmp #$28
|
||||
bne NXTCHAR
|
||||
CANCEL: lda #$DC
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
GETLN: lda PROMPT ; Get a line of input (with prompt)
|
||||
jsr COUT
|
||||
GETLN2: ldy #$01 ; Get a line of input (without prompt)
|
||||
sty RDTEMP
|
||||
BKSPCE: ldy RDTEMP
|
||||
beq GETLN2
|
||||
dec RDTEMP
|
||||
NXTCHAR:jsr RDCHAR
|
||||
ldy RDTEMP
|
||||
sta (INBUF),y
|
||||
cmp #$8D ; Carriage Return Check
|
||||
bne NOTCR
|
||||
CROUT: bit $C000
|
||||
bpl NOSTOP
|
||||
jsr KEYIN3
|
||||
cmp #$A0
|
||||
beq STOPLST
|
||||
cmp #$89
|
||||
bne NOSTOP
|
||||
jmp ERROR2
|
||||
STOPLST:lda $C000
|
||||
bpl STOPLST
|
||||
NOSTOP: lda #$8D ; Carriage Return Check
|
||||
jmp COUT
|
||||
RDKEY: jmp (KSWL)
|
||||
KEYIN: lda #$7F
|
||||
sta TBAS4H
|
||||
jsr PICK
|
||||
KEYIN1: pha
|
||||
jsr KEYWAIT
|
||||
bcs KEYIN2
|
||||
lda CURSOR
|
||||
jsr DISPLAY
|
||||
jsr KEYWAIT
|
||||
KEYIN2: pla
|
||||
php
|
||||
pha
|
||||
jsr DISPLAY
|
||||
pla
|
||||
plp
|
||||
bcc KEYIN1
|
||||
KEYIN3: lda $C000
|
||||
sta KBDATA
|
||||
lda $C008
|
||||
and #$0a ; Mask off all but the shift and alpha lock buttons
|
||||
cmp #$08 ; Is shift off and alpha lock off?
|
||||
bne @Shift
|
||||
lda KBDATA ; Yes - then move to lowercase
|
||||
cmp #$C1
|
||||
bmi @Shift
|
||||
cmp #$DB
|
||||
bpl @Shift
|
||||
clc
|
||||
adc #$20
|
||||
sta KBDATA
|
||||
@Shift: lda KBDATA
|
||||
KEYIN4: bit $C010
|
||||
rts
|
||||
KEYWAIT:inc TBAS4L
|
||||
bne KWAIT2
|
||||
inc TBAS4H
|
||||
lda #$7F
|
||||
clc
|
||||
and TBAS4H
|
||||
beq KEYRET
|
||||
KWAIT2: asl $C000
|
||||
bcc KEYWAIT
|
||||
KEYRET: rts
|
||||
ESC3: jsr GOESC
|
||||
ESCAPE: lda MODES
|
||||
and #$80
|
||||
eor #$AB
|
||||
sta CURSOR
|
||||
ESC1: jsr RDKEY
|
||||
ldy #$08
|
||||
ESC2: cmp ESCTABL,y
|
||||
beq ESC3
|
||||
dey
|
||||
bpl ESC2
|
||||
RDCHAR: lda #$20
|
||||
sta CURSOR
|
||||
jsr RDKEY
|
||||
cmp #$9B
|
||||
beq ESCAPE
|
||||
cmp #$95
|
||||
bne KEYRET
|
||||
jsr PICK
|
||||
ora #$80
|
||||
rts
|
||||
GOESC: lda #$FB
|
||||
pha
|
||||
lda ESCVECT,y
|
||||
pha
|
||||
rts
|
||||
ESCVECT:.byte $A1,$84,$7C,$62,$5C,$EC,$CA,$DC
|
||||
.byte $B7
|
||||
PICK: lda CH
|
||||
tay
|
||||
lda (BAS4L),y
|
||||
rts
|
||||
ESCTABL:.byte $CC,$D0,$D3,$B4,$B8,$88,$95,$8A
|
||||
.byte $8B,$00
|
||||
HOOKS: .addr COUT2
|
||||
.addr KEYIN
|
||||
VBOUNDS:.byte $00,$28,$00,$18
|
51
src/sos/sosconst.i
Normal file
51
src/sos/sosconst.i
Normal file
|
@ -0,0 +1,51 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 - 2014 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.include "applechr.i" ; ASCII string productions
|
||||
.include "const.i" ; ProDOS/SOS, CHR equates
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Horizontal tabs for volume display
|
||||
;---------------------------------------------------------
|
||||
H_SL = $01
|
||||
H_VO = $08
|
||||
H_SZ = $21
|
||||
VOL_LINE_LEN = $26
|
||||
|
||||
;---------------------------------------------------------
|
||||
; SOS specific stuff
|
||||
;---------------------------------------------------------
|
||||
OS_CALL_OFFSET = 1 ; Offset to the SOS call type byte
|
||||
CHR_RETURN = $8d ; Carriage return
|
||||
IN_BUF = $1e00 ; Must match the value that's set in rawio.asm at INBUF
|
||||
ALLOCSIR = $1913
|
||||
DEALCSIR = $1916
|
||||
|
||||
;---------------------------------------------------------
|
||||
; Apple /// hardware stuff
|
||||
;---------------------------------------------------------
|
||||
MAXSLOT = $04 ; The largest slot number we're likely to encounter (one-indexed)
|
||||
E_REG = $FFDF ; Environment register
|
||||
B_REG = $FFEF ; Bank register
|
||||
Z_REG = $FFD0 ; Zero-page register
|
||||
|
||||
INV_CHR_L = $4c
|
||||
INV_BLOCK = $20
|
||||
NRM_BLOCK = $a0
|
90
src/sos/sosmacros.i
Normal file
90
src/sos/sosmacros.i
Normal file
|
@ -0,0 +1,90 @@
|
|||
;
|
||||
; ADTPro - Apple Disk Transfer ProDOS
|
||||
; Copyright (C) 2008 - 2014 by David Schmidt
|
||||
; david__schmidt at users.sourceforge.net
|
||||
;
|
||||
; This program is free software; you can redistribute it and/or modify it
|
||||
; under the terms of the GNU General Public License as published by the
|
||||
; Free Software Foundation; either version 2 of the License, or (at your
|
||||
; option) any later version.
|
||||
;
|
||||
; This program is distributed in the hope that it will be useful, but
|
||||
; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
; for more details.
|
||||
;
|
||||
; You should have received a copy of the GNU General Public License along
|
||||
; with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
; 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
;
|
||||
|
||||
.include "macros.i"
|
||||
|
||||
.macro CALLOS Arg1, Arg2
|
||||
.byte $00
|
||||
.byte Arg1
|
||||
.addr Arg2
|
||||
.endmacro
|
||||
|
||||
.macro CALLOS_CHECK_POS
|
||||
beq :+ ; Branch on success
|
||||
.endmacro
|
||||
|
||||
.macro CALLOS_CHECK_NEG
|
||||
bne :+ ; Branch on failure
|
||||
.endmacro
|
||||
|
||||
.macro CONDITION_KEYPRESS
|
||||
and #$DF ; Convert to upper case
|
||||
ora #$80 ; Turn high bit on
|
||||
.endmacro
|
||||
|
||||
.macro LDA_BIGBUF_ADDR_HI
|
||||
lda FIND_SEG_BASE+1 ; Was lda #>BIGBUF (the high part of the address)
|
||||
sec
|
||||
sbc #$20
|
||||
clc
|
||||
.endmacro
|
||||
|
||||
.macro LDA_BIGBUF_ADDR_LO
|
||||
lda #$00
|
||||
.endmacro
|
||||
|
||||
.macro GO_SLOW
|
||||
jsr GO_SLOW_SOS ; Defined in conio.asm
|
||||
.endmacro
|
||||
|
||||
.macro GO_FAST
|
||||
jsr GO_FAST_SOS ; Defined in conio.asm
|
||||
.endmacro
|
||||
|
||||
.macro CONDITION_CR
|
||||
cmp #$8d ; If the character is $8d, strip off $80
|
||||
bne :+
|
||||
lda #$0d
|
||||
: ; Need a place to go
|
||||
.endmacro
|
||||
|
||||
.macro JSR_GET_PREFIX
|
||||
; Nothing to see here...
|
||||
.endmacro
|
||||
|
||||
.macro GO_MONITOR
|
||||
lda Z_REG
|
||||
sta USER_Z_REG
|
||||
lda E_REG
|
||||
sta USER_E_REG
|
||||
ora #$05 ; Set ROM on, stack to alternate
|
||||
and #$FB
|
||||
sta E_REG
|
||||
lda #$03 ; Use true zero page
|
||||
sta Z_REG
|
||||
jmp $F901 ; Jump to the monitor
|
||||
.endmacro
|
||||
|
||||
.macro GO_USER
|
||||
lda USER_E_REG
|
||||
sta E_REG ; Restore Environment register
|
||||
lda USER_Z_REG
|
||||
sta Z_REG ; Restore zero page
|
||||
.endmacro
|
133
src/sos/sossupport.asm
Normal file
133
src/sos/sossupport.asm
Normal file
|
@ -0,0 +1,133 @@
|
|||
.include "sos/sosconst.i"
|
||||
.include "sos/sosmacros.i"
|
||||
|
||||
.importzp CellTable, GameState, CH, CV, RestartLatch, P0ScoreBCD
|
||||
.import PRBYTE, COUT, CROUT, VTAB, SETUP, HOME, COL40
|
||||
.export READ_CHAR, DisplayBoard, DisplayState, InitScreen
|
||||
|
||||
InitScreen:
|
||||
lda E_REG ; Read the environment register
|
||||
and #$f7 ; Turn $C000-$CFFF to R/W
|
||||
ora #$40 ; Turn $C000-$CFFF to I/O
|
||||
sta E_REG ; Write the environment register
|
||||
jsr SETUP
|
||||
jsr COL40
|
||||
jsr HOME
|
||||
rts
|
||||
|
||||
;---------------------------------------------------------
|
||||
; READ_CHAR - Read a single character, no cursor
|
||||
;---------------------------------------------------------
|
||||
READ_CHAR:
|
||||
lda $C000 ;WAIT FOR NEXT COMMAND
|
||||
bit $C010
|
||||
CONDITION_KEYPRESS
|
||||
cmp #$80
|
||||
bne :+
|
||||
pha
|
||||
lda #$01
|
||||
sta RestartLatch
|
||||
pla
|
||||
: rts
|
||||
|
||||
DisplayBoard:
|
||||
; Home cursor
|
||||
lda #$00
|
||||
sta CH
|
||||
sta CV
|
||||
jsr VTAB
|
||||
; Paint top border
|
||||
lda #$20
|
||||
ldx #$0d
|
||||
: jsr COUT
|
||||
dex
|
||||
bne :-
|
||||
jsr CROUT
|
||||
; Paint first data row
|
||||
lda #$20
|
||||
jsr COUT
|
||||
ldy #$05
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$09
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$0e
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$13
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
jsr COUT
|
||||
iny
|
||||
: lda CellTable,y
|
||||
jsr PRBYTE
|
||||
lda #$a0
|
||||
jsr COUT
|
||||
iny
|
||||
cpy #$18
|
||||
bne :-
|
||||
dec CH
|
||||
lda #$20
|
||||
jsr COUT
|
||||
jsr CROUT
|
||||
lda #$20
|
||||
ldx #$0d
|
||||
: jsr COUT
|
||||
dex
|
||||
bne :-
|
||||
lda #$14
|
||||
sta CH
|
||||
lda #$01
|
||||
sta CV
|
||||
jsr VTAB
|
||||
lda P0ScoreBCD
|
||||
jsr PRBYTE
|
||||
lda P0ScoreBCD+1
|
||||
jsr PRBYTE
|
||||
lda P0ScoreBCD+2
|
||||
jsr PRBYTE
|
||||
rts
|
||||
|
||||
DisplayState:
|
||||
pha
|
||||
lda #$25
|
||||
sta CH
|
||||
lda #$00
|
||||
sta CV
|
||||
jsr VTAB
|
||||
lda GameState
|
||||
jsr PRBYTE
|
||||
pla
|
||||
rts
|
Loading…
Reference in New Issue
Block a user