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 >
Wrap
Text File
|
1998-09-27
|
2KB
|
79 lines
;
; BEGINNER'S GUIDE TO ASSEMBLY
; PART 2
;
; An article by Gary Pinkett
;
; Basic notes here, read article in mag for better explanation.
;
*********** Set Up stuff. bsr = basics gosub *********
start bsr super ;Enter SuperVisor Mode
bsr killmouse ;Self Explanatory
bsr savecols ;Store original colours
bsr setscr ;Set up Screen
bsr setpal ;Set palette from picture
bsr putpic ;Put picture on screen
************* Main loop **************
main cmp.b #$39,$fffc02 ;Check for Spacebar
bne main ;If space hasn't been pressed then goto main
bra exit ;goto exit
**************** Routines *****************
super clr.l -(sp) ;Clear SP
move.w #$20,-(sp) ;Move 20 into SP. Function: Super
trap #1 ;Call Gemdos
add.l #6,sp ;Add 6 to SP. Restore Stack
rts ;Return
setscr move.w #0,-(sp) ;Set Resolution (0-Lowres,1=Medium Res,2=High Res,-1=Stay with current res)
move.l screen,-(sp) ;Set address of Physical Base
move.l screen,-(sp) ;Set address of Logical Base
move.w #5,-(sp) ;Move 5 into SP. Function: Set Screen
trap #14 ;Call Xbios
add.l #12,sp ;Add 12 to SP. Restore Stack
rts ;Return
setpal move.l #pic+2,-(sp) ;Move pic+2 to SP, pic is picture (obvious)
move.w #6,-(sp) ;Move 6 into SP. Function: Set Palette
trap #14 ;Call Xbios
addq.l #6,sp ;Add 6 to SP. Restore Stack
rts ;Return
putpic move.l #$7d00,d0 ;$7d00=32000 (Geddit?)
move.l #pic+34,a0
move.l #$f8000,a1
loop move.b (a0)+,(a1)+ ;Loop 32000 times,
dbf d0,loop ;Why? Because it draws it line by line (160*200=32000)
rts ;Return
restcols movem.l oldcols,d0-d7
movem.l d0-d7,$ff8240
rts
savecols movem.l $ff8240,d0-d7
movem.l d0-d7,oldcols
rts
exit bsr restcols
move.b #8,$fffffc02.w
clr.w -(sp)
trap #1
killmouse move.b #$12,$fffffc02.w
rts
************** Data ****************
screen dc.l $f8000
oldcols ds.w 16
pic incbin "font.pi1" ;Any PI1 picture (Not NEO)