Browse Source

integrated Wheels 64 KERNAL patches

pull/2/merge
Michael Steil 3 years ago
parent
commit
4f19a7987e
83 changed files with 26769 additions and 230 deletions
  1. 2
    5
      .gitignore
  2. 102
    64
      Makefile
  3. 27
    11
      README.md
  4. 76
    6
      config.inc
  5. 5
    0
      inc/c64.inc
  6. 2
    0
      inc/const.inc
  7. 30
    2
      inc/diskdrv.inc
  8. 15
    1
      inc/jumptab.inc
  9. 70
    0
      inc/jumptab_wheels.inc
  10. 28
    3
      inc/kernal.inc
  11. 109
    10
      kernal/bswfont.s
  12. 27
    4
      kernal/conio.s
  13. 499
    13
      kernal/dlgbox.s
  14. 847
    22
      kernal/filesys.s
  15. 53
    2
      kernal/fonts.s
  16. 253
    13
      kernal/graph.s
  17. 35
    6
      kernal/header.s
  18. 13
    0
      kernal/hw.s
  19. 21
    3
      kernal/icon.s
  20. 66
    4
      kernal/init.s
  21. 12
    2
      kernal/irq.s
  22. 72
    1
      kernal/jumptable.s
  23. 16
    8
      kernal/kernal_bsw.cfg
  24. 134
    0
      kernal/kernal_wheels.cfg
  25. 138
    7
      kernal/keyboard.s
  26. 135
    7
      kernal/load.s
  27. 29
    5
      kernal/mainloop.s
  28. 24
    1
      kernal/math.s
  29. 41
    3
      kernal/memory.s
  30. 122
    7
      kernal/menu.s
  31. 6
    0
      kernal/misc.s
  32. 53
    0
      kernal/mouse.s
  33. 26
    3
      kernal/panic.s
  34. 69
    1
      kernal/process.s
  35. 48
    2
      kernal/reu.s
  36. 7
    0
      kernal/serial.s
  37. 24
    0
      kernal/sprites.s
  38. 32
    5
      kernal/time.s
  39. 6
    2
      kernal/tobasic.s
  40. 16
    1
      kernal/vars.s
  41. 941
    0
      kernal/wheels/copydisk.s
  42. 923
    0
      kernal/wheels/copyfile.s
  43. 191
    0
      kernal/wheels/devnum.s
  44. 275
    0
      kernal/wheels/directory.s
  45. 1561
    0
      kernal/wheels/format.s
  46. 719
    0
      kernal/wheels/loadb.s
  47. 1320
    0
      kernal/wheels/partition.s
  48. 413
    0
      kernal/wheels/ram.s
  49. 133
    0
      kernal/wheels/reux.s
  50. 869
    0
      kernal/wheels/tmp/reu0.s
  51. 621
    0
      kernal/wheels/tmp/reu1.s
  52. 1185
    0
      kernal/wheels/tmp/reu10.s
  53. 521
    0
      kernal/wheels/tmp/reu10_7900.s
  54. 749
    0
      kernal/wheels/tmp/reu11.s
  55. 2112
    0
      kernal/wheels/tmp/reu2.s
  56. 686
    0
      kernal/wheels/tmp/reu3.s
  57. 640
    0
      kernal/wheels/tmp/reu4.s
  58. 1824
    0
      kernal/wheels/tmp/reu5.s
  59. 708
    0
      kernal/wheels/tmp/reu6.s
  60. 1117
    0
      kernal/wheels/tmp/reu7.s
  61. 1416
    0
      kernal/wheels/tmp/reu8.s
  62. 862
    0
      kernal/wheels/tmp/reu8_7900.s
  63. 1387
    0
      kernal/wheels/tmp/reu9.s
  64. 762
    0
      kernal/wheels/tmp/reu9_7900.s
  65. 248
    0
      kernal/wheels/tobasicb.s
  66. 650
    0
      kernal/wheels/validate.s
  67. 610
    0
      kernal/wheels/wheels.s
  68. BIN
      reference/wheels/kernal.bin
  69. BIN
      reference/wheels/reu0.bin
  70. BIN
      reference/wheels/reu1.bin
  71. BIN
      reference/wheels/reu10.bin
  72. BIN
      reference/wheels/reu11.bin
  73. BIN
      reference/wheels/reu2.bin
  74. BIN
      reference/wheels/reu3.bin
  75. BIN
      reference/wheels/reu4.bin
  76. BIN
      reference/wheels/reu5.bin
  77. BIN
      reference/wheels/reu6.bin
  78. BIN
      reference/wheels/reu7.bin
  79. BIN
      reference/wheels/reu8.bin
  80. BIN
      reference/wheels/reu9.bin
  81. BIN
      reference/wheels/reux.bin
  82. BIN
      reference/wheels/wheels.reu
  83. 36
    6
      regress.sh

+ 2
- 5
.gitignore View File

@@ -1,6 +1,3 @@
*.o
*.bin
*.prg
*.d64
GEOS64.D64
desktop.cvt
kernal.map
build

+ 102
- 64
Makefile View File

@@ -1,3 +1,6 @@

VARIANT ?= bsw

AS=ca65
LD=ld65

@@ -35,7 +38,30 @@ KERNAL_SOURCES= \
kernal/start.s \
kernal/time.s \
kernal/tobasic.s \
kernal/vars.s
kernal/vars.s \
kernal/wheels/wheels.s \
kernal/wheels/ram.s \
kernal/wheels/devnum.s \
kernal/wheels/format.s \
kernal/wheels/partition.s \
kernal/wheels/directory.s \
kernal/wheels/validate.s \
kernal/wheels/copydisk.s \
kernal/wheels/copyfile.s \
kernal/wheels/loadb.s \
kernal/wheels/tobasicb.s \
kernal/wheels/reux.s \

DRIVER_SOURCES= \
drv/drv1541.bin \
drv/drv1571.bin \
drv/drv1581.bin \
input/joydrv.bin \
input/amigamse.bin \
input/lightpen.bin \
input/mse1531.bin \
input/koalapad.bin \
input/pcanalog.bin

DEPS= \
inc/c64.inc \
@@ -48,88 +74,100 @@ DEPS= \
inc/kernal.inc \
inc/printdrv.inc

KERNAL_OBJECTS=$(KERNAL_SOURCES:.s=.o)
KERNAL_OBJS=$(KERNAL_SOURCES:.s=.o)
DRIVER_OBJS=$(DRIVER_SOURCES:.s=.o)
ALL_OBJS=$(KERNAL_OBJS) $(DRIVER_OBJS)

BUILD_DIR=build/$(VARIANT)

PREFIXED_KERNAL_OBJS = $(addprefix $(BUILD_DIR)/, $(KERNAL_OBJS))

ALL_BINS= \
kernal.bin \
lokernal.bin \
start.bin \
drv1541.bin \
drv1571.bin \
drv1581.bin \
amigamse.bin \
joydrv.bin \
lightpen.bin \
mse1531.bin \
koalapad.bin \
pcanalog.bin

all: geos.d64
$(BUILD_DIR)/kernal/kernal.bin \
$(BUILD_DIR)/drv/drv1541.bin \
$(BUILD_DIR)/drv/drv1571.bin \
$(BUILD_DIR)/drv/drv1581.bin \
$(BUILD_DIR)/input/joydrv.bin \
$(BUILD_DIR)/input/amigamse.bin \
$(BUILD_DIR)/input/lightpen.bin \
$(BUILD_DIR)/input/mse1531.bin \
$(BUILD_DIR)/input/koalapad.bin \
$(BUILD_DIR)/input/pcanalog.bin


all: $(BUILD_DIR)/geos.d64

regress:
@echo "********** Building variant 'bsw'"
@$(MAKE) VARIANT=bsw all
./regress.sh bsw
@echo "********** Building variant 'wheels'"
@$(MAKE) VARIANT=wheels all
./regress.sh wheels

clean:
rm -f $(KERNAL_OBJECTS) drv/*.o input/*.o $(ALL_BINS) combined.prg compressed.prg geos.d64

geos.d64: compressed.prg
if [ -e GEOS64.D64 ]; then \
cp GEOS64.D64 geos.d64; \
echo delete geos geoboot | c1541 geos.d64 >/dev/null; \
echo write compressed.prg geos | c1541 geos.d64 >/dev/null; \
echo \*\*\* Created geos.d64 based on GEOS64.D64.; \
rm -rf build
$(BUILD_DIR)/geos.d64: $(BUILD_DIR)/kernal_compressed.prg
@if [ -e GEOS64.D64 ]; then \
cp GEOS64.D64 $@; \
echo delete geos geoboot | c1541 $@ >/dev/null; \
echo write $< geos | c1541 $@ >/dev/null; \
echo \*\*\* Created $@ based on GEOS64.D64.; \
else \
echo format geos,00 d64 geos.d64 | c1541 >/dev/null; \
echo write compressed.prg geos | c1541 geos.d64 >/dev/null; \
if [ -e desktop.cvt ]; then echo geoswrite desktop.cvt | c1541 geos.d64; fi >/dev/null; \
echo \*\*\* Created fresh geos.d64.; \
echo format geos,00 d64 $@ | c1541 >/dev/null; \
echo write $< geos | c1541 $@ >/dev/null; \
if [ -e desktop.cvt ]; then echo geoswrite desktop.cvt | c1541 $@; fi >/dev/null; \
echo \*\*\* Created fresh $@.; \
fi;

compressed.prg: combined.prg
pucrunch -f -c64 -x0x5000 $< $@

combined.prg: $(ALL_BINS)
printf "\x00\x50" > tmp.bin
cat start.bin /dev/zero | dd bs=1 count=16384 >> tmp.bin 2> /dev/null
cat drv1541.bin /dev/zero | dd bs=1 count=3456 >> tmp.bin 2> /dev/null
cat lokernal.bin /dev/zero | dd bs=1 count=8640 >> tmp.bin 2> /dev/null
cat kernal.bin /dev/zero | dd bs=1 count=16192 >> tmp.bin 2> /dev/null
cat joydrv.bin >> tmp.bin 2> /dev/null
mv tmp.bin combined.prg

kernal.bin: $(KERNAL_OBJECTS) kernal/kernal.cfg
$(LD) -C kernal/kernal.cfg $(KERNAL_OBJECTS) -o $@ -m kernal.map
$(BUILD_DIR)/kernal_compressed.prg: $(BUILD_DIR)/kernal_combined.prg
@echo Creating $@
pucrunch -f -c64 -x0x5000 $< $@ 2> /dev/null

lokernal.bin: kernal.bin
$(BUILD_DIR)/kernal_combined.prg: $(ALL_BINS)
@echo Creating $@
@printf "\x00\x50" > $(BUILD_DIR)/tmp.bin
@dd if=$(BUILD_DIR)/kernal/kernal.bin bs=1 count=16384 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/drv/drv1541.bin /dev/zero | dd bs=1 count=3456 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/kernal/kernal.bin /dev/zero | dd bs=1 count=24832 skip=19840 >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@cat $(BUILD_DIR)/input/joydrv.bin >> $(BUILD_DIR)/tmp.bin 2> /dev/null
@mv $(BUILD_DIR)/tmp.bin $(BUILD_DIR)/kernal_combined.prg

start.bin: kernal.bin
$(BUILD_DIR)/drv/drv1541.bin: $(BUILD_DIR)/drv/drv1541.o drv/drv1541.cfg $(DEPS)
$(LD) -C drv/drv1541.cfg $(BUILD_DIR)/drv/drv1541.o -o $@

drv1541.bin: drv/drv1541.o drv/drv1541.cfg $(DEPS)
$(LD) -C drv/drv1541.cfg drv/drv1541.o -o $@
$(BUILD_DIR)/drv/drv1571.bin: $(BUILD_DIR)/drv/drv1571.o drv/drv1571.cfg $(DEPS)
$(LD) -C drv/drv1571.cfg $(BUILD_DIR)/drv/drv1571.o -o $@

drv1571.bin: drv/drv1571.o drv/drv1571.cfg $(DEPS)
$(LD) -C drv/drv1571.cfg drv/drv1571.o -o $@
$(BUILD_DIR)/drv/drv1581.bin: $(BUILD_DIR)/drv/drv1581.o drv/drv1581.cfg $(DEPS)
$(LD) -C drv/drv1581.cfg $(BUILD_DIR)/drv/drv1581.o -o $@

drv1581.bin: drv/drv1581.o drv/drv1581.cfg $(DEPS)
$(LD) -C drv/drv1581.cfg drv/drv1581.o -o $@
$(BUILD_DIR)/input/amigamse.bin: $(BUILD_DIR)/input/amigamse.o input/amigamse.cfg $(DEPS)
$(LD) -C input/amigamse.cfg $(BUILD_DIR)/input/amigamse.o -o $@

amigamse.bin: input/amigamse.o input/amigamse.cfg $(DEPS)
$(LD) -C input/amigamse.cfg input/amigamse.o -o $@
$(BUILD_DIR)/input/joydrv.bin: $(BUILD_DIR)/input/joydrv.o input/joydrv.cfg $(DEPS)
$(LD) -C input/joydrv.cfg $(BUILD_DIR)/input/joydrv.o -o $@

joydrv.bin: input/joydrv.o input/joydrv.cfg $(DEPS)
$(LD) -C input/joydrv.cfg input/joydrv.o -o $@
$(BUILD_DIR)/input/lightpen.bin: $(BUILD_DIR)/input/lightpen.o input/lightpen.cfg $(DEPS)
$(LD) -C input/lightpen.cfg $(BUILD_DIR)/input/lightpen.o -o $@

lightpen.bin: input/lightpen.o input/lightpen.cfg $(DEPS)
$(LD) -C input/lightpen.cfg input/lightpen.o -o $@
$(BUILD_DIR)/input/mse1531.bin: $(BUILD_DIR)/input/mse1531.o input/mse1531.cfg $(DEPS)
$(LD) -C input/mse1531.cfg $(BUILD_DIR)/input/mse1531.o -o $@

mse1531.bin: input/mse1531.o input/mse1531.cfg $(DEPS)
$(LD) -C input/mse1531.cfg input/mse1531.o -o $@
$(BUILD_DIR)/input/koalapad.bin: $(BUILD_DIR)/input/koalapad.o input/koalapad.cfg $(DEPS)
$(LD) -C input/koalapad.cfg $(BUILD_DIR)/input/koalapad.o -o $@

koalapad.bin: input/koalapad.o input/koalapad.cfg $(DEPS)
$(LD) -C input/koalapad.cfg input/koalapad.o -o $@
$(BUILD_DIR)/input/pcanalog.bin: $(BUILD_DIR)/input/pcanalog.o input/pcanalog.cfg $(DEPS)
$(LD) -C input/pcanalog.cfg $(BUILD_DIR)/input/pcanalog.o -o $@

pcanalog.bin: input/pcanalog.o input/pcanalog.cfg $(DEPS)
$(LD) -C input/pcanalog.cfg input/pcanalog.o -o $@
$(BUILD_DIR)/%.o: %.s
@mkdir -p `dirname $@`
$(AS) -D $(VARIANT)=1 $(ASFLAGS) $< -o $@

%.o: %.s $(DEPS)
$(AS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/kernal/kernal.bin: $(PREFIXED_KERNAL_OBJS) kernal/kernal_$(VARIANT).cfg
@mkdir -p $$(dirname $@)
$(LD) -C kernal/kernal_$(VARIANT).cfg $(PREFIXED_KERNAL_OBJS) -o $@ -m $(BUILD_DIR)/kernal/kernal.map

# a must!
love:

+ 27
- 11
README.md View File

@@ -78,25 +78,35 @@ Without pucrunch/c1541, you can still build an uncompressed KERNAL binary image.

## Building

Run `make` to build GEOS. This will create the following files:
Run `make` to build the original "BSW" "GEOS. This will create the following files in directory `build/bsw`:

* raw KERNAL components: `kernal.bin`, `lokernal.bin`, `init.bin`
* disk drive drivers: `drv1541.bin`, `drv1571.bin`, `drv1581.bin`
* input drivers: `amigamse.bin`, `joydrv.bin`, `lightpen.bin`, `mse1531.bin`, `koalapad.bin`, `pcanalog.bin`
* combined KERNAL image (`SYS 49155`): `combined.prg`
* compressed KERNAL image (`RUN`): `compressed.prg`
* combined KERNAL image (`SYS 49155`): `kernal_combined.prg`
* compressed KERNAL image (`RUN`): `kernal_compressed.prg`
* disk image: `geos.d64`

If you have the [cbmfiles.com](http://www.cbmfiles.com/) `GEOS64.D64` image in the current directory, the disk image will be based on that one, with the `GEOS` and `GEOBOOT` files deleted and the newly built kernel added. Otherwise, it will be a new disk image with the kernel, and, if you have a `desktop.cvt` file in the current directory, with `DESK TOP` added.

## Customization
## Variants

The build system supports the following variants:

* `bsw` (default): Berkeley Softworks GEOS 64 2.0 variant
* `cbmfiles`: The [cbmfiles.com](http://www.cbmfiles.com/) version. It starts out with a different date, and has some variables in the kernel pre-filled.
* `gateway`: The patched KERNEL shipped by gateWay 2.51. It contains a slightly modified BSW font, has the `Panic` code replaced with code to swap the disk driver on a RESTORE press, and it loads `GATEWAY` instead of `DESK TOP` as the shell.
* `wheels`: The Wheels 64 variant. It is heavily patched, optimized for size and speed, and contains additional features. It requires a RAM extension. The current version compiles into the same binary, but won't actually run because of missing boot code. More work is needed here.

You can build a specific variant like this:

make VARIANT=<variant>

`config.inc` contains lots of compile time options. Most of them have not been tested recently and may not work.
All output will be put into `build/<variant>`.

By default, the "BSW" version of GEOS is built, which is the same binary as English GEOS 2.0. The following options can be set to 1 to build different versions:
## Customization

* `cbmfiles = 1`: The [cbmfiles.com](http://www.cbmfiles.com/) version. It starts out with a different date, and has some variables in the kernel pre-filled.
* `gateway = 1`: The patched KERNEL shipped by gateWay 2.51. It contains a slightly modified BSW font, has the `Panic` code replaced with code to swap the disk driver on a RESTORE press, and it loads `GATEWAY` instead of `DESK TOP` as the shell.
If you want to customize your KERNAL, you can do so by flipping switches in `config.inc`, which contains lots of compile time options. Some them have not been tested recently and may not work.

The following options can be enabled:

@@ -170,7 +180,11 @@ The original GEOS was copy protected in three ways:

## Contributing

Pull requests are greatly appreciated. Please keep in mind that a default build should always recreate the orginal binaries (use `regress.sh` to check), so for smaller changes use conditional assembly using `.if`, and for larger changes create new source files that are conditionally compiled.
Pull requests are greatly appreciated. Please keep in mind that a default build should always recreate the orginal binaries, so for smaller changes use conditional assembly using `.if`, and for larger changes create new source files that are conditionally compiled.

The following command line will build the `bsw` and `wheels` variants of GEOS and compare the resulting binaries with reference binaries:

make regress

## TODO

@@ -179,7 +193,10 @@ Pull requests are greatly appreciated. Please keep in mind that a default build
* `boot.s` should be based on the original GEOS version
* REU detection is missing from `boot.s`
* The 1541 driver is hardcoded. We should create one version per drive.
* Most of Maciej's original changes/improvements have bitrotten and need to be resurrected
* Some of Maciej's original changes/improvements have bitrotten and need to be resurrected
* Wheels
* The Wheels variant needs boot code to start up correctly.
* The additional Wheels code needs to be reverse engineered properly.
* Integrate other versions as compile time options
* Localized versions
* Plus/4 version
@@ -187,7 +204,6 @@ Pull requests are greatly appreciated. Please keep in mind that a default build
* Apple II version (includes new APIs)
* Integrate existing patches as compile time options
* megaPatch
* Wheels
* SuperCPU
* Flash 8
* [misc](http://www.zimmers.net/anonftp/pub/cbm/geos/patches/index.html)

+ 76
- 6
config.inc View File

@@ -1,14 +1,84 @@
; GEOS System build configuration
; by Maciej Witkowiak

;------------------------
; which variant to build
cbmfiles = 0 ; the cbmfiles.com variant
gateway = 0 ; the gateWay 2.51 variant
; if all of these are 0, the BSW variant will be built
;------------------------
; use "make TARGET=<variant>" to build a specific variant

;------------------------
; the Berkeley Softworks GEOS 64 2.0 variant
;------------------------
.ifdef bsw
; BSW traps to counter tampering
trap = 1
.endif

;------------------------
; the cbmfiles.com variant of GEOS 64 2.0
;------------------------
.ifdef cbmfiles
trap = 1

; additionally, there are ".ifdef cbmfiles" checks
; throughout the code
.endif

;------------------------
; the gateWay 2.51 variant
;------------------------
.ifdef gateway
trap = 1
gateway_font = 1

; additionally, there are ".ifdef gateway" checks
; throughout the code
.endif

;------------------------
; the Wheels 64 variant
;------------------------
.ifdef wheels
; size optimizations that have no significant speed impact
wheels_size = 1

; optimizations that benefit both size and speed
wheels_size_and_speed = 1

; fixes for bugs in the BSW version
wheels_fixes = 1

; The original GEOS binary contains a few traps to counter tampering.
; They can be turned off with this global switch
trap = 1
; dialog box buttons can be selected using "o" for
; "Open" etc.
wheels_button_shortcuts = 1

; misc dialog box features, requires RAM extension
wheels_dlgbox_features = 1

; dialog box double click support
wheels_dlgbox_dblclick = 1

; support for chdir in dialogs
wheels_dialog_chdir = 1

; screensaver support
wheels_screensaver = 1

; ReadFile and WriteFile are in a "NewKernal" group
wheels_external_readwrite_file = 1

; allows applications to check whether modifier keys are pressed
wheels_expose_mod_keys = 1

; changes that are actually bad ideas
wheels_bad_ideas = 1

; German keyboard layout
german_keyboard = 1

; additionally, there are ".ifdef wheels" checks
; throughout the code
.endif

; general code generation/optimization control:
onlyVLIR = 0 ; only VLIR and SEQ supported

+ 5
- 0
inc/c64.inc View File

@@ -75,6 +75,11 @@ mob7clr = $d02e
keyreg = $d02f
clkreg = $d030

scpu_base = $d074
scpu_turbo = $d07b
scpu_hwreg_enable = $d07e
scpu_hwreg_disable = $d07f

;
vdcreg = $d600
vdcdata = $d601

+ 2
- 0
inc/const.inc View File

@@ -398,6 +398,8 @@ SET_SURPRESS = %01000000
SET_RIGHTJUST = %00000000
SET_LEFTJUST = %10000000

CLICK_COUNT = 30

; icons, menus status flags
ST_FLASH = $80
ST_INVERT = $40

+ 30
- 2
inc/diskdrv.inc View File

@@ -34,7 +34,35 @@ GetBorder = $9036
AddDirBlock = $9039
ReadBuff = $903c
WriteBuff = $903f
;??? = $9042
;??? = $9045
SendTSBytes = $9042
CheckErrors = $9045
AllocateBlock = $9048
ReadLink = $904b

; Wheels only
ddriveType = $904e
driverVersion = $904f
OpenRoot = $9050
OpenDirectory = $9053
GetBamBlock = $9056
PutBamBlock = $9059
dirHeadTrack = $905c
dirHeadSector = $905d
curBamBlock = $905e
lastBamByte = $905f
lastBamSector = $9060
bamAltered = $9061
highestTrack = $9062
GetHeadTS = $9063
PutHeadTS = $9066
GetLink = $9069
GetSysDirBlk = $906c
startBank = $906f
startPage = $9070
pagesUsed = $9071
cableType = $9073
ckdBrdrYet = $9074 ; $ff means GetNxtDirEntry is working
; in the system directory. (read only)
dir3Head = $9c80 ; to be used by the disk drivers only.
; It resides within each driver.
; ($9c80-$9d7f)

+ 15
- 1
inc/jumptab.inc View File

@@ -175,4 +175,18 @@ AccessCache = $c2ef
HideOnlyMouse = $c2f2
SetColorMode = $c2f5
ColorCard = $c2f8
ColorRectangle = $c2fb
ColorRectangle = $c2fb ; Wheels renames this to ColorBox

; only in Wheels
InitMachine = $c2fe
GEOSOptimize = $c301
DEFOptimize = $c304
DoOptimize = $c307
NFindFTypes = $c30a
ReadXYPot = $c30d
MainIRQ = $c310
ColorRectangle_W = $c313 ; Original name is ColorRectangle
i_ColorRectangle = $c316
SaveColor = $c319
RstrColor = $c31c
ConvToCards = $c31f

+ 70
- 0
inc/jumptab_wheels.inc View File

@@ -0,0 +1,70 @@
; Wheels
; these are addresses to routines that are in the extended
; kernal that get loaded in at $5000 in groups.

; group 0
GetRAMBam = $5000
PutRAMBam = $5003
AllocAllRAM = $5006
AllocRAMBlock = $5009
FreeRAMBlock = $500c
GetRAMInfo = $500f
RamBlkAlloc = $5012
RemoveDrive = $5015
SvRamDevice = $5018
DelRamDevice = $501b
RamDevInfo = $501e

; group 1
DevNumChange = $5000
SwapDrives = $5003

; group 2
NSetGEOSDisk = $5000
DBFormat = $5000+3
FormatDisk = $5000+6
DBEraseDisk = $5000+9
EraseDisk = $5000+12

; group 3
OReadFile = $5000

; group 4
OWriteFile = $5000

; group 5
ChgParType = $5000
ChPartition = $5000+3
ChSubdir = $5000+6
ChDiskDirectory = $5000+9
GetFEntries = $5000+12
TopDirectory = $5000+15
UpDirectory = $5000+18
DownDirectory = $5000+21
GoPartition = $5000+24
ChPartOnly = $5000+30
FindRamLink = $5000+39

; group 6
MakeDirectory = $5000
MakeSysDir = $5003

; group 7
ValDisk = $5000

; group 8
CopyDisk = $5000
TestCompatibility = $5003

; group 9
CopyFile = $5000

; group 10
NewDesktop = $5000
OEnterDesktop = $5003
InstallDriver = $5006
FindDesktop = $5009
FindAFile = $500c

; group 11
KToBasic = $5000

+ 28
- 3
inc/kernal.inc View File

@@ -21,12 +21,27 @@ DBoxDesc = $43
DBoxDescL = $43
DBoxDescH = $44

; Wheels internal vars

; bit 7 = time out, run the screensaver.
; bit 6 = saver blocked, don't run it yet.
; bit 5 = stop the timer.
; bit 4 = timer off. Screensaver will never run.
; bits 2,3 = unused.
; bit 1 = if set then ignore mouse movement.
; bit 0 = screensaver is running.
saverStatus = $88b4
saverTimer = $88b5 ; time remaining before screensaver.
saverCount = $88b7 ; user defined countdown to screensaver.
saverBank = $88b9 ; bank in reu holding screensaver.
vdcRamType = $88ba ; bit7 1=64K VDC ram, 0=16K ram.

; GEOS Kernal internal vars (not for use by apps)

savedmoby2 = $88bb ; ---
scr80polar = $88bc ; ---
scr80colors = $88bd ; ---
vdcClrMode = $88be ; ---
vdcClrMode = $88be ; --- (used with 128 only)
driveData = $88bf ; drv
ramExpSize = $88c3 ; reu
sysRAMFlg = $88c4 ; drv, filesys, memory, tobasic
@@ -62,7 +77,7 @@ obj7Pointer = $8fff ; ---
BVBuff = $0400
RunREU = $6000

; locations to be defined later
keyScanChar = $87ea ; character fetched during the last interrupt. (Wheels)
E87FC = $87fc
E87FD = $87fd
E87FE = $87fe
@@ -72,10 +87,20 @@ A885D = $885d
A885E = $885e
A885F = $885f
A8860 = $8860
e88b7 = $88b7 ;4 bytes indexed by curDrive, 1571 disk type (SS/DS)
dblDBData = $88a7 ; icon number used for double clicking
; in the file requestor. Default is OPEN.
minKeyRepeat = $88b0 ; minimum key repeat value during accel. (Wheels)
keyAccFlag = $88b1 ; zero turns off key acceleration. (Wheels)
keyAccel = $88b2 ; used during key acceleration. (Wheels)
keyRptCount = $88b3 ; user defined key repeat delay. (Wheels)
e88b7 = $88b7 ; 4 bytes indexed by curDrive, 1571 disk type (SS/DS)
A8FE8 = $8fe8
A8FF0 = $8ff0

; Wheels
prtHdrStorage = $f700 ; print driver header stored here.
prtCodeStorage = $f800 ; print driver code stored here.

; RamExp stats block structure
DACC_ST_ADDR = $80 ;deskAccessory load addr
DACC_LGH = $82 ;deskAccessory lenght

+ 109
- 10
kernal/bswfont.s View File

@@ -10,6 +10,104 @@
.segment "bswfont"

BSWFont:
.ifdef wheels
.byte $06,$3c,$00,$09,$08,$00,$cc,$00
.byte $00,$00,$05,$00,$07,$00,$0b,$00
.byte $11,$00,$17,$00,$1d,$00,$23,$00
.byte $25,$00,$29,$00,$2d,$00,$33,$00
.byte $39,$00,$3c,$00,$41,$00,$43,$00
.byte $4a,$00,$4f,$00,$52,$00,$56,$00
.byte $5a,$00,$5f,$00,$63,$00,$68,$00
.byte $6d,$00,$72,$00,$77,$00,$79,$00
.byte $7c,$00,$80,$00,$84,$00,$88,$00
.byte $8e,$00,$94,$00,$9a,$00,$9f,$00
.byte $a4,$00,$a9,$00,$ad,$00,$b1,$00
.byte $b6,$00,$bc,$00,$be,$00,$c2,$00
.byte $c8,$00,$cc,$00,$d4,$00,$da,$00
.byte $e0,$00,$e5,$00,$eb,$00,$f0,$00
.byte $f5,$00,$f9,$00,$fe,$00,$04,$01
.byte $0c,$01,$12,$01,$18,$01,$1e,$01
.byte $23,$01,$28,$01,$2d,$01,$33,$01
.byte $3b,$01,$3f,$01,$44,$01,$49,$01
.byte $4e,$01,$53,$01,$58,$01,$5b,$01
.byte $60,$01,$65,$01,$67,$01,$69,$01
.byte $6e,$01,$70,$01,$78,$01,$7d,$01
.byte $83,$01,$88,$01,$8d,$01,$90,$01
.byte $94,$01,$97,$01,$9c,$01,$a2,$01
.byte $aa,$01,$b0,$01,$b5,$01,$ba,$01
.byte $bf,$01,$c4,$01,$c9,$01,$ce,$01
.byte $d7,$01,$e0,$01,$02,$a5,$1e,$c1
.byte $88,$a0,$80,$00,$00,$0c,$59,$82
.byte $e2,$79,$8c,$00,$00,$38,$01,$1c
.byte $67,$3b,$99,$14,$51,$44,$14,$4e
.byte $71,$ce,$3b,$a5,$14,$14,$51,$7d
.byte $29,$48,$00,$08,$04,$00,$20,$20
.byte $42,$a1,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$18,$00,$38
.byte $02,$a5,$28,$ca,$09,$12,$a0,$00
.byte $00,$52,$c4,$46,$84,$0a,$52,$01
.byte $04,$44,$e2,$92,$94,$a2,$25,$14
.byte $52,$46,$36,$51,$4a,$29,$41,$25
.byte $14,$14,$51,$04,$00,$00,$00,$04
.byte $04,$00,$20,$40,$40,$21,$00,$00
.byte $00,$00,$04,$00,$00,$00,$00,$12
.byte $94,$a4,$00,$78,$02,$0f,$98,$12
.byte $42,$09,$c2,$00,$00,$96,$44,$4a
.byte $c8,$12,$52,$02,$72,$08,$84,$52
.byte $84,$a2,$21,$14,$54,$45,$55,$51
.byte $4a,$29,$21,$25,$14,$12,$91,$08
.byte $c6,$48,$80,$02,$77,$18,$e6,$67
.byte $72,$a5,$76,$71,$ce,$39,$36,$94
.byte $52,$51,$4b,$cc,$00,$24,$00,$c7
.byte $02,$05,$08,$21,$e2,$0b,$e2,$00
.byte $01,$1a,$48,$92,$2e,$21,$8e,$94
.byte $01,$11,$c4,$5c,$84,$bb,$a1,$f4
.byte $58,$44,$94,$d1,$4a,$29,$11,$25
.byte $14,$91,$0a,$11,$29,$49,$40,$00
.byte $94,$a5,$29,$49,$4a,$a9,$49,$4a
.byte $29,$4a,$44,$94,$52,$4a,$48,$82
.byte $64,$a8,$00,$c0,$02,$0f,$8c,$42
.byte $42,$09,$cf,$87,$82,$12,$50,$5e
.byte $29,$22,$42,$02,$72,$11,$27,$d2
.byte $84,$a2,$2d,$14,$54,$44,$14,$51
.byte $72,$2e,$09,$25,$15,$52,$84,$21
.byte $e9,$4a,$20,$00,$94,$a1,$2f,$49
.byte $4a,$b1,$49,$4a,$29,$4a,$24,$94
.byte $52,$44,$49,$0e
.byte $94,$a4,$00,$c7,$00,$05,$0a,$9a
.byte $42,$0a,$a2,$00,$04,$12,$50,$42
.byte $29,$22,$44,$01,$04
.byte $00
.byte $e4,$52,$84,$a2,$25,$14,$52,$44
.byte $14,$51,$42,$2a,$09,$24,$a6,$34
.byte $44,$41,$29,$48,$00,$00,$94,$a1
.byte $28,$49,$4a,$a9,$49,$4a,$29,$4a
.byte $14,$92,$92,$4a,$4a,$12,$94,$a4
.byte $00,$78,$02,$05,$3c,$19,$c1,$10
.byte $82,$10,$28,$0c,$5d,$82,$c6,$21
.byte $88,$90,$00,$10,$44,$5c,$77,$3a
.byte $1d,$15,$91,$74,$14,$4e,$41,$c9
.byte $71,$1c,$44,$14,$44,$7d,$26,$30
.byte $00,$00,$57,$1c,$e7,$47,$4a,$a5
.byte $49,$49,$ce,$3a,$62,$71,$0d,$91
.byte $3b,$ce,$63,$28,$00,$38,$00,$00
.byte $08,$00,$00,$a0,$00,$20,$00,$00
.byte $00,$00,$00,$00,$00,$20,$00,$01
.byte $c0,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$40,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$01,$00,$80,$00,$00,$08,$08
.byte $00,$00,$00,$00,$08,$00,$00,$20
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$20
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $1f,$e0,$00,$00,$00,$02,$01,$00
.byte $00,$00,$08,$08,$00,$00,$00,$00
.byte $10,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00
.else
.byte $06, $3c, $00, $09, $08, $00, $cc, $00, $00, $00, $05, $00, $07, $00, $0b, $00
.byte $11, $00, $17, $00, $1d, $00, $23, $00, $25, $00, $29, $00, $2d, $00, $33, $00
.byte $39, $00, $3c, $00, $41, $00, $43, $00, $4a, $00, $4f, $00, $52, $00, $56, $00
@@ -22,7 +120,7 @@ BSWFont:
.byte $4d, $01, $52, $01, $57, $01, $5a, $01, $5f, $01, $64, $01, $66, $01, $68, $01
.byte $6d, $01, $6f, $01, $77, $01, $7c, $01, $82, $01, $87, $01, $8c, $01, $8f, $01
.byte $93, $01, $96, $01, $9b, $01, $a1, $01, $a9, $01, $af, $01, $b4, $01
.if gateway
.ifdef gateway_font
.byte $b9, $01, $bd, $01, $bf, $01, $c3, $01, $c9, $01, $d1, $01, $dc
.else
.byte $ba, $01, $be, $01, $c0, $01, $c4, $01, $ca, $01, $d2, $01, $dd
@@ -32,7 +130,7 @@ BSWFont:
.byte $67, $3b, $99, $14, $51, $44, $14, $4e, $71, $ce, $3b, $a5, $14, $14, $51, $7d
.byte $a0, $30, $00, $10, $08, $00, $40, $40, $85, $42, $00, $00, $00, $00, $00, $00
.byte $00, $00, $00
.if gateway
.ifdef gateway_font
.byte $0a, $84, $80, $1c, $00
.else
.byte $05, $42, $40, $07, $80
@@ -41,7 +139,7 @@ BSWFont:
.byte $00, $52, $c4, $46, $84, $0a, $52, $01, $04, $45, $12, $92, $94, $a2, $25, $14
.byte $52, $46, $36, $51, $4a, $29, $41, $25, $14, $14, $51, $05, $10, $10, $00, $08
.byte $08, $00, $40, $80, $80, $42, $00, $00, $00, $00, $08, $00, $00, $00, $00
.if gateway
.ifdef gateway_font
.byte $12, $4b, $00, $3c, $00
.else
.byte $09, $25, $80, $0f, $80
@@ -50,7 +148,7 @@ BSWFont:
.byte $c8, $12, $52, $02, $72, $09, $74, $52, $84, $a2, $21, $14, $54, $45, $55, $51
.byte $4a, $29, $21, $25, $14, $12, $91, $09, $08, $11, $00, $04, $ee, $31, $cc, $ce
.byte $e5, $4a, $ec, $e3, $9c, $72, $6d, $28, $a4, $a2, $97
.if gateway
.ifdef gateway_font
.byte $92, $40, $00, $77, $00
.else
.byte $89, $20, $00, $1c, $70
@@ -59,7 +157,7 @@ BSWFont:
.byte $01, $11, $54, $5c, $84, $bb, $a1, $f4, $58, $44, $94, $d1, $4a, $29, $11, $25
.byte $14, $91, $0a, $11, $04, $12, $80, $01, $29, $4a, $52, $92, $95, $52, $92, $94
.byte $52, $94, $89, $28, $a4, $94, $91
.if gateway
.ifdef gateway_font
.byte $22, $20, $00, $70
.else
.byte $11, $10, $00, $1c
@@ -69,7 +167,7 @@ BSWFont:
.byte $84, $a2, $2d, $14, $54, $44, $14, $51, $72, $2e, $09, $25, $15, $52, $84, $21
.byte $02, $14, $40, $01, $29, $42, $5e, $92, $95, $62, $92, $94, $52, $94, $49, $28
.byte $a4, $88, $92
.if gateway
.ifdef gateway_font
.byte $22, $20, $00, $77, $00
.else
.byte $11, $10, $00, $1c, $70
@@ -78,7 +176,7 @@ BSWFont:
.byte $04, $12, $50, $42, $29, $22, $44, $01, $04, $01, $04, $52, $84, $a2, $25, $14
.byte $52, $44, $14, $51, $42, $2a, $09, $24, $a6, $34, $44, $41, $01, $10, $00, $01
.byte $29, $42, $50, $92, $95, $52, $92, $94, $52, $94, $29, $25, $24, $94, $94
.if gateway
.ifdef gateway_font
.byte $12, $40, $00, $3c, $00
.else
.byte $09, $20, $00, $0f, $80
@@ -87,7 +185,7 @@ BSWFont:
.byte $c6, $21, $88, $90, $00, $10, $e4, $5c, $77, $3a, $1d, $15, $91, $74, $14, $4e
.byte $41, $c9, $71, $1c, $44, $14, $44, $7d, $00, $90, $00, $00, $ae, $39, $ce, $8e
.byte $95, $4a, $92, $93, $9c, $74, $c4, $e2, $1b, $22, $77
.if gateway
.ifdef gateway_font
.byte $92, $40, $00, $1c, $00
.else
.byte $89, $20, $00, $07, $80
@@ -96,7 +194,7 @@ BSWFont:
.byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $00, $00
.byte $00, $00, $00, $01, $80, $30, $00, $00, $00, $00, $00, $02, $01, $00, $00, $00
.byte $10, $10, $00, $00, $00, $00, $10
.if gateway
.ifdef gateway_font
.byte $0a, $80
.else
.byte $05, $40
@@ -106,9 +204,10 @@ BSWFont:
.byte $00, $00, $00, $00, $00, $00, $00, $00, $00, $20, $00, $00, $00, $00, $00, $00
.byte $00, $00, $3f, $c0, $00, $00, $00, $04, $02, $00, $00, $00, $10, $10, $00, $00
.byte $00, $00, $20
.if gateway
.ifdef gateway_font
.byte $02
.else
.byte $01
.endif
.byte $00, $00, $00, $00
.endif

+ 27
- 4
kernal/conio.s View File

@@ -36,7 +36,7 @@
.import stringMargCtrl
.import PrvCharWidth

.if (trap)
.ifdef trap
; filesys.s
.import SerialHiCompare
; serial.s
@@ -118,12 +118,15 @@ _SmallPutChar:
jmp FontPutChar

DoTAB:
lda #0
.ifndef wheels_size_and_speed ; no-op
lda #0 ; XXX was this a constant in the source?
add r11L
sta r11L
bcc @1
inc r11H
@1: rts
@1:
.endif
rts

DoLF:
lda r1H
@@ -230,8 +233,12 @@ DoESC_GRAPHICS:
ldx #r0
jsr Ddec
ldx #r0
.ifdef wheels_size_and_speed ; tail call
jmp Ddec
.else
jsr Ddec
rts
.endif

_i_PutString:
PopB r0L
@@ -285,7 +292,7 @@ _LoadCharSet:
AddW r0, curIndexTable
AddW r0, cardDataPntr

.if (trap)
.ifdef trap
; copy high-byte of serial
lda SerialHiCompare
bne @2
@@ -388,7 +395,12 @@ GSSkeyVector:
beq @5
sta (string),y
PushB dispBufferOn
.ifdef wheels_size_and_speed ; duplicate read of dispBufferOn
and #$20
beq @3
.else
bbrf 5, dispBufferOn, @3
.endif
LoadB dispBufferOn, (ST_WR_FORE | ST_WRGS_FORE)
@3: PushB r1H
clc
@@ -406,7 +418,9 @@ GSSkeyVector:
stx stringX
bra @5
@4: jsr GSHelp1
.ifndef wheels_size_and_speed ; no op
bra @5
.endif
@5: jmp _PromptOn
@6: sei
jsr _PromptOff
@@ -532,7 +546,11 @@ CalcDecimal:
bcc @3
sta r0H
iny
.ifdef wheels_size_and_speed ; Y can't be 0
bne @2
.else
bra @2
.endif
@3: lda r0L
adc DecTabL,x
sta r0L
@@ -580,8 +598,13 @@ DecTabH:
;---------------------------------------------------------------
_PutDecimal:
jsr CalcDecimal
.ifdef wheels_size_and_speed ; duplicate load
lda r2L
bmi @1
.else
bbsf 7, r2L, @1
lda r2L
.endif
and #$3f
sub r3H
add r11L

+ 499
- 13
kernal/dlgbox.s View File

@@ -10,6 +10,9 @@
.include "kernal.inc"
.include "jumptab.inc"
.include "c64.inc"
.ifdef wheels_dlgbox_features
.include "jumptab_wheels.inc"
.endif

; conio.s
.import _UseSystemFont
@@ -26,6 +29,11 @@
; mouse.s
.import _StartMouseMode

.ifdef wheels_fixes
; mouse.s
.import DoESC_RULER
.endif

; var.s
.import menuOptNumber
.import TimersTab
@@ -56,7 +64,13 @@ _DoDlgBox:
bne @1
jsr DlgBoxPrep
jsr DrawDlgBox
.ifdef wheels_size_and_speed ; duplicate LDA #0
lda #0
sta r11H
sta r11L
.else
LoadW__ r11, 0
.endif
jsr _StartMouseMode
jsr _UseSystemFont
ldx #11
@@ -103,20 +117,50 @@ _DoDlgBox:
jmp MainLoop

.define DlgBoxProc1 DBDoIcons, DBDoIcons, DBDoIcons, DBDoIcons, DBDoIcons, DBDoIcons
.ifdef wheels_fixes ; fix: have commands 7-10 (undefined) point to RTS
.define DlgBoxProc2 DoESC_RULER, DoESC_RULER, DoESC_RULER, DoESC_RULER
.else
.define DlgBoxProc2 DBDoIcons, DBDoIcons, DBDoIcons, DBDoIcons
.endif
.define DlgBoxProc3 DBDoTXTSTR, DBDoVARSTR, DBDoGETSTR, DBDoSYSOPV, DBDoGRPHSTR, DBDoGETFILES, DBDoOPVEC, DBDoUSRICON, DBDoUSR_ROUT


DlgBoxProcL:
.lobytes DlgBoxProc1
.lobytes DlgBoxProc2 ; not used
.lobytes DlgBoxProc3
DlgBoxProcH:
.hibytes DlgBoxProc1
.ifdef wheels_fixes ; fix: correct pointers
.hibytes DlgBoxProc2
.else
.lobytes DlgBoxProc2 ; yes, lobytes!! -- not used
.endif
.hibytes DlgBoxProc3

DlgBoxPrep:
.ifdef wheels_size ; Dialog_2 was folded into this
sec
jsr DlgBoxPrep2
LoadB sysDBData, NULL
jmp InitGEOEnv

Dialog_2:
clc
DlgBoxPrep2:
PushB CPU_DATA
ASSERT_NOT_BELOW_IO
LoadB CPU_DATA, IO_IN
LoadW r4, dlgBoxRamBuf
bcc @1
jsr DialogSave
LoadB mobenble, 1
bne @2
@1: jsr DialogRestore
@2: pla
sta CPU_DATA
ASSERT_NOT_BELOW_IO
rts
.else
ASSERT_NOT_BELOW_IO
PushB CPU_DATA
LoadB CPU_DATA, IO_IN
@@ -128,6 +172,7 @@ ASSERT_NOT_BELOW_IO
jsr InitGEOEnv
LoadB sysDBData, NULL
rts
.endif

DrawDlgBox:
LoadB dispBufferOn, ST_WR_FORE | ST_WRGS_FORE
@@ -198,14 +243,18 @@ DrwDlgSpd1:
jsr CalcDialogCoords
MoveW r4, rightMargin
jsr Rectangle
.ifndef wheels_size_and_speed ; redundant
clc
jsr CalcDialogCoords
.endif
lda #$ff
jsr FrameRectangle
lda #0
sta defIconTab
.ifndef wheels_size_and_speed ; single 0 = no icons
sta defIconTab+1
sta defIconTab+2
.endif
rts

Dialog_1:
@@ -278,6 +327,7 @@ _RstrFrmDialogue:
PushW dlgBoxCallerPC
rts

.ifndef wheels_size ; folded into DlgBoxPrep
Dialog_2:
ASSERT_NOT_BELOW_IO
PushB CPU_DATA
@@ -287,6 +337,7 @@ ASSERT_NOT_BELOW_IO
PopB CPU_DATA
ASSERT_NOT_BELOW_IO
rts
.endif

DialogSave:
ldx #0
@@ -324,6 +375,15 @@ DialogNextSaveRestoreEntry:
bcc @1
inc r4H
@1: ldy #0
.ifdef wheels_size_and_speed ; 17 vs. 21 bytes and faster
lda DialogCopyTab3,x
beq @2
sta r3L
lda DialogCopyTab1,x
sta r2L
lda DialogCopyTab2,x
sta r2H
.else
lda DialogCopyTab,x
sta r2L
inx
@@ -334,10 +394,32 @@ DialogNextSaveRestoreEntry:
beq @2
lda DialogCopyTab,x
sta r3L
.endif
inx
@2: rts

; pointer & length tuples of memory regions to save and restore
.ifdef wheels_size_and_speed
.define DialogCopyTab curPattern, appMain, IconDescVec, menuOptNumber, TimersTab, obj0Pointer, mob0xpos, mobenble, mobprior, mcmclr0, mob1clr, moby2
DialogCopyTab1:
.lobytes DialogCopyTab
DialogCopyTab2:
.hibytes DialogCopyTab
DialogCopyTab3:
.byte 23
.byte 38
.byte 2
.byte 49
.byte 227
.byte 8
.byte 17
.byte 1
.byte 3
.byte 2
.byte 7
.byte 1
.byte NULL
.else
DialogCopyTab:
.word curPattern
.byte 23
@@ -364,18 +446,28 @@ DialogCopyTab:
.word moby2
.byte 1
.word NULL
.endif

; handler for commands 1-6
DBDoIcons:
dey
bne @1
.ifdef wheels_button_shortcuts ; install keyVector for all button types
lda keyVector+1
.else
dey ; command-1: "OK"==0
bne @1 ; not "OK"
lda keyVector
ora keyVector+1
.endif
bne @1
lda #>DBKeyVector
sta keyVector+1
lda #<DBKeyVector
sta keyVector
@1: tya
@1:
.ifdef wheels_button_shortcuts
dey
.endif
tya
asl
asl
asl
@@ -451,6 +543,7 @@ DBDefIconsTab:
.word DBIcPicOK
.word 0
.byte 6, 16
DBDefIconsTabRoutine:
.word DBIcOK

.word DBIcPicCANCEL
@@ -479,9 +572,90 @@ DBDefIconsTab:
.word DBIcDISK

DBKeyVector:
.ifdef wheels_button_shortcuts
lda keyData
ldy #ShortcutKeysEnd - ShortcutKeys - 1
@1: cmp ShortcutKeys,y
beq DoKeyboardShortcut
dey
bpl @1
rts

DoKeyboardShortcut:
tya
asl
asl
asl
tay
lda #0
sta r0L
LF4AC: tax
lda defIconTab+4,x
cmp DBDefIconsTab,y
bne LF4BD
lda defIconTab+4+1,x
cmp DBDefIconsTab+1,y
beq LF4CC
LF4BD: inc r0L
lda r0L
cmp defIconTab
bcs LF4CB
asl
asl
asl
bne LF4AC
LF4CB: rts
LF4CC: lda DBDefIconsTabRoutine,y
ldx DBDefIconsTabRoutine+1,y
jmp CallRoutine

ShortcutKeys:
.byte 13, "cynod"; ok, cancel, yes, no, open, disk
ShortcutKeysEnd:
.else
CmpBI keyData, CR
beq DBIcOK
rts
.endif

.ifdef wheels_size
DBIcDISK:
.ifdef wheels_dialog_chdir ; "Disk" button can change directory
; Maurice says: If your application includes a dialogue box
; with the "DISK" icon, that's all you really need to let the
; user select any partition or subdirectory on a CMD device or
; a subdirectory on a native ramdisk.
; ATTN: *requires* wheels_size!!!
.import GetNewKernal
.import RstrKernal
lda #$40 + 5
jsr GetNewKernal
jsr ChDiskDirectory
jsr RstrKernal
.endif
lda #DISK
.byte $2c
DBIcOK:
lda #OK
.byte $2c
DBIcCANCEL:
lda #CANCEL
.byte $2c
DBIcYES:
lda #YES
.byte $2c
DBIcNO:
lda #NO
.byte $2c
DBIcOPEN:
lda #OPEN
.byte $2c
DBStringFaultVec2:
lda #DBSYSOPV
.byte $2c
DBKeyVector2:
lda #DBGETSTRING
.else
DBIcOK:
lda #OK
bne DBKeyVec1
@@ -499,8 +673,9 @@ DBIcOPEN:
bne DBKeyVec1
DBIcDISK:
lda #DISK
bne DBKeyVec1
bne DBKeyVec1 ; ???
DBKeyVec1:
.endif
sta sysDBData
jmp RstrFrmDialogue

@@ -513,9 +688,13 @@ DBDoSYSOPV:

DBStringFaultVec:
bbsf 7, mouseData, DBDoOPVEC_rts
.ifdef wheels_size ; reuse common code
jmp DBStringFaultVec2
.else
lda #DBSYSOPV
sta sysDBData
jmp RstrFrmDialogue
.endif

DBDoOPVEC:
ldy r1L
@@ -532,6 +711,9 @@ DBDoOPVEC_rts:

DBDoGRPHSTR:
ldy r1L
.ifdef wheels_size
jsr StringGetNext
.else
lda (DBoxDesc),y
sta r0L
iny
@@ -539,6 +721,7 @@ DBDoGRPHSTR:
sta r0H
iny
tya
.endif
pha
jsr GraphicsString
PopB r1L
@@ -546,6 +729,17 @@ DBDoGRPHSTR:

DBDoUSR_ROUT:
ldy r1L
.ifdef wheels_size_and_speed ; 13->11 bytes, 25->23 cycles
iny
iny
tya
pha
dey
lda (DBoxDesc),y
tax
dey
lda (DBoxDesc),y
.else
lda (DBoxDesc),y
sta r0L
iny
@@ -555,6 +749,7 @@ DBDoUSR_ROUT:
tya
pha
lda r0L
.endif
jsr CallRoutine
PopB r1L
rts
@@ -563,6 +758,9 @@ DBDoTXTSTR:
clc
jsr CalcDialogCoords
jsr DBTextCoords
.ifdef wheels_size
jsr StringGetNext
.else
lda (DBoxDesc),y
sta r0L
iny
@@ -570,11 +768,24 @@ DBDoTXTSTR:
sta r0H
iny
tya
.endif
pha
jsr PutString
PopB r1L
rts

.ifdef wheels_size
StringGetNext:
lda (DBoxDesc),y
sta r0L
iny
lda (DBoxDesc),y
sta r0H
iny
tya
rts
.endif

DBDoVARSTR:
clc
jsr CalcDialogCoords
@@ -617,9 +828,11 @@ DBDoGETSTR:
PopB r1L
rts

.ifndef wheels_size ; code reuse
DBKeyVector2:
LoadB sysDBData, DBGETSTRING
jmp RstrFrmDialogue
.endif

DBTextCoords:
ldy r1L
@@ -654,10 +867,18 @@ DBDoGETFILES:
ror
lsr
lsr
.ifdef wheels_dlgbox_features ; ???
addv 4
.else
addv 7
.endif
pha
lda r2H
.ifdef wheels_dlgbox_features ; ???
subv 12
.else
subv 14
.endif
pha
PushB r7L
PushW r10
@@ -671,6 +892,38 @@ DBDoGETFILES:
jsr HorizontalLine
PopW r10
PopB r7L
.ifdef wheels_dlgbox_features ; ???
.import extKrnlIn
.import TmpFilename
lda extKrnlIn
cmp #5
beq @B
PushB r10L ; r10: source string
sta r5L
PushB r10H
sta r5H
ora r5L
beq @A ; null ptr
LoadW r10, TmpFilename
ldx #r5
ldy #r10
jsr CopyString
@A: lda #$40 + 5
jsr GetNewKernal
jsr GetFEntries
jsr RstrKernal
PopW r10
bra @C
@B: jsr GetFEntries
@C: PopB r2L
PopB r3L
sta DBGFArrowX
lda #0
sta DBGFileSelected
sta DBGFTableIndex
lda DBGFilesFound
beq @2
.else
LoadB r7H, 15
LoadW r6, fileTrScTab
jsr FindFTypes
@@ -681,23 +934,27 @@ DBDoGETFILES:
sub r7H
beq @2
sta DBGFilesFound
.endif
cmp #6
bcc @1
lda #>DBGFilesArrowsIcons
sta r5H
lda #<DBGFilesArrowsIcons
sta r5L
LoadW r5, DBGFilesArrowsIcons
jsr DBIconsHelp2
@1: lda #>DBGFPressVector
sta otherPressVec+1
lda #<DBGFPressVector
sta otherPressVec
@1:
.ifdef wheels_dlgbox_features ; ???
lda #0
jsr SetupRAMOpCall
jsr FetchRAM
.endif
LoadW otherPressVec, DBGFPressVector
.ifndef wheels_dlgbox_features ; ???
jsr DBGFilesHelp1
.endif
jsr DBGFilesHelp5
jsr DBGFilesHelp2
@2: PopB r1L
rts

.ifndef wheels_dlgbox_features ; xxx
DBGFilesHelp1:
PushB DBGFilesFound
@1: pla
@@ -719,15 +976,39 @@ DBGFilesHelp1:
lda #0
@4: sta DBGFTableIndex
@5: rts
.endif

DBGFilesArrowsIcons:
.word DBGFArrowPic
DBGFArrowX:
.word 0
.ifdef wheels_dlgbox_features
.byte 8, 8
.else
.byte 3, 12
.endif
.word DBGFDoArrow

DBGFArrowPic:
.ifdef wheels_dlgbox_features
.byte 10, %11111111 ; repeat 10
.byte $80+2 ; 2 data bytes
.byte %10000000, %00000001
.byte 4, %10000001 ; repeat 4
.byte $80 + 36
; %11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111
; %11111111,%11111111,%10000000,%00000001,%10000001,%10000001,%10000001,%10000001
.byte %11111111,%11111111,%10000000,%00000001,%10000011,%11000001,%10000001,%10000001
.byte %10000000,%00000001,%10000000,%00000001,%10000111,%11100001,%10001111,%11110001
.byte %10000000,%00000001,%10000000,%00000001,%10001111,%11110001,%10000111,%11100001
.byte %10000000,%00000001,%11111111,%11111111,%10000001,%10000001,%10000011,%11000001
.byte %10000000,%00000001,%11111111,%11111111;%10000001,%10000001,%10000001,%10000001
; %11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111,%11111111
.byte 4, %10000001 ; repeat 4
.byte 8, %11111111 ; repeat 8

.byte 8, $bf ; ??? unused
.else
.byte 3, %11111111, $80+(10*3)
;%11111111, %11111111, %11111111
.byte %10000000, %00000000, %00000001 ;1
@@ -742,6 +1023,7 @@ DBGFArrowPic:
.byte %10000000, %00000000, %00000001 ;10
;%11111111, %11111111, %11111111
.byte 3, %11111111
.endif

DBGFPressVector:
lda mouseData
@@ -774,9 +1056,116 @@ DBGFPressVector:
@1: sta DBGFileSelected
jsr DBGFilesHelp6
jsr DBGFilesHelp2
.ifdef wheels_dlgbox_dblclick
lda dblClickCount
beq @X
ldy dblDBData
dey
jmp DoKeyboardShortcut
@X: lda #CLICK_COUNT
sta dblClickCount
.endif
@2: rts

DBGFDoArrow:
.ifdef wheels_dlgbox_features
.import dbFieldWidth
; which icon inside the top/bot/up/down image was the mouse on?
lda mouseXPos+1
lsr
lda mouseXPos
ror
lsr
lsr ; / 16
sec
sbc DBGFArrowX
lsr
tay
cpy #4
bcc @1
rts
@1: lda DoArrowTabL,y
ldx DoArrowTabH,y
jmp CallRoutine

.define DoArrowTab DBGFDoArrowTop, DBGFDoArrowBottom, DBGFDoArrowUp, DBGFDoArrowDown

DoArrowTabL:
.lobytes DoArrowTab
DoArrowTabH:
.hibytes DoArrowTab

DBGFDoArrowTop:
lda DBGFTableIndex
bne @1
rts
@1: lda #0
beq DBGFDoArrowFuncCommon

DBGFDoArrowBottom:
ldx DBGFilesFound
dex
stx r0L
lda #0
sta r0H
sta r1H
lda #5
sta r1L
ldx #r0
ldy #r1
jsr Ddiv
jsr BBMult
lda r0L
bra DBGFDoArrowFuncCommon

DBGFDoArrowDown:
lda DBGFTableIndex
clc
adc #5
cmp DBGFilesFound
bcc DBGFDoArrowFuncCommon
rts

DBGFDoArrowUp:
lda DBGFTableIndex
bne @1
rts
@1: sec
sbc #5
DBGFDoArrowFuncCommon:
sta DBGFTableIndex+1
sta DBGFTableIndex
jsr SetupRAMOpCall
jsr FetchRAM
jsr DBGFilesHelp2
jmp DBGFilesHelp5

SetupRAMOpCall:
sta r1L
lda #5
sta r0L
lda dbFieldWidth
sta r2L
ldx #r2
ldy #r0L
jsr BBMult ; r2 = 5 * dbFieldWidth (count)
lda dbFieldWidth
sta r0L
ldx #r1
ldy #r0L
jsr BBMult ; r1 = arg * dbFieldWidth (REU offset)
clc
lda r1L
adc #<$E080
sta r1L
lda r1H
adc #>$E080 ; REU address
sta r1H
LoadW r0, fileTrScTab ; CBM address
sta r3L ; REU bank 0
rts
.else
; DBGFDoArrow:
jsr DBGFilesHelp6
LoadB r0H, 0
lda DBGFArrowX
@@ -808,8 +1197,19 @@ DBGFDoArrow:
sta DBGFileSelected
@6: jsr DBGFilesHelp2
jmp DBGFilesHelp5
.endif

DBGFilesHelp2:
.ifdef wheels_dlgbox_features
lda DBGFTableIndex+1
sec
sbc DBGFTableIndex
ldx #r0
jsr DBGFilesHelp4
MoveW DBGFNameTable, r5
ldy #r5
jmp CopyString
.else
lda DBGFileSelected
jsr DBGFilesHelp3
ldy #r1
@@ -820,10 +1220,15 @@ DBGFilesHelp3:
jsr DBGFilesHelp4
MoveW DBGFNameTable, r1
rts
.endif

DBGFilesHelp4:
sta r0L
.ifdef wheels_dlgbox_features
MoveB dbFieldWidth, r1L
.else
LoadB r1L, 17
.endif
txa
pha
ldy #r0
@@ -832,27 +1237,87 @@ DBGFilesHelp4:
pla
tax
lda r1L
.ifdef wheels_size_and_speed
sta zpage,x
.assert <fileTrScTab = 0, error, "fileTrScTab must be page-aligned!"
lda #>fileTrScTab
.else
clc
adc #<fileTrScTab
sta zpage,x
lda #>fileTrScTab
adc #0
.endif
sta zpage+1,x
rts

DBGFilesHelp5:
.ifdef wheels_dlgbox_features
PushW rightMargin
PushB currentMode
LoadB currentMode, $40
lda #0
jsr DBGFilesHelp8
clc
lda r2H
adc #$38
sta r2H
lda #0
jsr SetPattern
jsr Rectangle
lda #0
lda r4H
sta rightMargin+1
lda r4L
sta rightMargin
lda #0
sta r15L
ldx #30
jsr DBGFilesHelp4
LF843: lda r15L
jsr DBGFilesHelp8
lda r3H
sta r11H
lda r3L
sta r11L
lda r2L
clc
adc #9
sta r1H
lda r14H
sta r0H
lda r14L
sta r0L
jsr PutString
clc
lda dbFieldWidth
adc r14L
sta r14L
bcc LF86E
inc r14H
LF86E: inc r15L
lda r15L
cmp #5
bne LF843
jsr DBGFilesHelp6
PopB currentMode
PopW rightMargin
rts
.else
PushW rightMargin
lda #0
jsr DBGFilesHelp8
MoveW r4, rightMargin
LoadB r15L, 0
jsr SetPattern

lda DBGFTableIndex
ldx #r14
jsr DBGFilesHelp4
LoadB currentMode, SET_BOLD
@1: lda r15L
jsr DBGFilesHelp8

jsr Rectangle
MoveW r3, r11
lda r2L
@@ -868,6 +1333,7 @@ DBGFilesHelp5:
LoadB currentMode, NULL
PopW rightMargin
rts
.endif

DBGFilesHelp6:
lda DBGFileSelected
@@ -900,16 +1366,36 @@ DBGFilesHelp8:
jsr DBGFilesHelp7
AddB r0L, r2L
clc
.ifdef wheels_dlgbox_features
adc #13
.else
adc #14
.endif
sta r2H
inc r2L
.ifdef wheels_size ; code reuse
jsr IncR3
.else
dec r2H
inc r3L
bne @1
inc r3H
.endif
@1: ldx #r4
.ifdef wheels_size_and_speed
jmp Ddec
.else
jsr Ddec
rts
.endif

.ifdef wheels_size ; code reuse
.global IncR3
IncR3: inc r3L
bne @1
inc r3H
@1: rts
.endif

DBIcPicNO:
.byte 5, %11111111, $80+1, %11111110, $db+8, 2, $80+6

+ 847
- 22
kernal/filesys.s
File diff suppressed because it is too large
View File


+ 53
- 2
kernal/fonts.s View File

@@ -62,6 +62,7 @@ ID110:
; a baseline offset
; Destroyed: nothing
;---------------------------------------------------------------
.ifndef wheels ; moved
_GetRealSize:
subv 32
jsr GetChWdth1
@@ -84,6 +85,12 @@ _GetRealSize:
rts
@2: lda baselineOffset
rts
.endif

.ifdef wheels
FontTVar1 = $8886
FontTVar2 = $8887
.endif

Font_1:
ldy r1H
@@ -369,6 +376,36 @@ Font_tab2:
.byte <(e6-base)
.byte <(e7-base)

.ifdef wheels
.res 9, 0 ; XXX
.endif

.ifdef wheels ; xxx moved, but unchanged
_GetRealSize:
subv 32
jsr GetChWdth1
tay
txa
ldx curHeight
pha
and #$40
beq @1
iny
@1: pla
and #8
beq @2
inx
inx
iny
iny
lda baselineOffset
addv 2
rts
@2: lda baselineOffset
rts

.endif

; called if currentMode & (SET_UNDERLINE | SET_ITALIC)
Font_3:
lda currentMode
@@ -382,7 +419,15 @@ Font_3:
@1: lda r10L
eor #$ff
sta r10L
@2: bbrf ITALIC_BIT, currentMode, clc_rts
@2:
.ifdef wheels
bbsf ITALIC_BIT, currentMode, @X
clc
rts
@X:
.else
bbrf ITALIC_BIT, currentMode, clc_rts
.endif
lda r10H
lsr
bcs @5
@@ -568,7 +613,9 @@ Font_9:
; central character printing, called from conio.s
; character - 32 in A
FontPutChar:
.ifndef wheels_size_and_speed
nop
.endif
tay
PushB r1H
tya
@@ -795,10 +842,14 @@ FontGt4_2:
sta Z45+2,y
beq FontGt2_1

.ifndef wheels
FontTVar1:
.endif
.byte 0
.ifndef wheels
FontTVar2:
.if cbmfiles
.endif
.ifdef cbmfiles
; This should be initialized to 0, and will
; be changed at runtime.
; The cbmfiles version was created by dumping

+ 253
- 13
kernal/graph.s View File

@@ -59,6 +59,7 @@ GraphPenXH = GraphPenX+1

.segment "graph1"

.ifndef wheels
;---------------------------------------------------------------
; used by EnterDesktop
;---------------------------------------------------------------
@@ -83,6 +84,7 @@ ClrScr2:
dex
bne ClrScr1
rts
.endif

.segment "graph2"

@@ -107,6 +109,82 @@ PrepareXCoord:
sta r4L
rts

.ifdef wheels_size
.import WheelsTemp
_HorizontalLine:
sta r7L
lda #0
.byte $2c
_InvertLine:
lda #$80
sta WheelsTemp
PushW r3
PushW r4
jsr PrepareXCoord
ldy r3L
lda r3H
beq @1
inc r5H
inc r6H
@1: lda r3H
cmp r4H
bne @2
lda r3L
cmp r4L
@2: beq @7
jsr LineHelp2
lda r8L
bit WheelsTemp
bmi @3
jsr LineCommon
bra @4
@3: eor (r5),y
@4: bit WheelsTemp
bpl @5
eor #$FF
@5: sta (r6),y
sta (r5),y
tya
clc
adc #8
tay
bcc @6
inc r5H
inc r6H
@6: dec r4L
beq @8
lda r7L
bit WheelsTemp
bpl @4
lda (r5),y
bra @4
@7: lda r8L
ora r8H
bra @9
@8: lda r8H
@9: bit WheelsTemp
bmi @A
jsr LineCommon
jmp @B
@A: eor #$FF
eor (r5),y
@B: sta (r6),y
sta (r5),y
LineEnd:
PopW r4
PopW r3
rts

LineCommon:
sta r11H
and (r6),y
sta r7H
lda r11H
eor #$FF
and r7L
ora r7H
rts
.else
;---------------------------------------------------------------
; HorizontalLine $C118
;
@@ -170,6 +248,7 @@ HLineHelp:
and r7L
ora r7H
rts

;---------------------------------------------------------------
; InvertLine $C11B
;
@@ -235,6 +314,7 @@ ImprintLine:
sta r6H
sty r5H
bra RLin0
.endif

;---------------------------------------------------------------
; RecoverLine $C11E
@@ -247,6 +327,79 @@ ImprintLine:
; Destroyed: a, x, y, r5 - r8
;---------------------------------------------------------------
_RecoverLine:
.ifdef wheels_size
lda #$18 ; clc
.byte $2c
ImprintLine:
lda #$38 ; sec
sta @1
PushW r3
PushW r4
lda dispBufferOn
pha
ora #ST_WR_FORE | ST_WR_BACK
sta dispBufferOn
jsr PrepareXCoord
pla
sta dispBufferOn
@1: clc
bcc @2
lda r5L
ldy r6L
sta r6L
sty r5L
lda r5H
ldy r6H
sta r6H
sty r5H
@2: ldy r3L
lda r3H
beq @3
inc r5H
inc r6H
@3: CmpW r3, r4
beq @6
jsr LineHelp2
lda r8L
jsr LineHelp1
@4: tya
clc
adc #8
tay
bcc @5
inc r5H
inc r6H
@5: dec r4L
beq @7
lda (r6),y
sta (r5),y
bra @4
@6: lda r8L
ora r8H
bra @8
@7: lda r8H
@8: jsr LineHelp1
jmp LineEnd

LineHelp1:
sta r7L
and (r5),y
sta r7H
lda r7L
eor #$FF
and (r6),y
ora r7H
sta (r5),y
rts

LineHelp2:
SubW r3, r4
lsr r4H
ror r4L
lsr r4L
lsr r4L
rts
.else
PushW r3
PushW r4
PushB dispBufferOn
@@ -254,7 +407,6 @@ _RecoverLine:
sta dispBufferOn
jsr PrepareXCoord
PopB dispBufferOn

RLin0:
ldy r3L
lda r3H
@@ -298,6 +450,7 @@ RecLineHelp:
ora r7H
sta (r5),Y
rts
.endif

;---------------------------------------------------------------
; VerticalLine $C121
@@ -355,6 +508,10 @@ _VerticalLine:
_i_Rectangle:
jsr GetInlineDrwParms
jsr _Rectangle
.ifdef wheels_size
.global DoInlineReturn7
DoInlineReturn7:
.endif
php
lda #7
jmp DoInlineReturn
@@ -409,9 +566,13 @@ _InvertRectangle:
_i_RecoverRectangle:
jsr GetInlineDrwParms
jsr _RecoverRectangle
.ifdef wheels_size
jmp DoInlineReturn7
.else
php
lda #7
jmp DoInlineReturn
.endif

;---------------------------------------------------------------
; RecoverRectangle $C12D
@@ -440,9 +601,13 @@ _RecoverRectangle: