Welcome, Guest. Please login or register.

Author Topic: Need help again, hehe, this time in asm  (Read 3459 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Need help again, hehe, this time in asm
« on: May 10, 2004, 02:23:44 PM »
Ok, this is the problem, I've been digging alittle into the amiga with  asmOne during the last two days, now, the code runs fine when I assemble and run it, but when I write the object to disk and then run it from cli, the cli-window disappears leaving a blue screen, and the sound sound weird, I'm assuming that the copper-list is loaded into FAST-RAM, so what should I do ? I know I could insert some code to copy the copper-list into chip directly and start it, but I do believe there are other ways (including the OS), besides, it wouldnt be system-friendly (yes my code is supposed to exit nice and quiet), so whats the best way to solve this ?

Thank you very much in advance
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #1 on: May 10, 2004, 03:15:44 PM »
I'll try to take the code with me tomorrow. (Do not think its anything fancy, its just the most primitive beginning of some (later) intro (? haha,  :pissed: ).

This kinking thing, what is it ? Does the assembler assemble my code and then put that together with a pre-assembled object file into one file or what ?
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #2 on: May 11, 2004, 01:17:41 PM »
@Cymric, thanx for clarifiying, unfortunately I didnt have time to move the code to a pc-disk, however I'l give the vary base of the code.

I made an include file with the name "SaveLoadSys.i" (hey, dont laugh, I just used "Sys" because I didnt come up with anything better)

This is (I think) the source of "SaveLoadSys.i":

*CODE*

savesys:

move.l  4,a6
lea  dosname,a1
moveq  #0,d0
jsr  -552(a6)
move.l  d0,dosbase

move.l  dosbase,a0
move.l  -30(a0),oldcop  ;I think it was -30
move  $dff002,d0
bset  #9,d0
bset  #15,d0
move  d0,olddma

move.l  4,a6
move.l  dosbase,a1
jsr  -414(a6)
rts

loadsys:

move  olddma,$dff096
move.l  oldcop,$dff080
move.l  #1,$dff088
rts


oldcop:
dc.l  0

olddma:
dc.w  0

dosbase:
dc.l  0

dosname:
dc.b  'dos.library',0

I'm almost certain it misses some lines from the original code, anyway lets look at the main code (about 1/10 or so of the original):

bra  start
include "df0:asm/SaveLoadSys.i"

start:
bsr  savesys

move  #%0xxxxxxxxxxxxxxx,$dff096  ;I KNOW I set the RIGHT bits, but since I dont remember say, if blitter-dma was bit number 9 or 7 I just wrote "x" here !

move  #%1xxxxxxxxxxxxxxx,$dff096  ;same goes here !

move.l  #cop,$dff080
moveq  #1,$dff088

;also some code for noise, but I dont have energy to write'm down here now

waitmb:
btst  #10,$dff016
bne.s  waitmb

bsr  loadsys
rts

cop:
dc.w  .....,.....
dc.w  .....,.....
etc ...

*/CODE*

The point is that it full version works when assembled and ran run immediately but not as a separate object file, since everything works EXCEPT the copper (and sound) definition is executed (I can click the mouse button to exit the code and get back to cli) also when ran as a separate object file, I assume it's becouse the whole thing (including the copper) is loaded into fast-ram.
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #3 on: May 11, 2004, 02:50:35 PM »
Yes, I will test the NoFastMem, thanx !
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #4 on: May 11, 2004, 03:40:06 PM »
Quote

That's wrong. DOSBase - 30 is ptr to jump to _LVOOpen routine, not old copper list. You only find JMP (abs).l instruction there on 2.x+ or 'moveq #x,d0 + bra.w' with 1.x.

This means the code is unable to restore system copper list at exit.


Offcourse, for one little moment I forgot that negative offsets contain jump-instuctions to routines, it should offcourse be a positive number, whether its 30 or 3x I dont remember right now, but I have offcourse the correctr offset in the original code.

Quote

You need to disable all DMA before restoring:


Yes, yes, I said in a comment in that post that I'm sure I forgot some line(s), however, are you sure that the word #$7fff is correct ? when I used that value in a line in the "savesys" subroutine BEFORE setting new dma bits the system crashed when I ran the code, why did that happen ?

Quote

Also, the code lacks disabling of interrupts (INTENA(R)) before peeking & poking DMACON(R).


yes, but like I said, when I did disable them all the system crashed.
So this is the reason why the command-prompt/CLI out put the charachters of every key I pressed during the execution of the code, huh ???

By the way one thing I forgot in the code HERE, is the disabling of multitasking. (shouldnt the disabling of multi-tasking take care of the keyboard thing ?)
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #5 on: May 12, 2004, 12:57:09 PM »
Ok, it worked when I disabled fast-ram with NoFastMem, I knew there were nothing wrong with my code itself, so now I have to write some lines to copy copper to chip ram, therefore I have another question: I know of two routines in exec.library namely, AllocMem and AllocAbs, however in the tutorial I have nowhere is mensioned if you use them (or another routine) to allocate CHIP ram, can I do that ? I KNOW I can use AllocAbs to allocate CHIP ram, but thats an absoulte address I request for and NOT a random one that the routine returns.
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #6 on: May 12, 2004, 02:03:48 PM »
Quote
move.l #2,d1 ;$00000002 is MEMF_CHIP


1. what are the other values ? 0 and 1 ? (for fast ram etc..)
2. what does the "F" in "MEMF_CHIP" stand for ? I know I ask too much, but I really need to know EVERYTHING that I do, thats the reason I like asm. (what I dislike is relatively advanced math in low level asm coding )

Thanx
 

Offline GreatLorTopic starter

  • Jr. Member
  • **
  • Join Date: Apr 2004
  • Posts: 72
    • Show all replies
Re: Need help again, hehe, this time in asm
« Reply #7 on: May 13, 2004, 01:42:18 PM »
I didnt get anything of what you said now, but thanx I guess  :-D , I dont know, I just HATE macros, I prefere direct values/code, THEN I could make my own macros if I WANT.

Oh, hehe, it was really graphics.library and NOT dos.library I should have opened there  :lol: