if .p

t "TopSym"

t "TopMac"

t "Sym128.erg"

:VDCwrite = $ca76

:VDCread = $ca82

:AlleNamen = $4670

:DatenBereich = $5000

:Entpacked = $55c0

:Analoged = $5ac0

endif

n "PaintPreview"

c "PaintPreview V1.1"

a "Torsten Kracke"

f APPLICATION

z $c0

o APP_RAM

p Start

i:Start jsr Rechteck

LoadW keyVector,Tastaturabfrage

LoadW r0,MenüTabelle ; Zeiger auf MenüTabelle

lda #1 ; Maus auf 2. Menüpkt

jsr DoMenu ; Menü darstellen

LoadW r0,DummyIconTabelle ; Zeiger auf IconTabelle

jmp DoIcons ; Rücksprung zur Mainloop

:DummyIconTabelle b 1

w $0000

b 0

w $0000

b 0,0,1,1

w $0000

:RecTabelle b 0,199

w 0,639

:MenüTabelle b 0,14 ; y-Koordinaten

w 0,74 ; x-Koordinaten

b 2 ! HORIZONTAL

w geosText

b SUB_MENU

w geosSubTabelle

w DateiText

b SUB_MENU

w DateiSubTabelle

;---- Hauptmenüpunkt geos ----

:geosText b "geos",NULL

:geosSubTabelle b 14,29 ; y-Koordinaten

w 0,137 ; x-Koordinaten

b 1 ! VERTICAL ! CONSTRAINED

w InfoText

b MENU_ACTION

w InfoReaktion

:InfoText b "PaintPreview Info",GOTOX

w 117

b SHORTCUT,BOLDON,"I",PLAINTEXT,NULL

:InfoReaktion jsr GotoFirst Menu

:InfoReakTast LoadW r0,InfoDiaTab

jmp DoDlgBox

:InfoDiaTab b $81 ; Standardbox

b DBTXTSTR,10,25

w InfoText1

b DBTXTSTR,10,40

w InfoText2

b DBTXTSTR,10,55

w InfoText3

b DBTXTSTR,10,65

w InfoText4

b DBTXTSTR,10,75

w InfoText5

b OK,16,70

b DBSYSOPV

b NULL

:InfoText1 b BOLDON,OUTLINEON,"PaintPreview",PLAINTEXT,NULL

:InfoText2 b BOLDON,"Shareware-Gebühr: 5,- DM an:"

b PLAINTEXT,NULL

:InfoText3 b "Torsten Kracke",NULL

:InfoText4 b "Marktstr. 4",NULL

:InfoText5 b "D-W-2723 Scheeßel",NULL

;---- Hauptmenüpunkt Datei ----

:DateiText b "Datei",NULL

:DateiSubTabelle b 14,57

w 37,128

b 3 ! VERTICAL ! CONSTRAINED

w ÖffnenText

b MENU_ACTION

w ÖffnenReaktion

w AlleText

b MENU_ACTION

w AlleReaktion

w VerlassenText

b MENU_ACTION

w EnterDeskTop

:ÖffnenText b "Öffnen",GOTOX

w 103

b SHORTCUT,BOLDON,"O",PLAINTEXT,NULL

:AlleText b "Alle",GOTOX

w 103

b SHORTCUT,BOLDON,"A",PLAINTEXT,NULL

:VerlassenText b "Verlassen",GOTOX

w 103

b SHORTCUT,BOLDON,"Q",PLAINTEXT,NULL

:ÖffnenReaktion jsr GotoFirstMenu

:ÖffnenReakTast LoadW LfFlag,LfwerkTab

lda numDrives

cmp #1

bne :onedrive

LoadW LfFlag,LfwDummy

::onedrive lda curType

and #%10000000

bne :RamDisk

lda #DISK

bne :NormDisk

::RamDisk lda #0

::NormDisk sta DskFlag

jsr OpenDisk

ldy #0

::NameLesen lda (r5),y

cmp #$a0

beq :NameEnde

sta Name,y

iny

cpy #17

bne :NameLesen

::NameEnde lda #0

sta Name,y

LoadB DateiName,0

LoadW r0,LoadDiaTab

LoadW r5,DateiName

LoadB r7L,APPL_DATA

LoadW r10,Klasse

jsr DoDlgBox ; installiert Dateiauswahl-Box

lda r0L

cmp #CANCEL

beq :Wiederholen ; Abbruch: zurück ins Hauptmenü

cmp #20 ; Laufwerk wechseln

bne :wei

lda curDrive

eor #1

jsr SetDevice

jmp ÖffnenReakTast

::wei cmp #DISK

bne :wei2

jmp ÖffnenReakTast

::wei2 lda DateiName

beq :Wiederholen ; keine Datei: zurück ins Hauptmenü

jsr GrafikAn ; ÖffneDokument Routine

jsr GrafikZeig

LoadB mouseData,0

::warte lda mouseData

bpl :warte

jmp GrafikAus

::Wiederholen rts

:LoadDiaTab b $81

b CANCEL,17,77

b OPEN,17,23

b DBGETFILES,4,4

b DBTXTSTR,131,9

w AufDisk

b DBTXTSTR,131,19

w Name

b DBUSRICON,17,59 ; Lf-werk Icon

:LfFlag w LfwerkTab ; Routine für Lf-werk Icon

:DskFlag b DISK,17,41

b NULL

:AufDisk b BOLDON,"Auf Disk:",PLAINTEXT,NULL

:Name s 17

:LfwerkTab w LfwerkIcon

b 0,0,6!DOUBLE_B,16

w LfwerkRout

:LfwDummy w 0

b 0,0,0,0

w 0

:LfwerkRout LoadB sysDBData,20

jmp RstrFrmDialogue

:LfwerkIcon

:DateiName s 17

:Klasse b "Paint Image",NULL

:AlleReaktion jsr GotoFirstMenu

:AlleReakTast LoadW LfFlag2,LfwerkTab

lda numDrives

cmp #1

bne :onedrive

LoadW LfFlag2,LfwDummy

::onedrive lda curType

and #%10000000

bne :RamDisk

lda #DISK

bne :NormDisk

::RamDisk lda #0

::NormDisk sta DskFlag2

jsr OpenDisk

ldy #0

::NameLesen lda (r5),y

cmp #$a0

beq :NameEnde

sta Name,y

iny

cpy #17

bne :NameLesen

::NameEnde lda #0

sta Name,y

LoadW r0,AlleDiaTab

jsr DoDlgBox

lda r0L

cmp #CANCEL

bne :wei3

rts

::wei3 cmp #20

bne :wei

lda curDrive

eor #1

jsr SetDevice

jmp AlleReakTast

::wei cmp #DISK

bne :wei2

jmp AlleReakTast

::wei2 LoadB r7L,APPL_DATA

LoadB r7H,144

LoadW r10,Klasse

LoadW r6,AlleNamen

jsr FindFTypes

lda #144

sec

sbc r7H

bne :weiter

rts

::weiter sta r12L ; Anzahl der Namen in r12L

LoadW r11,AlleNamen; Zeiger auf aktuellen Namen in r11

jsr GrafikAn

::schleife ldy #16

::schleife2 lda (r11),y

sta DateiName,y

dey

bpl :schleife2

jsr GrafikZeig

LoadB mouseData,0

::warte lda mouseData

bpl :warte

jsr GrafikLösch

lda r11L

clc

adc #17

bcc :nohigh

inc r11H

::nohigh sta r11L

dec r12L

bne :schleife

jmp GrafikAus

:AlleDiaTab b $81

b CANCEL,17,77

b OPEN,17,23

b DBTXTSTR,131,9

w AufDisk

b DBTXTSTR,131,19

w Name

b DBTXTSTR,10,50

w ZeigText

b DBUSRICON,17,59 ; Lf-werk Icon

:LfFlag2 w LfwerkTab ; Routine für Lf-werk Icon

:DskFlag2 b DISK,17,41

b NULL

:ZeigText b BOLDON,"Zeigt alle Bilder der Diskette an."

b PLAINTEXT,NULL

:GrafikAn ldy #18

::marke lda TabelleAn,y

tax

lda TabelleAn+1,y

jsr VDCwrite

dey

dey

bne :marke

:GrafikLösch ldx #24

jsr VDCread

and #127

jsr VDCwrite

lda #0

ldx #19

jsr VDCwrite

ldy #0

::marke2 tya

ldx #18

jsr VDCwrite

lda #0

ldx #31

jsr VDCwrite

ldx #30

jsr VDCwrite

iny

bne :marke2

rts

:TabelleAn b 0,$7d, 4,$6c, 5,$e6, 6,$6c

b 7,$67, 8,$ff, 9,$e6,28,$ff,34,$79

:GrafikZeig lda #0 ; Adresse 0 in VDC-RAM

ldx #18

jsr VDCwrite

ldx #19

jsr VDCwrite

LoadW r0,DateiName

jsr OpenRecordFile

LoadB r5H,255 ; Zeiger auf curRecord

:LiesSector LoadW r6,DatenBereich ; Zeiger im DatenBereich

LoadW r8,Entpacked ; Zeiger auf entpackte Daten

inc r5H ; Zeiger curRecord erhöhen

lda r5H

cmp #45 ; Vlir-Block 45 schon gelesen

bne :weiter ; nein ? dann weiter

jmp CloseRecordFile ; zurück ins Hauptprogramm

::weiter jsr PointRecord

tya

beq Leer

LoadW r7,DatenBereich

LoadW r2,1472

jsr ReadRecord

:Prüfe ldy #0

lda (r6),y

beq DoGraphic

cmp #$40 ; ungepackte Daten ?

bcs Packed ; Sprung, wenn gepackt

tax ; Routine für ungepackte Daten

ldy #1

::schleife lda (r6),y

dey

sta (r8),y

iny

iny

dex

bne :schleife

jmp EntZeigerSetz

:Packed cmp #$80

bcs Highpacked

and #$3f

sta r9L

::schleife ldy #1

ldx #8

::schleife2 lda (r6),y

dey

sta (r8),y

iny

iny

dex

bne :schleife2

lda r8L

clc

adc #8

bcc :nohigh

inc r8H

::nohigh sta r8L

dec r9L

bne :schleife

jmp DatZeigerSetz

:Highpacked and #$7f

tax

ldy #1

lda (r6),y

dey

::schleife sta (r8),y

iny

dex

bne :schleife

jmp EntZeigerSetz

:Leer ldx #19

jsr VDCread

clc

adc #$80

jsr VDCwrite

ldx #18

jsr VDCread

adc #$02

jsr VDCwrite

jmp LiesSector

:DoGraphic LoadW r9,Analoged

LoadB r10H,2

::oberschleife ldx #0

::schleife lda r10H

cmp #01

bne :weiter1

LoadW r8,Entpacked+640

bne :weiter2

::weiter1 LoadW r8,Entpacked

::weiter2 txa

clc

adc r8L

sta r8L

ldy #0

::schleife2 tya

pha

ldy #0

lda (r8),y

sta r10L

pla

tay

lda r10L

sta (r9),y

lda #8

clc

adc r8L

bcc :nohigh

inc r8H

::nohigh sta r8L

iny

cpy #80

bne :schleife2

tya

clc

adc r9L

bcc :nohigh2

inc r9H

::nohigh2 sta r9L

inx

cpx #8

bne :schleife

dec r10H

bne :oberschleife

LoadW r9,Analoged

LoadB r10H,16

::graphschleife ldy #0

::graphschleife2 lda (r9),y

ldx #31

jsr VDCwrite

iny

cpy #80

bne :graphschleife2

tya

clc

adc r9L

bcc :nohigh3

inc r9H

::nohigh3 sta r9L

lda #1

bit r10H

bne :nointerlace

ldx #19

jsr VDCread

clc

adc #$20

jsr VDCwrite

ldx #18

jsr VDCread

adc #$76

jsr VDCwrite

bne :weiter

::nointerlace ldx #19

jsr VDCread

sec

sbc #$70

jsr VDCwrite

ldx #18

jsr VDCread

sbc #$76

jsr VDCwrite

::weiter dec r10H

bne :graphschleife

jmp LiesSector

:EntZeigerSetz ldy #0

lda (r6),y

and #$7f

clc

adc r8L

bcc :nohigh

inc r8H

::nohigh sta r8L

:DatZeigerSetz ldy #0

lda (r6),y

cmp #$40 ; ungepackte Daten ?

bcs :pack

tax

inx

txa

bcc :korrdatzeiger

::pack cmp #$80 ; 8'er Folgen gepackte Daten ?

bcs :highpack

lda #9

bcc :korrdatzeiger

::highpack lda #2

::korrdatzeiger clc

adc r6L

bcc :nohigh

inc r6H

::nohigh sta r6L

jmp Prüfe

:GrafikAus ldy #18

::marke lda TabelleAus,y

tax

lda TabelleAus+1,y

jsr VDCwrite

dey

dey

bne :marke

jsr Rechteck

lda #0

jsr SetPattern

ldy #5

::10 lda MenüTabelle,y

sta r2L,y

dey

bpl :10

jsr Rectangle

lda #255

jsr FrameRectangle

LoadW r4,36

LoadB r3L,0

LoadB r3H,14

lda #170

jsr VerticalLine

LoadW r0,geosText

LoadW r11,4

LoadB r1H,9

jsr PutString

LoadW r0,DateiText

LoadW r11,40

LoadB r1H,9

jmp PutString

:TabelleAus b 0,$7e, 4,$20, 5,$e0, 6,$19

b 7,$1c, 8,$fc, 9,$e7,28,$2f,34,$7d

:Rechteck lda #2