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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [bench/] [asm/] [helloworld.S] - Blame information for rev 133

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 dgisselq
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;
3
; Filename:     helloworld.S
4
;
5
; Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
;
7
; Purpose:      A test of whether or not we can scroll a message on a
8
;               seven segment display.  This depends upon the seven segment
9
;               display driver (not included) being installed at position
10
;               0x15 in memory.  If so, this scrolls the message:
11
;               "HELLO UJorld." across the 4 seven segment display digits.
12
;
13
;               This test discovered that right shifting by 31 or more did
14
;               not result in zero as desired.  It also discovered that the
15
;               .DAT assembly instruction did not function as desired.  Both
16
;               bugs were fixed to get this to work.
17
;
18
; Creator:      Dan Gisselquist, Ph.D.
19 69 dgisselq
;               Gisselquist Technology, LLC
20 12 dgisselq
;
21
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22
;
23
; Copyright (C) 2015, Gisselquist Technology, LLC
24
;
25
; This program is free software (firmware): you can redistribute it and/or
26
; modify it under the terms of  the GNU General Public License as published
27
; by the Free Software Foundation, either version 3 of the License, or (at
28
; your option) any later version.
29
;
30
; This program is distributed in the hope that it will be useful, but WITHOUT
31
; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
32
; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
33
; for more details.
34
;
35
; License:      GPL, v3, as defined and found on www.gnu.org,
36
;               http://www.gnu.org/licenses/gpl.html
37
;
38
;
39
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40
;
41
; Register map
42
;       R12 peripherals
43
;       R11  timer length
44
;       R10  value to clear/reset the PIC
45
;       uR12 = memory
46
;       uR11 = rawsseg
47
;       uR9  = state
48
;       R8   = new value for SSEG
49
build_supervisor_state:
50
        CLR     R12             ; Load a pointer to our peripherals
51
        LDIHI   $c000h,R12
52
        LDI     $5f5e1h,R11     ; An amount to reset the timer to: 1/4 sec
53
        LSL     $6,R11
54
        LDIHI   $8010h,R10      ; A value to clear/reset the PIC for timerA ints
55
        LDILO   $ffffh,R10
56
        MOV     $1+PC,uR12      ; User memory (so this isn't supervisor state..)
57
        BRA     $4
58
        .DAT    $0x6e9e1c1c     ; Raw SSEG for 'HELL'
59
        .DAT    $0xfc007c70     ; Raw SSEG for 'O UJ'
60
        .DAT    $0x3a0a607b     ; Raw SSEG for 'orld.'
61
        .DAT    $0x00000000     ; Raw SSEG for '    '
62
build_user_state:
63
        LDI     $15h,R0
64
        MOV     R0,uR11
65
        MOV     $6+PC,uPC
66
        CLR     R0
67
        MOV     R0,uR9
68
repeat:
69
        STO     R11,$4(R12)     ; Reset the timer
70
        STO     R10,(R12)       ; Reset the PIC
71
        RTU
72
        BRA     $-4
73
user_task:
74
        MOV     R9,R0
75
        LSR     $2,R0
76
        ADD     R12,R0
77
        LOD     (R0),R8         ; Read the left word
78
        MOV     R9,R1           ; Rotate it into place
79
        AND     $3,R1
80
        LSL     $3,R1           ; Multiply by eight
81
        LSL     R1,R8           ; Shift words to left by 0,8,16,24 bits
82
 
83
        ADD     $1,R0           ; Calculate address of next word
84
        CMP     $4+R12,R0
85
        SUB.GE  $4,R0
86
        LOD     (R0),R2         ; Load the next word into a building location
87
        LDI     $32,R3
88
        SUB     R1,R3
89
        LSR     R3,R2
90
        OR      R2,R8           ; Put the two together
91
 
92
        STO     R8,(R11)        ; Store the result
93
 
94
        ADD     $1,R9           ; Increment our state
95
        AND     $15,R9
96
 
97
        WAIT                    ; Wait for the next interrupt
98
        BRA     $-21            ; Back up to the top to start over
99
 
100
        BREAK
101
        BREAK
102
        BREAK

powered by: WebSVN 2.1.0

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