Skip to content

Commit

Permalink
enable all useful code paths for "custom" config
Browse files Browse the repository at this point in the history
"custom" now has $280 free bytes in the KERNAL area,
enabling +60K or RamCart works again.

In addition, switched everything to .ifdef
  • Loading branch information
mist64 committed Sep 19, 2016
1 parent 0aedab8 commit ca1d8e8
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 65 deletions.
47 changes: 26 additions & 21 deletions config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,39 @@
.endif

.ifdef custom
; make use of all reusable Wheels optimizations and fixes
wheels_size = 1
wheels_size_and_speed = 1
wheels_fixes = 1
.endif

; general code generation/optimization control:
onlyVLIR = 0 ; only VLIR and SEQ supported
removeToBASIC = 0 ; shorter code if you don't use BASIC rebooter
; replace BASIC reboot code with trivial version (+380 bytes)
removeToBASIC = 1

; for 2MHz-on-border on C128 in 64 mode
use2MHz = 1

; only VLIR and SEQ supported
;onlyVLIR = 1

; RAM expansions configuration
; (only one value may be '1', if all are 0 then REU is utililzed)
usePlus60K = 0 ; for +60K expansion users
; XXX these are untested and probably broken XXX
useRamCart64 = 0 ; for Ram Cart 64K
useRamCart128 = 0 ; for Ram Cart 128K
; RAM expansions configuration
; (only one may be defined, if all are undefined, then REU is utililzed)
; for +60K expansion users
;usePlus60K = 1
; for Ram Cart 64K
;useRamCart64 = 1
; for Ram Cart 128K
;useRamCart128 = 1

; GEOS2000
; makes drawing dialog boxes much faster, might cause visual mess
; takes more bytes
;speedupDlgBox = 1

; runtime speedup
use2MHz = 0 ; for 2MHz-on-border on C128 in 64 mode
; GEOS2000
; bug - when 0 no blinking in menu
;newMenu_5 = 1

.endif

; Feel (almost) free to change values below:
iniMaxMouseSpeed = $7f ; range from $00-$7f
Expand All @@ -111,12 +123,6 @@ iniMouseAccel = $7f ;
currentInterleave = 8 ; 8 for 1541, 6 for 1571
SelectFlashDelay = 10 ; 10 in 1/50 s

; makes drawing dialog boxes much faster, might cause visual mess
; takes more bytes
speedupDlgBox = 0

oldMenu_5 = 1 ; bug - when 0 no blinking in menu

; if both menu separator patterns are null, then kernal menu code
; will be a bit optimized for speed and space
menuVSeparator = %10101010 ; %10101010 ;both=0 -> speed&space
Expand All @@ -131,9 +137,8 @@ REUOsVarBackup = $7900 ; base for OS_VARS_LGH bytes for
REUDskDrvSPC = $8300 ; base for 4*DISK_DRV_LGH disk drivers

; do not change two values below - it's automatic
useRamExp = usePlus60K | useRamCart64 | useRamCart128
.if (useRamExp)
REUPresent = 0
.if .defined(usePlus60K) || .defined(useRamCart64) || .defined(useRamCart128)
useRamExp = 1
.else
REUPresent = 1
.endif
4 changes: 2 additions & 2 deletions kernal/dlgbox.s
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ DrawDlgBox:
ldy #0
lda (DBoxDesc),y
and #%00011111
.if (speedupDlgBox)
.ifdef speedupDlgBox
bne DrwDlgSpd0
jmp @1
DrwDlgSpd0:
Expand Down Expand Up @@ -269,7 +269,7 @@ Dialog_1:
jmp RcvrMnu0

CalcDialogCoords:
.if (speedupDlgBox)
.ifdef speedupDlgBox
LoadB r1H, 0
.else
lda #0
Expand Down
14 changes: 7 additions & 7 deletions kernal/filesys.s
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
.global SerialHiCompare
.endif

.if (useRamExp)
.ifdef useRamExp
; reu.s
.import RamExpRead
.import RamExpGetStat
Expand Down Expand Up @@ -664,7 +664,7 @@ LD684: .byte 0
LD685: .byte 0

.else
.if (useRamExp)
.ifdef useRamExp
CmpWI r7, ($0100+SYSTEM)
bne FFTypesStart
CmpWI r6, $8b80
Expand Down Expand Up @@ -1320,7 +1320,7 @@ _FreeFile:
bnex @3
ldy #OFF_GSTRUC_TYPE
lda (r9),y
.if (onlyVLIR)
.ifdef onlyVLIR
beq @2
.else
cmp #VLIR
Expand Down Expand Up @@ -1526,7 +1526,7 @@ _RenameFile:
@4: rts

_OpenRecordFile:
.if (useRamExp)
.ifdef useRamExp
lda DeskTopOpen
bmi OpRFile1
LoadW r6, DeskTopName
Expand All @@ -1551,7 +1551,7 @@ OpRFile1:
bne ClearRecordTableTS
ldy #OFF_GSTRUC_TYPE
lda (r5),y
.if (onlyVLIR)
.ifdef onlyVLIR
beq ClearRecordTableTS
.else
cmp #VLIR
Expand Down Expand Up @@ -1624,7 +1624,7 @@ _UpdateRecordFile:
sta fileWritten
@1: rts

.if (useRamExp)
.ifdef useRamExp
_NextRecord:
lda curRecord
addv 1
Expand Down Expand Up @@ -1740,7 +1740,7 @@ _AppendRecord:
@1: rts

_ReadRecord:
.if (useRamExp)
.ifdef useRamExp
ldx DeskTopOpen
beq ReaRec0
jsr RamExpGetStat
Expand Down
4 changes: 2 additions & 2 deletions kernal/hw.s
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ASSERT_NOT_BELOW_IO
LoadW r0, VIC_IniTbl
ldy #VIC_IniTbl_end - VIC_IniTbl
jsr SetVICRegs
.if .defined(wheels) || removeToBASIC
.if .defined(wheels) || .defined(removeToBASIC)
ldx #32
@3: lda KERNALVecTab-1,x
sta irqvec-1,x
Expand All @@ -86,7 +86,7 @@ ASSERT_NOT_BELOW_IO

.segment "hw2"

.if !.defined(wheels) && (!removeToBASIC)
.if !.defined(wheels) && (!.defined(removeToBASIC))
Init_KRNLVec:
ldx #32
@1: lda KERNALVecTab-1,x
Expand Down
6 changes: 3 additions & 3 deletions kernal/irq.s
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ _IRQHandler:
pha
tya
pha
.if (use2MHz)
.ifdef use2MHz
LoadB clkreg, 0
.endif
PushW CallRLo
Expand Down Expand Up @@ -84,7 +84,7 @@ ASSERT_NOT_BELOW_IO
sta grirq
PopB CPU_DATA
ASSERT_NOT_BELOW_IO
.if (use2MHz)
.ifdef use2MHz
lda #>IRQ2Handler
sta $ffff
lda #<IRQ2Handler
Expand All @@ -105,7 +105,7 @@ ASSERT_NOT_BELOW_IO
lda tempIRQAcc
_NMIHandler:
rti
.if (use2MHz)
.ifdef use2MHz
IRQ2Handler:
pha
txa
Expand Down
2 changes: 1 addition & 1 deletion kernal/jumptable.s
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ Panic:
.endif
BitOtherClip:
jmp _BitOtherClip
.if (REUPresent)
.ifdef REUPresent
StashRAM:
jmp _StashRAM
FetchRAM:
Expand Down
4 changes: 2 additions & 2 deletions kernal/kernal_custom.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ SEGMENTS {
files1b: load = LOKERNAL, type = ro;
serial1: load = LOKERNAL, type = ro;
reu: load = LOKERNAL, type = ro;
ramexp2: load = LOKERNAL, type = ro;
tobasic1: load = LOKERNAL, type = ro;
fonts1: load = LOKERNAL, type = ro;

# icons: $BF40-$BFFF
mouseptr: load = ICONS, type = ro;
Expand All @@ -41,6 +41,7 @@ SEGMENTS {
jumptab: load = KERNAL, type = ro;

# kernal code
ramexp2: load = KERNAL, type = ro;
mainloop3: load = KERNAL, type = ro;
bitmask: load = KERNAL, type = ro;
files3: load = KERNAL, type = ro;
Expand All @@ -66,7 +67,6 @@ SEGMENTS {
panic: load = KERNAL, type = ro;
serial2: load = KERNAL, type = ro;
patterns: load = KERNAL, type = ro;
fonts1: load = KERNAL, type = ro;
bswfont: load = KERNAL, type = ro;
memory3: load = KERNAL, type = ro;
load3: load = KERNAL, type = ro;
Expand Down
12 changes: 6 additions & 6 deletions kernal/load.s
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
.import DeskAccPC
.import TempCurDrive

.if (useRamExp)
.ifdef useRamExp
; reu.s
.import RamExpRead
.import RamExpWrite
Expand Down Expand Up @@ -87,7 +87,7 @@ _EnterDeskTop:
txs
jsr ClrScr
jsr _InitMachine
.if (useRamExp)
.ifdef useRamExp
MoveW DeskTopStart, r0
MoveB DeskTopLgh, r2H
LoadW r1, 1
Expand Down Expand Up @@ -353,7 +353,7 @@ tmp3: .byte 0
MoveB r10L, A885D
jsr GetFHdrInfo
bnex LDAcc1
.if (useRamExp)
.ifdef useRamExp
PushW r1
jsr RamExpGetStat
MoveW fileHeader+O_GHST_ADDR, diskBlkBuf+DACC_ST_ADDR
Expand Down Expand Up @@ -419,7 +419,7 @@ LD81D: lda tmp1
pha
rts
.else
.if (useRamExp)
.ifdef useRamExp
jsr RamExpGetStat
MoveW diskBlkBuf+DACC_ST_ADDR, r0
MoveB diskBlkBuf+DACC_LGH, r2H
Expand Down Expand Up @@ -463,7 +463,7 @@ _LdApplic:
@1: rts

.ifndef wheels
.if (!useRamExp)
.ifndef useRamExp
SwapFileName:
.byte $1b,"Swap File", NULL
.endif
Expand All @@ -472,7 +472,7 @@ SwapFileName:
.segment "load5"

.ifndef wheels
.if (!useRamExp)
.ifndef useRamExp
SaveSwapFile:
LoadB fileHeader+O_GHGEOS_TYPE, TEMPORARY
LoadW fileHeader, SwapFileName
Expand Down
2 changes: 1 addition & 1 deletion kernal/memory.s
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ _MoveData:
bcc @8
.else
PushB r3L
.if (REUPresent)
.ifdef REUPresent
lda sysRAMFlg
bpl @1
PushB r1H
Expand Down
2 changes: 1 addition & 1 deletion kernal/menu.s
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ LEFE4: ldx menuNumber
lda menuOptionTab,x
jmp (r0)
.else
.if (oldMenu_5)
.ifndef newMenu_5
bvs Menu_51
MoveB selectionFlash, r0L
LoadB r0H, NULL
Expand Down
20 changes: 10 additions & 10 deletions kernal/ramexp.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

.segment "ramexp1"

.if (usePlus60K)
.ifdef usePlus60K
DetectPlus60K:
ASSERT_NOT_BELOW_IO
LoadB CPU_DATA, IO_IN
Expand Down Expand Up @@ -67,7 +67,7 @@ Plus60KTest:
Plus60KTestEnd:
.endif

.if (useRamCart64 | useRamCart128)
.if .defined(useRamCart64) || .defined(useRamCart128)
DetectRamCart:
ASSERT_NOT_BELOW_IO
LoadB CPU_DATA, IO_IN
Expand Down Expand Up @@ -96,7 +96,7 @@ ASSERT_NOT_BELOW_IO
rts
.endif

.if (useRamExp)
.ifdef useRamExp
ExpFaultDB:
.byte DEF_DB_POS | 1
.byte DBTXTSTR, TXT_LN_X, TXT_LN_1_Y
Expand All @@ -110,18 +110,18 @@ ExpFaultStr:
.byte BOLDON
.byte "This version of GEOS works", 0
ExpFaultStr2:
.if (useRamCart64 | useRamCart128)
.if .defined(useRamCart64) || .defined(useRamCart128)
.byte "only with a RamCart expansion.", 0
.endif
.if (usePlus60K)
.ifdef usePlus60K
.byte "only with a +60K expansion.", 0
.endif

BVChainTab:

.endif

.if (useRamExp)
.ifdef useRamExp
LoadDeskTop:
LoadB a0L, 0
LoadB BVChainTab, 1 ;1 - first free
Expand Down Expand Up @@ -194,7 +194,7 @@ BVLast_1:

.segment "ramexp2"

.if (useRamExp)
.ifdef useRamExp
RamExpSetStat:
LoadW r1, 0
LoadB r0H, >diskBlkBuf
Expand All @@ -221,7 +221,7 @@ DeskTopLgh:
.byte 0
.endif

.if (usePlus60K)
.ifdef usePlus60K
; r0 c64 address
; r1 exp page number (byte/word - RamCart 64/128)
; r2H # of bytes (in pages)
Expand Down Expand Up @@ -334,7 +334,7 @@ ASSERT_NOT_BELOW_IO
RamExpWrHlpEnd:
.endif

.if (useRamCart64)
.ifdef useRamCart64
RamExpRead:
PushB CPU_DATA
ASSERT_NOT_BELOW_IO
Expand Down Expand Up @@ -383,7 +383,7 @@ RamExWr_1:
jmp RamExRd_End
.endif

.if (useRamCart128)
.ifdef useRamCart128
RamExpRead:
PushB CPU_DATA
ASSERT_NOT_BELOW_IO
Expand Down
Loading

0 comments on commit ca1d8e8

Please sign in to comment.