22 September 2019, 17:43 | #1 |
Registered User
|
2k intro boot...
I just want to ask your help for something I always have been wondering about for many years...
let's get to it: Assuming I have any 2k executable intro and want to experience how to write it into the bootblock can I do this job with the ASM-One/ARIII or do I need any special tool? Sorry to ask, but I am in the dark..... Last edited by W4r3DeV1L; 18 October 2020 at 23:50. |
22 September 2019, 17:54 | #2 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
Quote:
I have no idea if there is a special tool, but if you want I will do it for you |
|
22 September 2019, 18:14 | #3 | |
Registered User
|
Quote:
Then ... assuming I have a 1k code to jam into the bootblock sectors ... how can I do this? Last edited by W4r3DeV1L; 18 October 2020 at 23:51. |
|
22 September 2019, 18:29 | #4 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
|
22 September 2019, 18:38 | #5 |
Registered User
|
|
22 September 2019, 18:47 | #6 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
Ok, two possibilities:
1) the exe is fully pc relative, so you do not need to relocate it. Simply strip the header (at start and end of the binary). Then assemble: Code:
bb: dc.b 'DOS',0 dc.l checksum dc.l $370 start: incbin "your.exe" 2) relocate the exe at some fixed location. Then: Code:
bb: dc.b 'DOS',0 dc.l checksum dc.l $370 start: copy bin to right location bin: incbin "your.exe" |
22 September 2019, 19:26 | #7 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,569
|
Not sure if this will be simple for a beginner, without knowledge of the hunk format structure.
To simplify it: if you have a single-section executable the header will be 32 bytes, which you can skip. But then you lose this space in the boot block. Code:
bb: dc.b 'DOS',0 dc.l checksum dc.l $370 start: bra.b *+34 incbin "your.exe" |
22 September 2019, 19:54 | #8 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,089
|
For asm-one:
1. use this source: Code:
start: DC.B 'DOS',0 DS.L 1 ; checksum comes here DC.L 880 exe_code: DS.B 1024-12 end: 3. load exe into memory with RO, you will get its memory location, say it's X 4. copy exe with C (beg is X, end is X+1024-12, dest is exe_code) 5. write bb to disk as 2 sectors with WS (ram ptr is start, disk ptr is 0, length is 2) 6. calculate bootblock checksum with CC Edit: Forgot to mention, you can simulate bootblock with BS (beg is start). Last edited by a/b; 22 September 2019 at 19:59. |
22 September 2019, 21:45 | #9 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
A real example: "It's a sin" by Planet Jazz.
It's a 1KB bootblock intro with source code available, full PC relative. I chose this because I took the opportunity to fix some small bugs that prevents it to exit to CLI regularly. Greeting to the original coder Code:
;Planet Jazz - It's a sin bootblock for Datastorm 2017 ;Partycoded by Olle using Blueberrys bootblock examplecode. ;It's not only a sin, it is also a complete mess. :) ; little fix by ross 22/09-2019 ; Bootblock example code by Blueberry / Loonies, 23/9-2012 ; Public Domain ; System constants _LVOFindResident = -96 _LVOLoadView = -222 _LVOWaitTOF = -270 gb_ActiView = 34 gb_copinit = 38 IVBLIT = 156 RT_INIT = 22 SU_tf_CharData = $22 SU_OpenFont = -72 _AUD0LCH = $A0 _AUD0LEN = $A4 _AUD0PER = $A6 _AUD0VOL = $A8 _AUD2LCH = $C0 _AUD2LEN = $C4 _AUD2PER = $C6 _AUD2VOL = $C8 Mask = 2048-1 section BB,code ; The bootblock starts here. ; It cannot generally be assumed to be placed in a specific ; kind of memory, or at any specific address, so all code ; must be completely PC relative, and all chip data must ; be explicitly copied to chip memory. BB: DC.B 'DOS',0 DC.L 0 DC.L $370 START: ; Bootblock code goes here. movem.l d0-a6,-(sp) ; Global pointer to chip space in A4 ; Chip space at the end of (512k) chip memory lea $80000-4096-(Space_End-Space),a4 ; Open topaz ; movea.l $4.w,a6 movea.l IVBLIT(a6),a6 ; graphics.library lea TextAttr(pc),a0 lea TopazName(pc),a1 move.l a1,(a0) jsr SU_OpenFont(a6) movea.l d0,a0 move.l SU_tf_CharData(a0),TopazCharData-Space(a4) lea TextScr-Space(a4),a0 lea Bpl2-Space(a4),a1 move.w #$00e4,d1 bsr.w SetBpl addq.w #2,d1 adda.l #(80*1)+2,a0 bsr.w SetBpl lea Kottig_Text(pc),a0 lea TextMsg-Space(a4),a1 moveq #(Kottig_TextE-Kottig_Text)/4-1,d7 .tloop move.l (a0)+,(a1)+ dbf d7,.tloop ; Copy copperlist to chip lea CopperData(pc),a0 lea Copper-Space(a4),a1 moveq #(CopperData_End-CopperData)/4-1,d7 .cloop move.l (a0)+,(a1)+ dbf d7,.cloop move.l #$00280078,Yptr1-Space(a4) lea TextMsg-Space(a4),a0 move.l a0,Textptr-Space(a4) lea $DFF000,A5 move.w 2(a5),-(sp) ori.w #$8000,(sp) ;init sound lea Waveform-Space(a4),a1 move.w #$7f80,(a1) move.l a1,_AUD0LCH(a5) move.w #1,_AUD0LEN(a5) move.l a1,_AUD2LCH(a5) move.w #1,_AUD2LEN(a5) ; bsr.w gen_sin lea Bpl_Sinus-Space(a4),a0 lea 1024(a0),a1 moveq #0,d4 move #256-1,d3 .l1 move.l d4,d0 swap d0 add.l #823550,d4 ;Pi<<18 move d0,d2 move d0,d1 mulu d1,d1 lsl.l #4,d1 swap d1 mulu d1,d0 divu #3<<11,d0 sub d0,d2 mulu d1,d0 divu #10<<11,d0 add d0,d2 mulu d1,d0 divu #21<<11,d0 sub d0,d2 asr #4,d2 move d2,(a0)+ move d2,2046(a0) move d2,-(a1) neg d2 move d2,1022(a0) move d2,1024(a1) dbf d3,.l1 ; bsr.w render_triangle moveq #0,d1 moveq #0,d7 lea TScreen-Space(a4),a0 move.l #640/2,d0 .floop subq.l #1,d0 add.l #80,d1 move.w d7,d2 lsl.w #1,d2 move.l d0,d3 .fscanl ; bfset (a0,d1.w){d3:01} ; 68020+ method ; 68000-method ;( ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= move.l d3,d4 ; x move.l d1,d5 ; y ror.l #3,d4 add.l d4,d5 ; + x position in bit(!)[*] rol.l #3,d4 ; /8 - now we have byte offset not d4 ; correct offset for bitset bset d4,(a0,d5.w) ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= addq.l #1,d3 dbra d2,.fscanl addq.w #1,d7 cmp.w #320,d7 bne.b .floop ; bsr.w fill_copper lea Bplist-Space(a4),a0 move.l #$1ee1fffe,d0 move.l #300-1,d1 .fill move.l d0,(a0)+ move.l #$00e00000,(a0)+ move.l #$00e20000,(a0)+ add.l #$01000000,d0 dbra d1,.fill ; Set copperlist lea Copper-Space(a4),a1 move.l a1,$80(a5) ; Disable interrupts and set some DMAs move.w #$4000,$9a(a5) move.w #$87C5,$96(a5) ; move.w #%1000000000000101,_DMACON(a5) ; Switch off sprite DMA ; bsr.w WaitVbl move.w #$0020,$96(a5) ; Main per-frame loop MainLoop ; bsr.w do_sine move.w Yptr1-Space(a4),d2 move.w Yptr2-Space(a4),d3 lea Bpl_Sinus-Space(a4),a0 lea TScreen-Space(a4),a1 ; Triangle screen lea Bplist-Space(a4),a2 move.l #300-1,d7 .loop move.w (a0,d2),d4 add.w (a0,d3),d4 asr.w #2,d4 add.w #100,d4 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-= mulu #80,d4 add.l a1,d4 move.w d4,10(a2) swap d4 move.w d4,6(a2) add.l #12,a2 ;-=-=-=-=-=-=-=-=-=-=-=-=-=-= add.w #8*4,d2 add.w #4*4,d3 and.w #Mask,d2 and.w #Mask,d3 dbra d7,.loop move.w Yptr1-Space(a4),d2 move.w Yptr2-Space(a4),d3 add.w #2*4,d2 add.w #4*4,d3 and.w #Mask,d2 and.w #Mask,d3 move.w d2,Yptr1-Space(a4) move.w d3,Yptr2-Space(a4) bsr.w write_text ;-------------- audio -------------- ;do_drum cmp.w #32,Ticks-Space(a4) bne.b .ntrig move.w #124,Per-Space(a4) move.w #64,Vol-Space(a4) clr.w Ticks-Space(a4) .ntrig addq.w #1,Ticks-Space(a4) move.w Per-Space(a4),_AUD0PER(a5) move.w Vol-Space(a4),_AUD0VOL(a5) add.w #12<<8,Per-Space(a4) subq.w #8,Vol-Space(a4) move.w Per-Space(a4),_AUD2PER(a5) move.w Vol-Space(a4),_AUD2VOL(a5) ;---------------------------------- bsr.b WaitVbl ; Loop until LMB btst #6,$bfe001 bne.w MainLoop Exit: ; Recover DMA settings move.w #$7fff,$96(a5) move.w (sp)+,$96(a5) ; Restore copper ; move.l IVBLIT(a6),a6 move.l gb_copinit(a6),$80(a5) ; Restore registers movem.l (sp)+,d0-a6 ; Return init function of dos.library resident in A0 lea DosName(pc),a1 jsr _LVOFindResident(a6) movea.l d0,a0 movea.l RT_INIT(a0),a0 moveq #0,d0 rts WaitVbl tst.b 5(a5) beq.b WaitVbl .wvb tst.b 5(a5) bne.b .wvb rts SetBpl move.l a0,d0 move.w d1,(a1)+ ;$00ex swap d0 move.w d0,(a1)+ ;h swap d0 addq.w #2,d1 move.w d1,(a1)+ ;$00ex move.w d0,(a1)+ ;l rts ;----------------------------------- ; Textwriter using Topaz font. write_text lea TextScr-Space(a4),a1 adda.l #80*8+20-2+((80*10)*5),a1 movea.l Textptr-Space(a4),a0 .getch moveq #0,d0 move.b (a0)+,d0 beq.b .fin ; if 0 then finished move.l a0,Textptr-Space(a4) tst.b d0 ; repeat space $7f+no of spaces bpl.b .norepspace sub.w #$7f,d0 add.w d0,TextCursorx-Space(a4) bra.b .getch .norepspace cmp.b #10,d0 ; newline bne.b .cont add.w #80*10,TextCursory-Space(a4) clr.w TextCursorx-Space(a4) bra.b .getch .cont sub.b #32,d0 move.l TopazCharData-Space(a4),a0 add.w d0,a0 add.w TextCursorx-Space(a4),a1 add.w TextCursory-Space(a4),a1 moveq #8-1,d0 .cpy move.b (a0),(a1) add.w #192,a0 add.w #80,a1 dbra d0,.cpy addq.w #1,TextCursorx-Space(a4) .fin rts Kottig_Text dc.b $7f+14,'At DataStorm 2017',10,10,10 dc.b $7f+13,'Planet.Jazz cracked',10 dc.b $7f+13,'Several braincells',10 dc.b 10,10,10 dc.b $7f+7,'Greetings to everyone at the party',10,10 dc.b $7f+4,'and heck, even to the sofa-sceners :P',10 dc.b 10,10,10,10,10,10,10 dc.b 'partycode, same procedure as every year james.',0 even Kottig_TextE CopperData dc.w $0100,$b000,$008e,$2c81,$0090,$2cc1 dc.w $0092,$003c,$0094,$00d4 dc.w $0108,$0000,$010a,$0000 dc.w $0102,$0407 dc.w $0180,$05c5,$0182,$04a4 dc.w $0184,$0151,$0186,$0141 dc.w $0188,$0fef,$018a,$0fff dc.w $018c,$0fef,$018e,$0fff CopperData_End DosName dc.b 'dos.library',0 TextAttr dc.l 0 dc.w 8 dc.b 0,0 TopazName dc.b 'topaz.font',0 even ; section space,bss_c Space Ticks ds.w 1 Per ds.w 1 Vol ds.w 1 Yptr1 ds.w 1 Yptr2 ds.w 1 Sq ds.w 1 TextCursorx ds.w 1 TextCursory ds.w 1 Textptr ds.l 1 TopazCharData ds.l 1 TextMsg ds.b Kottig_TextE-Kottig_Text Bpl_Sinus ds.w 4096 Waveform ds.l 1 Copper ds.b CopperData_End-CopperData Bpl2 ds.w 4 ;dc.w $00e4,$0000,$00e6,$0000 Bpl3 ds.w 4 ;dc.w $00e8,$0000,$00ea,$0000 Bplist ds.w 300*6 ; Triangle bitplane ptrs ds.l 1 ; Terminator TextScr ds.b 80*256 TScreen ds.b 80*640 Space_End Just noticed two small inaccuracies in the copper list. But the purpose was a bb intro example so it doesn't matter Last edited by ross; 22 September 2019 at 22:54. |
23 September 2019, 20:34 | #10 |
Registered User
|
Thank you so much ross! ...
Anyway I started the .adf with WinUAE and of course it works, but ... trying to figure out how things have been done ... I opened, with ASM-One, the source file you attached "pjz-its_a_sin.s" and once assembled I haven't been able to execute anything. Can you, ... please ... , give me/us more help telling ... how to start it and how to (maybe step by step) end up writing it into and .adf disk boot block? It would be nice to to have the file pjz-its_a_sin.adf like the one you attached. I have greatly appreciated your work for this bb intro example ... Last edited by W4r3DeV1L; 23 September 2019 at 20:42. |
23 September 2019, 21:05 | #11 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
Load and assemble the source.
Then: WS RAM PRT>BB DISK PTR>0 LENGTH>2 CC What did you do in practice: WS -> write assembled code to disk starting from routine at BB (DC.B 'DOS',0 etc.) at disk sector 0 (where bootblock reside) length 2 (self explanatory ) CC -> calculate checksum (fill the second long -> DC.L 0 with the right value) [if you wonder what the third longword DC.L $370 is, is the disk rootblock, sector 880] Now if you boot the disk code start from offset $c, the START label. Enjoy! |
24 September 2019, 11:54 | #12 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,130
|
http://aminet.net/package/dev/asm/Asm_course There is a Assembler course on aminet. It comes with Asm One and it comes with example code.
Read /examples/BootBlock.S But it pretty much is as Ross says. |
24 September 2019, 22:45 | #13 | |
Registered User
|
Quote:
Thanks to to ross and you too! |
|
25 September 2019, 22:32 | #14 |
Registered User
|
Hello... remaining in the topic of boot block tutorial, I made tonight another experiment...
Here is the code of a flashing screen waiting for the left mouse button to execute a custom boot block: Code:
bb: dc.b 'DOS',0 dc.l 0 dc.l $370 dcb.b 1024,0 loop: move.w #$000, $dff180 move.w #$fff, $dff182 checkExit: btst #6, $bfe001 ; test LEFT mouse click bne loop rts lea Dos(pc),a1 ; string of dos.library into a1 register jsr -96(a6) ; call FindResident tst.l d0 beq.s Err ; mod.resid. not found movea.l d0,a0 movea.l $16(a0),a0 moveq #0,d0 Usc: rts Err: moveq #-1,d0 ; set error flag bra.s Usc Dos: dc.b 'dos.library',0 ; "dos.library" string do you guys have any clue? Last edited by W4r3DeV1L; 25 September 2019 at 22:45. |
25 September 2019, 22:53 | #15 |
noodle
Join Date: Jun 2007
Location: europe
Posts: 247
|
what is the "dcb.b 1024,0" ?
the code is after the boot with that so not copied to disk... loop should be just after dc.l $370 |
25 September 2019, 22:57 | #16 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
Code:
bb: dc.b 'DOS',0 dc.l 0 dc.l $370 ; dcb.b 1024,0 loop: move.w $dff006, $dff180 ; move.w #$fff, $dff182 checkExit: btst #6, $bfe001 ; test LEFT mouse click bne loop ; rts lea Dos(pc),a1 ; string of dos.library into a1 register jsr -96(a6) ; call FindResident tst.l d0 beq.s Err ; mod.resid. not found movea.l d0,a0 movea.l $16(a0),a0 moveq #0,d0 Usc: rts Err: moveq #-1,d0 ; set error flag bra.s Usc Dos: dc.b 'dos.library',0 ; "dos.library" string |
25 September 2019, 23:08 | #17 | |
Registered User
|
Quote:
I do not how to arrange this last step.... |
|
25 September 2019, 23:24 | #18 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
Nothing to arrange here
You simply need to type CC and ASM-One will generate (and write to inserted ADF, or DF0: in a real machine) the correct checksum on the disk. Then you can boot the disk and the code in the bootblock starts. |
25 September 2019, 23:36 | #19 |
Registered User
|
|
25 September 2019, 23:45 | #20 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 54
Posts: 4,522
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Intro ;) | diskers | Member Introductions | 2 | 19 September 2012 14:29 |
Intro | tomse | Member Introductions | 7 | 04 July 2010 09:40 |
no-intro? | Marcuz | project.TOSEC (amiga only) | 10 | 25 August 2008 22:30 |
What's the intro? | xtc | request.Demos | 4 | 14 February 2008 09:47 |
Can you name this intro?! | Quickbeam | Retrogaming General Discussion | 3 | 17 May 2003 10:54 |
|
|