OpenCores
URL https://opencores.org/ocsvn/tv80/tv80/trunk

Subversion Repositories tv80

[/] [tv80/] [branches/] [restruc1/] [tests/] [otir.asm] - Diff between revs 46 and 84

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 46 Rev 84
; basic test of OTIR block-transfer instruction
; basic test of OTIR block-transfer instruction
;
;
; initializes a memory region and then transfers that region
; initializes a memory region and then transfers that region
; to an accumulator
; to an accumulator
    .module otir
    .module otir
;--------------------------------------------------------
;--------------------------------------------------------
; special function registers
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
_sim_ctl_port   =       0x0080
_sim_ctl_port   =       0x0080
_msg_port       =       0x0081
_msg_port       =       0x0081
_timeout_port   =       0x0082
_timeout_port   =       0x0082
_max_timeout_low        =       0x0083
_max_timeout_low        =       0x0083
_max_timeout_high       =       0x0084
_max_timeout_high       =       0x0084
_intr_cntdwn    =       0x0090
_intr_cntdwn    =       0x0090
_cksum_value    =       0x0091
_cksum_value    =       0x0091
_cksum_accum    =       0x0092
_cksum_accum    =       0x0092
_inc_on_read    =       0x0093
_inc_on_read    =       0x0093
    .area INIT (ABS)
    .area INIT (ABS)
    .org  0
    .org  0
    jp      init
    jp      init
init:
init:
    ld      sp, #0xffff
    ld      sp, #0xffff
    ;; initialize dbuf memory area with regular pattern
    ;; initialize dbuf memory area with regular pattern
    ;; pattern starts with 1 and increments
    ;; pattern starts with 1 and increments
    ld      hl, #dbuf
    ld      hl, #dbuf
    ld      b, #255
    ld      b, #255
    ld      c, #1
    ld      c, #1
dbuf_init:
dbuf_init:
    ld      (hl), c
    ld      (hl), c
    inc     hl
    inc     hl
    inc     c
    inc     c
    djnz    dbuf_init
    djnz    dbuf_init
    call    reset_timeout
    call    reset_timeout
    ld      b, #16
    ld      b, #16
    call    xfer_test
    call    xfer_test
    call    reset_timeout
    call    reset_timeout
    ld      b, #63
    ld      b, #63
    call    xfer_test
    call    xfer_test
    call    reset_timeout
    call    reset_timeout
    ld      b, #127
    ld      b, #127
    call    xfer_test
    call    xfer_test
    call    reset_timeout
    call    reset_timeout
    ld      b, #128
    ld      b, #128
    call    xfer_test
    call    xfer_test
    call    reset_timeout
    call    reset_timeout
    ld      b, #254
    ld      b, #254
    call    xfer_test
    call    xfer_test
    call    reset_timeout
    call    reset_timeout
    ld      b, #255
    ld      b, #255
    call    xfer_test
    call    xfer_test
    ;; finish simulation with test passed
    ;; finish simulation with test passed
    ld      a, #1
    ld      a, #1
    out     (_sim_ctl_port), a
    out     (_sim_ctl_port), a
    ret
    ret
    ;; test sending X amount of data from the buffer to the
    ;; test sending X amount of data from the buffer to the
    ;; accumulator.  Amount of data to transfer is in B.
    ;; accumulator.  Amount of data to transfer is in B.
    ;; After tranferring data to checksummer, perform
    ;; After tranferring data to checksummer, perform
    ;; checksum and compare
    ;; checksum and compare
xfer_test:
xfer_test:
    push    bc
    push    bc
    ld      hl, #dbuf
    ld      hl, #dbuf
    ld      a, #0
    ld      a, #0
    out     (_cksum_value), a
    out     (_cksum_value), a
    ld      c, #_cksum_accum
    ld      c, #_cksum_accum
    otir
    otir
    ;; do checksum over same region
    ;; do checksum over same region
    pop     bc
    pop     bc
    ld      hl, #dbuf
    ld      hl, #dbuf
    ld      a, #0
    ld      a, #0
xfer_test_cksum:
xfer_test_cksum:
    add     a, (hl)
    add     a, (hl)
    inc     hl
    inc     hl
    djnz    xfer_test_cksum
    djnz    xfer_test_cksum
    ;; store calc'ed checksum in D and read out cksum register
    ;; store calc'ed checksum in D and read out cksum register
    ld      d, a
    ld      d, a
    in      a, (_cksum_value)
    in      a, (_cksum_value)
    ;; compare two values and fail test if not equal
    ;; compare two values and fail test if not equal
    cp      d
    cp      d
    jp      nz, xfer_fail
    jp      nz, xfer_fail
    ret
    ret
xfer_fail:
xfer_fail:
    ld      a, #2
    ld      a, #2
    out     (_sim_ctl_port), a
    out     (_sim_ctl_port), a
    ret
    ret
reset_timeout:
reset_timeout:
    ld      a, #2
    ld      a, #2
    out     (_timeout_port), a
    out     (_timeout_port), a
    ret
    ret
    .org    0x8000
    .org    0x8000
dbuf:
dbuf:
    .ds     256
    .ds     256
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.