mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-26 01:49:19 +00:00
90 lines
2.9 KiB
Plaintext
90 lines
2.9 KiB
Plaintext
;==========================================================================
|
|
;
|
|
; File: QueueUtils.a
|
|
;
|
|
; Contains: CEnqueueHead routine (should probably be in Queue.a)
|
|
;
|
|
; Written by: Paul Wolf
|
|
;
|
|
; Copyright: © 1992-1993 by Apple Computer, Inc., All rights reserved.
|
|
;
|
|
; This file initializes all the files that comprise the New SCSI Manager
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <SM8> 10/14/93 pdw <MC> roll-in.
|
|
; <SM7> 9/12/93 pdw Changed name of EnqueueHead to CEnqueueHead to avoid conflict
|
|
; with newly added ROM OS routine.
|
|
; <SM5> 6/29/93 pdw Changed headers included.
|
|
; <SM4> 5/5/93 PW Converted names to meanies-friendly names. Updated with latest
|
|
; from Ludwig stuff.
|
|
; <SM3> 3/20/93 PW Removed some of the PDMDebug stuff that's not needed.
|
|
; <SM2> 1/31/93 PW Update from the latest of Ludwig. Also changes required for PDM
|
|
; (will update Ludwig with these as needed myself).
|
|
;
|
|
;==========================================================================
|
|
|
|
MACHINE MC68020 ; '020-level
|
|
BLANKS ON ; assembler accepts spaces & tabs in operand field
|
|
STRING ASIS ; generate string as specified
|
|
PRINT OFF ; do not send subsequent lines to the listing file
|
|
; don't print includes
|
|
CASE OBJECT ; preserve case in object file
|
|
|
|
|
|
;--------------------------------------------------------------------------
|
|
|
|
|
|
LOAD 'StandardEqu.d' ; from StandardEqu.a and for building ROMs
|
|
INCLUDE 'Debug.a' ; for NAME macro
|
|
|
|
|
|
;***********************************************************************
|
|
; CEnqueueHead -- add a queue element to the head of a queue.
|
|
;-----------------------------------------------------------------------
|
|
;
|
|
; Entry:
|
|
; A0 - points to the queue element
|
|
; A1 - points to the queue header
|
|
; All registers are preserved; there are no error conditions.
|
|
;
|
|
; The element is inserted at the beginning of the list.
|
|
;
|
|
;-----------------------------------------------------------------------
|
|
;
|
|
CEnqueueHead PROC EXPORT
|
|
|
|
move.l 4(sp), A0 ; get ptr to Q element
|
|
move.l 8(sp), A1 ; get ptr to Q header
|
|
|
|
MOVE SR, -(SP) ;preserve status
|
|
ADDQ #2, A1 ;point to QHead
|
|
ORI #$0700, SR ;disable interrupts for exclusion
|
|
|
|
TST.L (A1)+ ;anything in the queue? (QHead)
|
|
BNE.S DOQINSERT ;if so, skip ahead
|
|
;
|
|
; the queue is empty so make the head and tail point to the new element
|
|
;
|
|
MOVE.L A0, (A1) ;QTail
|
|
MOVE.L A0, -(A1) ;QHead
|
|
CLR.L QLINK(A0) ;clear the link of the element
|
|
BRA.S ENQDONE
|
|
;
|
|
; insert the element at the head of the list
|
|
;
|
|
DOQINSERT MOVE.L A2, -(SP) ;preserve A2
|
|
MOVE.L -(A1), A2 ;get ptr to old QHead
|
|
MOVE.L A2, QLINK(A0) ;update new link to old head
|
|
MOVE.L A0, (A1) ;update QHead
|
|
MOVE.L (SP)+, A2 ;restore A2
|
|
;
|
|
ENQDONE SUBQ #2, A1 ;restore A1
|
|
MOVE (SP)+, SR ;restore status and go home
|
|
RTS
|
|
|
|
NAME 'CEnqueueHead'
|
|
|
|
ENDP
|
|
|
|
END |