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

Subversion Repositories tv80

[/] [tv80/] [trunk/] [tests/] [alu_optest.ast] - Diff between revs 113 and 114

Show entire file | Details | Blame | View Log

Rev 113 Rev 114
Line 67... Line 67...
        ;; print a hex number between 0-255, stored in the A register
        ;; print a hex number between 0-255, stored in the A register
print_number:
print_number:
        push    bc
        push    bc
        ld      b, a            ; store number to be printed in b
        ld      b, a            ; store number to be printed in b
 
 
        and     #0x0
        and     #0xF0
        sra     a
        sra     a
        sra     a
        sra     a
        sra     a
        sra     a
        sra     a
        sra     a
        cp      a, #0x10
        cp      a, #10
        jp      p, alpha_0
        jp      p, alpha_0
        add     #48             ; ordinal value of '0'
        add     #48             ; ordinal value of '0'
        out     (_msg_port), a
        out     (_msg_port), a
        jp      second_digit
        jp      second_digit
alpha_0:
alpha_0:
        add     #55              ; 'A' - 10
        add     #55              ; 'A' - 10
        out     (_msg_port), a
        out     (_msg_port), a
 
 
second_digit:
second_digit:
        ld      a, b
        ld      a, b
        and     #0x0
        and     #0x0F
 
 
        cp      a, #0x10
        cp      a, #10
        jp      p, alpha_1
        jp      p, alpha_1
        add     #0x48
        add     #48
        out     (_msg_port), a
        out     (_msg_port), a
        jp      print_number_exit
        jp      print_number_exit
 
 
alpha_1:
alpha_1:
        add     #55              ; 'A' - 10
        add     #55              ; 'A' - 10
Line 117... Line 117...
        jp      failed
        jp      failed
 
 
 
 
 
 
starting_test:  .ascii "Starting test"
starting_test:  .ascii "Starting test"
        .db 0x0A
        .db 0x0A .db 0x00
        .db 0x00
 
 
 
push_message: .ascii "push_0"
push_message: .ascii "push_0"
        .db 0xa
        .db 0xa
        .db 0x0
        .db 0x0
 
 
Line 173... Line 172...
                call    print_sub
                call    print_sub
                ld      bc,#0x1234
                ld      bc,#0x1234
                push    bc
                push    bc
                ld      bc,#0
                ld      bc,#0
                pop     bc
                pop     bc
                ld      a,#12      ;bjp was >#0x1234
                ld      a,#0x12      ;bjp was >#0x1234
                cp      b
                cp      b
                jr      z,push_1
                jr      z,push_1
        ld      b, #0
        ld      b, #0
        jp      fail_routine
        jp      fail_routine
push_1:         ld      a,#34      ;bjp was >#0x1234
push_1:         ld      a,#0x34      ;bjp was >#0x1234
                cp      c
                cp      c
                jr      z,push_2
                jr      z,push_2
        ld      b, #1
        ld      b, #1
        jp      fail_routine
        jp      fail_routine
push_2:         ld      de,#0x55aa
push_2:         ld      de,#0x55aa
Line 275... Line 274...
                ld      hl,#0
                ld      hl,#0
                push    de
                push    de
                pop     ix
                pop     ix
                ld      sp,ix
                ld      sp,ix
                add     hl,sp
                add     hl,sp
                ld      a,#12      ;bjp was >#0x1234
                ld      a,#0x12      ;bjp was >#0x1234
                cp      h
                cp      h
                jr      z,push_17
                jr      z,push_17
        ld      b, #16
        ld      b, #16
        jp      fail_routine
        jp      fail_routine
push_17:        ld      a,#34      ;bjp was >#0x1234
push_17:        ld      a,#0x34      ;bjp was >#0x1234
                cp      l
                cp      l
                jr      z,push_18
                jr      z,push_18
        ld      b, #17
        ld      b, #17
        jp      fail_routine
        jp      fail_routine
push_18:        ld      sp,#stack_end
push_18:        ld      sp,#stack_end
Line 304... Line 303...
                cp      l
                cp      l
                jr      z,push_20
                jr      z,push_20
        ld      b, #19
        ld      b, #19
        jp      fail_routine
        jp      fail_routine
push_20:        ld      sp,#stack_end
push_20:        ld      sp,#stack_end
        ld hl, #ex_0
        ld hl, #msg_ex_0
        call print_sub
        call print_sub
ex_0:           ld      de,#0x1234
ex_0:           ld      de,#0x1234
                ld      hl,#0xffff
                ld      hl,#0xffff
                ex      de,hl
                ex      de,hl
                ld      a,#0xff
                ld      a,#0xff
Line 318... Line 317...
        jp      fail_routine
        jp      fail_routine
ex_1:           cp      e
ex_1:           cp      e
                jr      z,ex_2
                jr      z,ex_2
        ld      b, #1
        ld      b, #1
        jp      fail_routine
        jp      fail_routine
ex_2:           ld      a,#12      ;bjp was >#0x1234
ex_2:           ld      a,#0x12      ;bjp was >#0x1234
                cp      h
                cp      h
                jr      z,ex_3
                jr      z,ex_3
        ld      b, #2
        ld      b, #2
        jp      fail_routine
        jp      fail_routine
ex_3:           ld      a,#34      ;bjp was >#0x1234
ex_3:           ld      a,#0x34      ;bjp was >#0x1234
                cp      l
                cp      l
                jr      z,ex_4
                jr      z,ex_4
        ld      b, #3
        ld      b, #3
        jp      fail_routine
        jp      fail_routine
ex_4:           ld      h,#0
ex_4:           ld      h,#0
Line 387... Line 386...
ex_13:          cp      c
ex_13:          cp      c
                jr      z,ex_14
                jr      z,ex_14
        ld      b, #13
        ld      b, #13
        jp      fail_routine
        jp      fail_routine
ex_14:          exx
ex_14:          exx
                ld      a,#12      ;bjp was >#0x1234
                ld      a,#0x12      ;bjp was >#0x1234
                cp      h
                cp      h
                jr      z,ex_15
                jr      z,ex_15
        ld      b, #14
        ld      b, #14
        jp      fail_routine
        jp      fail_routine
ex_15:          ld      a,#34      ;bjp was >#0x1234
ex_15:          ld      a,#0x34      ;bjp was >#0x1234
                cp      l
                cp      l
                jr      z,ex_16
                jr      z,ex_16
        ld      b, #15
        ld      b, #15
        jp      fail_routine
        jp      fail_routine
ex_16:          ld      a,#0xaa
ex_16:          ld      a,#0xaa
Line 488... Line 487...
ex_29:          ld      a,#0xff
ex_29:          ld      a,#0xff
                cp      c
                cp      c
                jr      z,ex_30
                jr      z,ex_30
        ld      b, #29
        ld      b, #29
        jp      fail_routine
        jp      fail_routine
ex_30:          ld      a,#12      ;bjp was >#0x1234
ex_30:          ld      a,#0x12      ;bjp was >#0x1234
                cp      h
                cp      h
                jr      z,ex_31
                jr      z,ex_31
        ld      b, #30
        ld      b, #30
        jp      fail_routine
        jp      fail_routine
ex_31:          ld      a,#34      ;bjp was >#0x1234
ex_31:          ld      a,#0x34      ;bjp was >#0x1234
                cp      l
                cp      l
                jr      z,add_0
                jr      z,add_0
        ld      b, #31
        ld      b, #31
        jp      fail_routine
        jp      fail_routine
add_0:          ld      sp,#stack_end ; reset stack after EX operations
add_0:          ld      sp,#stack_end ; reset stack after EX operations
Line 819... Line 818...
add_73:         cp      #0x80+1
add_73:         cp      #0x80+1
                jr      z,adc_0
                jr      z,adc_0
        ld      b, #73
        ld      b, #73
        jp      fail_routine
        jp      fail_routine
adc_0:          nop
adc_0:          nop
        ld hl, #adc_0
        ld hl, #msg_adc_0
        call print_sub
        call print_sub
                ld      a,#0                 ;clear cry
                ld      a,#0                 ;clear cry
                add     a,#0
                add     a,#0
                ld      b,#0x7f
                ld      b,#0x7f
                adc     a,b                  ;a=7f cry=0
                adc     a,b                  ;a=7f cry=0
Line 1153... Line 1152...
adc_80:         cp      #0x80+1
adc_80:         cp      #0x80+1
                jr      z,sub_0
                jr      z,sub_0
        ld      b, #80
        ld      b, #80
        jp      fail_routine
        jp      fail_routine
sub_0:          nop
sub_0:          nop
        ld hl, #sub_0
        ld hl, #msg_sub_0
        call print_sub
        call print_sub
                ld      a,#0
                ld      a,#0
                ld      b,#1
                ld      b,#1
                sub     a,b
                sub     a,b
                jp      m,sub_1
                jp      m,sub_1
Line 1414... Line 1413...
sub_62:         cp      #0x80+1
sub_62:         cp      #0x80+1
                jr      z,sbc_0
                jr      z,sbc_0
        ld      b, #62
        ld      b, #62
        jp      fail_routine
        jp      fail_routine
sbc_0:          nop
sbc_0:          nop
        ld hl, #sbc_0
        ld hl, #msg_sbc_0
        call print_sub
        call print_sub
                ld      a,#0x7f
                ld      a,#0x7f
                ld      b,#0
                ld      b,#0
                sub     a,b                     ;clear carry flag
                sub     a,b                     ;clear carry flag
                ld      b,#0xff
                ld      b,#0xff
Line 1681... Line 1680...
sbc_65:         cp      #0x55+1
sbc_65:         cp      #0x55+1
                jr      z,and_0
                jr      z,and_0
        ld      b, #65
        ld      b, #65
        jp      fail_routine
        jp      fail_routine
and_0:          nop
and_0:          nop
        ld hl, #and_0
        ld hl, #msg_and_0
        call print_sub
        call print_sub
                ld      a,#0xff
                ld      a,#0xff
                add     a,#1                    ;set carry
                add     a,#1                    ;set carry
                ld      a,#0xff
                ld      a,#0xff
                ld      b,#0xaa
                ld      b,#0xaa
Line 1897... Line 1896...
and_47:         cp      #0x55
and_47:         cp      #0x55
                jr      z,or_0
                jr      z,or_0
        ld      b, #47
        ld      b, #47
        jp      fail_routine
        jp      fail_routine
or_0:           nop
or_0:           nop
        ld hl, #or_0
        ld hl, #msg_or_0
        call print_sub
        call print_sub
                ld      a,#0
                ld      a,#0
                ld      b,#0x7f
                ld      b,#0x7f
                or      a,b
                or      a,b
                jp      p,or_1
                jp      p,or_1
Line 2139... Line 2138...
or_50:          cp      #0x55
or_50:          cp      #0x55
                jr      z,xor_0
                jr      z,xor_0
        ld      b, #50
        ld      b, #50
        jp      fail_routine
        jp      fail_routine
xor_0:          nop
xor_0:          nop
        ld hl, #xor_0
        ld hl, #msg_xor_0
        call print_sub
        call print_sub
                ld      a,#0xff
                ld      a,#0xff
                ld      b,#0x55
                ld      b,#0x55
                xor     a,b
                xor     a,b
                jp      m,xor_1
                jp      m,xor_1
Line 2400... Line 2399...
xor_58:         cp      #0x55
xor_58:         cp      #0x55
                jr      z,cp_0
                jr      z,cp_0
        ld      b, #58
        ld      b, #58
        jp      fail_routine
        jp      fail_routine
cp_0:           nop
cp_0:           nop
        ld hl, #cp_0
        ld hl, #msg_cp_0
        call print_sub
        call print_sub
                ld      a,#0
                ld      a,#0
                ld      b,#0
                ld      b,#0
                cp      a,b
                cp      a,b
                jr      z,cp_1
                jr      z,cp_1

powered by: WebSVN 2.1.0

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