;This is an outline of a program to implement a queue.
;Note that it is NOT a complete program yet!
; The front of the queue is in the first position, and the back
;  of the queue is at queue + count
;  THus you can insert a new element at queue + count
maxlen  equ  500
        jmp start
queue   db  maxlen dup (?)
count   dw  ?
;  This simulates an insert queue procedure
start:  mov     al,  'A'                ;insert the value in al into queue
        cmp     count, maxlen
        jae     error
        mov     di, count
        mov     queue [di], al
        inc     count
; end of the insert "procedure"

;This simulates a remove queue procedure
remove: cmp     count, 0
        je      error
        mov     al,  queue              ;take element front front
        mov     di, 0
        mov     si, 1
movloop: mov    bl, queue [si]
        mov     queue [di], bl
        inc     si
        inc     di
        cmp     si, count
        jea     finito
        jmp     movloop
finito:  dec    count
;  end of remove "procedure"