home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d439
/
deluxechanger
/
sources
/
deluxechanger.asm
< prev
next >
Wrap
Assembly Source File
|
1991-01-17
|
9KB
|
500 lines
XREF SysRequest,Request,TypeAsk,TitelBitmap
XDEF _DCScrBase,TopazName
;*********************************************************
;** _ _ **
;** /| \ DELUXE CHANGER V1.0 / |\ **
;** /_|_/ (C) 1990/91 BY ANDREAS RÖPKE \_|_\ **
;** / | \ THIS IS PUBLIC DOMAIN SOFTWARE / | \ **
;** **
;** MADE WITH THE A68K ASSEMBLER & AMIGA 500 1.3 **
;** WORK WITH KICKSTART 2.0 UNCERTAIN **
;** **
;*********************************************************
INCLUDE exec/exec_lib.i
INCLUDE intuition/intuition_lib.i
INCLUDE libraries/dos_lib.i
INCLUDE graphics/graphics_lib.i
INCLUDE help.i
SECTION "Startup",CODE
Start move.l 4,a6 ;DOS-Basis finden
lea $17a(a6),a0 ;und merken
lea DOSName,a1
CALLSYS FindName
move.l d0,_DOSBase
move.l $114(a6),a4 ;Aufruf von diesem Task ?
tst.l $ac(a4)
bne.s FromCLI
lea 92(a4),a0
CALLSYS WaitPort
lea 92(a4),a0
CALLSYS GetMsg
move.l d0,-(sp)
jsr DeluxeStart
CALLEXEC Forbid
move.l (sp)+,a1
CALLSYS ReplyMsg
bra EndAll
FromCLI CALLSYS Forbid
PEEKL Start-4,SegmentPtr
clr.l Start-4
move.l #ProcessName,d1
moveq.l #9,d2
move.l #DeluxeStart-4,d3
asr.l #2,d3
move.l #3000,d4
CALLDOS CreateProc
EndAll moveq.l #0,d0
rts
SECTION "Main",CODE
DeluxeStart
bsr GetLibs
SADD DCScreen,a0
CALLPC _IntuitionBase,OpenScreen
beq NoScr
POKEL d0,_DCScrBase
PEEKL _DCScrBase,a0
lea $2c(a0),a0
SADD Colors,a1
moveq.l #4,d0
CALLPC _GfxBase,LoadRGB4
SADD DCWindow,a0
CALLPC _IntuitionBase,OpenWindow
beq NoWind
POKEL d0,_DCWindBase
move.l d0,a1
POKEL $32(a1),_DCWindRast
POKEL $56(a1),_DCWindUser
bsr MakeTop
DCWait PEEKL _DCWindUser,a0
CALLEXEC WaitPort
PEEKL _DCWindUser,a0
CALLSYS GetMsg
move.l d0,a1
move.l $14(a1),d4
move.l $1c(a1),a4
CALLSYS ReplyMsg
cmpi.b #$40,d4
beq.s GadUp
bra DCWait
GadUp cmpi.w #"QU",$26(a4)
beq.s DCQuit
cmpi.w #"LD",$26(a4)
bne.s NoLD
bsr Load
bra DCWait
NoLD cmpi.w #"CV",$26(a4)
bne.s NoCV
bsr Convert
bra DCWait
NoCV cmpi.w #"SV",$26(a4)
bne.s DCWait
bsr Save
bra DCWait
DCQuit PEEKL _DCWindBase,a0
CALLPC _IntuitionBase,CloseWindow
NoWind PEEKL _DCScrBase,a0
CALLPC _IntuitionBase,CloseScreen
NoScr bsr ASCBufTest
bsr FileBufTest
tst.l SegmentPtr
beq.s WasWork
CALLEXEC Forbid
PEEKL SegmentPtr,d1
CALLPC _DOSBase,UnLoadSeg
WasWork moveq.l #0,d0
rts
SegmentPtr ds.l 1
*** File laden
Load bsr FileBufTest
SADD LoadTitel,a0
jsr Request
beq NoLoad
move.l d0,d1
move.l #1005,d2
CALLPC _DOSBase,Open
bne ScrOK
SADD ErrNoFile,a0
jsr SysRequest
bra NoLoad
ScrOK move.l d0,d6
move.l d6,d1
moveq.l #0,d2
moveq.l #1,d3
CALLSYS Seek
move.l d6,d1
moveq.l #0,d2
moveq.l #-1,d3
CALLSYS Seek
POKEL d0,FileLenght
moveq.l #1,d1
CALLEXEC AllocMem
bne ScrBufferOK
SADD ErrNoMem,a0
jsr SysRequest
bra NoScrBuffer
ScrBufferOK
POKEL d0,FileBuffer
move.l d6,d1
PEEKL FileBuffer,d2
PEEKL FileLenght,d3
CALLPC _DOSBase,Read
SADD DoneIt,a0
jsr SysRequest
NoScrBuffer
move.l d6,d1
CALLPC _DOSBase,Close
NoLoad rts
*** File nach ASC konvertieren
Convert bsr ASCBufTest
tst.l FileBuffer
bne.s OKConv
SADD ErrEmpty,a0
jsr SysRequest
bra NoConv
OKConv jsr TypeAsk
cmpi.w #"CL",d7
beq NoConv
POKEL d0,ASCLenght
move.l #1!$10000,d1
CALLEXEC AllocMem
bne.s MemGot
SADD ErrNoMem,a0
jsr SysRequest
bra NoConv
MemGot POKEL d0,ASCBuffer
PEEKL FileLenght,d5
PEEKL FileBuffer,a2
PEEKL ASCBuffer,a3
divu #16,d5
tst.w d5
beq NoMore16
subq.w #1,d5
LineLoop
PEEKL ASCBuffer,d0
add.l ASCLenght(pc),d0
sub.l #100,d0
cmpa.l d0,a3
bls Enough
SADD ErrNoBuffer,a0
jsr SysRequest
bra NoConv
Enough bsr ConstructFront
move.w #7,d4
ConLoop bsr ConstructPrefix
move.w (a2)+,d2
bsr D2ToHex
cmpi.w #0,d4
beq NoKomma
move.b #44,(a3)+
NoKomma dbra d4,ConLoop
dbra d5,LineLoop
NoMore16
swap d5
tst.w d5
beq NoEnd
addq.l #1,d5
lsr.w #1,d5
subq.l #1,d5
bsr ConstructFront
EndLoop bsr ConstructPrefix
move.w (a2)+,d2
bsr D2ToHex
cmpi.w #0,d5
beq LastByte
move.b #44,(a3)+
LastByte
dbra d5,EndLoop
NoEnd suba.l ASCBuffer(pc),a3
move.l a3,ASCLast
SADD DoneIt,a0
jsr SysRequest
NoConv rts
ConstructPrefix
cmpi.w #"AS",d7
bne NoAss2
move.b #"$",(a3)+
bra Ques2
NoAss2 cmpi.w #"CS",d7
bne Ques2
move.b #"0",(a3)+
move.b #"x",(a3)+
Ques2 rts
ConstructFront
cmpi.w #"BS",d7
bne NoBas1
SADD BasicFront,a0
CopyBas move.b (a0)+,(a3)+
cmpi.b #0,(a0)
bne.s CopyBas
bra Ques1
NoBas1 cmpi.w #"AS",d7
bne NoAss1
SADD AssFront,a0
AssCopy move.b (a0)+,(a3)+
cmpi.b #0,(a0)
bne.s AssCopy
bra Ques1
NoAss1 move.b #10,(a3)+
move.b #9,(a3)+
Ques1 rts
*** wandelt d2 nach Hex-ASC
D2ToHex moveq.w #3,d1
D2Next rol.w #4,d2
move.w d2,d3
and.b #$f,d3
add.b #48,d3
cmp.b #58,d3
bcs D2Out
addq.b #7,d3
D2Out move.b d3,(a3)+
dbra d1,D2Next
rts
*** Save
Save tst.l ASCBuffer
bne.s OKSave
SADD ErrEmpty,a0
jsr SysRequest
bra NoSave
OKSave SADD SaveTitel,a0
jsr Request
beq NoSave
move.l d0,d1
move.l #1006,d2
CALLPC _DOSBase,Open
bne SaveFileOK
SADD ErrNoFile,a0
jsr SysRequest
bra NoSave
SaveFileOK
move.l d0,-(sp)
move.l (sp),d1
PEEKL ASCBuffer,d2
PEEKL ASCLast,d3
CALLSYS Write
move.l (sp)+,d1
CALLSYS Close
SADD DoneIt,a0
jsr SysRequest
NoSave rts
*** Buffer-Test & Speicher freigeben
FileBufTest
tst.l FileBuffer
beq FileBufEmpty
PEEKL FileBuffer,a1
PEEKL FileLenght,d0
CALLEXEC FreeMem
POKEL #0,FileBuffer
FileBufEmpty
rts
ASCBufTest
tst.l ASCBuffer
beq ASCBufEmpty
PEEKL ASCBuffer,a1
PEEKL ASCLenght,d0
CALLEXEC FreeMem
POKEL #0,ASCBuffer
ASCBufEmpty
rts
*** Titel Image/Border/Text ausgeben
MakeTop PEEKL _DCWindRast,a0
SADD TitelImage,a1
moveq.l #0,d0
moveq.l #0,d1
CALLPC _IntuitionBase,DrawImage
PEEKL _DCWindRast,a0
SADD Border0,a1
moveq.l #0,d0
moveq.l #0,d1
CALLSYS DrawBorder
PEEKL _DCWindRast,a0
SADD TitelText,a1
moveq.l #0,d0
moveq.l #0,d1
CALLSYS PrintIText
rts
*** Library-Zeiger suchen und merken
GetLibs move.l 4,a6
lea $17a(a6),a0
SADD IntName,a1
CALLSYS FindName
POKEL d0,_IntuitionBase
lea $17a(a6),a0
SADD GrafName,a1
CALLSYS FindName
POKEL d0,_GfxBase
rts
IntName INTNAME
DOSName DOSNAME
GrafName GRAFNAME
_IntuitionBase ds.l 1
_DOSBase ds.l 1
_GfxBase ds.l 1
*** Data-Teil
DCScreen dc.w 0,0,640,200,2
dc.b 0,1
dc.w $8000,1
dc.l Topaz8,0,0,0
Colors dc.w $888,0,$fff,$555
DCWindow dc.w 0,0,640,200
dc.b -1,-1
dc.l 8!$40,$800!$1000!$10000,DCGad0,0,0
_DCScrBase dc.l 0,0
dc.w 0,0,0,0,15
_DCWindBase ds.l 1
_DCWindRast ds.l 1
_DCWindUser ds.l 1
DCGad0 dc.l DCGad1
dc.w 20,68,600,23,2,1,1
dc.l Border2,Border4,DCText0,0,0
dc.w "LD"
dc.l 0
DCText0 dc.b 1,0,0,0
dc.w 300-16*4,8
dc.l 0,DCBytes0,0
TEXT DCBytes0,<"LOAD BINARY FILE">
DCGad1 dc.l DCGad2
dc.w 20,101,600,23,2,1,1
dc.l Border2,Border4,DCText1,0,0
dc.w "CV"
dc.l 0
DCText1 dc.b 1,0,0,0
dc.w 300-19*4,8
dc.l 0,DCBytes1,0
TEXT DCBytes1,<"CONVERT BINARY FILE">
DCGad2 dc.l DCGad3
dc.w 20,134,600,23,2,1,1
dc.l Border2,Border4,DCText2,0,0
dc.w "SV"
dc.l 0
DCText2 dc.b 1,0,0,0
dc.w 300-15*4,8
dc.l 0,DCBytes2,0
TEXT DCBytes2,<"SAVE ASCII FILE">
DCGad3 dc.l 0
dc.w 20,167,600,23,2,1,1
dc.l Border2,Border4,DCText3,0,0
dc.w "QU"
dc.l 0
DCText3 dc.b 1,0,0,0
dc.w 300-4*4,8
dc.l 0,DCBytes3,0
TEXT DCBytes3,<"QUIT">
*** Titel-Strukturen
TitelImage dc.w 320-17*8,13,17*16,25,1
dc.l TitelBitmap
dc.b 1,0
dc.l 0
TitelText dc.b 1,0,0,0
dc.w 320-60*4,43
dc.l 0,TitelBytes,0
TEXT TitelBytes,<"(C) WRITTEN 1990/91 BY ANDREAS RÖPKE PUBLIC DOMAIN SOFTWARE">
LoadTitel dc.b 1,0,0,0
dc.w 160-14*4,0
dc.l 0,LoadBytes,0
TEXT LoadBytes,<"FILE TO LOAD ?">
SaveTitel dc.b 1,0,0,0
dc.w 160-14*4,0
dc.l 0,SaveBytes,0
TEXT SaveBytes,<"FILE TO SAVE ?">
DoneIt dc.b 1,0,0,0
dc.w 140-20*4,0
dc.l 0,DoneItBytes,0
TEXT DoneItBytes,<"I`VE DONE IT, MASTER">
*** Fehler
ErrEmpty dc.b 1,0,0,0
dc.w 140-15*4,0
dc.l 0,ErrNoLoadBytes,0
TEXT ErrNoLoadBytes,<"BUFFER IS EMPTY">
ErrNoFile dc.b 1,0,0,0
dc.w 140-15*4,0
dc.l 0,ErrNoFileBytes,0
TEXT ErrNoFileBytes,<"CAN`T OPEN FILE">
ErrNoMem dc.b 1,0,0,0
dc.w 140-21*4,0
dc.l 0,ErrNoMemBytes,0
TEXT ErrNoMemBytes,<"CAN`T ALLOCATE MEMORY">
ErrNoBuffer dc.b 1,0,0,0
dc.w 140-21*4,0
dc.l 0,ErrNoBBytes,0
TEXT ErrNoBBytes,<"SORRY, BUFFER IS FULL">
*** Fonts
Topaz8 dc.l TopazName
dc.w 8
dc.b 0,1
TEXT TopazName,"topaz.font"
*** Borders
Border0 dc.w 20,10
dc.b 2,0,0,3
dc.l Pairs0,Border1
Pairs0 dc.w 599,0,0,0,0,43
Border1 dc.w 20,10
dc.b 1,0,0,3
dc.l Pairs1,0
Pairs1 dc.w 0,44,599,44,599,1
Border2 dc.w 0,0
dc.b 2,0,0,3
dc.l Pairs24,Border3
Border3 dc.w 0,0
dc.b 1,0,0,3
dc.l Pairs35,0
Border4 dc.w 0,0
dc.b 1,0,0,3
dc.l Pairs24,Border5
Border5 dc.w 0,0
dc.b 2,0,0,3
dc.l Pairs35,0
Pairs24 dc.w 599,0,0,0,0,21
Pairs35 dc.w 0,22,599,22,599,1
BasicFront dc.b 10,"DATA ",0
AssFront dc.b 10,9,9,"dc.w",9,0
even
ASCBuffer ds.l 1
ASCLenght ds.l 1
ASCLast ds.l 1
FileBuffer ds.l 1
FileLenght ds.l 1
TEXT ProcessName,<"DeluxeChanger V1.0">
END