home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
GEOSApps
/
LOC128SRCA.SFX
/
newfsrc
(
.txt
)
< prev
next >
Wrap
GEOS ConVerT
|
1990-02-12
|
49KB
|
1,553 lines
NewF.SRC
PRG formatted GEOS file V1.0
StarNX-1000C
NewFsym
NEWF.SRC
LOCATE128.DOC
ReadMeFirst
Write Image V2.1
Red Storm
geoWrite V1.1
This file was created with
Wrong is Write.
Written by Joe Buckley.
.if Pass1
.include NewFsym
.include NewFmac
.endif
.psect
DAStart:
jsr FirstGO ; initilize entry to system & set-up
; some variables
jsr SecdGO ; init. drives and disk names
jsr ThreGO ; draw box subtitles to screen
jmp LastGO ; init. routine for user input
below is space for reliable var.'s, ect..
CatRuff: .byte 0,0,0,0,0,0,0,0,0 ; disk name holder
CntD: .byte 0 ; store current drive value
HoldMeA: .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; echo from GEOS keylog
SMKA: .byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; echo from input
.byte 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0
CntA: .byte 0 ; pointer for buffer
CntB: .byte 0 ; valid file limiter
CntC: .byte 0 ; name list limiter
a little history here......
; This routine self-destructs on start-up of the program. I originally did not
; intend this file for the Public Domain. Since the routine has long since been
; kracked (as they say) it'll give you an idea on protection of your
; programs. It was for debugging protection. As a debugger runs the
; program to disassemble it, this area would be nothing more than a group
; of text strings from the current directory, as seen by the debugger.
; hence, a major feature of the program would "disappear" when it was
; loaded into memory. Since debuggers have grown up a wee bit since
; 1988, it no longer applies there, but, it can be used for other things.
FirstGO: ; Set-up initial prg. buffer areas
LoadB dispBufferOn,#(ST_WR_FORE) ;allow writes to FG only
LoadW r0,(DAEnd-F_ENTRY) ;Clear all of .ramsect after GEOS zeropage
LoadW r1,F_ENTRY
jsr ClearRam
LoadW leftMargin,#$00
from Rob Knops RPN DA PD source code
jsr i_MoveData ;Save Applications zero page space so I can use it
.word $0061 ; (also GEOS space under the FAC's)
.word appzpage
.word $009e
jsr MySaver ; prepare directory TS table
bne 15$ ; No? then reset loop
PNOTE
load main program pointers and equates into memory before
; destroying this area. You'll also note I have expanded the macros' for
; a better look at what is happening here.
Init1:
lda #0
sta r0H
sta r1H
sta r2H
sta r3H
lda #8
sta r0L
lda #4
sta r1L
lda #24
sta r2L
lda #17
sta r3L
jsr DstroyA
lda #9
sta r0L
lda #0
sta r1H
lda #5
sta r1L
jmp DstroyA
DstroyA:
lda #40
sta r4L
ldx #4
ldy #10
jsr BBMult
clc
lda #0
adc r1L
sta r1L
lda #140
adc r1H
sta r1H
lda r0L
clc
adc r1L
sta r1L
lda r0H
adc r1H
sta r1H
lda
screencolors
ldx #0
R10A8: ldy #0
R10AA: sta (r1L),y
iny
cpy r2L
bne R10AA
pha
clc
lda #40
adc r1L
sta r1L
bcc R10RD
inc r1H
R10RD: pla
inx
cpx r3L
bne R10A8
rts
ps RPN DA PD source code
SecdGO: ;
jsr
InitDRVVars ;
Init.'s Drive var.'s
lda $C00F ; version checker
cmp #18
bcs R10CE ; skip if version is o.k.
jmp QutMe ; quit if version NOT o.k.
R10CE: lda #128 ; write to forground only
sta dispBufferOn ;
lda curDrive ; load drive byte
sta CntD ; store current drive value
ldx #2 ; address of source string to get
jsr GetPtrCurDkN ; get current disk name pntr.
LoadW r1,HoldMeA ; destination address of string
lda #0
; ammount of bytes to move
sta r2H ; "
lda #16
; "
sta r2L
; "
jsr MoveData ; copy diskname for internal use
I expanded this macro to allow easier changes
jmp WasteMeA ;
dummy routine to waste time
was part of trojan horse scheme
ThreGO: ; Draws Main Screen
jsr i_GraphicsString ; inline drawing routine
inline routine is faster than the normal GraphicsString routine
.byte NEWPATTERN, 1
.byte MOVEPENTO
.word $0048
.byte 40
.byte RECTANGLETO
.word 528
.byte 192
.byte NEWPATTERN, 0
.byte MOVEPENTO
.word $0040
.byte 32
.byte RECTANGLETO
.word 512
.byte 184
.byte MOVEPENTO
.word $0040
.byte 32
.byte FRAME_RECTO
.word 512
.byte 184
.byte MOVEPENTO
.word $0042
.byte 104
.byte FRAME_RECTO
.word 508
.byte 182
.byte MOVEPENTO
.word $0042
.byte 81
.byte FRAME_RECTO
.word 508
.byte 92
.byte NULL ; end of graphic drawings
so now we can draw the text
can draw the text
20$ rts ; rts here
various text strings to place in various parts of the screen
the GEOS inline routines are slightly faster than standard PutString routines
they are also a little neater for your source code
jsr i_PutString
.word 220
.byte 40
.byte BOLDON
.byte " LocateFile.128 ",0 ; title text
jsr i_PutString
.word 72
.byte 51
.byte "Drive:",0 ; Drive text
jsr i_PutString
.word 272
.byte 51
.byte "Disk:",0 ; Disk text
jsr i_PutString
.word 72
.byte 78
.byte "Enter Files' Name:",0 ; Input text
jsr i_PutString
.word 268
.byte 78
.byte "Last Page:",0 ; Last Page displayed text
jsr i_PutString
.word 72
.byte 100
.byte "File Name:",0 ; Name text
jsr i_PutString
.word 268
.byte 100
.byte "Page:",0 ; pad # numeric text
jsr i_PutString
.word 333
.byte 100
.byte "Pad #:",0 ; loc. # numeric text
jsr i_PutString
.word 393
.byte 100
.byte "FileType:",0 ; loc. # numeric text
LoadW r0,IconTable ;
jmp DoIcons ; set up icon loop
p icon loop
icon loop
icon loop
p icon loop
icon loop
icon loo
various routines to clear areas for screen printing, used during program flow
the GEOS inline routines a slightly faster than standard RECTANGLE routines
RECA: jsr i_Rectangle ;
"@Clear INPUT Box print area
.byte 82, 91 ; Y-top,Y-bot positions
.word $0045 ; X-right position
.word 506 ; X-left position
rts
RECB: jsr i_Rectangle ;
"@Clear DRIVE: print area
.byte 43, 53
.word $0073
.word $00E4
rts
RECG: jsr i_Rectangle ;
"@Clear DISK: print area
.byte 43, 53
.word $0144
.word $018E ;
rts
RECJ: jsr i_Rectangle ;
"@Clear Display Box print area
.byte 105,181
.word $0043
.word 506
rts
d 506
rts
me:",0 ; Name text
jsr i_PutString
.word 268
.byte 100
.byte "Page:",0 ; pad # numeric text
jsr i_PutString
.word 333
.byte 100
.byte "Pad #:",0 ; loc. # numeric text
IconTable: ;
Standard Icon Structure table
.byte 6 ; number of icons in table
.word $0000 ; xpos for mouse
.byte 0 ; ypos for mouse
.word DrvIcon ; ptr graphic data
"@ DRIVE ICON
.byte 9 ; xpos (in cards)
.byte 54 ; ypos (in pixels)
.byte (JDW|DOUBLE_B) ; width (in cards)
.byte JDH ; height (in pixels)
.word DriveChg
; service routine
.word DskIcon ;
"@ DISK ICON
.byte 23 ;
.byte 54 ;
.byte (JEW|DOUBLE_B) ;
.byte JEH ;
.word DkCg ;
.word RESET ;
"@ PAGE + forward ICON
.byte 37 ; X
.byte 54 ; Y
.byte (JGW|DOUBLE_B) ;
.byte JGH ;
.word MiSaver ;
.word BESET ;
"@ PAGE - reverse ICON
.byte 44 ; X
.byte 54 ; Y
.byte (WGJ|DOUBLE_B) ;
.byte HGJ ;
.word RiSaver ;
.word QutIcon ;
"@QUIT ICON
.byte 51 ;
.byte 54 ;
.byte (JFW|DOUBLE_B) ;
.byte JFH ;
.word QutMe ;
.word ALodr ;
"@LOAD APPLICATION ICON
.byte 51 ; X
.byte 36 ; Y
.byte (JHW|DOUBLE_B) ; W
.byte JHH ; H
.word ApExec ; SR
LoadW r0,IconTable ;
jmp DoIcons ; set up icon loop
p icon loop
icon loop
icon loop
p icon loop
icon loop
icon loo
"@ICON PICTURE DATA -
"@geoassembler will translate them to bitmap data
DrvIcon:
JDW = picW
JDH = picH
DskIcon:
JEW = picW
JEH = picH
QutIcon:
JFW = picW
JFH = picH
RESET:
JGW = picW
JGH = picH
BESET:
EWGJ = picW
HGJ = picH
ALodr:
JHW = picW
JHH = picH
PicDatEnd: .byte 00 ; label here for use with geoDebugger
; not necessary for program flow -
;
I place these labels in various areas when
;
debugging to locate certain problem areas
;
I might run into
te JGH ;
.word MiSaver ;
.word BESET ;
"@ PAGE - reverse ICON
ping: .byte 44 ; X
.byte 5
DriveChg: jsr ReStore ; restore vars. to org. settings
jsr SwapDrive ; change drives
bra R12EC ; I left this in so you can see I am
; Human and also make errors
"@ ; D
lda curDrive
R12E3: clc ; interesting isn't it !
adc #1 ; see if you can figure out my
; goof-up... clue..
how many times?
cmp #12
bne R12EC
lda #8
R12EC: pha
jsr SetDevice
jsr OpenDisk
pla
cpx #0
bne R12E3
jsr DkCg ; change disk vars.
L12FR: jsr RECB ; redraws drive print area
lda curDrive
clc
adc #57
pha
lda #0
sta r11H
lda #116
sta r11L
lda #51
sta r1H
pla
jmp PutChar ; for Drive letter
DkCg: jsr ReStore ; reset vars. for a new disk
jsr RECG ; redraw disk text
jsr OpenDisk
ldx #2
jsr GetPtrCurDkN
ldy #0
R1322: lda (r0L),y
cmp #160
beq R132D
iny
cpy #17
bne R1322
R132D: lda #0
sta (r0L),y
lda #$01
sta r11H
lda #$51
sta r11L
lda #51
sta r1H
jsr PutString ; prints string to screen
jsr MySaver ; prepare new directory TS table
; You may be wondering why some of my routines are named weird.
; These are standard routines I use in many different programs. I have disks
; full of routines so it is just an easier way for me to locate what I am looking for.
; an R prefix usually means I haven't finished improving it, but it works o.k. as is.
; an L prefix usually means I have finished working it and works o.k. as is.
; an S prefix means it is used to store data, but I can make it better if I try.
@; ]
; a J prefix usually menas I don't want to release it.
@: [
; an I prefix usually means it is PD, written by someone else, o.k. to use if
; credit is given where credit is due!
@; ]
ould enhance this routine to search
@ALL
active disk drives for the application
; we want to run
; **********************************************************************
"@LastGO
init.'s our USER routines for input (mish-mosh of routines)
Rick Coleman and William C. Coleman
both needed some "tweaking" this is the current result of combining them
; **********************************************************************
LastGO:
lda #0 ; pattern pointer
jsr SetPattern ; set system pattern
jsr L12FR ; rewrite drive/disk strings
jsr DkCg ; reset as if a new disk GEOS bug in
; early version
L134R: jsr UseSystemFont ; use 128's BSW char. set
Here I could have used MasterBlasters' "UseMYFont" routine if I wished to install
; my own custom Font set. Since a complete set of the BSW char. set is not
; available, I decided to bypass this feature in this version (some shifted chars do not jive!)
jsr RECA ; clear user input text area
lda #0 ; store char input with a '0' to be safe
sta SMKA ; internal string buffer
sta r1L ; fault routine flag (
$00 is sys. default
LoadW r0,SMKA ; pointer to string buffer for chars' typed in
; **
"@NOTE
** anything in the system string buffer will be echoed here when KeyVector
; is activated from getstring routine.
; if the systems string buffer has a string in it, it will echo here, hence the reason
; for routine L134R to start string with a "0" upon entry !
; Ex: If you ran this DA from geoWrite, then "geoWrite" would show here as soon
; as the routine was executed. The USER didn't type it in, so we don't want it!
lda #22
sta r2L ; MAX_CHAR's to accept
lda #0
; X POS (word value) for placement
sta r11H
; "
lda #68 ; "
sta r11L
; "
lda #83
sta r1H ; Y POS (byte value) for placement
LoadW keyVector,KeyLen ; mainloop wedge (until <CR> pressed)
jmp GetString ;
; KeyLen is wedged into MainLoop by GetString routine
; it is completed when the user presses the <CR> key.
Please note that while running this program under geoDebugger V2.0, the clock process
may stop if it is used too long
(while in geoDebugger).
will happen without a doubt if you are using a RamLink!
KeyLen:
lda SMKA ; char. typed in by user
bne KeyGetter ; if < > 0 then execute KeyGetter
jmp L134R ; if = 0 then re-start input routine
KeyGetter:
jsr RECJ ; clear area
lda #1 ; load new value
sta CntA ; store new pointer
sta CntB ; store new counter
jsr DirFrst ; check GEOS version and 1st dir entry
R13RR: jsr TrsBuf ; transfer valid stuff to buffer
bne R13C3 ; branch is not 0
jsr L13DE ; finish up misc. stuff
R13C3: jsr DirNxt ; check GEOS version and next dir entry
inc CntB ; increment counter by 1
lda CntB ; load new value into counter
cmp #9 ; check last valid count before reset/end
bcc R13D8
inc CntA
lda #1
sta CntB
R13D8: tya
beq R13RR
jmp L1523
L13DE: lda CntC
sta r0L
lda #19
sta r1L
ldx #2
ldy #4
jsr BBMult
lda #16
sta r1H
lda #82
sta r1L
lda r0L
clc
adc r1L
sta r1L
lda r0H
adc r1H
sta r1H
sec
lda r1L
sbc #3
sta r1L
bcs R140E
dec r1H
R140E: ldy #3
R1410: lda (r5L),y
sta (r1L),y
iny
cpy #19
bne R1410
lda #0
sta (r1L),y
lda CntA
iny
sta (r1L),y
lda CntB
iny
sta (r1L),y
inc CntC
lda CntC
cmp #8 ;
this counter imits to 8 filenames
bcc R1438
pla
pla
jmp L1523
R1438: rts
buffer for chars' typed in
; **
"@NOTE
** anything in the system string buffer will be echoed here when KeyVector
; is activat
; a much easier version of this routine to understand is found near the end
; of this file in PrintPage, LastPage, PDIR
TrsBuf: jsr L14D2
jsr L1479
bne R1444
lda #255
rts
R1444: ldx #0
L1446: lda SMKA,x ; checks character input
bne WildCk ; if not 0, then check wildcards
lda (r6L),y
cmp #160
beq R1453
lda #255
R1453: rts
WildCk: cmp #33 ;
"@ ! char
bne R145R
jsr L14RR
R145R: cmp #42 ;
"@* char
bne T1462
jsr L1480
T1462: cmp #63 ;
"@? char
bne L146R
inx
lda SMKA,x
iny
L146R: cmp (r6L),y
bne R1478
iny
inx
cpx #23
bcs R1478
jmp L1446
R1478: rts
ny
cpy #19
bne R1410
lda #0
sta (r1L),y
lda CntA
iny
sta (r1L),y
lda CntB
iny
sta (r1L),y
inc CntC
lda CntC
cmp #8
this
counter imi
L1479: ldy #0
lda (r5L),y
bne R147F
R147F: rts
L1480: inx
lda SMKA,x
beq R14R5
bne R148C
R1488: inx
lda SMKA,x
R148C: cmp #42
bne R1498
inx
lda SMKA,x
beq R14R5
bne R148C
R1498: cmp #0
checks for end of entry name ' 0 ' char beofre printing next char.
"@* char
bne T1462
jsr L1480
T1462: cmp #63 ;
"@? char
bne L146R
inx
lda S
bne R14A4
lda (r6L),y
cmp #160
check $A0 'padding' char in filenames
bne R14R2
beq R14R5
R14A4: cmp (r6L),y
bne R14AD
iny
cpx #23
bcc R1488
R14AD: iny
cpy #17
bcc R14A4
R14R2: ldx #255
.byte #44
R14R5: ldx #$00
R14R7: pla
pla
txa
rts
L14RR: inx
lda SMKA,x
cmp #42
bne R14C6
jmp L146R
R14C6: cmp #63
bne R14CD
jmp L146R
R14CD: dex
lda SMKA,x
rts
lda SMKA,x
rts
R1478
iny
inx
cpx #23
bcs R1478
jmp L1446
R1478: rts
ec r1H
R140E: ldy #3
R1410: lda (r5L),y
sta (r1L),y
L14D2: lda r5H
pha
lda r5L
pha
clc
lda #3
adc r5L
sta r5L
bcc R14E3
inc r5H
R14E3: lda #16
sta r6H
lda #62
sta r6L
ldy #16
jsr L1510
lda #39
sta r5L
sta r6L
lda #16
sta r5H
sta r6H
ldy #22
jsr L1510
pla
sta r5L
pla
sta r5H
lda #16
sta r6H
lda #62
sta r6L
rts
$150F 60
; $150F 60
rts ; $150F 60
; $150F 60
; $150F 60
; $150F 60
$150F 60
; $150F 60
$150F 60
; $150F 60
; $150F 60
; $150F 60
$150F 60
; $150F 60
; $150F 60
; $150F 6
L1510: lda (r5L),y
cmp #97
bcc R151D
cmp #123
bcs R151D
sec
sbc #32
R151D: sta (r6L),y
dey
bpl L1510
rts
L1523:
lda CntC
bne R152R
jmp L134R
R152R:
lda #112
sta r1H
LoadW r0,FirstGO
at this point, FirstGO is used as a buffer that stores Directory entries.
; from the keyboard input. It is no longer the start-up routine !
Originally used as a
trojan horse
to deter debugging efforts.
L1542: lda #0
sta r11H
lda #68
sta r11L
jsr PutString
11H
lda #68
sta r11L
jsr PutString
#68
sta r11L
jsr PutString
(r1L),y
see PDir routine for clearer explanation of this routine
inc r0L
bne R1553
inc r0H
R1553: lda r0H
pha
lda r0L
pha
ldy #0
lda (r0L),y
sta r0L
sty r0H
lda #1
sta r11H
JCC: lda #32
sta r11L
lda #192
jsr PutDecimal ; prints pad number
pla
sta r0L
pla
sta r0H
inc r0L
bne R157A
inc r0H
R157A: lda r0H
pha
lda r0L
pha
ldy #0
lda (r0L),y
sta r0L
sty r0H
lda #1
sta r11H
JDD: lda #99
sta r11L
lda #192
jsr PutDecimal ; prints page number
pla
sta r0L
pla
sta r0H
inc r0L
bne R15A1
inc r0H
R15A1: dec CntC
bne R15A9
jmp L134R
R15A9: lda r1H
clc
KMASS: adc #9
sta r1H
jmp L1542
WasteMeA: ; dummy routine to waste a cycle
; I found a timing problem when using an FD2000 and a RamLink, so I placed
; this routine here to give a chance to update the processes'. Seems my
; init. routines take up a little more time than I wanted them to.
rts
ring buffer has a string in it, it will ech
L15RD: ; dummy routine just to waste a cycle
was previously used for internal program protection routine
rts ;
detects if original disk booted from is in the drive
if different disk the swap file may be lost and you will crash !
QutMe: lda CntD ; exit routine checker
cmp curDrive ;
beq L15D2 ;
jsr SetDevice ;
L15D2: jsr OpenDisk ;
ldx #2 ;
jsr GetPtrCurDkN ;
lda #16 ;
sta r1H ;
lda #22 ;
sta r1L ;
ldx #4 ;
ldy #2 ;
lda #16 ;
jsr CmpFString ; see if disknames are the same
beq L15FF ; if yes, continue exit
jsr L160E ; if no, put up DB and process
lda #128 ;
sta mouseOn ;
LoadW otherPressVector,L1605 ;
rts ;
L15FF: jsr DoQuit ; restore app zero page
jsr L15RD ;
jmp RstrAppl ; back to application booted from
L1605: lda mouseData ;
bpl R160R ;
rts ;
R160R: jmp QutMe ;
L160E: jsr RECJ ;
jsr i_PutString ;
.word $0044 ;
.byte 116 ;
.byte "Insert " ;
.byte NULL ;
lda #0 ;
sta SMKA ;
LoadW r0,HoldMeA ;
"@Name of disk
jsr PutString ;
jsr i_PutString ;
.word $0044 ;
.byte 128 ;
.byte "(click when done)" ;
.byte NULL ;
rts ;
by William C. Coleman
needed for 64 version only, not needed here!
DirFrst: lda $C00F ;
"@check version
cmp #19 ;
bcs MyDir1 ;
jmp $C9F7 ; jmp alternate version kernal
MyDir1: jmp Get1stDirEnt ;
by William C. Coleman
needed for 64 version only, not needed here!
DirNxt: lda $C00F ;
"@check version
cmp #19 ;
bcs MyDirNx ;
jmp $CA10 ; jmp alternate version kernal
MyDirNx: jmp GetNxtDirEnt ;
LoadW keyVector,KeyLen ; mainloop route until <CR> pressed
jmp GetString ; see OGPRG routines
; KeyLen is wedged into MainLoop by GetString routine
; it is complete
InitDRVVars:
by William C. Coleman
; Initializes and stores drive number(s). Call this routine during
; your application's initization routine. boot_Drive and
; work_Drive will be initialized and NewDrive call to intialize
; disk turbo. If Geos V2.0 or above and a 3rd or 4th drive is
; available then numDrive will be inc'ed to 3 or 4. You should
; set this back just before your DA exits if it doesn't support
; the ammount of active drives available directly.
MoveB curDevice,boot_Drive
sta work_Drive ;indicates current drive
lda numDrives
cmp #1
beq 20$ ;branch if one drive
lda version ;make sure version > 2.0
cmp #$20
bcc 20$ ;no so leave numDrives alone
lda driveType+2 ;see if there's a third drive
beq 20$ ;no so leave numDrives alone
and #%1111 ;clear REU bits
sta temp3D
lda driveType ;drive A
and #%1111
cmp temp3D ;check if Drive C = Drive A
beq 10$ ;yep so it's OK to add it
lda sysRAMFlg ;no, so check for REU
and #%01000000 ;device driver bit
beq 20$ ;no REU or no drivers in it
@10$:
inc numDrives ;will now equal 3 or 4
@20$:
"@Name of disk
jsr PutString ;
jsr i_PutString ;
.word $0044 ;
@SwapDrive:
by William C. Coleman
; Swaps the active drive if multi-drive system. Don't pass this
; routine anything. work_Drive will be updated.
; Valid drive will be opened before returning
ldx numDrives
dex
beq 30$ ;branch if 1 drive
@20$:
jsr NextDrive ;get next drive number
sta work_Drive ;and store it
@30$:
rts
;***************************************************
; Returns next drive # in A. This is an internal routine.
@NextDrive
by William C. Coleman
;***************************************************
@NextDrive:
lda numDrives
cmp #1
beq 20$ ; only 1 drive so skip next stuff
add #7 ; org. #8, fixed to check drives correctly
; a common error in the original routine. Some tend to forget that the
; bit counts 7-0 (8 bits). If you add 8 it will overflow the pointer. Works well
; with 3 drives, but it mis-counts if it checks for a 4th disk drive in numDrives,
; and, the result would be
@setting
the 4th disk drive
@twice
@then
the 1st would
; be displayed
@afterwards
. If you per chance use a non-CBM disk drive
; it would be a fatal error if the #8 was left in there. Some use a 'swap'
; routine that puts data in this same area!
sta temp3D ;max drive # + 1 (10 or 11)
lda work_Drive ;current drive
@05$:
add #1
cmp temp3D
bcc 10$ ;valid device number
lda #8
@10$:
lda driveType-8,y
beq 05$ ;drive not available
tya ;new drive # in A
rts
@20$:
lda work_Drive ;return current drive #
rts
lliam C. Coleman
needed for 64 version only, not needed here!
DirNxt: lda $C00F ;
"@check version
cmp #19 ;
bcs MyDi
DoQuit: ; Restore applications's zero page space
below by Rob Knop
jsr i_MoveData
; Re-Install appzpage before exit
.word appzpage
.word $0061
.word $009e
some program var.s' placed here as they may trash in ramsect
program area is more reliable than ram area
.byte 0
; not used
temp3D: .byte 0 ; temporary drive storage
.byte 0
; not used
work_Drive: .byte 0 ; currently opened drive
.byte 0
; not used
boot_Drive: .byte 0 ; drive DA booted from
.byte 0
; not used
BoDet: .byte 0 ; page number of last page in dir.
.byte 0 ; not used
ModPtr: .byte 0 ; pointer for PGCT
ModTS: .byte 0 ; last page in dir. track
.byte 0 ; last page in dir. sector
TodPtr: .byte 0 ; not used
TodTS: .byte 0 ; pointer for curdisk dir. track
.byte 0 ; pointer for curdisk dir. sector
LastTS: .byte 0 ; last page in current dir. track
.byte 0 ; last page in current dir. sector
nd we can use diskBlkBuffer for other things.
MoveB TodTS,r1L ; track pointer
MoveB TodTS+1,r1H ; sector pointer
;------
I could have used the MoveW routine here, I split it up so you could see the
;------
proce
; **********************************************************************
@ MySaver
init.'s our T&S buffer with the current disk's directory page pointers
; **********************************************************************
MySaver:
LoadW r0,#(DAEnd-Cat) ; put buffer at end of DA
LoadW r1,#Cat ; address of buffer
jsr ClearRam ; fill area with 0's for now
10$ jsr GetDirHead ; Get pointer to directory block
beq 20$ ; if o.k. then continue
ldx #3 ; else set error code
bra 88$ ; and quit
;-----
Now we can get the first records T & S from the diskBlkBuffer and transfer
;-----
it to our internal var to hold it, as later we will trash the diskBlkBuffer
20$ MoveW curDirHead,TodTS ; copies word value to internal holder
;-----
Now we transfer the starting T & S to r1 so the followchain routine can
;-----
build a track and sector table of the current directory
;-----
It puts this in our buffer "Cat" so your main will not be trashed
;-----
and we can use diskBlkBuffer for other things.
MoveB TodTS,r1L ; track pointer
MoveB TodTS+1,r1H ; sector pointer
;------
I could have used the MoveW routine here, I split it up so you could see the
;------
process a little easier
LoadW r3,Cat ; load address of Buffer into r3
jsr FollowChain ; build our Track and Sector Table
jsr PGCT ;
now we set up our last page pointers/counters
;
for the wrap-around feature in PAGE
88$ rts
; **********************************************************************
@ RiSaver
displays the directory page's in reverse order and wraps around to the last
; page when it encounters page #1 (page 0)
; **********************************************************************
RiSaver: ; called from PAGE icon to display page directory
jsr
RECJ ; clear the filename box
LoadW r4,$8000 ; general buffer to copy block to
jsr RmpPage ; check page last used and decrement it
mide: lda Cat,y ; transfer track from internal buffer listing
sta r1L ; to track for use by getblock
lda Cat,y ; transfer sector from internal buffer listing
sta r1H ; to sector for use by getblock
jsr GetBlock ; copy the block info. to internal buffer
jmp PDir ; print the filenames to the display
; **********************************************************************
@MiSaver
displays the directory pages' in sequential order and wraps around to the 1st
; page when it encounters the last page
; **********************************************************************
MiSaver: ; called from PAGE icon to display page directory
jsr
RECJ ; clear the filename box
LoadW r4,$8000 ; general buffer to copy block to
jsr BmpPage ; check page last used and bump it
hide: lda Cat,y ; track from internal buffer listing
sta r1L ; track for use by getblock
lda Cat,y ; sector from internal buffer listing
sta r1H ; sector for use by getblock
CmpWI r1,65280 ; check for end of directory in listing (track$00 sector$FF)
beq Dumm ; if match, then end of directory found, reset stuff.
jsr GetBlock ; valid page so copy the block info. to buffer
jmp PDir ; print filenames to display
Dumm: jsr ReStore ; reset vars and counters
jmp MiSaver ; display 1st dir entry
; **********************************************************************
@ PDir
main routine for printing variable text to the screen
by Paul B. Murdaugh
; Uses a6,a8,a9,r0,r1,r11,a
; **********************************************************************
PDir: lda #$01 ; load
sta a9L ; pad # value
lda #$08 ; load
sta a9H ; MAX file counter
LoadW a6,$8002 ; valid file pointer
LoadW a8,$8018 ; filetype pointer
lda #112 ; Y pos to print string start address
sta r1H ; (byte)
LoadW r0,$8005 ;
"@address of string to print
lda #0 ; X pos to print string
sta r11H ; (word)
lda #68 ; "
sta r11L ; "
bra cig ; skip over bumpers
cih: AddVB 9,r1H ; bump Y pos
lda #0 ; X pos to print string
sta r11H ; (word)
lda #68 ; "
sta r11L ; "
jsr PrintString ;Print the filename to screen
jsr PrntPage ;Print the page # to screen
jsr PrintType ;Print filetype to screen
AddVW 32,r0 ;bump the name pointer to the next name
AddVW 32,a6 ;bump the valid pointer to the var.
AddVW 32,a8 ;bump the type pointer to the var.
inc a9L ;add 1 to pad number
dec a9H ;drop 1 from the counter
bne cih ;if counter is not 0 then do again
30$ jsr LastPage ;Print last page used to screen
lda #$01
sta a9L ;reset pad number to 1
rts ;finished
sta a9L ;reset pad number to 1
rts ;finished
number to 1
rts ;finished
ts ;finished
r1,65
;************************************************************************
@PrintString
filters non-printable chars from the output to prevent lockups
by Paul B. Murdaugh
;************************************************************************
PrintString:
ldy #0 ;
first we check for a valid file in the slot
lda (a6),y ;check for a valid file in slot
sta JTF ;save for Printfiletype varify
beq sht ;skip printing it's a deleted file
ldy #0 ;Set Counter to 0
mad: tya ;
returns here until loop finished
cmp #$10 ;
@16
is max characters in a filename
beq sht ;if = 16 then end of string/exit
lda (r0),y ;Get the char to be printed
beq sht ;if 0 then end of string/exit
cmp #$a0 ;if $a0 (shifted/space padding)
beq sht ; then end of string/exit
and #%01111111 ;stip off control bit
cmp #$20 ;if char is >= $20 (space)
bcs mae ;Then print it
lda #'*' ;else char = $20
mae: sty JRR ; save y pointer
jsr SmallPutChar ;Print the character
ldy JRR ; restore y pointer
iny ;bump the pointer
bne mad ;If pointer has not wraped around then
;do loop again
sht: rts ;else exit routine
utine
; **********************************************************************
@ PrntPage
prints the Page, and Pad numbers to the screen
from Paul B. Murdaugh
; **********************************************************************
PrntPage
lda r0H ; save value in r0 so doesn't get trashed
pha ; we need it again for PDir
lda r0L ;
expanded version of PushW
pha
ldy #0
lda JRD ;
"@ page number var.
sta r0L
sty r0H
lda #1
sta r11H
lda #32
sta r11L
lda #192
jsr PutDecimal ;
prints the PAGE number to the display
pla
restore r0 for next part
sta r0L
expanded version of PopW
pla
sta r0H
lda r0H ; save value in r0 so doesn't get trashed
pha ; we need it again later for PDir
lda r0L ;
expanded version of PushW
pha
ldy #0
lda a9L ;
"@pad location var.
sta r0L
sty r0H
lda #1 ; X pos (word)
sta r11H
lda #99
sta r11L
lda #192
jsr PutDecimal ;
prints the PAD number to the display
pla ; restore the value in r0
sta r0L
pla
sta r0H
age used to screen
lda #$01
sta a9L ;reset pad number to 1
rts ;finished
sta a9L ;reset pad number to 1
rts ;finished
number to 1
rts ;finished
ts ;finished
r1,65
;************************************************************************
@PrintType
gets pointer to filetype byte
; Checks through a list of values to varify which type of file is to be printed.
; and then points to another list of pointers to print text to screen.
; Destroys a,x,y
; Returns r11 with new value, r0 restored with previous value, prints text string
by Paul B. Murdaugh
;************************************************************************
PrintType:
PushW r0 ;save r0 for later
lda JTF ;check if valid file in entry
beq exa ;if = 0, entry is deleted, so print it
ldy #0 ;list counter
lda (a8),y ;get filetype value
ldx #0 ;Get number on list
exc: cmp StrTab,x ;See if number matches
beq exd ;If it does then process
inx ;Else, bump pointer
cpx #SUMCUTS ;if x <> SUMCUTS
bne exc ;then check next
PopW r0 ;restore r0 value due to error
bra exb
;return to PDir route w/o printing
exa: LoadW r0,stext ;get pointer to deleted text
AddVW 37,r11 ;bump r11 to new X position
jsr PutString ;Print to screen
PopW r0 ;restore r0 value
exb: rts ;return to PDir route
exd: txa ;Put pointer to list in a
asl a ;double a (a=a*2)
tax ;Put pointer to listvector in x
MoveB "StrJump,x",r0 ;Put Vector in r0
MoveB "StrJump,x",r0+1
AddVW 37,r11 ;bump r11 to new X position
jsr PutString ;Print to screen
PopW r0 ;restore r0 value
20$ rts ;return to PDir route
list of values to match filetype value
StrTab: .byte 0,1,2,3,4,5,6,7,8,9,10
.byte 11,12,13,14,15,16,17,18,19
StrLen:
SUMCUTS = StrLen-StrTab ;
equate for text/list to print
list of pointers to text strings
StrJump: .word atext,btext,ctext,dtext,etext,ftext,gtext,htext,itext,jtext
.word ktext,ltext,mtext,ntext,otext,ptext,qtext,rtext,stext
filetype text tables
atext: .byte "NOT_GEOS",0
btext: .byte "BASIC",0
ctext: .byte "ASSEMBLY",0
dtext: .byte "DATA",0
etext: .byte "SYSTEM",0
ftext: .byte "DESK_ACC",0
gtext: .byte "APPLICATION",0
htext: .byte "APPL_DATA",0
itext: .byte "FONT",0
jtext: .byte "PRINTER",0
ktext: .byte "INPUT_DEVICE",0
ltext: .byte "DISK_DEVICE",0
mtext: .byte "SYSTEM_BOOT",0
ntext: .byte "TEMPORARY",0
otext: .byte "AUTO_EXEC",0
ptext: .byte "INPUT_128",0
qtext: .byte "UNKNOWN17",0 ;for future use
rtext: .byte "UNKNOWN18",0 ;for future use
stext: .byte "DELETED",0
rts ;dummy rts for use with debugger
; **********************************************************************
@ LastPage
prints the last PAGE # viewed to the screen
; **********************************************************************
LastPage:
jsr LJDRA ; clear the Last Page# area
lda r0H ; save r0 value
pha
lda r0L
pha
ldy #0
lda JRD
sta r0L
sty r0H
ldx #78
stx r1H
lda #1
sta r11H
rJEE: lda #92
sta r11L
lda #192
jsr PutDecimal ;
"@print last page #
pla ; restore r0 value
sta r0L
pla
sta r0H
ldy #0 ;list counter
lda (a8),y ;get filetype value
ldx #0 ;Get number on list
exc: cmp StrTab,x ;See if num
; **********************************************************************
@BmpPage
bumps the vars. for the Page T&S locations in the Cat buffer listing
;
used in Page Forward routine
; **********************************************************************
BmpPage:
lda JRD ; pointer to page # used last
beq 10$ ; if = 0, it's 1st dir. entry, do 1st entry sub
Enters here if First Page was already displayed Uses JRD for varification
bumps Y reg by 2 for next page T & S address in Cat buffer listing
ldy EnterStr ; transfer page number to Y reg
iny ; add 1 to Y value
iny ;
add 1 to Y value
sty EnterStr ; set up EnterStr for next page # value
ldx JRD ; set up JRD for next page
inx ;
add 1 to X value
stx JRD ; and store it for next page var.
bra 20$ ; exit
clears Y reg for First Page bumps x reg for JRD value
10$ ldx JRD ; load vars with pointers/counters for 1st dir entry
inx ; bump/up x reg
stx JRD ; set up JRD for next page
ldy #$00 ; set up y reg for buffer pointer
sty EnterStr ; store Y for next pointer in Cat buffer
20$ rts ;
returns to 'hide' address of routine MiSaver
;
with value in Y reg for T&S list in Cat buffer
; **********************************************************************
@RmpPage
decrements the vars. for the Page T&S locations in the Cat buffer listing
used in Page Backward routine by Jim Robbins
; **********************************************************************
RmpPage:
lda JRD ; page used last pointer
beq 10$ ; if 0, it is first dir. entry
cmp #$01 ; see if last page was page #2
beq 10$ ; if = , do last page display
Enters here if First Page was already displayed Uses JRD for varification
ldy EnterStr ; transfer page number to y reg
dey ; sub. 1 from Y reg
dey ;
sub. 1 from Y reg
sty EnterStr ; set up EnterStr for next page
ldx JRD ; set up JRD for next page
dex ;
sub. 1 from X reg
stx JRD ; and store it for next page value
bra 20$ ; exit routine
sets counters and pointers for last page
10$ lda BoDet ; load last page number
sta JRD ; store it in JRD for page # diaplay
ldy ModPtr ; set up reg for buffer pointer
sty EnterStr ; store for next pointer in Cat buffer
bra 20$
15$ ldx #$01
stx JRD
ldy #$00 ; set up y reg for buffer pointer
sty EnterStr ; store Y for next pointer in Cat buffer
20$ rts ; returns to 'mide' address of main routine (RiSaver)
; **********************************************************************
@PGCT
sets up pointers and counters for last page of current dir. printing later
; Used only for init. after MySaver routine has stored the new directory T/S table
; **********************************************************************
PGCT:
ldx #$00 ; start buffer pointer
stx ModPtr ; store list pointer for wrap around
stx BoDet ; store page number
clide: lda Cat,x ; load pointer to T&S table
beq Stop ; skip it, found last page (track 00 sector FF)
ldy BoDet ; load Y with value in BoDet
iny ; bump Y
sty BoDet ; store page number for last page in directory
sta LastTS ; store track pointer for use with GetBlock
stx ModPtr ; store table pointer for use with Cat buffer
lda Cat,x
sta LastTS+1 ; store sector pointer
bra clide ; branch if last page not fopund
stx ModTS ; opps ! goofed again didn't I !
@; D
; (not really !)
I left this here for space to update a future version with another idea
see if you can beat me to it !
Stop: rts
; **********************************************************************
"@ReStore
clears the vars. for a new disk, drive or restart of directory display
; **********************************************************************
ReStore:
lda #$01
sta a9L ; pad number
lda #$08
sta a9H ; MAX file counter
lda #$00
sta JRD ; page number
sta EnterStr ; T&S pointer
; **********************************************************************
@LJDRA
clears the Page Number area for a fresh slate to write on
; **********************************************************************
LJDRA:
jsr i_Rectangle ;
.byte 72, 78 ;
.word 348 ;
.word 506 ;
rts ; returns to LastPage routine
displayed Uses JRD for varification
ldy EnterStr ; transfer page number to y reg
dey ; sub. 1 from Y reg
dey ;
sub. 1 from Y reg
; **********************************************************************
"@ApExec
will load and execute a GEOS application file on the current drive/disk...
.....only when a
"Pvalid
filename is entered and the
"PLOAD
icon is clicked.....
it will
"PNOT
return to this DA if executed
; If a
"@ non-valid
filename is entered the routine will reset at LastGO
by Paul B. Murdaugh
; **********************************************************************
ApExec:
jsr SetDevice ;Give control to current Drive
txa ; transfer error status to 'a' register
bne 15$ ;If error ignore and reset
; You'll notice here I do not put up a dialog box telling you a goof happened.
; No need to, as you will see the name area clear and it will reset you
; for a new input string. Saves a headache you can't do anything about anyway!
jsr OpenDisk ;Open the disk
bne 15$ ;If error ignore and reset
LoadW r6,SMKA ; filename you typed in EXACTLY
jsr FindFile
bne 15$ ;If error ignore and reset
ldy #22 ; Get Geos File type
lda (r5),y ; from directory entry found
cmp #$6 ; is it an Application?
bne 15$ ; No? then reset loop
PNOTE
We can only run applications from a desk accessory - hence the limitation.
If you made this a standard application you could run a varitey of GEOS filetypes.
like an alternate desktop or such.....
LoadB r0L,#$00 ; YES ! so continue loading
LoadW r6,SMKA ; the file and run it
LoadB r10L,#$00 ; RCVR_OPTS no longer used, set to 0
jmp GetFile
bra 20$ ; skip next
15$ jmp
LastGO ; this routine will restart input loop if an error occurred
20$ rts ; rts here for debugger seperation only
; so routine label will not run-over
;
necessary for program flow itself.
@** NOTE **
; We could enhance this routine to search
@ALL
active disk drives for the application
; we want to run by using a variation of the SwapDrive routine.
; Since this is a Desk Accessory space is a concern.
; You could make this a standard application if you chose to.
short excuse is I was too lazy to add it in.....
@; D
@; D
.ramsect
these next four vars were used from Rob Knops RPN DA source code
appzpage: .block $9e ;holds application's zero page word-registers
Save380: .block $80 ;
not used this version
GEOSzero: .block $41
not used this version
F_ENTRY: .block 1 ;Flag for Entry in progress
JRA: .block 1 ;
not used this version
JRR: .block 1 ;pointer for smaputchar y counter
JRC: .block 1 ;
not used this version
JRD: .block 1 ;pointer for current directory page
JRE: .block 1 ;
not used this version
JRF: .block 1 ;value for valid file in slot (filename)
JTF: .block 1 ;value for valid file in slot (filetype)
EnterStr: .block 1 ;Current T&S of Directory var.
EnterPos: .block 1 ;
not used this version
Cat: .block 512 ;directory page table
DAEnd:
; necessary to locate end of DA for Linker and swap file(s)
file(s)
swap file(s)
;Open the disk
bne 15$ ;If error ignore and reset
LoadW r6,SMKA ;
; jsr MySaver ;
jsr
L139R ; clear the filename box
LoadW r4,$8000 ; general buffer to copy block to
MoveW
CatchBuffer
,r1 ; location T&S of block to write to
jsr Ge