D-Bug & Automation Forum | |
D-Bug & Automation Forum >> Coding >> Hidden messages in code
http://d-bug.mooo.com/dbugforums/cgi-bin/yabb2/YaBB.pl?num=1257011785 Message started by ggn on 31.10.09 at 17:56:24 |
Title: Re: Hidden messages in code Post by ggn on 15.12.09 at 22:47:27
Wacky races
Code (]* This routine loads the Bootsector load_bootsector move.w #2,side(a6) ; A: side 0 bsr set_side ; sets the side bsr restore ; SEEK TRACK 0 move.l #load_buffer,a0 move.l a0,loadaddress(a6) add.l #512*8,a0 move.l a0,endaddress(a6) bsr set_dma_address move.w #1,sector(a6) ; sector number 1 bsr readsector ; read 1 sector rts *---------------------------------------------------------------------------* * This routine loads the directory sectors load_dir2 move.w #2,side(a6) ; A: side 0 bsr set_side ; sets the side move.l #load_buffer,a0 move.l a0,loadaddress(a6) add.l #512*8,a0 move.l a0,endaddress(a6) bsr set_dma_address moveq #1,d0 moveq #0,d1 move.w NFATS(a6),d1 move.w SPF(a6),d2 mulu d2,d1 add.l d1,d0 ; d0 = logical start sector move.w #-1,last_t move.w d0,logical(a6) move.w #7-1,nlog(a6) ; number of logical sectors to load bsr load_logical rts *---------------------------------------------------------------------------* * This routine loads the F.A.T sectors load_fat move.w #2,side(a6) ; A: side 0 bsr set_side ; sets the side move.l #load_buffer,a0 move.l a0,loadaddress(a6) add.l #512*8,a0 move.l a0,endaddress(a6) bsr set_dma_address bsr restore ; track 0 move.w #2,sector(a6) move.w SPF(a6),d4 subq.w #1,d4 .loop bsr readsector add.w #1,sector(a6) dbra d4,.loop rts *---------------------------------------------------------------------------* * This routine gets the bootsector info get_boot_info move.l #load_buffer,a0 moveq #0,d0 move.b $0b(a0),d0 lsl.w #8,d0 move.b $0c(a0),d0 bsr convertmsdosw move.w d0,BPS(a6) moveq #0,d0 move.b $0d(a0),d0 lsl.w #8,d0 bsr convertmsdosw move.w d0,SPC(a6) moveq #0,d0 move.b $0e(a0),d0 lsl.w #8,d0 move.b $0f(a0),d0 bsr convertmsdosw move.w d0,RES(a6) moveq #0,d0 move.b $10(a0),d0 lsl.w #8,d0 bsr convertmsdosw move.w d0,NFATS(a6) moveq #0,d0 move.b $11(a0),d0 lsl.w #8,d0 move.b $12(a0),d0 bsr convertmsdosw move.w d0,NDIRS(a6) moveq #0,d0 move.b $13(a0),d0 lsl.w #8,d0 move.b $14(a0),d0 bsr convertmsdosw move.w d0,NSECTS(a6) moveq #0,d0 move.b $16(a0),d0 lsl.w #8,d0 move.b $17(a0),d0 bsr convertmsdosw move.w d0,SPF(a6) moveq #0,d0 move.b $18(a0),d0 lsl.w #8,d0 move.b $19(a0),d0 bsr convertmsdosw move.w d0,SPT(a6) moveq #0,d0 move.b $1a(a0),d0 lsl.w #8,d0 move.b $1b(a0),d0 bsr convertmsdosw move.w d0,NSIDES(a6) moveq #0,d0 move.b $1c(a0),d0 lsl.w #8,d0 move.b $1d(a0),d0 bsr convertmsdosw move.w d0,NHID(a6) rts *---------------------------------------------------------------------------* convertmsdosw move.w d0,d1 and.w #$ff00,d0 and.w #$00ff,d1 lsr.w #8,d0 lsl.w #8,d1 or.w d1,d0 rts *---------------------------------------------------------------------------* ; This routine searches for the desired filename sfilename dc.b " . " dfilename dc.b " . " search_name lea sfilename(pc),a0 move.l #" ",(a0)+ move.l #" ",(a0)+ move.b #".",(a0)+ move.b #" ",(a0)+ move.b #" ",(a0)+ move.b #" ",(a0)+ move.l #load_buffer,a5 ; dir list move.l filepointer(a6),a4 ; filename lea sfilename(pc),a0 moveq #8-1,d7 ; first name .search1 move.b (a4)+,d2 beq.s .gotsname cmp.b #".",d2 beq.s .gotsfilen bsr convertupper ; make upper case move.b d2,(a0)+ dbra d7,.search1 cmp.b #0,(a4) beq.s .gotsname addq.l #1,a4 ; skip period (.) .gotsfilen lea sfilename+9(pc),a0 moveq #3-1,d7 ; first name .search2 move.b (a4)+,d2 beq.s .gotsname cmp.b #".",d2 bne.s .notper bra.s .search2 .notper bsr convertupper ; make upper case move.b d2,(a0)+ dbra d7,.search2 .gotsname move.w #112-1,d0 ; max dir ents .searchdir move.l a5,a4 ; dir pointer lea dfilename(pc),a3 move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ ; name move.b #".",(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ move.b (a4)+,(a3)+ ; ext lea sfilename(pc),a0 lea dfilename(pc),a1 move.l (a0),d2 cmp.l (a1),d2 bne.s .nomatch move.l 4(a0),d2 cmp.l 4(a1),d2 bne.s .nomatch move.l 8(a0),d2 cmp.l 8(a1),d2 bne.s .nomatch bra.s .match .nomatch lea 32(a5),a5 dbra d0,.searchdir move.w #1,error(a6) *---------------------------------------------------------------------------* * This routine loads logical sectors load_logical move.w nlog(a6),d4 ; nunber of sectors to load .loop moveq #0,d0 move.w logical(a6),d0 divu SPT(a6),d0 move.w d0,l_track(a6) swap d0 add.w #1,d0 move.w d0,l_sector(a6) move.w #0,d0 swap d0 move.w #2,side(a6) cmp.w #1,NSIDES(a6) beq.s .ss divu #2,d0 move.w d0,l_track(a6) swap d0 addq.w #2,d0 move.w d0,side(a6) .ss bsr set_side ; get side move.w l_track(a6),d0 cmp.w last_t(a6),d0 ; same rts .match moveq #0,d0 move.b 26(a5),d0 lsl.w #8,d0 move.b 27(a5),d0 bsr convertmsdosw move.w d0,cluster(a6) move.l loadpointer(a6),d0 move.l d0,loadaddress(a6) move.l d0,d4 moveq #0,d0 move.b 28(a5),d0 lsl.w #8,d0 move.b 29(a5),d0 bsr convertmsdosw move.w d0,d2 swap d2 move.b 30(a5),d0 lsl.w #8,d0 move.b 31(a5),d0 bsr convertmsdosw move.w d0,d2 swap d2 move.l d2,filelen(A6) rts *---------------------------------------------------------------------------* convertupper cmp.b #"a",d2 blt.s .noc cmp.b #"z",d2 bgt.s .noc sub.b #"a",d2 add.b #"A",d2 .noc rts *---------------------------------------------------------------------------* load_cluster move.w cluster(a6),d0 subq.w #2,d0 ; starts at sector 2 muls SPC(a6),d0 add.w DATREC(a6),d0 ; add DATREC tst.w d0 bge.s .smeg move.w #0,d0 .smeg move.w d0,logical(a6) ; store logical sector move.w #2-1,nlog(A6) ; 2 sectors bsr load_logical rts ; Load cluster *---------------------------------------------------------------------------* next_cluster move.l #load_buffer,a0 moveq #0,d0 move.w cluster(a6),d0 moveq #3,d1 mulu d0,d1 lsr.w #1,d1 btst #0,d0 bne.s .codd .ceven move.b 1(a0,d1.w),d0 lsl.w #8,d0 or.b 0(a0,d1.w),d0 and.w #$0fff,d0 move.w d0,cluster(a6) bra.s .gcluster .codd move.b 1(a0,d1.w),d0 lsl.w #8,d0 move.b 0(a0,d1.w),d0 lsr.w #4,d0 and.w #$0fff,d0 move.w d0,cluster(a6) .gcluster rts *---------------------------------------------------------------------------* seek move.w #$86,(dmamode).l move.w d0,d7 bsr wrt1772 move.w #$80,(dmamode).l move.w #$13,d7 bsr wrt1772 bsr fdcwait rts *---------------------------------------------------------------------------* * This routine sets the DMA address set_dma_address move.l loadaddress(a6),d7 move.b d7,$ff860d lsr.l #8,d7 move.b d7,$ff860b lsr.l #8,d7 move.b d7,$ff8609 rts *---------------------------------------------------------------------------* * This routine restores the Drive (seeks track 0) restore move.w #$80,(dmamode).l move.w #%00001111,d7 bsr wrt1772 ; 6m/s Step rate bsr fdcwait ; normal fdc wait rts *---------------------------------------------------------------------------* * This routine sets the side (0 or 1) set_side movem.l d0-d7/a0-a6,-(sp) ; save all regs moveq.l #0,d7 move.w side(a6),d7 bne.s .set ; set side bsr motoroff ; wait for motor to stop moveq #0,d7 .set eor.b #7,d7 and.b #7,d7 move.b #$e,$ff8800 ; GI-SELECT move.b ($ff8800).l,d0 and.b #$f8,d0 or.b d0,d7 move.b d7,$ffff8802.w ; GI-WRITE movem.l (sp)+,d0-d7/a0-a6 rts *---------------------------------------------------------------------------* * This routine turns off the motor motoroff move.w #$80,(dmamode).l .test bsr read1772 btst #7,d0 bne.s .test rts *---------------------------------------------------------------------------* * This routine gets the status of the 1772 read1772 bsr wait move.w (dmascnt).l,d0 bsr wait rts *---------------------------------------------------------------------------* * This routine gets the status of the 1772 wrt1772 bsr wait move.w d7,(dmascnt).l bsr wait rts *---------------------------------------------------------------------------* * This routine performs a short delay wait move.w sr,-(sp) move.w #$20,d5 .loop dbra d5,.loop move.w (sp)+,sr [...):
|
D-Bug & Automation Forum » Powered by YaBB 2.6.0! YaBB Forum Software © 2000-2024. All Rights Reserved. |