home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / KELAUG / KELAUG11.MSA / FREEBIES_CODING_ASSEMB_2.S < prev    next >
Text File  |  1998-09-27  |  2KB  |  79 lines

  1. ;   BEGINNER'S GUIDE TO ASSEMBLY
  2. ;           PART 2
  3. ;
  4. ;   An article by Gary Pinkett
  5. ;
  6. ; Basic notes here, read article in mag for better explanation.
  7. ;
  8.  
  9. *********** Set Up stuff. bsr = basics gosub *********
  10.  
  11. start    bsr    super        ;Enter SuperVisor Mode    
  12.     bsr    killmouse    ;Self Explanatory
  13.     bsr    savecols    ;Store original colours
  14.     bsr    setscr        ;Set up Screen
  15.     bsr    setpal        ;Set palette from picture
  16.     bsr    putpic        ;Put picture on screen
  17.  
  18. ************* Main loop **************
  19.  
  20. main    cmp.b    #$39,$fffc02    ;Check for Spacebar
  21.     bne    main        ;If space hasn't been pressed then goto main
  22.     bra    exit        ;goto exit
  23.  
  24. **************** Routines *****************
  25.  
  26. super    clr.l    -(sp)        ;Clear SP 
  27.     move.w    #$20,-(sp)    ;Move 20 into SP. Function: Super
  28.     trap    #1        ;Call Gemdos
  29.     add.l    #6,sp        ;Add 6 to SP. Restore Stack
  30.     rts            ;Return
  31.  
  32. setscr    move.w    #0,-(sp)    ;Set Resolution (0-Lowres,1=Medium Res,2=High Res,-1=Stay with current res)
  33.     move.l    screen,-(sp)    ;Set address of Physical Base
  34.     move.l    screen,-(sp)    ;Set address of Logical Base
  35.     move.w    #5,-(sp)    ;Move 5 into SP. Function: Set Screen
  36.     trap    #14        ;Call Xbios
  37.     add.l    #12,sp        ;Add 12 to SP. Restore Stack
  38.     rts            ;Return
  39.  
  40. setpal    move.l    #pic+2,-(sp)    ;Move pic+2 to SP, pic is picture (obvious)
  41.     move.w    #6,-(sp)    ;Move 6 into SP. Function: Set Palette
  42.     trap    #14        ;Call Xbios
  43.     addq.l    #6,sp        ;Add 6 to SP. Restore Stack
  44.     rts            ;Return
  45.  
  46. putpic    move.l    #$7d00,d0    ;$7d00=32000 (Geddit?)
  47.     move.l    #pic+34,a0    
  48.     move.l    #$f8000,a1    
  49. loop    move.b    (a0)+,(a1)+    ;Loop 32000 times, 
  50.     dbf    d0,loop        ;Why? Because it draws it line by line (160*200=32000)
  51.     rts            ;Return
  52.  
  53. restcols    movem.l    oldcols,d0-d7
  54.     movem.l    d0-d7,$ff8240
  55.     rts
  56.  
  57. savecols    movem.l    $ff8240,d0-d7
  58.     movem.l    d0-d7,oldcols
  59.     rts
  60.  
  61. exit    bsr    restcols
  62.     move.b    #8,$fffffc02.w
  63.     clr.w    -(sp)
  64.     trap    #1
  65.  
  66. killmouse    move.b    #$12,$fffffc02.w
  67.     rts
  68.  
  69. ************** Data ****************
  70.  
  71. screen    dc.l    $f8000 
  72. oldcols    ds.w    16
  73.  
  74. pic    incbin    "font.pi1"    ;Any PI1 picture (Not NEO) 
  75.  
  76.  
  77.  
  78.