**************************************************************************** !MAX_FIND set 14 ; --== DO NOT TOUCH ==-- !BYTE_POS set 4 ; !MATCHED set 6 ; !DATA_STRT set 8 ; !FIND_DATA set 64 ; **************************************************************************** !CODELEN set CodeEnd - CodeStart / 16 !BC set $12 !BH set $1D ***************************************************************************** ORG 0 HEADER ***************************************************************************** * Disk View V1.00 (C) Matthew Judge 1996 * ***************************************************************************** CodeStart: cs:move.w es, PSPSegment ;Save the PSP. move.w cs, bx ; cs:move.w bx, CodeSegment ;SAve the Code Segment. move.w bx, ds ;Set DS to match CS. * move.w #MEM_ERROR, dx ;Ths memory error string. move.b #$4a, ah ;Give the memory back. cs:sub.w PSPSegment, bx ;Get the code segment. add.w #!CODELEN, bx ;Add the length of the code. trap #$21 ;Give it back. bcs.s Dos_Print ;Exit if Error. * bsr.w Get_CmdLine ;Get the passed arguements. * bsr.w InitCLS ;The initial CLS. * bsr.w Save_Palette ;Save the users current palette. * bsr.w Print_Border ;Print a top and bottom border. * move.w #PALETTE, si ;Set the new palette. bsr.w Set_Palette ; * bsr.w Main ;Execute the main program. * eor.b ah, ah ;Restore the previous video mode. cs:move.b OldVideoMode, al ;The saved video mode. trap #$10 ;Call BIOS. * push,w dx move.w #SPALETTE, si ;Restore the old palette. bsr.w Set_Palette ; pop.w dx ***************************************************************************** Dos_Print: cmp.w #0, dx ;Do we print a message? beq.s Prog_Exit ;No. move.b #9, ah trap #$21 ***************************************************************************** Prog_Exit: move.b #$4c, ah ; trap #$21 ***************************************************************************** Get_CmdLine: push ds push es *-+-* cs:move.w PSPSegment, ds ;Set the DS. cs:move.w CodeSegment, es ;Set the ES. *-+-* move.w #$81, si ;Where to get the data from. move.w #CmdLine, di ;Where to store it to. move.w #Arguements, bx ;Where to store the pointers. eor.b ah, ah ;Set the flag as nothing read. *-+-* CmdLine_Loop: lods.b ;Get the next character. cmp.b #$0D, al ;The end of the line? beq.s CmdLine_Exit ;Quit if true. cmp.b #$20, al ;A space perhaps? bne.s CmdLine_Next ;No. cmp.b #0, ah ;Have we Flagged a word end? beq.s CmdLine_Loop ;Move on... *-* not.b ah ;Swap the Word Flag. move.b #$24, al ; bra.s Save_Char ; CmdLine_Next: cmp.b #0, ah ;A new word? bne.s Save_Char ;No. Start_Word: not.b ah ;Flag as NOT new word. cs:move.w di, (bx) ;Save the pointer. add.w #2, bx ;Move next. Save_Char: stos.b ;Store the character. bra.s CmdLine_Loop ;Get the next character. CmdLine_Exit: cs:move.b #$24, (di) ;End the last word. *-+-* pop es pop ds rts ***************************************************************************** Save_Palette: push cs ; pop es ;Set the segment register. move.w #SPALETTE, di :Where to save the data. move.w #6*3, cx ;The count. eor.b al, al ;The first colour to save. bsr.w _Load_Palette move.w #3, cx ; move.b #20, al ;The odd one. bsr.w _Load_Palette move.w #3, cx ; move.b #7, al ; bsr.w _Load_Palette ; move.w #7*3, cx ;The count. move.b #56, al ;The save position. _Load_Palette: move.w #$3c7, dx ;The hardware address. out.b al, dx ;Tell the hardware. add.w #2, dx ;Move to the data send. _Load_Loop: rep:ins.b ;Save the palette. rts ***************************************************************************** Print_Border: push.w es push.w cx cs:les TopLine, di ;Where to print move.w #40, cx ;The print count dc.b $66,$B8,$20,!BC,$20,!BC ;Set AX with our fill colour. repne:stos.l ;Write to the screen cs:les BottomLine, di ;Where to print move.w #40, cx ;The print count dc.b $66,$B8,$20,!BC,$20,!BC ;Set AX with our fill colour. repne:stos.l ;Write to the screen move.w #2, CursorPos ; move.w #TOP_LINE1, dx ; bsr.w Print_String move.w #114, CursorPos ; move.w #TOP_LINE2, dx ; bsr.w Print_String ; move.w #$F40, CursorPos ; move.w #BOT_LINE, dx ; bsr.w Print_String ; pop.w cx pop.w es rts ***************************************************************************** InitCLS: move.b #$0F, ah ;Get current video state. trap #$10 ;Call BIOS. *-* cs:move.b ah, OldColumns ;Save the columns. cs:move.b al, OldVideoMode ;Save the video mode. cs:move.b bh, OldDispPage ;Save the old display page. *-* move.w #$0003, ax ;Set the video mode. trap #$10 ;Call BIOS. *-* move.b #$02, ah ;Set cursor function. cs:move.b OldDispPage, bh ;The display page to use. move.w #$1000, dx ;The Row / Column. trap #$10 ;Call BIOS. CLS: push.w es push.w cx cs:les ScreenHome, di ;Where to start the CLS. cs:move.w ScreenSize, cx ; dc.b $66,$B8,$20,$0B,$20,$0B ;Set AX with our fill colour. dc.b $66,$F2,$AB ;Repeat not equal. pop.w cx pop.w es rts ***************************************************************************** Set_Palette: push cs ;Set the segment. pop ds ; _Set2: move.w #6*3, cx ;The count. eor.b al, al ;The start position. bsr.w _Send_Palette :Set the palette. move.w #3, cx ; move.b #20, al ;The odd one. bsr.w _Send_Palette ;Set it. move.w #3, cx ; move.b #7, al ; bsr.w _Send_Palette ; move.w #7*3, cx ;The new Count. move.b #56, al ;The new position. _Send_Palette: cli ;Disable interrupts. move.w #$3c8, dx ;The hardware address. out.b dx, al ;Send the mode data. inc.w dx rep:outs.b sti rts ***************************************************************************** * A Printing Binary to Hex converter:- * * AH = Colour / Character attributes * * BX = Binary to convert to Ascii Hex * * CL = Count of bytes (1 to 8) * * ES:DI = The screen address to print to * ***************************************************************************** Print_Hex: push.w cx ; asl.b #2, cl ; We are printing backwards:- dc.b $66 ror.l cl, b ; to the front of the queue. pop.w cx ; Print_Hex_lp: dc.b $66 rol.l #4, b ; Move to the first nibble. move.b bl, al ; and.b #$f, al ; Mask it off. add.b #$30, al ; cmp.b #$39, al ; ble.s Print_HChar ; add.b #7, al ; Print_HChar: stos.w ; Print the hex character. dec.b cl ; Decrement the count. bne.s Print_Hex_lp ; Loop again if not zero. rts ***************************************************************************** Get_String: xor.w cx, cx _inp_loop: bsr.w Get_KeyStroke or.w ax, ax beq.s _inp_loop *--* cmp.b #13, al bne.s _v_char _String_Exit: cmp.w #6, cx blt.s _inp_loop rts _v_char: cmp.b #8, al bne.s _check *--* or.w cx, cx beq.s _inp_loop * cs:sub.w #2, CursorPos move.w #0132, ax bsr.w Print_Char cs:sub.w #2, CursorPos dec.w cx dec.w di bra.s _inp_loop *--* _check: cmp.b #32, al blt.s _inp_loop cmp.b #127, al bgt.s _inp_loop cmp.w #30, cx bge.s _inp_loop *--* inc.w cx move.b #6, ah cs:move.b al, (di) inc.w di bsr.w Print_Char bra.w _inp_loop ***************************************************************************** * DS:DX = The string to print. * * Destroys AX. * ***************************************************************************** Print_String: push.w bx push.w dx push.w di push.w si push.w es *-+-* move.w #160, bx ;Bytes per line. move.w dx, si ;Where to print from. cs:les CursorPos, di ;Where to print to. Print_Loop: lods.b ;Get the first character. cmp.b #32, al ;Greater than a space? bge.s _Print_It ;Yeh, sure is.. *-+-* cmp.b #0, al ;Do we quit here? beq.s _Print_Exit ;Leave all this behind us. *-+-* cmp.b #10, al ;Line feed? bne.s _Check_CR ;Nope, sure ain't. add.w #$A0, di ;Do a line feed. bra.s Print_Loop ;Go again... _Check_CR: cmp.b #13, al ;Carriage return, perhaps? bne.s _Check_Col ;Get 'outa here. push.w ax ;Save AX. move.w di, ax ;You know the score (Wish I did). xor.w dx, dx ;Clear DX. div.w bx ;Stupid System!! asr.w #8,ax ;Position the remainder. sub.w dx, di ;Intel / Microshit monopoly combination! cs:add.w WinX, di pop.w ax ;Restore AX. bra.s Print_Loop ;Go again... _Check_Col: cmp.b #01, al ;Change of colour? bne.s _Print_It ;Nay. lods.b ;Yea, so merrily load the next colour. asl.w #8, ax ;Set the colour. bra.s Print_Loop _Print_It: stos.w :Send it to the screen. bra.s Print_Loop ;Not again... *-+-* _Print_Exit: cs:move.w di, CursorPos ;Save the cursor position. pop.w es pop.w si pop.w di pop.w dx pop.w bx rts ***************************************************************************** Print_Char: push.w bx push.w dx push.w di push.w si push.w es *-+-* move.w #160, bx ;Bytes per line. move.w dx, si ;Where to print from. cs:les CursorPos, di ;Where to print to. *-+-* stos.w :Send it to the screen. *-+-* cs:move.w di, CursorPos ;Save the cursor position. pop.w es pop.w si pop.w di pop.w dx pop.w bx rts ***************************************************************************** * CL -> 0 = Just draw the box and string. * * CL -> 1 = Draw the box and string and wait for any key. * * CL -> 2 = Draw the box and string and wait for Yes or No. * * DX = The string to print. * ***************************************************************************** DrawInfoBox: push.w cx ;Save the get mode. eor.w cx, cx ;Set CX to our initial width. move.w #1, bx ;Set BX to our initial depth. move.w dx, di ;Move the string to our work area. Info_Loop: cs:move.b (di), al ;Get the current byte. inc.w di ;Move on one. *-* cmp.b #0, al ;Are we at the end of the string? beq.s Length_Found ;Yes, so quit. cmp.b #1, al ;Change of colour within? bne.s _Check_A ; inc.w di ;Move on another one. bra.s Info_Loop ;Loop... _Check_A: cmp.b #10, al ;A Line Feed perhaps? bne.s _Check_B ; inc.w bx ;Increment the line count. bra.s Info_Loop ;Loop once more. _Check_B: cmp.b #13, al ;A carriage? bne.s _Just_A_Char ;No... cmp.b ch, cl ;Check which is the greater. blt.s _Clear_CL asl.w #8, cx ;Set this as the widest line. _Clear_CL: eor.b cl, cl ;Start again. bra.s Info_Loop _Just_A_Char: inc.w cx ;No, increment the count... bra.s Info_Loop ;Search next. Length_Found: push.w dx ;Save the string. cmp.b ch, cl ;Get the longest line. bgt.s _Line_OK ; asr.w #8, cx ;Get the longest line length. _Line_OK: and.w #$00FF, cx ;Mask off the relevant bits. add.w #2, cx ;Create a space either side. move.b #!BC, ah ;Set the colour. bsr.w DrawBox ;Draw the box. cs:move.w dx, CursorPos ;Set the print position. pop.w dx ;Pop the string. bsr.w Print_String ;Print the string. pop.w cx ;Pop the key mode. or.b cl ,cl ;Check just quit. beq.s InfoExit InfoWait: bsr.w Get_KeyStroke ;Get a keystroke. or.w ax, ax ;Check for zero entry. beq.s InfoWait cmp.b #1, cl ;Check for any key. beq.s InfoExit ;Yep. and.b #$DF, al ;Mask off the bits. cmp.b #'Y', al ; beq.s InfoExit cmp.b #'N', al bne.s InfoWait InfoExit: cs:move.w #0, WinX :Reset the X start position. rts ***************************************************************************** * BX = Depth * * CX = Width * * DX = Returns the first byte inside the box * ***************************************************************************** DrawBox: push.w ax ;Save AX - the colour! push.w cx ;Save CX. move.w #24, ax ;This little lot will - sub.w bx, ax ;attempt to centre the box. shr.w #1, ax ; move.w ax, di ; shl.w #2, di ; cs:move.w di, WinY :Save the Y start position. add.w ax, di ; shl.w #5, di ; cs:move.b OldColumns, ax ;How many columns on this screen. sub.w cx, ax ; and.w #$FFFE,ax ;Keep it crisp and even. add.w ax, di ; add.w #4, ax ; cs:move.w ax, WinX :Save the window X position. pop.w cx ;Restore CX. pop.w ax ; DrawImdBox: push.w es ;Save ES. cs:move.w CursorPos+2, es ;Set the screen. *-* push.w di ;Save the screen position. move.b #201, al ;The top left corner. stos.w ;Print it. move.w di, dx ; add.w #162, dx ;The first byte inside the box. move.b #205, al ;An horizontal line. push.w cx ;The Width. repne ;Print a line. stos.w ;Print it. pop.w cx ;Restore the width. move.b #187, al ;Top right corner. stos.w ;Print it. _Line_Loop: pop.w di ;Pop it. lea 160(di), di ;Move to the next line. push.w di ;Save it. move.b #186, al ;Load AX. stos.w ;Print a vertical line. push.w cx :Save the width, move.b #32, al :Print Spaces. repne ;Repeat... stos.w ;Print a load of filling spaces. pop.w cx ;Restore CX. move.b #186, al ;Pre-load AX. stos.w ;Print right vertical line. dec.w bx ;Move down a line bne.s _Line_Loop pop di ; lea 160(di), di ;Move next... move.b #200, al ;The bottom left corner. stos.w ;Print it. move.b #205, al ;An horizontal line. repne ;Print a line. stos.w ;Print it. move.b #188, al ;The bottom right corner. stos.w ;Print it. *-* pop.w es ;Restore ES. rts ***************************************************************************** Wait_Trace: push dx move.w #$3da, dx ;Wait for the vertical trace. _wait_lp1: in.b dx, a ;Wait for retrace to start. and.b #8, a ;Quicker than 'test' on older machines. bne.s _wait_lp1 ;Twiddle your thumbs awhile. _wait_lp2: in.b dx, a and.b #8, a beq.s _wait_lp2 ;Wait for retrace to finish. pop dx rts ***************************************************************************** Get_KeyStroke: push si push di push ds push bx cs:lds KeyMem, si eor.w ax, ax move.w (si), di cmp.w 2(si), di ;Check if a key was pressed. beq.s Exit_KeyStroke ;Definitely, Maybe not. move.w (di), bx ;Get the KeyStroke data. lea 2(di), di ;Reset the header. move.w di, (si) ; cmp.w #$3c, di ; ble.s Print_KeyStroke ; move.w #$1e, (si) ; Print_KeyStroke: push bx ; push cx ; cs:les KeyPrint, di ; move.b #!BC, ah ; move.b #4, cl ; bsr.w Print_Hex ; pop cx ; pop ax ; Exit_KeyStroke: pop bx pop ds pop di pop si rts *-+-* KeyMem dc.w $001a, $0040 KeyPrint dc.w $0F96, $B800 ***************************************************************************** * DI = Then string to checksum * DX = The length of the string * EAX = Checksum on exit ***************************************************************************** Get_Checksum: push.w ds push.w cs pop.w ds *--* xor.l a, a _loop_A: xor.l c, c dc.b $66 move.w ax, bp move.b (di), cl inc.w di move.l c, b xor.l a, b and.l #$F, b dc.b $66 shr.w #4, bp dc.b $66 push.w bx shl.w #2, bx dc.b $66 move.w 0(si, bx), a dc.b $66 pop.w bx dc.b $66 xor.w bp, ax move.l a, b shr.l #4, c and.l #$F, b and.l #$F, c xor.l c, b shr.l #4, a dc.b $66 push.w bx shl.w #2, bx dc.b $66 move.w 0(si, bx), c dc.b $66 pop.w bx xor.l c, a dec dx bne _loop_A *--* pop.w ds rts ***************************************************************************** PALETTE dc.b $00,$00,$00 ;COLOUR0 dc.b $0E,$12,$12 ;COLOUR1 dc.b $12,$30,$25 ;COLOUR2 dc.b $15,$25,$30 ;COLOUR3 dc.b $10,$37,$10 ;COLOUR4 dc.b $05,$20,$05 ;COLOUR5 dc.b $2D,$2D,$00 ;COLOUR6 dc.b $29,$20,$02 ;COLOUR7 dc.b $27,$15,$00 ;COLOUR8 dc.b $32,$14,$04 ;COLOUR9 dc.b $2B,$22,$37 ;COLOUR10 dc.b $2B,$08,$15 ;COLOUR11 dc.b $00,$25,$35 ;COLOUR12 dc.b $34,$34,$34 ;COLOUR13 dc.b $37,$12,$0E ;COLOUR14 ***************************************************************************** Y_DATA dc.b $00, $00, $00, $00 dc.b $64, $10, $B7, $1D dc.b $C8, $20, $6E, $3B dc.b $AC, $30, $D9, $26 dc.b $90, $41, $DC, $76 dc.b $F4, $51, $6B, $6B dc.b $58, $61, $B2, $4D dc.b $3C, $71, $05, $50 dc.b $20, $83, $B8, $ED dc.b $44, $93, $0F, $F0 dc.b $E8, $A3, $D6, $D6 dc.b $8C, $B3, $61, $CB dc.b $B0, $C2, $64, $9B dc.b $D4, $D2, $D3, $86 dc.b $78, $E2, $0A, $A0 dc.b $1C, $F2, $BD, $BD ***************************************************************************** SPALETTE ds.b 15*3 ;Saved colour data. OldDispPage dc.b 1 OldVideoMode dc.b 1 OldColumns dc.b 1 *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-* ScreenSize dc.w 40*23 TopLine dc.w $0000,$B800 ;Where to print the top bar BottomLine dc.w $0F00,$B800 ;Where to print the bottom bar. ScreenHome dc.w $00A0,$B800 ;The first line for output. CursorPos dc.w $00A0,$B800 ;The current cursor position. *---------------------------------------------------------------------------* WinX dc.w 0 WinY dc.w 0 *---------------------------------------------------------------------------* PSPSegment dc.w 1 CodeSegment dc.w 1 GET_NAME dc.b 1,4," Enter Your Name (Min 6 chars): ",0 GET_COMPANY dc.b 1,4,"Enter Company/Email (Min 6 chars): ",0 UNLOCK_KEY dc.b 1,9,"Unlock Code: ",0 CHECK_KEY dc.b 1,9," Check Key: ",0 TOP_LINE1 dc.b 1,$16,"Key Generator for CDR Win 3.6 to 3.7b",0 TOP_LINE2 dc.b 1,$12,"Version 1.0 [13/4/99]",0 BOT_LINE dc.b 1,$1f,"--== MYSTIQUE ==--",0 MEM_ERROR dc.b "Error Freeing Memory...$" DISCLAIMER dc.b 1,$1E,10," *** DISCLAIMER ***",13,10,10 dc.b 1,$13," If you find this software useful then",13,10 dc.b 1,$13,"please register and buy the full version.",13,10,10 dc.b 1,$12," Supplied in full " dc.b 1,$14,$54,1,$15,$65,1,$1E,$63,1,$16,$68,1,$1D,$6E,1,$18,$6F,1,$12,"-Colour",13,10, dc.b 1,$12," and compiled with ",1,$16,"GEMA",0 BYE dc.b "Bye...$" Arguements ds.w 20 CmdLine ds.b 256 ***************************************************************************** X_DATA dc.b $00, $00, $00, $00 dc.b $7E, $88, $3E, $1C dc.b $FC, $10, $7D, $38 dc.b $82, $98, $43, $24 dc.b $F8, $21, $FA, $70 dc.b $86, $A9, $C4, $6C dc.b $04, $31, $87, $48 dc.b $7A, $B9, $B9, $54 dc.b $F0, $43, $F4, $E1 dc.b $8E, $CB, $CA, $FD dc.b $0C, $53, $89, $D9 dc.b $72, $DB, $B7, $C5 dc.b $08, $62, $0E, $91 dc.b $76, $EA, $30, $8D dc.b $F4, $72, $73, $A9 dc.b $8A, $FA, $4D, $B5 ***************************************************************************** * The program is to go here. ***************************************************************************** Main: bsr.w CLS * cs:move.w #$148, CursorPos move.w #GET_NAME, dx bsr.w Print_String move.w #Name+1, di bsr.w Get_String cs:move.b cl, Name *--* cs:move.w #$1e8, CursorPos move.w #GET_COMPANY, dx bsr.w Print_String move.w #Company+1, di bsr.w Get_String cs:move.b cl, Company *--* eor.b dh, dh move.w #Name+1, di cs:move.b Name, dl move.w #X_DATA, si bsr.w Get_Checksum push.l a *--* eor.b dh, dh move.w #Company+1, di cs:move.b Company, dl move.w #X_DATA, si bsr.w Get_Checksum *--* move.l a, c move.l a, d pop.l b and.l #$0000ff00, c shl.l #$10, d or.l d, c move.l a, d and.l #$00ff0000, d shr.l #$10, a or.l a, d xor.l a, a shl.l #$8, c shr.l #$8, d or.l d, c xor.l b, c *--* cs:move.l c, UnlockCode+12 xor.w ax, ax trap #$1a cs:move.w cx, UnlockCode cs:move.w dx, UnlockCode+2 *--* move.b #4, ah trap #$1a cs:move.w cx, UnlockCode+4 cs:move.w dx, UnlockCode+6 *--* cs:move.w UnlockCode+14, cx ; xor.w #$04a0, cx ; cs:move.w cx, UnlockCode+8 ; * move.w #UnlockCode+12, di push.w di add.l #$64, (di) move.w #4, dx move.w #Y_DATA, si bsr.w Get_Checksum shr.l #$10, a cs:move.w ax, UnlockCode+10 pop.w di sub.l #$64, (di) *--* cs:move.l UnlockCode, c cs:move.l UnlockCode+12, a xor.l c, a cs:move.l a, CheckCode *--* cs:move.l UnlockCode+4, a xor.l c, a cs:move.l a, CheckCode+4 *--* cs:move.l UnlockCode+8, c cs:move.l UnlockCode+4, a xor.l c, a cs:move.l a, CheckCode+8 *--* cs:move.l UnlockCode+12, a xor.l c, a cs:move.l a, CheckCode+12 *--* *--* cs:move.w #$3d8, CursorPos move.w #UNLOCK_KEY, dx bsr.w Print_String cs:les CursorPos, di **** move.b #2, ah move.w #8, cx move.w #4, dx move.w #UnlockCode, si bra.s _lp_x_s _loop_x: move.b #'-', al stos.w _lp_x_s: cs:move.l (si), b * push.w dx push.w si pusha bsr.w Print_Hex popa pop.w si pop.w dx * lea 16(di), di lea 4(si), si dec.w dx bne.s _loop_x *--* cs:move.w #$518, CursorPos move.w #CHECK_KEY, dx bsr.w Print_String cs:les CursorPos, di **** move.b #2, ah move.w #8, cx move.w #4, dx move.w #CheckCode, si bra.s _lp_z_s _loop_z: move.b #'-', al stos.w _lp_z_s: cs:move.l (si), b * push.w dx push.w si pusha bsr.w Print_Hex popa pop.w si pop.w dx * lea 16(di), di lea 4(si), si dec.w dx bne.s _loop_z *--* move.b #1, cl bsr.w InfoWait * move.w #DISCLAIMER, dx bsr.w DrawInfoBox * move.w #BYE, dx ;The Goodbye message. rts ***************************************************************************** * This must be the last statements * ***************************************************************************** Name ds.b 52 Company ds.b 52 UnlockCode ds.l 4 CheckCode ds.l 4 Buffer ds.b 512 stack ds.b 256 STACK CodeEnd: *****************************************************************************