home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
562.lha
/
ReturnCode
/
SetRC.asm
< prev
next >
Wrap
Assembly Source File
|
1991-08-06
|
2KB
|
91 lines
; SetRC .. mostly for testing .. Jim Butterfield 1991Apr19
; CLI only
; exec calls
_LVOOpenLibrary EQU -$228
_LVOCloseLibrary EQU -$19E
ThisTask EQU $114
; dos calls
_LVOWrite EQU -$30
_LVOOutput EQU -$3C
; process structure
pr_CLI EQU $AC
move.l a0,a2
lea dosName(pc),a1
moveq #0,d0
move.l 4.w,a6
move.l ThisTask(a6),a5
jsr _LVOOpenLibrary(a6)
move.l d0,a6
moveq #5,d7 ; WARN
tst.l d0
beq exit
moveq #0,d5 ; flag
moveq #0,d6 ; param value
moveq #0,d0
prmlp move.b (a2)+,d0
cmp.b #$20,d0
bcs.s main
cmp.b #'-',d0
bne.s 1$
moveq #-1,d5
1$ cmp.b #$30,d0
bcs.s prmlp
cmp.b #$3a,d0
bcc.s prmlp
and.b #$f,d0
mulu #10,d6
add.l d0,d6
move.b #1,d5
bra.s prmlp
main tst.b d5
beq.s main2
move.l d6,d7
tst.l d5
bpl.s dosexit
moveq #0,d7
sub.l d6,d7
bra.s dosexit
main2 jsr _LVOOutput(a6)
move.l d0,d4
move.l pr_CLI(A5),a4
add.l a4,a4
add.l a4,a4
move.l $C(a4),d7 ; return code
moveq #0,d5
move.l d7,d6
bpl.s posit
moveq #0,d6
sub.l d7,d6
moveq #-1,d5
move.l d4,d1
lea neg(pc),a0
move.l a0,d2
moveq #1,d3
jsr _LVOWrite(a6)
; d6 contains value for decimal conversion
posit link a3,#-$20
move.l a3,a2
move.b #10,-(a2) ;NewLine
2$ divu.w #10,d6
swap d6
or.b #$30,d6
move.b d6,-(a2)
move.b #0,d6
swap d6
bne.s 2$
move.l d4,d1
move.l a2,d2
move.l a3,d3
sub.l d2,d3
jsr _LVOWrite(a6)
unlk a3
dosexit move.l a6,a1
move.l 4.w,a6
jsr _LVOCloseLibrary(a6)
exit move.l d7,d0
rts
dc.b '$VER:SetRC 1.0',$A
dosName dc.b 'dos.library',0
neg dc.b '-'