16 November 2014, 18:57 | #1 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
Playing around with AsmOne on Winuae..
I have a classic wb install using rtg on winuae and im playing around with the example source on asmone.
I can get the example code to assemble just fine, but I dont see anything at all on the screen. Ive tried multiple examples from multiple source - same result. The code is actually running as it waits for a mouse click as expected. I press escape then a <return> this does a successful 2 pass assembly then j <return> to jump to first line of code Do I need to kick out rtg or something for this to work? cheers One example of the code im trying to run: Code:
;************************************************ ;* Non-System Draw Line Example * ;* Made as help to demo and game creaters * ;* * ;* ASM-One example coded by Rune Gram-Madsen * ;* * ;* All rights reserved. Copyright (c) 1990 * ;************************************************ ; Move the mouse around to draw a lot of lines. ;***************** ;* Constants * ;***************** OldOpenLibrary = -408 CloseLibrary = -414 DMASET= %1000000111000000 ; -----a-bcdefghij ; a: Blitter Nasty ; b: Bitplane DMA (if this isn't set, sprites disappear!) ; c: Copper DMA ; d: Blitter DMA ; e: Sprite DMA ; f: Disk DMA ; g-j: Audio 3-0 DMA START: MOVEM.L D0-D7/A0-A6,-(A7) ; Put registers on stack ;*********************************** ;* CLOSE ALL SYSTEM INTERRUPTS * ;* * ;* START DEMO INTERRUPTS * ;*********************************** MOVE.L $4.W,A6 ; Exec pointer to A6 LEA.L GfxName(PC),A1 ; Set library pointer MOVEQ #0,D0 JSR OldOpenLibrary(A6) ; Open graphics.library MOVE.L D0,A1 ; Use Base-pointer MOVE.L $26(A1),OLDCOP1 ; Store copper1 start addr MOVE.L $32(A1),OLDCOP2 ; Store copper1 start addr JSR CloseLibrary(A6) ; Close graphics library LEA $DFF000,A6 MOVE.W $1C(A6),INTENA ; Store old INTENA MOVE.W $2(A6),DMACON ; Store old DMACON MOVE.W $10(A6),ADKCON ; Store old ADKCON MOVE.W #$7FFF,$9A(A6) ; Clear interrupt enable BSR.L Wait_Vert_Blank MOVE.W #$7FFF,$96(A6) ; Clear DMA channels MOVE.L #COPLIST,$80(A6) ; Copper1 start address MOVE.W #DMASET!$8200,$96(A6) ; DMA kontrol data MOVE.L $6C.W,OldInter ; Store old inter pointer MOVE.L #INTER,$6C.W ; Set interrupt pointer MOVE.W #$7FFF,$9C(A6) ; Clear request MOVE.W #$C020,$9A(A6) ; Interrupt enable ;**** Your main routine **** ;**** Main Loop Test mouse button **** LOOP: BTST #6,$BFE001 ; Test left mouse button BNE.S LOOP ;***************************************** ;* * ;* RESTORE SYSTEM INTERRUPTS ECT ECT * ;* * ;***************************************** LEA $DFF000,A6 MOVE.W #$7FFF,$9A(A6) ; Disable interrupts BSR.S Wait_Vert_Blank MOVE.W #$7FFF,$96(A6) MOVE.L OldCop1(PC),$80(A6) ; Restore old copper1 MOVE.L OldCop2(PC),$84(A6) ; Restore old copper1 MOVE.L OldInter(PC),$6C.W ; Restore inter pointer MOVE.W DMACON,D0 ; Restore old DMACON OR.W #$8000,D0 MOVE.W D0,$96(A6) MOVE.W ADKCON,D0 ; Restore old ADKCON OR.W #$8000,D0 MOVE.W D0,$9E(A6) MOVE.W INTENA,D0 ; Restore inter data OR.W #$C000,D0 MOVE.W #$7FFF,$9C(A6) MOVE.W D0,$9A(A6) MOVEM.L (A7)+,D0-D7/A0-A6 ; Get registers from stack RTS ;*** WAIT VERTICAL BLANK *** Wait_Vert_Blank: BTST #0,$5(A6) BEQ.S Wait_Vert_Blank .loop BTST #0,$5(A6) BNE.S .loop RTS ;*** DATA AREA *** GfxName DC.B 'graphics.library',0 even DosBase DC.L 0 OldInter DC.L 0 OldCop1 DC.L 0 OldCop2 DC.L 0 INTENA DC.W 0 DMACON DC.W 0 ADKCON DC.W 0 ;********************************** ;* * ;* INTERRUPT ROUTINE. LEVEL 3 * ;* * ;********************************** INTER: MOVEM.L D0-D7/A0-A6,-(A7) ; Put registers on stack LEA.L $DFF000,A6 MOVE.L #SCREEN,$E0(A6) ;--- Place your interrupt routine here --- BSR.S INITLINE ; Init line registers MOVEQ #0,D0 ; Start X - Y coords MOVEQ #0,D1 MOVEQ #0,D3 ; End X - Y coords MOVEQ #0,D2 MOVE.W $A(a6),D3 ; Get mouse position MOVE.B D3,D2 LSR.W #8,D3 BSR.S DRAWLINE ; Draw the line MOVE.W #$4020,$9C(A6) ; Clear interrupt request MOVEM.L (A7)+,D0-D7/A0-A6 ; Get registers from stack RTE ;******************** ;* Init line draw * ;******************** SINGLE = 0 ; 2 = SINGLE BIT WIDTH BYTEWIDTH = 40 ; The below registers only have to be set once each time ; you want to draw one or more lines. INITLINE: LEA.L $DFF000,A6 .WAIT: BTST #$E,$2(A6) BNE.S .WAIT MOVEQ #-1,D1 MOVE.L D1,$44(A6) ; FirstLastMask MOVE.W #$8000,$74(A6) ; BLT data A MOVE.W #BYTEWIDTH,$60(A6) ; Tot.Screen Width MOVE.W #$FFFF,$72(A6) LEA.L SCREEN,A5 RTS ;***************** ;* DRAW LINE * ;***************** ; USES D0/D1/D2/D3/D4/D7/A5/A6 DRAWLINE: SUB.W D3,D1 MULU #40,D3 ; ScreenWidth * D3 MOVEQ #$F,D4 AND.W D2,D4 ; Get lowest bits from D2 ;--------- SELECT OCTANT --------- SUB.W D2,D0 BLT.S DRAW_DONT0146 TST.W D1 BLT.S DRAW_DONT04 CMP.W D0,D1 BGE.S DRAW_SELECT0 MOVEQ #$11+SINGLE,D7 ; Select Oct 4 BRA.S DRAW_OCTSELECTED DRAW_SELECT0: MOVEQ #1+SINGLE,D7 ; Select Oct 0 EXG D0,D1 BRA.S DRAW_OCTSELECTED DRAW_DONT04: NEG.W D1 CMP.W D0,D1 BGE.S DRAW_SELECT1 MOVEQ #$19+SINGLE,D7 ; Select Oct 6 BRA.S DRAW_OCTSELECTED DRAW_SELECT1: MOVEQ #5+SINGLE,D7 ; Select Oct 1 EXG D0,D1 BRA.S DRAW_OCTSELECTED DRAW_DONT0146: NEG.W D0 TST.W D1 BLT.S DRAW_DONT25 CMP.W D0,D1 BGE.S DRAW_SELECT2 MOVEQ #$15+SINGLE,D7 ; Select Oct 5 BRA.S DRAW_OCTSELECTED DRAW_SELECT2: MOVEQ #9+SINGLE,D7 ; Select Oct 2 EXG D0,D1 BRA.S DRAW_OCTSELECTED DRAW_DONT25: NEG.W D1 CMP.W D0,D1 BGE.S DRAW_SELECT3 MOVEQ #$1D+SINGLE,D7 ; Select Oct 7 BRA.S DRAW_OCTSELECTED DRAW_SELECT3: MOVEQ #$D+SINGLE,D7 ; Select Oct 3 EXG D0,D1 ;--------- CALCULATE START --------- DRAW_OCTSELECTED: ADD.W D1,D1 ; 2*dy ASR.W #3,D2 ; x=x/8 EXT.L D2 ADD.L D2,D3 ; d3 = x+y*40 = screen pos MOVE.W D1,D2 ; d2 = 2*dy SUB.W D0,D2 ; d2 = 2*dy-dx BGE.S DRAW_DONTSETSIGN ORI.W #$40,D7 ; dx < 2*dy DRAW_DONTSETSIGN: ;--------- SET BLITTER --------- .WAIT: BTST #$E,$2(A6) ; Wait on the blitter BNE.S .WAIT MOVE.W D2,$52(A6) ; 2*dy-dx MOVE.W D1,$62(A6) ; 2*d2 SUB.W D0,D2 ; d2 = 2*dy-dx-dx MOVE.W D2,$64(A6) ; 2*dy-2*dx ;--------- MAKE LENGTH --------- ASL.W #6,D0 ; d0 = 64*dx ADD.W #$0042,D0 ; d0 = 64*(dx+1)+2 ;--------- MAKE CONTROL 0+1 --------- ROR.W #4,D4 ORI.W #$BEA,D4 ; $B4A - DMA + Minterm SWAP D7 MOVE.W D4,D7 SWAP D7 ADD.L A5,D3 ; SCREEN PTR MOVE.L D7,$40(A6) ; BLTCON0 + BLTCON1 MOVE.L D3,$48(A6) ; Source C MOVE.L D3,$54(A6) ; Destination D MOVE.W D0,$58(A6) ; Size RTS ;***************************** ;* * ;* COPPER1 PROGRAM * ;* * ;***************************** SECTION Copper,DATA_C COPLIST: DC.W $0100,$1200 ; Bit-Plane control reg. DC.W $0102,$0000 ; Hor-Scroll DC.W $0104,$0010 ; Sprite/Gfx priority DC.W $0108,$0000 ; Modolu (odd) DC.W $010A,$0000 ; Modolu (even) DC.W $008E,$2C81 ; Screen Size DC.W $0090,$2CC1 ; Screen Size DC.W $0092,$0038 ; H-start DC.W $0094,$00D0 ; H-stop DC.W $0180,$0000 ; Color #0 = 000 DC.W $0182,$0FFF ; Color #1 = fff DC.L $FFFFFFFE ;***************************** ;* * ;* SCREEN DATA AREA * ;* * ;***************************** SECTION Screen,BSS_C SCREEN DS.B 40*256 |
17 November 2014, 07:47 | #2 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
The code doesn't work from non-native (i.e. RTG) screens that's why you don't see anything. To fix that you have to add a LoadView(0) and 2 WaitTOF() calls (2nd WaitTOF calls is to make the code run correctly from interlaced screens) before killing the system (i.e. before the move.w #$7fff,$dff09a line). I'll attach my ministartup so you can check how it's done or even use it for your own projects.
|
17 November 2014, 08:24 | #3 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
Brilliant, thanks StingRay I will try it out after work tonight.
I eventually got the code to run by changing AsmOne to a PAL Hires mode (Non RTG) but this is a fudge and will I definitely follow your advice for a more robust and versatile startup. |
17 November 2014, 21:59 | #4 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
mmm having a little trouble with MiniStartup.s
Code:
******************************************* *** Get Address of the VBR *** ******************************************* .GetVBR move.l a5,-(a7) moveq #0,d0 ; default at $0 move.l $4.w,a6 btst #0,296+1(a6) ; 68010+? beq.b .is68k ; nope. lea .getit(pc),a5 jsr -30(a6) ; SuperVisor() .is68k move.l (a7)+,a5 rts .getit movec vbr,d0 rte ; back to user state code (.getit movec vbr,d0) vbr doesnt seem to be defined and whats a movec? thanks |
17 November 2014, 22:37 | #5 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
VBR is the V.ector B.ase R.egister and movec is a 68010+ instruction to move from/to control register.
Basically you need to use a newer Asm1 version which supports 680x0 opcodes or "cheat" and use the following hex line: dc.l $4e7a0801 ; movec VBR,d0 |
17 November 2014, 22:39 | #6 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
Thanks, does that mean that the code will only work on 68020+ processors due to this single instruction?
|
17 November 2014, 22:41 | #7 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Nope! Check the code and read the comments and you'll find the answer!
|
17 November 2014, 22:59 | #8 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
hehe checking
|
17 November 2014, 23:17 | #9 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
I see, the code is only executed when its *NOT* a vanilla 68k
|
18 November 2014, 06:34 | #10 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Exactly. This piece of code is needed for interrupts to work properly on 68010+ machines as these can have a relocated vector base, simply changing $6c.w to install a custom VBI for example won't work anymore if VBR is set to any other location than $0, $6c+VBR offset must be used in that case. And this is exactly what happens in these lines of code (a0: VBR):
Code:
lea .NewVBI(pc),a1 move.l a1,$6c(a0) |
18 November 2014, 06:43 | #11 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
The shutdown and startup code is excellent, works 100% on all configurations so far, I wish I could say the same for AsmOne, I found it really flakey and awkward to edit with.. After having winuae crash on me when I was trying out devpac with cygnus ed, I decided i was going to develop on the pc natively using the winuaedemotoolchain method (VASM), This is by far the best for me, crash proof and a decent editor! I need to research debugging with this setup...
Thanks again for the code and guidance StingRay. |
18 November 2014, 06:52 | #12 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Asm-One unfortunately has a lot of problems indeed, you can try Asm-Pro (which is a reverse engineered and enhanced version of Asm-One) but it has a fair share of problems too. The RTG support is much better than Asm-One's though.
I've been using Asm-Pro 1.16d for years and probably won't ever change as I know all its bugs and how to circumvent them. In case of questions regarding Asm-One/Pro feel free to ask, for VASM you may ask phx who is also a member on this board here, he sure can help you with debugging (I only used vasm for doing Atari stuff and debugged using Asm-Pro on the Amiga side so can't help you there). |
18 November 2014, 15:11 | #13 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,509
|
Concerning debugging with vasm:
There not many debuggers which work stable and comfortable with all M68k CPUs. I am using bdebug, the Barfly debugger, when debugging on real Amiga hardware. When testing under UAE then the internal debugger is quite useful, so you don't need any extra tools. BTW, tomorrows vasm snapshot (which will become 1.7c some day) can automatically generate line debug hunks for the assembled source, so you can also debug on the original source with debuggers which support that. |
18 November 2014, 18:22 | #14 |
Beyond Mutton
Join Date: Mar 2011
Location: North West, UK
Age: 52
Posts: 347
|
That sounds fantastic phx, i will be sure to check it out. I need to invest more time in learning about debugging 68k in general, I tend to iterate loops and logic in my head from the source code to debug, not looking at the generated code much.
To be honest, I have only been using Vasm for 1 day, but it has been really easy to use and porting code over from AsmOne and DevPac has been painless (without using compatibility settings). I will spend more time reading the great looking manual and exploring features this weekend. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WinUAE slow after playing game | Heula | support.WinUAE | 5 | 03 January 2008 12:42 |
WinUAE issues when playing Hoi | Team_Hoi | support.WinUAE | 2 | 04 July 2007 11:36 |
Playing NTSC games through WinUAE | DamienD | support.WinUAE | 41 | 10 June 2006 21:12 |
Playing Clockwiser CD32 in WinUAE | mcbpete | New to Emulation or Amiga scene | 5 | 07 June 2006 00:43 |
Playing MP3s on WinUAE using AHI | andreas | support.WinUAE | 5 | 07 March 2002 15:27 |
|
|