CPU_DataStructures.i | |
FIFO | |
FIFO_alloc | Allocate static FIFO (queue) buffer |
FIFO_enq | Write (enqueue) byte to FIFO buffer |
FIFO_deq | Read (dequeue) byte from FIFO buffer |
FILO | |
FILO_alloc | Allocate static FILO (stack) buffer |
FILO_push | Write byte to FILO buffer |
FILO_pop | Read byte from FILO buffer |
Allocate static FIFO (queue) buffer
Buffer is allocated in the LORAM segment. Implemented as a circular buffer without overrun protection.
:in: name Name identifier Any string (without quotes) :in: size Capacity in bytes constant Power of two integer up to 256 bytes
FIFO_alloc TestFIFO, 32 FIFO_enq TestFIFO, $f FIFO_enq TestFIFO, $0 lda #$0 FIFO_enq TestFIFO, a lda #$d FIFO_enq TestFIFO, a FIFO_deq TestFIFO ;y = #$0f, z = 0 FIFO_deq TestFIFO, a ;a = #$00, z = 0 FIFO_deq TestFIFO ;y = #$00, z = 0 FIFO_deq TestFIFO ;y = #$0d, z = 0 FIFO_deq TestFIFO ;z = 1 -> Buffer empty
Allocate static FILO (stack) buffer
Buffer is allocated in the LORAM segment. No overflow protection.
:in: name Name identifier Any string (without quotes) :in: size Capacity in bytes constant Power of two integer up to 256 bytes
FILO_alloc TestFILO, 32 FILO_push TestFILO, $b FILO_push TestFILO, $e lda #$e FILO_push TestFILO, a lda #$f FILO_push TestFILO, a FILO_pop TestFILO ;y = #$0f, z = 0 FILO_pop TestFILO, a ;a = #$0e, z = 0 FILO_pop TestFILO ;y = #$0e, z = 0 FILO_pop TestFILO ;y = #$0b, z = 0 FILO_pop TestFILO ;z = 1 -> Buffer empty