home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-02 | 34.4 KB | 1,003 lines |
- *****************************************************************************
- * SECURITY CONTROL *
- * Compiler: Devpac 3.04 ORHAN *
- *****************************************************************************
- MACHINE MC68000
- INCLUDE "exec/types.i"
- INCLUDE "exec/memory.i"
- INCLUDE "exec/execbase.i"
- INCLUDE "exec/io.i"
- INCLUDE "exec/resident.i"
- INCLUDE "exec/tasks.i"
- INCLUDE "graphics/gfxbase.i"
- INCLUDE "graphics/rastport.i"
- INCLUDE "graphics/modeid.i"
- INCLUDE "graphics/text.i"
- INCLUDE "graphics/view.i"
- INCLUDE "hardware/custom.i"
- INCLUDE "hardware/dmabits.i"
- INCLUDE "hardware/intbits.i"
- INCLUDE "dos/dosextens.i"
- INCLUDE "devices/input.i"
- INCLUDE "devices/inputevent.i"
- INCLUDE "devices/trackdisk.i"
- INCLUDE "lvo/exec_lib.i"
- INCLUDE "lvo/dos_lib.i"
- INCLUDE "lvo/graphics_lib.i"
- INCLUDE "lvo/keymap_lib.i"
- INCLUDE "lvo/utility_lib.i"
- *****************************************************************************
- * check from cli or boot time *
- *****************************************************************************
- SECTION "CODE",CODE_C
- MOVE.L ($4),A6
- LEA.L CONNAME,A1
- CALLSYS FindTask
- TST.L D0
- BEQ START
-
- LEA.L SEMANAME,A1
- CALLSYS FindSemaphore
- MOVE.L D0,SEMADR
- BEQ EXIT
-
- MOVE.L SEMADR,A1
- LEA.L RETCODE-MYSEMAFOR(A1),A0
- MOVE.L (A0),D2
-
- MOVE.L SEMADR,A1
- CALLSYS RemSemaphore
-
- MOVE.L D2,D0
- RTS
- *****************************************************************************
- * creat task *
- *****************************************************************************
- START:
- CMP.W #36,LIB_VERSION(A6)
- BLO ADDFS ;check KS2.0+
-
- LEA.L STARTFLAG,A0 ;check first call
- TST.L (A0)
- BNE ADDFS
- NOT.L (A0)
- *****************************************************************************
- * stop floppy drives clicks *
- *****************************************************************************
- CALLSYS CreateMsgPort
- MOVE.L D0,TRACKPORT
- BEQ CREATETASK
- MOVE.L D0,A0
- MOVE.L #IOSTD_SIZE,D0
- CALLSYS CreateIORequest
- MOVE.L D0,TRACKREQ
- BEQ CREATETASK
-
- MOVE.L #NUMUNITS-1,D6
- AA12:
- LEA.L TRACKNAME,A0
- MOVE.L D6,D0
- MOVE.L TRACKREQ,A1
- MOVE.L #0,D1
- CALLSYS OpenDevice
- TST.L D0
- BNE AA13
-
- MOVE.L TRACKREQ,A1
- MOVE.L IO_UNIT(A1),A2
- BSET.B #TDPB_NOCLICK,TDU_PUBFLAGS(A2)
- AA13: DBF D6,AA12
- ;dont close device
- MOVE.L TRACKREQ,A0
- CALLSYS DeleteIORequest
- MOVE.L TRACKPORT,A0
- CALLSYS DeleteMsgPort
- *****************************************************************************
- * creat task *
- *****************************************************************************
- CREATETASK:
- MOVE.L ThisTask(A6),MYTASK
- MOVE.L #-1,D0
- CALLSYS AllocSignal
- MOVE.L D0,SIGBIT
- BMI ADDFS
-
- LEA.L THEMEMLIST,A0
- CALLSYS AllocEntry
- BCLR.L #31,D0
- BNE ADDFS
- MOVE.L D0,A1 ;new memlist
- LEA.L THETASK,A0
- MOVE.L ML_ME+ME_ADDR(A1),D0
- MOVE.L ML_ME+ME_LENGTH(A1),D1
- MOVE.L #0,LN_NAME(A0)
- MOVE.B #0,LN_PRI(A0)
- MOVE.B #NT_TASK,LN_TYPE(A0)
- MOVE.L D0,TC_SPLOWER(A0)
- ADD.L D1,D0
- MOVE.L D0,TC_SPUPPER(A0)
- MOVE.L TC_SPUPPER(A0),TC_SPREG(A0)
- LEA.L TC_MEMENTRY(A0),A0
- NEWLIST A0
- ADDHEAD
-
- LEA.L THETASK,A1
- LEA.L CREATVIEW,A2
- MOVE.L #0,A3
- CALLSYS AddTask
-
- MOVE.L SIGBIT,D1
- CLR.L D0
- BSET.L D1,D0
- CALLSYS Wait
-
- MOVE.L SIGBIT,D0
- CALLSYS FreeSignal
- *****************************************************************************
- * add '*' wildcard character to DOS *
- *****************************************************************************
- LEA.L LibList(A6),A0
- LEA.L DOSNAME,A1
- CALLSYS FindName ;get DosBase
- TST.L D0
- BEQ ADDFS
-
- MOVE.L D0,A1
- MOVE.L dl_Root(A1),A0
- OR.L #RNF_WILDSTAR,rn_Flags(A0)
- OR.B #LIBF_CHANGED,LIB_FLAGS(A1)
- *****************************************************************************
- * add standard file systems *
- *****************************************************************************
- ADDFS:
- LEA.L FSNAME,A1
- CALLSYS FindResident
- TST.L D0
- BEQ EXIT
- MOVE.L D0,A1
- CLR.L D1
- CALLSYS InitResident
- *****************************************************************************
- * exit *
- *****************************************************************************
- EXIT:
- MOVE.L #0,D0
- RTS
- *****************************************************************************
- * creat view (task) *
- *****************************************************************************
- CREATVIEW:
- MOVE.L ($4),A6
- MOVE.W $DFF000+dmaconr.L,D0
- OR.W #BITSET,D0
- MOVE.W D0,SAVEDMA
-
- CALLSYS CreateMsgPort
- MOVE.L D0,INPUTPORT
- BEQ CLEANGFX
- MOVE.L D0,A0
- MOVE.L #IOSTD_SIZE,D0
- CALLSYS CreateIORequest
- MOVE.L D0,INPUTREQ
- BEQ CLEANGFX
-
- LEA.L INPUTNAME,A0
- MOVE.L INPUTREQ,A1
- MOVE.L #0,D0
- MOVE.L #0,D1
- CALLSYS OpenDevice
- TST.L D0
- BNE CLEANGFX
- NOT.L OPENSTATUSI
-
- LEA.L INPUTHAND,A0
- MOVE.B #127,LN_PRI(A0)
- LEA.L EVENTFLAG,A1
- MOVE.L A1,IS_DATA(A0)
- LEA.L INPUTHANDLER,A1
- MOVE.L A1,IS_CODE(A0)
-
- MOVE.L INPUTREQ,A1
- LEA.L INPUTHAND,A0
- MOVE.L A0,IO_DATA(A1)
- MOVE.W #IND_ADDHANDLER,IO_COMMAND(A1)
- CALLSYS DoIO ;add input handler
-
- LEA.L KEYMAPNAME,A1
- CLR.L D0
- CALLSYS OpenLibrary
- MOVE.L D0,KEYMAPBASE
- BEQ CLEANGFX
-
- LEA.L UTILNAME,A1
- CLR.L D0
- CALLSYS OpenLibrary
- MOVE.L D0,UTILBASE
- BEQ CLEANGFX
-
- LEA.L GFXNAME,A1
- CLR.L D0
- CALLSYS OpenLibrary
- MOVE.L D0,GFXBASE
- BEQ CLEANGFX
- *****************************************************************************
- * display view *
- *****************************************************************************
- MOVE.L GFXBASE,A6
- MOVE.L gb_ActiView(A6),D0
- MOVE.L D0,OLDVIEW ;save current View
-
- LEA.L THEVIEW,A1
- CALLSYS InitView
- LEA.L THEVIEW,A0
- OR.W #V_LACE,v_Modes(A0)
-
- LEA.L THEVPORT,A0
- CALLSYS InitVPort
-
- LEA.L THEVPORT,A1
- LEA.L THERASINFO,A0
- MOVE.L A0,vp_RasInfo(A1)
- MOVE.W #WIDTH,vp_DWidth(A1)
- MOVE.W #HEIGHT,vp_DHeight(A1)
- ADD.W #(256-HEIGHT)/2,vp_DyOffset(A1)
-
- SUB.W #90,vp_DxOffset(A1) ;for VGA
- OR.W #HIRES_KEY,vp_Modes(A1) ;monitor
- ;; SUB.W #26,vp_DxOffset(A1) ;for PAL
- ;; OR.W #LORES_KEY,vp_Modes(A1) ;monitor
-
- LEA.L THEVIEW,A0
- LEA.L THEVPORT,A1
- MOVE.L A1,v_ViewPort(A0)
-
- LEA.L THEBITMAP,A0
- MOVE.L #DEPTH,D0
- MOVE.L #WIDTH,D1
- MOVE.L #HEIGHT,D2
- CALLSYS InitBitMap
-
- LEA.L THEBITMAP+bm_Planes,A0 ;clear plane pointers
- MOVE.W #8-1,D2
- CLR1: CLR.L (A0)+
- DBF D2,CLR1
-
- LEA.L THERASINFO,A0 ;set RasInfo
- LEA.L THEBITMAP,A1
- MOVE.L A1,ri_BitMap(A0)
- MOVE.W #0,ri_RxOffset(A0)
- MOVE.W #0,ri_RyOffset(A0)
- MOVE.L #0,ri_Next(A0)
-
- LEA.L THERASTPORT,A1
- CALLSYS InitRastPort
- LEA.L THERASTPORT,A1
- LEA.L THEBITMAP,A0
- MOVE.L A0,rp_BitMap(A1)
-
- MOVE.L #(RAW_DATA-COLORMAP)/2,D0 ;number of colors
- CALLSYS GetColorMap ;initialize ColorMap
- LEA.L THEVPORT+vp_ColorMap,A0
- MOVE.L D0,(A0)
- BEQ CLEANGFX
-
- LEA.L THEVPORT,A0
- LEA.L COLORMAP,A1
- MOVE.L #(RAW_DATA-COLORMAP)/2,D0 ;number of colors
- CALLSYS LoadRGB4 ;change colors in table
-
- MOVE.W THEBITMAP+bm_BytesPerRow,D6
- MULU.W THEBITMAP+bm_Rows,D6 ;calculate Raster size
- LEA.L RAW_DATA,A0
- LEA.L THEBITMAP+bm_Planes,A1
- MOVE.W #DEPTH-1,D5
- ALL1: MOVE.L A0,(A1)+
- ADD.L D6,A0
- DBF D5,ALL1
- *****************************************************************************
- * sort and merge copper lists *
- *****************************************************************************
- LEA.L THEVIEW,A0
- LEA.L THEVPORT,A1
- CALLSYS MakeVPort ;construct preliminary Copper list
-
- LEA.L THEVIEW,A1
- CALLSYS MrgCop ;merge lists into a real list
- *****************************************************************************
- * set font *
- *****************************************************************************
- LEA.L TEXTATTR,A0 ;initialize text attr
- LEA.L FONTNAME,A1
- MOVE.L A1,ta_Name(A0)
- MOVE.W #8,ta_YSize(A0)
- MOVE.B #FS_NORMAL,ta_Style(A0)
- MOVE.B #FPF_DESIGNED|FPF_ROMFONT,ta_Flags(A0)
-
- LEA.L TEXTATTR,A0
- CALLSYS OpenFont
- LEA.L FONTTEXT,A0
- MOVE.L D0,(A0)
- BEQ CLEANGFX
-
- LEA.L THERASTPORT,A1
- MOVE.L FONTTEXT,A0
- CALLSYS SetFont
-
- LEA.L THERASTPORT,A1
- MOVE.L #RP_JAM2,D0
- CALLSYS SetDrMd
-
- LEA.L THEVIEW,A1
- CALLSYS LoadView ;display View
- CALLSYS WaitTOF
- MOVE.W #BITCLR|DMAF_SPRITE,($DFF000+dmacon)
- MOVE.W #BITSET|DMAF_MASTER|DMAF_RASTER|DMAF_COPPER,($DFF000+dmacon)
- *****************************************************************************
- * check input string *
- *****************************************************************************
- AA10:
- MOVE.L #100,D0
- MOVE.L #040,D1
- MOVE.L #8,D2
- LEA.L USERID,A0
- MOVE.L #' ',0(A0)
- MOVE.L #' ',4(A0)
- BSR GETSTRING
-
- MOVE.L #1,RETCODE
- LEA.L USERID,A0
- LEA.L TEXT1,A1
- MOVE.L #8,D0
- LINKSYS Strnicmp,UTILBASE
- TST.L D0
- BEQ AA11
-
- LEA.L USERID,A0
- LEA.L TEXT0,A1
- MOVE.L #8,D0
- LINKSYS Strnicmp,UTILBASE
- TST.L D0
- BEQ RESET1
-
- MOVE.L #5,RETCODE
- LEA.L USERID,A0
- LEA.L TEXT2,A1
- MOVE.L #8,D0
- LINKSYS Strnicmp,UTILBASE
- TST.L D0
- BNE AA10
- AA11:
- *****************************************************************************
- * write something to semaphore *
- *****************************************************************************
- MOVE.L ($4),A6
- MOVE.L #LENSEMA,D0
- MOVE.L #MEMF_PUBLIC,D1
- CALLSYS AllocMem
- MOVE.L D0,SEMADR
- BEQ ERROR
-
- LEA.L MYSEMAFOR,A0
- MOVE.L SEMADR,A1
- MOVE.W #LENSEMA-1,D0
- AA3: MOVE.B (A0)+,(A1)+
- DBF D0,AA3
-
- MOVE.L SEMADR,A0
- CALLSYS InitSemaphore
-
- MOVE.L SEMADR,A1
- LEA.L SEMANAME-MYSEMAFOR(A1),A0
- MOVE.L A0,LN_NAME(A1)
- MOVE.B #0,LN_PRI(A1)
-
- MOVE.L SEMADR,A1
- CALLSYS AddSemaphore
- BRA CLEANGFX
- *****************************************************************************
- * wait vertical blank *
- *****************************************************************************
- WAITB:
- MOVE.L $DFF000+vposr.L,D0
- LSR.L #8,D0
- AND.W #$07FF,D0
- CMP.W #290,D0
- BLO WAITB
- RTS
- *****************************************************************************
- * clean up *
- *****************************************************************************
- CLEANGFX:
- MOVE.W #BITCLR|DMAF_RASTER|DMAF_COPPER,($DFF000+dmacon)
- MOVE.W SAVEDMA,($DFF000+dmacon)
-
- MOVE.L GFXBASE,A6
- MOVE.L OLDVIEW,D0
- BEQ CLEAN1
- MOVE.L D0,gb_ActiView(A6)
- MOVE.L D0,A1
- CALLSYS LoadView ;put back the old View
- CALLSYS WaitTOF
- CLEAN1:
- MOVE.L THEVPORT+vp_ColorMap,D0
- BEQ CLEAN2
- MOVE.L D0,A0
- CALLSYS FreeColorMap
- CLEAN2:
- LEA.L THEVPORT,A0
- TST.L vp_DspIns(A0)
- BEQ CLEAN33
- CALLSYS FreeVPortCopLists
- CLEAN33:
- MOVE.L THEVIEW+v_LOFCprList,D0
- BEQ CLEAN3
- MOVE.L D0,A0
- CALLSYS FreeCprList
- CLEAN3:
- MOVE.L THEVIEW+v_SHFCprList,D0
- BEQ CLEAN4
- MOVE.L D0,A0
- CALLSYS FreeCprList
- CLEAN4:
- MOVE.L FONTTEXT,D0
- BEQ CLEAN44
- MOVE.L D0,A1
- CALLSYS CloseFont
- CLEAN44:
- MOVE.L ($4),A6
- MOVE.L GFXBASE,D0
- BEQ CLEAN5
- MOVE.L D0,A1
- CALLSYS CloseLibrary
- CLEAN5:
- MOVE.L OPENSTATUSI,D0
- BEQ CLEAN6
- MOVE.L INPUTREQ,A1
- LEA.L INPUTHAND,A0
- MOVE.L A0,IO_DATA(A1)
- MOVE.W #IND_REMHANDLER,IO_COMMAND(A1)
- CALLSYS DoIO
-
- MOVE.L INPUTREQ,A1
- CALLSYS CloseDevice
-
- MOVE.L INPUTREQ,A0
- CALLSYS DeleteIORequest
- MOVE.L INPUTPORT,A0
- CALLSYS DeleteMsgPort
- CLEAN6:
- MOVE.L KEYMAPBASE,D0
- BEQ CLEAN7
- MOVE.L D0,A1
- CALLSYS CloseLibrary
- CLEAN7:
- MOVE.L UTILBASE,D0
- BEQ EXITCLEAN
- MOVE.L D0,A1
- CALLSYS CloseLibrary
- EXITCLEAN:
- MOVE.L SIGBIT,D1
- CLR.L D0
- BSET.L D1,D0
- MOVE.L MYTASK,A1
- CALLSYS Signal
-
- MOVE.L #0,D0
- RTS
- *****************************************************************************
- * getstring function D0=LocX, D1=LocY, D2=lenstr, A0=str *
- *****************************************************************************
- GETSTRING:
- MOVEM.L D0-D7/A0-A6,-(SP)
- LEA.L LOCX,A1
- MOVE.L D0,(A1)
- LEA.L LOCY,A1
- MOVE.L D1,(A1)
- LEA.L LENSTR,A1
- MOVE.L D2,(A1)
- LEA.L STRADR,A1
- MOVE.L A0,(A1)
- LEA.L CURPOS,A1
- CLR.L (A1)
- LEA.L CHRPOS,A1
- CLR.L (A1)
-
- MOVE.L STRADR,A0
- LEA.L STRING,A1
- MOVE.L LENSTR,D1
- SUB.W #1,D1
- CPY2: MOVE.B (A0)+,(A1)+
- DBF D1,CPY2
- MOVE.B #' ',(A1)
-
- WAITKEY:
- BSR PUTSTRING
- BSR READKEY
- CMP.L #KEY_ENTER,KEYRAW
- BEQ KEYENTER
- CMP.L #KEY_DELETE,KEYRAW
- BEQ KEYDELETE
- CMP.L #KEY_BACKSPACE,KEYRAW
- BEQ KEYBACKSPACE
- CMP.L #KEY_LEFT,KEYRAW
- BEQ KEYLEFT
- CMP.L #KEY_RIGHT,KEYRAW
- BEQ KEYRIGHT
- CMP.B #32,KEYANSI
- BLS WAITKEY
- CMP.B #126,KEYANSI
- BHI WAITKEY
- BRA PUTCHAR
-
- KEYENTER:
- LEA.L STRING,A0
- MOVE.L STRADR,A1
- MOVE.L LENSTR,D1
- SUB.W #1,D1
- CPY3: MOVE.B (A0)+,(A1)+
- DBF D1,CPY3
- MOVE.B #' ',(A1)
- BRA EXITSTRING
-
- KEYDELETE:
- MOVE.L CURPOS,D0
- CMP.L LENSTR,D0
- BGE AA6
-
- LEA.L STRING,A0
- ADD.L CURPOS,A0
- MOVE.L LENSTR,D0
- SUB.L CURPOS,D0
- SUB.W #1,D0
- CPY4: MOVE.B 1(A0),(A0)+
- DBF D0,CPY4
- AA6: BRA WAITKEY
-
- KEYBACKSPACE:
- LEA.L CURPOS,A0
- TST.L (A0)
- BEQ AA5
- SUB.L #1,(A0)
-
- LEA.L STRING,A0
- ADD.L CURPOS,A0
- MOVE.L LENSTR,D0
- SUB.L CURPOS,D0
- SUB.W #1,D0
- CPY5: MOVE.B 1(A0),(A0)+
- DBF D0,CPY5
- AA5: BRA WAITKEY
-
- KEYLEFT:
- LEA.L CURPOS,A0
- TST.L (A0)
- BEQ AA7
- SUB.L #1,(A0)
- AA7: BRA WAITKEY
-
- KEYRIGHT:
- LEA.L STRING,A0
- ADD.L CURPOS,A0
- CMP.B #' ',(A0)
- BEQ AA8
- LEA.L CURPOS,A0
- MOVE.L LENSTR,D0
- CMP.L (A0),D0
- BLS AA8
- ADD.L #1,(A0)
- AA8: BRA WAITKEY
-
- PUTCHAR:
- MOVE.L CURPOS,D0
- CMP.L LENSTR,D0
- BGE DISPFLASH
-
- LEA.L STRING,A0
- ADD.L LENSTR,A0
- CMP.B #' ',-1(A0)
- BNE DISPFLASH
-
- LEA.L STRING,A0
- MOVE.L LENSTR,D0
- AA4: SUB.L #1,D0
- MOVE.B (A0,D0.L),1(A0,D0.L)
- CMP.L CURPOS,D0
- BGT AA4
-
- LEA.L STRING,A0
- ADD.L LENSTR,A0
- MOVE.B #' ',(A0)
-
- LEA.L STRING,A0
- ADD.L CURPOS,A0
- MOVE.B KEYANSI,(A0)
-
- LEA.L CURPOS,A0
- ADD.L #1,(A0)
- BRA WAITKEY
- DISPFLASH:
- MOVE.W #12,D2
- LOOP0: NEG.W D2
- BEQ WAITKEY
- BLT AA9
- SUB.W #2,D2
- AA9: ADD.W #1,D2
- MOVE.L GFXBASE,A6
- LEA.L THEVPORT,A0
- ADD.W D2,vp_DxOffset(A0)
- CALLSYS ScrollVPort
- LEA.L THEVPORT,A0
- SUB.W D2,vp_DxOffset(A0)
- BRA LOOP0
- EXITSTRING:
- MOVEM.L (SP)+,D0-D7/A0-A6
- RTS
- *****************************************************************************
- * putstring *
- *****************************************************************************
- PUTSTRING:
- MOVEM.L D0-D7/A0-A6,-(SP)
-
- LEA.L STRING,A0
- LEA.L STRING2,A1
- MOVE.L LENSTR,D0 ;+1 extra byte to display
- AA14: MOVE.B (A0)+,(A1)+
- CMP.B #' ',-1(A0)
- BEQ AA15
- MOVE.B #'*',-1(A1)
- AA15 DBF D0,AA14
-
-
- MOVE.L GFXBASE,A6
- LEA.L THERASTPORT,A1
- MOVE.L #14,D0
- CALLSYS SetAPen
-
- LEA.L THERASTPORT,A1
- MOVE.L #15,D0
- CALLSYS SetBPen
-
- LEA.L THERASTPORT,A1
- MOVE.L LOCX,D0
- MOVE.L LOCY,D1
- CALLSYS Move ;set pen position
-
- LEA.L THERASTPORT,A1
- LEA.L STRING2,A0
- MOVE.L LENSTR,D0
- ADD.L #1,D0
- CALLSYS Text ;write text
-
- LEA.L THERASTPORT,A1
- MOVE.L #13,D0
- CALLSYS SetAPen
-
- LEA.L THERASTPORT,A1
- MOVE.L #12,D0
- CALLSYS SetBPen
-
- LEA.L THERASTPORT,A1
- MOVE.L CURPOS,D0
- LSL.L #3,D0 ;mul font X size
- ADD.L LOCX,D0
- MOVE.L LOCY,D1
- CALLSYS Move ;set pen position
-
- LEA.L THERASTPORT,A1
- LEA.L STRING2,A0
- ADD.L CURPOS,A0
- MOVE.L #1,D0
- CALLSYS Text ;write text
-
- MOVEM.L (SP)+,D0-D7/A0-A6
- RTS
- *****************************************************************************
- * read keyboard event ret: KEYRAW, KEYANSI *
- *****************************************************************************
- READKEY:
- MOVEM.L D0-D7/A0-A6,-(SP)
- WAITE: LEA.L EVENTFLAG,A0
- MOVE.L (A0),D0
- BEQ WAITE
- CLR.L (A0)
-
- MOVE.L D0,A0
- LEA.L KEYRAW,A1
- MOVE.W ie_Code(A0),2(A1)
- AND.L #$FF,(A1)
- CMP.L #$7F,(A1)
- BHI WAITE
-
- MOVE.L KEYMAPBASE,A6
- MOVE.L D0,A0
- LEA.L KEYANSI,A1
- MOVE.L #4,D1
- MOVE.L #0,A2
- CALLSYS MapRawKey
- TST.L D0
- BEQ WAITE
- BMI ERROR
-
- MOVEM.L (SP)+,D0-D7/A0-A6
- RTS
- *****************************************************************************
- * input handler *
- *****************************************************************************
- INPUTHANDLER:
- CMP.B #IECLASS_RAWKEY,ie_Class(A0)
- BNE NEXTEVENT
- MOVE.L A0,(A1) ;save input event
- NEXTEVENT:
- MOVE.L ie_NextEvent(A0),D0
- MOVE.L D0,A0
- BNE INPUTHANDLER
-
- MOVE.L #0,D0 ;return event list or NULL
- RTS
- *****************************************************************************
- * software reset *
- *****************************************************************************
- RESET1:
- MOVE.L ($4),A6
- MOVE.L #LENCOP,D0
- MOVE.L #MEMF_CHIP,D1
- CALLSYS AllocMem
- MOVE.L D0,MYCOP
- BEQ ERROR
- BSR SETCOP
-
- LEA.L SUPMOD,A0
- MOVE.L A0,($80)
- TRAP #0
- SUPMOD: MOVE.W #$2700,SR
- CLR.L $4
- LEA.L $F80002.L,A0
- BRA RESETVEC
- CNOP 0,4
- RESETVEC: RESET
- JMP (A0)
- *****************************************************************************
- * creat copper list *
- *****************************************************************************
- SETCOP:
- LEA.L $DFF000.L,A6
- MOVE.W #BITCLR|DMAF_RASTER|DMAF_SPRITE,dmacon(A6)
-
- MOVE.L MYCOP,A0
- MOVE.L #LINESTART,D1
- MOVE.W #LINECOUNT,D2
- SUB.W #1,D2
- L004:
- MOVE.L #$0035FFFE,(A0)
- MOVE.B D1,(A0)
- ADD.L #4,A0
- MOVE.L #$01800000,(A0)+
-
- MOVE.W #46,D4
- SUB.W #1,D4
- L325: MOVE.L #$01BE0000,(A0)+
- DBF D4,L325
-
- ADD.L #1,D1
- DBF D2,L004
-
- MOVE.L #$01800000,(A0)+
- MOVE.L #$FFFFFFFE,(A0)
-
- MOVE.L MYCOP,A0
- MOVE.L A0,cop1lc(A6)
- MOVE.W #0,copjmp1(A6)
- MOVE.W #BITSET|DMAF_MASTER|DMAF_COPPER,dmacon(A6)
- *****************************************************************************
- * renklendirme *
- *****************************************************************************
- CLR.L D0
- MOVE.W vhposr(A6),D0
- DIVU.W #COLOREND-COLORS,D0
- CLR.W D0
- SWAP D0
- BCLR.L #0,D0
- LEA.L COLORPTR,A0
- MOVE.L D0,(A0)
- L16:
- LEA.L COLORPTR,A1
- ADD.L #2,(A1)
- CMP.L #(COLOREND-COLORS),(A1)
- BLT L77
- SUB.L #(COLOREND-COLORS),(A1)
- L77:
- MOVE.L (A1),D3
- MOVE.L D3,D1
- LEA.L COLORS,A1
- MOVE.L MYCOP,A0
- ADD.L #6,A0
- MOVE.W #LINECOUNT-1,D2
- L15:
- MOVE.L D2,D4
- DIVU.W #11,D4
- SWAP D4
- TST.W D4
- BNE L676
- ADD.L #2,D3
- CMP.L #(COLOREND-COLORS),D3
- BLT L678
- MOVE.L #0,D3
- L678: MOVE.L D3,D1
- L676:
- MOVE.W (A1,D1.L),(A0)
- ADD.L #48*4,A0
-
- ADD.L #2,D1
- CMP.L #(COLOREND-COLORS),D1
- BLT L777
- MOVE.L #0,D1
- L777: DBF D2,L15
-
- BSR WBLANK
- TST.L D0
- BEQ L16
-
- MOVE.W #BITCLR|DMAF_COPPER,dmacon(A6)
- NOP
- NOP
- MOVE.W #0,color(A6)
- RTS
- *****************************************************************************
- * wait vertical blank *
- *****************************************************************************
- WBLANK:
- MOVE.L vposr(A6),D0
- LSR.L #8,D0
- AND.W #$07FF,D0
- CMP.W #LINESTART+LINECOUNT,D0
- BNE WBLANK
-
- MOVE.L COUNTVB,D0
- ADD.L #1,D0
- DIVU.W #55,D0
- SWAP D0
- MOVE.W D0,COUNTVB+2
- BEQ OKCNT
-
- MOVEQ.L #0,D0
- RTS
- OKCNT: MOVEQ.L #-1,D0
- RTS
- *****************************************************************************
- * error *
- *****************************************************************************
- ERROR:
- LEA.L SUPMOD1,A0
- MOVE.L A0,($80)
- TRAP #0
- SUPMOD1: MOVE.W #$2700,SR
- MOVE.W #$7FFF,($DFF000+dmacon)
- CLR.L $4
- WAIT2: MOVE.W #$00CC,($DFF000+color)
- MOVE.W #$0000,($DFF000+color)
- BRA WAIT2
- *****************************************************************************
- * module data *
- *****************************************************************************
- THEVIEW DCB.B v_SIZEOF ;STRUCTURE View,v_SIZEOF
- THEVPORT DCB.B vp_SIZEOF ;STRUCTURE ViewPort,vp_SIZEOF
- THEBITMAP DCB.B bm_SIZEOF ;STRUCTURE BitMap,bm_SIZEOF
- THERASINFO DCB.B ri_SIZEOF ;STRUCTURE RasInfo,ri_SIZEOF
- THERASTPORT DCB.B rp_SIZEOF ;STRUCTURE RastPort,rp_SIZEOF
- TEXTATTR DCB.B ta_SIZEOF ;STRUCTURE TextAttr,ta_SIZEOF
- INTSTRUCT DCB.B IS_SIZE ;STRUCTURE IS,IS_SIZE
- INPUTHAND DCB.B IS_SIZE ;STRUCTURE IS,IS_SIZE
- THETASK DCB.B TC_SIZE ;STRUCTURE TC_Struct,TC_SIZE
-
- MYSEMAFOR:
- DCB.B SS_SIZE ;STRUCTURE SS,SS_SIZE
- RETCODE DC.L 0
- SEMANAME DC.B 'orpsw',0
- LENSEMA EQU *-MYSEMAFOR
-
- THEMEMLIST: ;for task stack
- DCB.B LN_SIZE ;STRUCTURE ML,LN_SIZE
- DC.W 1 ;UWORD ML_NUMENTRIES
- DC.L MEMF_PUBLIC ;LABEL ML_ME (ME_REQS)
- DC.L 2048 ; (ME_LENGTH)
- ;LABEL ML_SIZE
-
- KEY_ESC EQU $45
- KEY_ENTER EQU $44
- KEY_F1 EQU $50
- KEY_F2 EQU $51
- KEY_DELETE EQU $46
- KEY_UP EQU $4C
- KEY_DOWN EQU $4D
- KEY_LEFT EQU $4F
- KEY_RIGHT EQU $4E
- KEY_BACKSPACE EQU $41
-
- SIGBIT DC.L 0
- INPUTPORT DC.L 0
- TRACKPORT DC.L 0
- INPUTREQ DC.L 0
- TRACKREQ DC.L 0
- OPENSTATUSI DC.L 0
- MYTASK DC.L 0
- SEMADR DC.L 0
- SAVEDMA DC.W 0
- STARTFLAG DC.L 0
- SOUNDFLAG DC.L 0
- EVENTFLAG DC.L 0
- KEYRAW DC.L 0
- KEYANSI DC.L 0
- OLDVIEW DC.L 0
- LOCX DC.L 0
- LOCY DC.L 0
- CURPOS DC.L 0
- CHRPOS DC.L 0
- LENSTR DC.L 0
- STRADR DC.L 0
- FONTTEXT DC.L 0
- GFXBASE DC.L 0
- KEYMAPBASE DC.L 0
- UTILBASE DC.L 0
- CONNAME DC.B 'CON',0
- FSNAME DC.B 'filesystem',0
- GFXNAME DC.B 'graphics.library',0
- DOSNAME DC.B 'dos.library',0
- FONTNAME DC.B 'topaz.font',0
- INPUTNAME DC.B 'input.device',0
- KEYMAPNAME DC.B 'keymap.library',0
- UTILNAME DC.B 'utility.library',0
- TRACKNAME DC.B 'trackdisk.device',0
- STRING DCB.B 20
- STRING2 DCB.B 20
- USERID DCB.B 20
- TEXT0 DC.B 'RESET '
- TEXT1 DC.B 'FLAME '
- TEXT2 DC.B 'ZONE '
- VERSION DC.B '$VER: Orpsw 1.0 (12.01.95) © by OR',13,10,0
- EVEN
-
- LINESTART EQU 28
- LINECOUNT EQU 280
- LENCOP EQU 55*1024
- COUNTVB DC.L 0
- COLORPTR DC.L 0
- MYCOP DC.L 0
- COLORS:
- DC.W $110,$220,$330,$440,$550,$660,$770
- DC.W $880,$990,$AA0,$BB0,$CC0,$DD0,$EE0,$FF0
- DC.W $EE0,$DD0,$CC0,$BB0,$AA0,$990,$880
- DC.W $770,$660,$550,$440,$330,$220,$110
-
- DC.W $101,$202,$303,$404,$505,$606,$707
- DC.W $808,$909,$A0A,$B0B,$C0C,$D0D,$E0E,$F0F
- DC.W $E0E,$D0D,$C0C,$B0B,$A0A,$909,$808
- DC.W $707,$606,$505,$404,$303,$202,$101
-
- DC.W $111,$222,$333,$444,$555,$666,$777
- DC.W $888,$999,$AAA,$BBB,$CCC,$DDD,$EEE,$FFF
- DC.W $EEE,$DDD,$CCC,$BBB,$AAA,$999,$888
- DC.W $777,$666,$555,$444,$333,$222,$111
-
- DC.W $011,$022,$033,$044,$055,$066,$077
- DC.W $088,$099,$0AA,$0BB,$0CC,$0DD,$0EE,$0FF
- DC.W $0EE,$0DD,$0CC,$0BB,$0AA,$099,$088
- DC.W $077,$066,$055,$044,$033,$022,$011
-
- DC.W $001,$002,$003,$004,$005,$006,$007
- DC.W $008,$009,$00A,$00B,$00C,$00D,$00E,$00F
- DC.W $00E,$00D,$00C,$00B,$00A,$009,$008
- DC.W $007,$006,$005,$004,$003,$002,$001
-
- DC.W $010,$020,$030,$040,$050,$060,$070
- DC.W $080,$090,$0A0,$0B0,$0C0,$0D0,$0E0,$0F0
- DC.W $0E0,$0D0,$0C0,$0B0,$0A0,$090,$080
- DC.W $070,$060,$050,$040,$030,$020,$010
-
- DC.W $100,$200,$300,$400,$500,$600,$700
- DC.W $800,$900,$A00,$B00,$C00,$D00,$E00,$F00
- DC.W $E00,$D00,$C00,$B00,$A00,$900,$800
- DC.W $700,$600,$500,$400,$300,$200,$100
- COLOREND:
- INCLUDE "aa.raw.asm"
- END
-