home *** CD-ROM | disk | FTP | other *** search
Text File | 1978-01-01 | 32.7 KB | 1,443 lines |
- *******************************************************************************
- * Hardware Enviroment Framework v3.0c Copyright © 1992 2-Cool/LSD
- * ----------------------------------- ---------------------------
- * Amiga Hardware Enviroment frame (OS friendly Shutdown, Recovery & Error
- * Protection, Version 3.0c)
- *
- * Routines are 100% PC-Relative & fully Compatible with ANY Kickstart ROM,
- * v1.2/1.3/2.04/3.0/etc.. Including all future releases. Do -NOT- distribute
- * these routines without « GRAPEVINE » Magazine. All Rights are Reserved.
- *
- * When using this routine, please remember who wrote it!
- *******************************************************************************
- section framework,code_c ; were using chipmemory
-
- movem.l a0-a6/d0-d7,-(a7) ; save old registers to stack
- move.l a7,d0 ; save stack (temp) to d0
- bsr.b take_sys ; save Everthing & disable OS!
- bsr.w init_screen ; initialise bplane ptrs.etc.
-
-
- ; the 'JMP' below should be removed for normal operation, this is just to show
- ; you what happens when a error occurs.
-
- ;-CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT
- JMP 1.W ; CAUSE AN ADDRESS ERROR!
- ; TESTS DEBUGGER, Remove this
- ; line for normal operation!
- ;-CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT---CUT
-
- *******************************************************************************
- * Main VBL wait
- *******************************************************************************
-
- MainLoop: bsr.b getvpos ; get beam wait
-
- ; vbl routines go here
-
- btst.b #6,$bfe001 ; check left mouse button
- beq.w Enable_Sys ; it was pressed, so exit
- bra.s MainLoop ; nope so get loopin!
-
- *******************************************************************************
- * VerticleBlankLoop (VBL)
- *******************************************************************************
-
- getvpos move.l $dff004.l,d7 ;check raster count (vposr)
- and.l #$1ff00,d7 ;for line 214
- cmp.l #$3000,d7 ;if not wait around
- bne.s getvpos
- rts
-
- ****************************************************************************
- * Lev 3 Interrupt Request ($6c.w)
- * -------------------------------
- * Only processes correct VBL interrupt, if no request is made, it skips
- * processsing of interrupt. Registers are Preserved & Restored on Entry/Exit
- ****************************************************************************
-
- interrupt movem.l d0-d7/a0-a6,-(sp) ; preserve registers
- move.w #$2300,sr
- lea $dff000,a6 ; hardware addr a6
- move.w intreqr(a6),d0 ; check which int occurred
- and.w #$20,d0 ; mask out all except vbl req
- tst.w d0 ; did one occur?
- beq.b no_request ; nope, don`t call interrupt!
-
- ; routines go here
-
- move.w #$20,$dff09c.l ; clear vbl_request
- no_request movem.l (sp)+,d0-d7/a0-a6 ; restore registers
- rte ; exit interrupt
-
- *******************************************************************************
- * Preserve OS System
- * ------------------
- * Saves all used system stuff, copperlists,dma,intena,etc & installs debugger
- * sound channel volumes are also reset to zero, all dma,etc are configurated.
- * Software reset detection removed, it wasn`t really that useful was it ?
- *******************************************************************************
-
- Take_sys: lea Oldstack(pc),a0 ; ptr to stack buffer
- move.l d0,(a0) ; save old stack ptr to buffer
-
- move.l 4.w,a6 ; get execbase
- lea GFXlib(pc),a1 ; point graphics.library name
- jsr -408(a6) ; open graphics library
- move.l d0,a1 ; save gfxbase address
- lea SysCp1(pc),a0
- move.l $26(a1),(a0)+ ; restore old workbench copper
- move.l $32(a1),(a0) ; restore old workbench copper
- jsr -414(a6) ; close gfx library
-
- jsr -132(a6) ; forbid () multitasking off
-
- jsr -150(a6) ; goto superstate (OS Friendly)
- lea SysStack(pc),a0 ; save buffer for old ptr
- move.l d0,(a0) ; save old system stack
-
- lea $dff000.l,a5 ; customchip base address in a6
- lea DMAsave(pc),a0 ; save buffer
- move.w $2(a5),(a0)+ ; save old DMACONR
- move.w $1c(a5),(a0)+ ; save old INTENAR
- move.w $1e(a5),(a0)+ ; save old INTREQ
- move.w $10(a5),(a0) ; save old ADKCON
-
- lea exceptsav(pc),a0 ; ptr to exception save buffer
- lea $8.w,a1 ; ptr to first exception
- moveq.l #10-1,d0 ; no. to save
- exloop move.l (a1)+,(a0)+ ; save old exception ptrs
- dbra d0,exloop ; keep on
- move.l $3c.w,(a0)+ ; uninitialised interrupt save
- move.l $60.w,(a0) ; unjustified interrupt save
-
- lea intersav(pc),a0 ; ptr to exception save buffer
- lea $64.w,a1 ; ptr to first exception
- moveq.l #6-1,d0 ; no. to save
- interloop move.l (a1)+,(a0)+ ; save old interrupt ptrs
- dbra d0,interloop ; keep on
-
- re_init move.w #$7fff,d0 ; kill value in d0
- moveq #0,d1
- move.w d0,dmacon(a5) ; kill INTREQ:
- move.w d0,intreq(a5) ; kill INTREQ:
- move.w d0,intena(a5) ; kill INTENA:
- move.w d0,adkcon(a5) ; kill ADKCON:
- move.w d1,aud0vol(a5)
- move.w d1,aud1vol(a5)
- move.w d1,aud2vol(a5)
- move.w d1,aud3vol(a5) ; all sound channels off
-
- move.w #$c040,intena(a5) ; Setit:Master Int, enable vbl
- move.w #$8040,intreq(a5)
- move.w #$83ff,dmacon(a5) ; Setit:Dsk/Spr/Cop/Blt/Bpl/Aud
-
-
- ; These lines below setup the Debugger...
-
- lea $8.w,a1 ; ptr to fist exception
- lea BusErr(pc),a2 ; BusErr ptr to debug routines
- move.l a2,(a1)+ ; Install our exception+inc ptr
- lea AddrErr(pc),a2
- move.l a2,(a1)+
- lea IllegalErr(pc),a2
- move.l a2,(a1)+
- lea DivErr(pc),a2
- move.l a2,(a1)+
- lea ChkErr(pc),a2
- move.l a2,(a1)+
- lea TrapvErr(pc),a2
- move.l a2,(a1)+
- lea PrivErr(pc),a2
- move.l a2,(a1)+
- lea TraceErr(pc),a2
- move.l a2,(a1)+
- lea LineaErr(pc),a2
- move.l a2,(a1)+
- lea LinefErr(pc),a2
- move.l a2,(a1)+
- lea UnInitErr(pc),a2
- move.l a2,$3c.w ; uninitialised int
- lea UnJustErr(pc),a2
- move.l a2,$60.w ; unjustified int
-
- ;
-
- lea interwait(pc),a0 ; ptr to exception exit!
- lea $64.w,a1 ; ptr to first exception
- moveq.l #6-1,d0 ; no. to install
- intrloop move.l a0,(a1)+ ; install exception wait!
- dbra d0,intrloop ; keep on
-
- lea Interrupt(pc),a0 ; ptr to our new interrupt
- move.l a0,$6c.w ; install level 3 interrupt
- rts
-
- *******************************************************************************
-
- enable_sys lea intersav(pc),a1 ; ptr to our saved interrupts
- lea $64.w,a0 ; ptr to 1st interrupt
- moveq.l #6-1,d0 ; no. to restore
- intloop2 move.l (a1)+,(a0)+ ; re-enable system interrupts
- dbra d0,intloop2 ; keep on until done
-
- lea exceptsav(pc),a1 ; ptr to our saved exceptions
- lea $8.w,a0 ; ptr to 1st exception
- moveq.l #10-1,d0 ; no. to restore
- exloop3 move.l (a1)+,(a0)+ ; re-enable system exceptions
- dbra d0,exloop3 ; keep on until done
- move.l (a1)+,$3c.w ; uninitialised interrupt save
- move.l (a1)+,$60.w ; unjustified interrupt save
-
- lea $dff000.l,a5 ; custom base address in a6
- lea DMAsave(pc),a2 ; addr of old values
- moveq #$f,d0 ; bit to set in d0
- move.l SysCp1(pc),$80(a5) ; restore old workbench copper
- move.l SysCp2(pc),$84(a5) ; restore old workbench copper
-
- bset d0,(a2) ; set clr/control bit
- move.w (a2)+,$96(a5) ; write back OS dma
- bset d0,(a2) ; set clr/control bit
- move.w (a2)+,$9a(a5) ; write back OS intena
- bset d0,(a2) ; set clr/control bit
- move.w (a2)+,$9c(a5) ; write back OS intreq
- bset d0,(a2) ; set clr/control bit
- move.w (a2)+,$9e(a5) ; write back OS adkcon
-
- move.l 4.w,a6 ; get execbase in a6
- move.l SysStack(pc),d0 ; old system stack in d0
- jsr -156(a6) ; go back into userstate
- jsr -138(a6) ; permit multitasking
- move.l OldStack(pc),a7 ; restore old stack ptr
- movem.l (a7)+,a0-a6/d0-d7 ; restore old regs from stack
- moveq #0,d0 ; no cli return code for us!
- rts ; Back to OS, Bye Bye...
-
- *****************************************************************************
- * Initialise Screen Copperlist, Bitplanes, etc.
- *****************************************************************************
-
- Init_Screen: lea BScript1(pc),a6 ; bitplane script to init!
- bsr.b scriptplanes ; call script
-
- lea copperlist1(pc),a0 ; copperlist to install in a0
- bsr.b Init_Copperlist ; install copperlist
- rts
-
- *******************************************************************************
- * Bitplane/Sprite initialiation Scripting System
- * ----------------------------------------------
- * Inputs: a6=ptr to script to initialise
- *
- * Script Usage: dc.w bitplane_ptr,copper_ptr
- * dc.w size of 1 Bitplane,no of bitplanes-1
- *
- * Script MUST be terminated with a "-1" after last entry
- *******************************************************************************
-
- ScriptPlanes movem.l d0-d7/a0-a6,-(sp) ;preserve regs on entry
- ScriptNext moveq.l #0,d1
- move.l (a6)+,a0 ; extract bitmap ptr
- move.l (a6)+,a1 ; " copperlist ptr
- move.w (a6)+,a2 ; " size of 1 bitplane
- move.w (a6)+,d1 ; " no bplanes to init-1
- cmpa.l #-1,a0 ; was that last entry in script?
- beq.s ScriptDone ; yep, so script is complete!
- pea ScriptNext(pc)
- InitPlanes move.l a0,d0 ; bmap/sprite ptr in d0
- swap d0
- move.l d0,a0
- move.w a0,(a1) ; lo word
- move.l a0,d0
- swap d0
- move.l d0,a0
- move.w a0,4(a1) ; high word
- add.w a2,a0 ; size
- addq.w #8,a1 ; next copper ptr
- dbra d1,InitPlanes ; loop until all is done
- rts
- ScriptDone movem.l (sp)+,d0-d7/a0-a6 ;restore regs on exit!
- rts
-
- *****************************************************************************
- * Installs a New Copperlist pointed to by a0
- *****************************************************************************
-
- Init_Copperlist move.l a5,-(sp) ; store a5 contents to stack
- lea (_Custom).l,a5 ; custom base address in a5
- move.w #$7fff,intena(a5) ; turn off intena
- clr.l copjmp1(a5) ; clear cop1jmp & cop2jmp
- move.l a0,cop1lch(a5) ; install custom copperlist
- move.w #$c020,intena(a5) ; Set: Master Int, Strt Vbl
- move.w #$83e0,dmacon(a5) ; enable dma
- move.l (sp)+,a5 ; restore old a5 contents
- rts
-
- *******************************************************************************
- * Main Display Copperlist
- *******************************************************************************
- noplanes = $200
- mouse_infront = $024
- mouse_behind = 0
- wait = -2
- palenable = $ffe1fffe
- endclist = -2
-
- CopperList1: dc.w diwstrt,$2c81,diwstop,$2cc1
- dc.w ddfstrt,$38,ddfstop,$d0 ; lo-res ddfstart
- dc.w bpl1mod,0,bpl2mod,0 ; (no moduo)
- dc.w bplcon1,0,bplcon2,mouse_infront ; mouse (infront bpl`s)
- dc.w spr0pth,0,spr0ptl,0,spr1pth,0,spr1ptl,0 ;no sprites
- dc.w spr2pth,0,spr2ptl,0,spr3pth,0,spr3ptl,0
- dc.w spr4pth,0,spr4ptl,0,spr5pth,0,spr5ptl,0
- dc.w spr6pth,0,spr6ptl,0,spr7pth,0,spr7ptl,0
- dc.w color00,$0000,color01,$0fff
-
- dc.w bplcon0,$2200 ;2 bitplanes enabled!
- dc.w bpl1pth ;1st bplane ptr
- Planes1: dc.w 0,bpl1ptl
- dc.w 0,bpl2pth ;2nd bplane ptr
- dc.w 0,bpl2ptl
- dc.w 0
-
- dc.l palenable ;enable pal screen area
-
- dc.l endclist ;terminate copperlist
-
- DebugCopper: dc.w diwstrt,$2c81,diwstop,$2cc1
- dc.w ddfstrt,$003c,ddfstop,$00d0
- dc.w $0108,0,$010a,0,bplcon0,$a200
- dc.w spr0pth,0,spr0ptl,0,spr1pth,0,spr1ptl,0
- dc.w spr2pth,0,spr2ptl,0,spr3pth,0,spr3ptl,0
- dc.w spr4pth,0,spr4ptl,0,spr5pth,0,spr5ptl,0
- dc.w spr6pth,0,spr6ptl,0,spr7pth,0,spr7ptl,0
- dc.w color00,3,color01,$fff,color02,0,color03,$fff
- dc.w bpl1pth
- debugplane: dc.w 0,bpl1ptl
- dc.w 0,bpl2pth
- dc.w 0,bpl2ptl
- dc.w 0
- dc.w $3c09,wait,color00,$0fff,$3d09,-2,color00,$0006
- dc.l palenable
- dc.w $1009,wait,color00,$0fff,$1109,-2,color00,$0003
- dc.w $2109,wait,bplcon0,noplanes
- dc.l endclist
-
- MemCopper: dc.w diwstrt,$2c81,diwstop,$2cc1
- dc.w ddfstrt,$003c,ddfstop,$00d0
- dc.w $0108,0,$010a,0,bplcon0,$0200
- dc.w spr0pth,0,spr0ptl,0,spr1pth,0,spr1ptl,0
- dc.w spr2pth,0,spr2ptl,0,spr3pth,0,spr3ptl,0
- dc.w spr4pth,0,spr4ptl,0,spr5pth,0,spr5ptl,0
- dc.w spr6pth,0,spr6ptl,0,spr7pth,0,spr7ptl,0
- dc.w color00,$003,color01,$0fff
- dc.w $2009,-2,bplcon0,$9200
- dc.w bpl1pth
- memplane: dc.w 0,bpl1ptl
- dc.w 0
- dc.w $3c09,-2,color00,$0fff,bplcon0,$0200,ddfstrt,$0038
- dc.w $3d09,-2,color00,6,bplcon0
- scrnmode dc.w $1200
- dc.w bpl1pth
- sm1h dc.w 0,bpl1ptl
- sm1l dc.w 0
- dc.l palenable
- dc.w $2009,-2,bplcon0,0,color00,$0fff,$2109,-2,color00,3
- dc.l endclist
-
- *******************************************************************************
- * Bitplane/Sprite Initialisation Script lists.
-
- BScript1: dc.l mainpage,planes1 ;raw data ptr, cop ptr
- dc.w (320/8)*256*2,2-1 ;size,no bplanes-1
-
- ; ... next entry goes here
-
- dc.l -1 ;terminate script
-
-
- *******************************************************************************
- * DEBUGGER ERROR HANDLER v3.0c
- * ----------------------------
- * Function: Show which type of error has occured, display important information
- * and allow the user to exit back to the assembler without having to reboot.
- *******************************************************************************
-
- BusErr bsr.s SaveRegs ; preserve registers
- lea BusErr.txt(pc),a0 ; error text to show in a4
- jmp (a1) ; call Debugger Routines
- AddrErr bsr.s SaveRegs
- lea AddrErr.txt(pc),a0
- jmp (a1)
- IllegalErr bsr.s SaveRegs
- lea IllegalErr.txt(pc),a0
- jmp (a1)
- DivErr bsr.s SaveRegs
- lea DivErr.txt(pc),a0
- jmp (a1)
- ChkErr bsr.s SaveRegs
- lea ChkErr.txt(pc),a0
- jmp (a1)
- TrapvErr bsr.s SaveRegs
- lea TrapvErr.txt(pc),a0
- jmp (a1)
- PrivErr bsr.s SaveRegs
- lea PrivErr.txt(pc),a0
- jmp (a1)
- TraceErr bsr.s SaveRegs
- lea TraceErr.txt(pc),a0
- jmp (a1)
- LineaErr bsr.s SaveRegs
- lea LineaErr.txt(pc),a0
- jmp (a1)
- LinefErr bsr.s SaveRegs
- lea LinefErr.txt(pc),a0
- jmp (a1)
- UnInitErr bsr.s SaveRegs
- lea UnInitErr.txt(pc),a0
- jmp (a1)
- UnJustErr bsr.s SaveRegs
- lea UnJustErr.txt(pc),a0
- jmp (a1)
-
- SaveRegs movem.l a6-a7,-(a7)
- lea oldregs(pc),a6
- move.l d0,(a6)+
- move.l d1,(a6)+
- move.l d2,(a6)+
- move.l d3,(a6)+
- move.l d4,(a6)+
- move.l d5,(a6)+
- move.l d6,(a6)+
- move.l d7,(a6)+
- move.l a0,(a6)+
- move.l a1,(a6)+
- move.l a2,(a6)+
- move.l a3,(a6)+
- move.l a4,(a6)+
- move.l a5,(a6)+
- move.l a6,a5
- movem.l (a7)+,a6-a7
- move.l a7,d0
- move.l a6,(a5)+
- move.l d0,(a5)+
- lea Oldstack(pc),a1
- move.l (a1),a0
- move.l -4(a0),OldPC-Oldstack(a1) ; save Old Program Counter
- move.l USP,a2
- move.l a2,OldUSP-Oldstack(a1) ; save USP into OldSP
- moveq.l #0,d6
- move.l d6,d0
- move.w SR,d0 ; get SR so we can save it
- move.l d0,OldSR-Oldstack(a1) ; save SR to OldSR
- lea INS(pc),a1
- rts
-
- INS lea $dff000.l,a5 ; customchip base address in a6
- lea mainpage(pc),a1 ; region to clear
- move.l #2500-1,d0 ; no times to loop
- move.l d6,d1 ; clear value in d1
- .clrpage move.l d1,(a1)+ ; clear screen memory
- move.l d1,(a1)+ ; clear screen memory
- dbra d0,.clrpage ; loop until done
- lea print(pc),a4
- jsr (a4) ; Now we can print error msg
- lea OldHardRegs(pc),a1
- move.w 2(a5),(a1)+ ; save old dmaconr
- move.w $e(a5),(a1)+ ; save old clxconr
- move.w $10(a5),(a1)+ ; save old adkconr
- move.w $1a(a5),(a1)+ ; save old diskbytr
- move.w $1c(a5),(a1)+ ; save old intenar
- move.w $1e(a5),(a1) ; save old intreq
- lea OldLevel1(pc),a1
- lea $64.w,a0
- moveq.l #6-1,d4
- vecloop move.l (a0)+,(a1)+ ; save old vectors
- dbra d4,vecloop
- lea OldTraps(pc),a1
- lea $80.w,a0
- moveq.l #16-1,d4
- traploop move.l (a0)+,(a1)+ ; save old traps
- dbra d4,traploop
- lea interwait(pc),a0 ; ptr to exception exit!
- lea $64.w,a1 ; ptr to first exception
- moveq.l #6-1,d0 ; no. to install
- intrexitloop move.l a0,(a1)+ ; install exception exit!
- dbra d0,intrexitloop ; keep on
- move.w d6,aud0vol(a5)
- move.w d6,aud1vol(a5)
- move.w d6,aud2vol(a5)
- move.w d6,aud3vol(a5) ; all sound channels off
- move.w #$f,dmacon(a5) ; sound DMA off
- lea mainpage(pc),a0 ; ptr to bitmap data
- lea debugplane(pc),a1 ; ptr in copperlist
- movea.l #80,a2 ; size of 1 bitplane
- moveq.l #2-1,d1 ; no of bitplanes-1
- bsr.w InitPlanes ; call blitplane init code
- lea debugcopper(pc),a0 ; copperlist to install
- bsr.w Init_Copperlist ; install it
- lea regd0(pc),a0
- lea oldregs(pc),a1
- lea Convert(pc),a2
- moveq.l #8-1,d4
- move.b #32,d5
- prtDregs move.l (a1)+,d1
- jsr (a2) ; get reg d0-d7 ACSII values
- move.b d5,(a0)+
- dbra d4,prtDregs
- lea rega0(pc),a0
- moveq.l #8-1,d4
- prtAregs move.l (a1)+,d1
- jsr (a2) ; get reg a0-a7 ACSII values
- move.b d5,(a0)+
- dbra d4,prtAregs
- lea regsr(pc),a0
- move.l (a1)+,d1
- jsr (a2)
- lea OldLevel1(pc),a1
- lea Lev1.txt(pc),a0
- moveq.l #6-1,d4
- moveq.l #1,d0
- prtvecs add.l d0,a0
- move.l (a1)+,d1
- jsr (a2)
- dbra d4,prtvecs
- lea OldHardRegs(pc),a1
- move.w (a1)+,d1
- lea dmacon.txt(pc),a0
- jsr (a2)
- move.w (a1)+,d1
- lea clxcon.txt(pc),a0
- jsr (a2)
- move.w (a1)+,d1
- lea adkcon.txt(pc),a0
- jsr (a2)
- move.w (a1)+,d1
- lea dskbytr.txt(pc),a0
- jsr (a2)
- move.w (a1)+,d1
- lea intena.txt(pc),a0
- jsr (a2)
- move.w (a1)+,d1
- lea intreq.txt(pc),a0
- jsr (a2)
- move.l OldPC(pc),d1
- lea regpc.txt(pc),a0
- jsr (a2)
- move.l OldUSP(pc),d1
- lea regUSP.txt(pc),a0
- jsr (a2)
- lea oldtraps(pc),a1
- lea trap0(pc),a0
- moveq.l #8-1,d4
- prtAtraps move.l (a1)+,d1
- jsr (a2)
- move.b d5,(a0)+
- dbra d4,prtAtraps
- lea trap8(pc),a0
- moveq.l #8-1,d4
- prtBtraps move.l (a1)+,d1
- jsr (a2)
- move.b d5,(a0)+
- dbra d4,prtBtraps
-
- move.l 4.w,a6
- move.l $2a(a6),d1 ; Memptr in APTR coldcapture
- lea coldcap.txt(pc),a0
- jsr (a2)
- move.l $2e(a6),d1 ; Memptr in APTR coldcapture
- lea coolcap.txt(pc),a0
- jsr (a2)
- move.l $32(a6),d1
- lea warmcap.txt(pc),a0
- jsr (a2)
- move.l $222(a6),d1
- lea kickmem.txt(pc),a0
- jsr (a2)
- move.l $226(a6),d1
- lea kicktag.txt(pc),a0
- jsr (a2)
- move.l $22a(a6),d1
- lea kickchk.txt(pc),a0
- jsr (a2)
-
- lea text(pc),a0
- jsr (a4)
-
- waitmouse btst.b #2,$16(a5)
- beq.w meminit
- btst.b #6,$bfe001.l
- beq.w enable_sys ; RETURN FROM PROGRAM ... BYE BYE!!!
- bne.s waitmouse
-
- Print: move.l d6,d4 ; a0:ascii text ,a1:fontdata ,a2=screen
- grabchar move.l d4,a2 ; d6:null value = 0
- move.l d6,d0
- move.b (a0)+,d0
- cmp.b #-1,d0 ; test for print termination
- beq.s prtdone
- cmp.b #$a,d0 ; test for newline
- bne.s printchr
- move.l d6,d1
- move.l d1,d2
- move.b (a0)+,d1 ; get ypos
- move.b (a0)+,d2 ; get xpos
- move.l d1,d3 ; save copy of ypos into d3
- lsl #8,d1
- lsl #6,d3
- add.l d3,d1
- add.w d1,d1
- add.l d1,d2
- lea mainpage(pc),a2
- add.l d2,a2 ; increase xpos
- move.l a2,d4 ; set text pointer
- bra.s grabchar
- printchr mulu #5,d0 ; 8x5 chars dimensions
- lea fontdata-160(pc),a1
- add.l d0,a1 ; calc font offset
- move.b (a1)+,(a2) ;\
- move.b (a1)+,80(a2) ; \
- move.b (a1)+,160(a2) ; \
- move.b (a1)+,240(a2) ; \
- move.b (a1)+,320(a2) ; ¯¯Char-2-Screen
- addq.l #1,d4 ; increase text pointer
- bra.s Grabchar
-
- Convert moveq #8-1,d3
- conloop rol.l #4,d1
- move d1,d2
- and #$f,d2
- add #$30,d2
- cmpi #$3a,d2
- bcs.s ok
- addq.w #7,d2
- ok move.b d2,(a0)+
- dbra d3,conloop
- move.l d6,d1
- prtdone rts
-
- meminit btst #2,$16(a5)
- beq.s meminit
- lea mainpage(pc),a0 ; ptr to bitmap data
- lea memplane(pc),a1 ; ptr in copperlist
- move.l d6,a2 ; size of 1 bitplane
- move.l d6,d1 ; no of bitplanes-1
- bsr.w InitPlanes ; call blitplane init code
- lea memtext(pc),a0
- jsr (a4)
- lea MemCopper(pc),a0 ; copperlist to install
- bsr.w Init_Copperlist ; install it
- memloop cmpi.b #255,$6(a5)
- bne.s memloop
- bsr.s getmousepos
- bsr.w mousemove
- btst #6,$bfe001.l
- bne.s getmode
- MemReturn btst.b #6,$bfe001.l ; go back to debugger screen
- beq.s MemReturn
- lea MemPeek.txt(pc),a0
- jsr (a4) ; Now we can print error msg
- lea mainpage(pc),a0 ; ptr to bitmap data
- lea debugplane(pc),a1 ; ptr in copperlist
- movea.l #80,a2 ; size of 1 bitplane
- moveq.l #2-1,d1 ; no of bitplanes-1
- bsr.w InitPlanes ; call blitplane init code
- lea debugcopper(pc),a0 ; copperlist to install
- bsr.w Init_Copperlist ; install it
- bra.w waitmouse
-
- getmode btst #2,$16(a5)
- beq.s modetoggle
- bne.s memloop
- modetoggle btst #2,$16(a5)
- beq.s modetoggle
- lea modeflag(pc),a0
- lea scrnmode(pc),a1
- tst.b (a0)
- beq.s LoRes
- move.b d6,(a0)
- move.b #$92,(a1) ; med-res
- bra.s memloop
- LoRes move.b #1,(a0)
- move.b #$12,(a1) ; lo-res
- bra.s memloop
-
- getmousepos movem.l a0-a6/d0-d7,-(a7) ; preserve all regesters
- move.l pos(pc),d1
- lea Addr.txt(pc),a0
- bsr.w Convert
- lea memtext(pc),a0
- jsr (a4)
- movem.l (a7)+,a0-a6/d0-d7 ; restore regesters
- rts
-
- InterWait move.w #$20,$dff09c.l ;clear request
- rte ;exit interrupt
-
- mousemove move.b d1,d0
- sub.b 10(a5),d0
- move.b 10(a5),d1
- ext.w d0
- mulu #80,d0
- ext.l d0
- lea pos(pc),a0
- add.l d0,(a0)
- move.l (a0),d2
- cmp.l d6,d2 ; check for start of chip mem
- ble.s resetpos
- cmpi.l #$80000,d2 ; check for end of chip mem
- blt.s updatepos
- move.l #$80000,(a0) ; if so reset pointer to $80000
- bra.s updatepos
- resetpos lea pos(pc),a2
- move.l d6,(a2) ; if so reset pointer to $0
- updatepos move.l (a0),d0
- lea sm1l(pc),a0
- move.w d0,(a0)
- lea sm1h(pc),a0
- swap d0
- move.w d0,(a0) ; update bplane pointers
- rts
-
- MemText dc.b $a,1,0,"MEMORY PEEKER VERSION 1.0C - "
- dc.b " MEMORY ADDRESS: $"
- Addr.txt dc.b "00000000",-1
- MemPeek.txt dc.b $a,1,0,"RETURNED FROM MEMPEEKER... "
- dc.b " ",-1
- text dc.b $a,0,0,"GURU SYSTEM INTERCEPTOR "
- dc.b " (GSI V3.0C)",$a
- dc.b 1,0,"GURU TRAPPED! ERROR TYPE:"
- dc.b $a,3,0,"DATA AND ADDRESS REGISTERS:",$A,4,0,"D0 : "
- regd0 dc.b " ",$a,05,0,"A0 : "
- rega0 dc.b " ",$a,07,0,"SR : "
- regsr dc.b " STATUS REGISTER (.W)",$a,08,0,"US : "
- regusp.txt dc.b " USER STACK POINTER (.L)",$a,09,0,"PC : "
- regpc.txt dc.b " PROGRAM COUNTER (.L)",$a,11,0,"DMACON ($DFF096): "
- dmacon.txt dc.b " (.W) CLXCON ($DFF098): "
- clxcon.txt dc.b " (.W)",$A,12,0,"INTENA ($DFF09A): "
- intena.txt dc.b " (.W) INTREQ ($DFF09C): "
- intreq.txt dc.b " (.W)",$A,13,0,"ADKCON ($DFF09E): "
- adkcon.txt dc.b " (.W) DSKBYTE ($DFF01A): "
- dskbytr.txt dc.b " (.W)",$A,15,0,"INTERRUPT VECTORS: (FROM $64 TO $78) LEVELS 1-6",$A,16,0,"IV :"
- lev1.txt dc.b " "
- lev2.txt dc.b " "
- lev3.txt dc.b " "
- lev4.txt dc.b " "
- lev5.txt dc.b " "
- lev6.txt dc.b " ",$A,18,0,"TRAP INTRUCTION POINTERS: (FROM TRAP #0 TO TRAP #15)",$A,19,0,"T0 : "
- trap0 dc.b " ",$a,20,0,"T8 : "
- trap8 dc.b " ",$a
- dc.b 22,0,"EXECBASE STRUCTURES: (CHECK FOR VIRUSES OR RESIDENT PROGRAMS!)",$A
- dc.b 23,0,"COLDCAPTURE : "
- coldcap.txt dc.b " COOLCAPTURE : "
- coolcap.txt dc.b " WARM CAPTURE : "
- warmcap.txt dc.b " ",$a,24,0,"KICKMEM PTR : "
- kickmem.txt dc.b " KICKTAG PTR : "
- kicktag.txt dc.b " KICKCHECKSUM : "
- kickchk.txt dc.b " ",$a
- dc.b 26,0,"PRESS RIGHT MOUSE BUTTON FOR MEMORY PEEKER! (MOUSE SCROLLS MEMORY!)",$A
- dc.b 27,0,"WHILE IN MEMPEEKER MODE : LEFT MOUSE EXIT,RIGHT MOUSE - TOGGLE SCREENMODE",$A
- dc.b 29,0,"(GSI) ERROR HANDLER V3.0C COPYRIGHT (C) 1992 WRITTEN BY 2-COOL OF LSD",$a
- dc.b 30,0,"THIS VERSION : 26/08/92 - LEFT MOUSE EXITS",$a,-1,-1,-1 ;end prt
- BusErr.txt dc.b $a,1,26,"BUS ERROR ($8)",-1
- AddrErr.txt dc.b $a,1,26,"ADDRESS ERROR ($C)",-1
- IllegalErr.txt dc.b $a,1,26,"ILLEGAL INSTRUCTION RAISED ($10)",-1
- DivErr.txt dc.b $a,1,26,"DIVISION BY ZERO ($14)",-1
- ChkErr.txt dc.b $a,1,26,"CHK EXCEPTION ($18)",-1
- TrapvErr.txt dc.b $a,1,26,"TRAPV EXCEPTION ($1C)",-1
- PrivErr.txt dc.b $a,1,26,"PRIVILEGE EXCEPTION ($20)",-1
- TraceErr.txt dc.b $a,1,26,"TRACE EXCEPTION ($24)",-1
- LineaErr.txt dc.b $a,1,26,"LINEA EMULATOR ERROR ($28)",-1
- LinefErr.txt dc.b $a,1,26,"LINEF EMULATOR ERROR ($2C)",-1
- UnInitErr.txt dc.b $a,1,26,"UNINITIALIZED EXCEPTION ($3C)",-1
- UnJustErr.txt dc.b $a,1,26,"UNJUSTIFIED EXCEPTION ($60)",-1
- even
- GfxLib dc.b 'graphics.library',0
- even
- OldPC ds.l 1
- OldRegs ds.l 16 ;holds d0-d7 a0-a6 & USP
- OldSR ds.l 1
- OldUSP ds.l 1
- OldTraps ds.l 16
- OldLevel1 ds.l 6
- OldHardRegs ds.l 3
- OldStack ds.l 1
- OldCop2 ds.l 1
- pos ds.l 1 ; contains addr of bitplanes
- textptr ds.l 1
- exceptsav ds.l 12
- intersav ds.l 6
- SysCp1 ds.l 1
- SysCp2 ds.l 1
- SysStack ds.l 1
- DMAsave: ds.l 2
- modeflag ds.b 1
- even
- fontdata: dc.b %00000000 ; ASCII ! STARTS WITH SPACE ($20 DEC:32)
- dc.b %00000000 ; 5*8 POINTS
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00011000
- dc.b %00011000
- dc.b %00011000
- dc.b %00000000
- dc.b %00011000
-
- dc.b %00110110
- dc.b %00110110
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00110110
- dc.b %01111111
- dc.b %00110110
- dc.b %01111111
- dc.b %00110110
-
- dc.b %00011110
- dc.b %00100100
- dc.b %00011110
- dc.b %00000101
- dc.b %00111110
-
- dc.b %00000000
- dc.b %00000000
- dc.b %11111110 ;%
- dc.b %11111110
- dc.b %00000000
-
- dc.b %00000000
- dc.b %11111111
- dc.b %00000000 ;&
- dc.b %11111111
- dc.b %00000000
-
- dc.b %00001100
- dc.b %00011000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00011000
- dc.b %00110000
- dc.b %00110000
- dc.b %00110000
- dc.b %00011000
-
- dc.b %00011000
- dc.b %00001100
- dc.b %00001100
- dc.b %00001100
- dc.b %00011000
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00000000
- dc.b %00011000
- dc.b %01111110
- dc.b %00011000
- dc.b %00000000
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00011000
- dc.b %00110000
-
- dc.b %00000000
- dc.b %00000000
- dc.b %01111110
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00011000
- dc.b %00011000
-
- dc.b %00000110
- dc.b %00001100
- dc.b %00011000
- dc.b %00110000
- dc.b %01100000
-
- dc.b %00111111
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00111111
-
- dc.b %00001100
- dc.b %00011100
- dc.b %00001100
- dc.b %00001100
- dc.b %00011110
-
- dc.b %00111111
- dc.b %00000011
- dc.b %00111111
- dc.b %00110000
- dc.b %00111111
-
- dc.b %00111111
- dc.b %00000011
- dc.b %00001111
- dc.b %00000011
- dc.b %00111111
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00111111
- dc.b %00000011
- dc.b %00000011
-
- dc.b %00111111
- dc.b %00110000
- dc.b %00111111
- dc.b %00000011
- dc.b %00111111
-
- dc.b %00110000
- dc.b %00110000
- dc.b %00111111
- dc.b %00110011
- dc.b %00111111
-
- dc.b %00111111
- dc.b %00000011
- dc.b %00000011
- dc.b %00000011
- dc.b %00000011
-
- dc.b %00111111
- dc.b %00110011
- dc.b %00111111
- dc.b %00110011
- dc.b %00111111
-
- dc.b %00111111
- dc.b %00110011
- dc.b %00111111
- dc.b %00000011
- dc.b %00000011
-
- dc.b %00000000
- dc.b %00011000
- dc.b %00000000
- dc.b %00011000
- dc.b %00000000
-
- dc.b %00000000
- dc.b %00011000
- dc.b %00000000
- dc.b %00011000
- dc.b %00110000
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00000000
- dc.b %10101010
- dc.b %11111111
- dc.b %11111111
- dc.b %10101010
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00011110
- dc.b %00000011
- dc.b %00001100
- dc.b %00000000
- dc.b %00001100
-
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
- dc.b %00000000
-
- dc.b %00011110
- dc.b %00110011
- dc.b %00111111
- dc.b %00110011
- dc.b %00110011
-
- dc.b %00111110
- dc.b %00110011
- dc.b %00111110
- dc.b %00110011
- dc.b %00111110
-
- dc.b %00011110
- dc.b %00110011
- dc.b %00110000
- dc.b %00110011
- dc.b %00011110
-
- dc.b %00111100
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00111100
-
- dc.b %00111111
- dc.b %00110000
- dc.b %00111100
- dc.b %00110000
- dc.b %00111111
-
- dc.b %00111111
- dc.b %00110000
- dc.b %00111100
- dc.b %00110000
- dc.b %00110000
-
- dc.b %00011110
- dc.b %00110000
- dc.b %00110111
- dc.b %00110011
- dc.b %00011111
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00111111
- dc.b %00110011
- dc.b %00110011
-
- dc.b %00011110
- dc.b %00001100
- dc.b %00001100
- dc.b %00001100
- dc.b %00011110
-
- dc.b %00001111
- dc.b %00000110
- dc.b %00000110
- dc.b %00110110
- dc.b %00011100
-
- dc.b %00110110
- dc.b %00110110
- dc.b %00111100
- dc.b %00110110
- dc.b %00110011
-
- dc.b %00110000
- dc.b %00110000
- dc.b %00110000
- dc.b %00110000
- dc.b %00111111
-
- dc.b %00110011
- dc.b %00111111
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
-
- dc.b %00110011
- dc.b %00111011
- dc.b %00111111
- dc.b %00110111
- dc.b %00110011
-
- dc.b %00011110
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00011110
-
- dc.b %00111110
- dc.b %00110011
- dc.b %00111110
- dc.b %00110000
- dc.b %00110000
-
- dc.b %00011110
- dc.b %00110011
- dc.b %00110011
- dc.b %00110111
- dc.b %00011111
-
- dc.b %00111110
- dc.b %00110011
- dc.b %00111110
- dc.b %00110110
- dc.b %00110011
-
- dc.b %00011110
- dc.b %00110000
- dc.b %00011110
- dc.b %00000011
- dc.b %00011110
-
- dc.b %00111111
- dc.b %00001100
- dc.b %00001100
- dc.b %00001100
- dc.b %00001100
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00011110
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00011110
- dc.b %00001100
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00110011
- dc.b %00111111
- dc.b %00110011
-
- dc.b %00110011
- dc.b %00011110
- dc.b %00001100
- dc.b %00011110
- dc.b %00110011
-
- dc.b %00110011
- dc.b %00110011
- dc.b %00011110
- dc.b %00001100
- dc.b %00001100
-
- dc.b %00111111
- dc.b %00000110
- dc.b %00001100
- dc.b %00011000
- dc.b %00111111
- even
-
- mainpage ds.b (320/8)*256*2 ;Lo-Res/ 256 Lines/ 2 Bplane
-
- ; End of code.
- *******************************************************************************
- * Hardware & Custom equate`s
- * --------------------------
- * For hardware regs, cia`s, raw keypresses, etc..
-
- _custom=$dff000
- bltddat=0
- dmaconr=$2
- vposr=$4
- vhposr=$6
- dskdatr=$8
- joy0dat=$a
- joy1dat=$c
- clxdat=$e
- adkconr=$10
- pot0dat=$12
- pot1dat=$14
- potgor=$16
- serdatr=$18
- dskbytr=$1a
- intenar=$1c
- intreqr=$1e
- dskpth=$20
- dskptl=$22
- dsklen=$24
- dskdat=$26
- refptr=$28
- vposw=$2a
- vhposw=$2c
- copcon=$2e
- serdat=$30
- serper=$32
- potgo=$34
- joytest=$36
- strequ=$38
- strvbl=$3a
- strhor=$3c
- strlong=$3e
- bltcon0=$40
- bltcon1=$42
- bltafwm=$44
- bltalwm=$46
- bltcpth=$48
- bltcptl=$4a
- bltbpth=$4c
- bltbptl=$4e
- bltapth=$50
- bltaptl=$52
- bltdpth=$54
- bltdptl=$56
- bltsize=$58
- bltcmod=$60
- bltbmod=$62
- bltamod=$64
- bltdmod=$66
- bltcdat=$70
- bltbdat=$72
- bltadat=$74
- dsksync=$7e
- cop1lch=$80
- cop1lcl=$82
- cop2lch=$84
- cop2lcl=$86
- copjmp1=$88
- copjmp2=$8a
- copins=$8c
- diwstrt=$8e
- diwstop=$90
- ddfstrt=$92
- ddfstop=$94
- dmacon=$96
- clxcon=$98
- intena=$9a
- intreq=$9c
- adkcon=$9e
- aud0pth=$a0
- aud0ptl=$a2
- aud0len=$a4
- aud0per=$a6
- aud0vol=$a8
- aud0dat=$aa
- aud1pth=$b0
- aud1ptl=$b2
- aud1len=$b4
- aud1per=$b6
- aud1vol=$b8
- aud1dat=$ba
- aud2pth=$c0
- aud2ptl=$c2
- aud2len=$c4
- aud2per=$c6
- aud2vol=$c8
- aud2dat=$ca
- aud3pth=$d0
- aud3ptl=$d2
- aud3len=$d4
- aud3per=$d6
- aud3vol=$d8
- aud3dat=$da
- bpl1pth=$e0
- bpl1ptl=$e2
- bpl2pth=$e4
- bpl2ptl=$e6
- bpl3pth=$e8
- bpl3ptl=$ea
- bpl4pth=$ec
- bpl4ptl=$ee
- bpl5pth=$f0
- bpl5ptl=$f2
- bpl6pth=$f4
- bpl6ptl=$f6
- bplcon0=$100
- bplcon1=$102
- bplcon2=$104
- bpl1mod=$108
- bpl2mod=$10a
- bpl1dat=$110
- bpl2dat=$112
- bpl3dat=$114
- bpl4dat=$116
- bpl5dat=$118
- bpl6dat=$11a
- spr0pth=$120
- spr0ptl=$122
- spr1pth=$124
- spr1ptl=$126
- spr2pth=$128
- spr2ptl=$12a
- spr3pth=$12c
- spr3ptl=$12e
- spr4pth=$130
- spr4ptl=$132
- spr5pth=$134
- spr5ptl=$136
- spr6pth=$138
- spr6ptl=$13a
- spr7pth=$13c
- spr7ptl=$13e
- spr0pos=$140
- spr0ctl=$142
- spr0data=$144
- spr0datb=$146
- spr1pos=$148
- spr1ctl=$14a
- spr1data=$14c
- spr1datb=$14e
- spr2pos=$150
- spr2ctl=$152
- spr2data=$154
- spr2datb=$156
- spr3pos=$158
- spr3ctl=$15a
- spr3data=$15c
- spr3datb=$15e
- spr4pos=$160
- spr4ctl=$162
- spr4data=$164
- spr4datb=$166
- spr5pos=$168
- spr5ctl=$16a
- spr5data=$16c
- spr5datb=$16e
- spr6pos=$170
- spr6ctl=$172
- spr6data=$174
- spr6datb=$176
- spr7pos=$178
- spr7ctl=$17a
- spr7data=$17c
- spr7datb=$17e
- color00=$180
- color01=$182
- color02=$184
- color03=$186
- color04=$188
- color05=$18a
- color06=$18c
- color07=$18e
- color08=$190
- color09=$192
- color10=$194
- color11=$196
- color12=$198
- color13=$19a
- color14=$19c
- color15=$19e
- color16=$1a0
- color17=$1a2
- color18=$1a4
- color19=$1a6
- color20=$1a8
- color21=$1aa
- color22=$1ac
- color23=$1ae
- color24=$1b0
- color25=$1b2
- color26=$1b4
- color27=$1b6
- color28=$1b8
- color29=$1ba
- color30=$1bc
- color31=$1be
- a=$20
- b=$35
- c=$33
- d=$22
- e=$12
- f=$23
- g=$24
- h=$25
- i=$17
- j=$26
- k=$27
- l=$28
- m=$37
- n=$36
- o=$18
- p=$19
- q=$10
- r=$13
- s=$21
- t=$14
- u=$16
- v=$34
- w=$11
- x=$32
- y=$15
- z=$31
- zero=$a
- one=$1
- two=$2
- three=$3
- four=$4
- five=$5
- six=$6
- seven=$7
- eight=$8
- nine=$9
- f1=$50
- f2=$51
- f3=$52
- f4=$53
- f5=$54
- f6=$55
- f7=$56
- f8=$57
- f9=$58
- f0=$59
- esc=$45
- del=$46
- help=$5f
- enter=$43
- tab=$42
- tabb=$42
- CsrUp=$4c
- CsrDn=$4d
- CsrLt=$4f
- CsrRt=$4e
- Space=$40
- Return=$44
- AmLft=$66
- AmRgt=$67
- Caps=$62
- pad0=$f
- pad1=$1d
- pad2=$1e
- pad3=$1f
- pad4=$2d
- pad5=$2e
- pad6=$2f
- pad7=$3d
- pad8=$3e
- pad9=$3f
- _ciaa=$bfe001
- _ciab=$bfd000
- ciaapra=$bfe001
- ciaaprb=$bfe101
- ciaaddra=$bfe201
- ciaaddrb=$bfe301
- ciaatalo=$bfe401
- ciaatahi=$bfe501
- ciaatblo=$bfe601
- ciaatbhi=$bfe701
- ciaae.lsb=$bfe801
- ciaae.mid=$bfe901
- ciaae.msb=$bfea01
- ciaasp=$bfec01
- ciaaicr=$bfed01
- ciaacra=$bfee01
- ciaacrb=$bfef01
- ciabpra=$bfd000
- ciabprb=$bfd100
- ciabddra=$bfd200
- ciabddrb=$bfd300
- ciabtalo=$bfd400
- ciabtahi=$bfd500
- ciabtblo=$bfd600
- ciabtbhi=$bfd700
- ciaje.lsb=$bfd800
- ciabe.mid=$bfd900
- ciabe.mij=$bfda00
- ciabsp=$bfdc00
- ciabicr=$bfdd00
- ciabcra=$bfde00
- ciabcrb=$bfdf00
- Execbase=4
- _SysBase=4
-
-
-