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

Subversion Repositories z80soc

[/] [z80soc/] [branches/] [RonivonCosta/] [DE1/] [ROM/] [SoC_PS2.z8a] - Rev 31

Compare with Previous | Blame | View Log


           ld          sp,0FFFFh          ; Put Stack on top of memory
inicio:
           call        clear
           ld          hl,8242
           ld          de,Text1
           call        printmsg
           ld          hl,8282
           ld          de,Text2
           call        printmsg
           call        Border
           ld          hl,8518
           ld          de,Text3
           call        printmsg
           ld          hl,8598
           ld          de,Text4
           call        printmsg
           ld          hl,8678
           ld          de,Text5
           call        printmsg
           ld          hl,8758
           ld          de,Text6
           call        printmsg
           ld          hl,8798
           ld          de,Text7
           call        printmsg
setDelay:
           in a,(20h)           ; Read SW(7-0)
           ld (0E000h),a         ; Stores delay multiplier
                                ; to be used in Delay routine
                                ; This value it is set only when
                                ; Z80 is reset


setprint:
           ld          de,8918
           ld          bc,30
loopprint:
           call        read_kbd
           cp          41h
           jr          z,go_on
           OUT         (11H),A
           ld          (de),a
           inc         de
           dec         bc
           ld          a,b
           or          c
           jr          z,setprint
           jr          loopprint
go_on:
           ld hl,4000h          ; RAM Address
           ld a,0               ; Value to store in memory
loop1:
           ld (hl),a            ; Store A into Memory (HL)
           inc hl               ; Point to next memory location
           inc a                ; Add 1 to value to store in memory
           jr nz,loop1          ; If A not equal 0 continue loop1
                                ; When A=FFh, and we make A=A+1 ...
                                ; A becomes 100h
                                ; But, A is an 8 bits register, and
                                ; can only store the two last hex digits,
                                ; that is, 8 bits.
           ld          a,1
           out         (01h),a
           call        delay
           call        delay
           call        delay
           call        read_key0       ; Wait until KEY0 is pressed
           call        delay
           call        read_key0
                                ;
           ld hl,4000h          ; Get back the start RAM address
loop2:
           ld a,h
           out (11h),a
           ld a,l
           out (10h),a
           ld a,(hl)            ; Read back the values stored in loop1
           out (01h),a          ; Send to Green Leds
           call delay           ; Call sub-routine to delay some time
           inc hl               ; Add 1 to the memory location
           ld a,(hl)            ; Read the value in the memory
           cp FFh               ; check if equal 255
           jr nz,loop2          ; If not equal 255, continue loop2
                                ; end of First execution
           ld a,00h             ;
           out (01h),a          ; Turn off leds
           out (02h),a
           call read_key0       ; Wait until KEY0 is pressed
           jP inicio            ; Restart program
read_key0:
loop3:
           call delay
           in a,(30h)           ; Read KEYs (all 4 KEYs)
           out (10h),a
           cp 0Eh               ; check if returns "00001110"
           jr nz,loop3          ; KEY0 not pressed, continue checking
           ret                  
iodelay:
           ld a,(0E000h)         ; Read the number of times to loop
loop4:
           dec a                ; Start counting backwards
           jr nz,loop4          ; If A greather than 0, continue loop
           ret                  ; return to calling program
delay:
           ld a,(0E000h)         ; Read the delay mulpitplier
loop5:
           PUSH af
           ld a,ffh             ; Every delay has at least 255 loops
loop6:
           dec a                ; Start counting backwards
           jr nz,loop6          ; If A greather than 0, continue loop
           pop af               ; Get multiplier back
           dec a                ;
           jr nz,loop5
           ret                  ; return to calling program
clear:
        ld      hl,2000h
        ld      de,1200
clean_loop:
        ld      a,20h
        ld      (hl),a
        inc     hl
        dec     de
        ld      a,d
        or      e
        jr      nz,clean_loop
        ret
printmsg:

ploop:

        ld      a,(de)
        or      a
        ret     z
        ld      (hl),a
        inc     hl
        inc     de
        jr      ploop
read_kbd:
         call   delay
         in     a,(80h)
         or     a
         jr     z,read_kbd
         ret
Border:
           ld        de,Lineu
           ld        hl,8437
           call      printmsg
           ld        hl,8477
           ld        a,10
brdloop:
           ld        de,Column
           push      af
           push      hl
           call      printmsg
           pop       hl
           pop       af
           ld        bc,40
           add       hl,bc
           dec       a
           jr        nz,brdloop
           ld        de,Lined
           call      printmsg
           ret
Text1:
           db                   "Z80 SYSTEM ON CHIP"
           db                   0
Text2:
           db                   "RONIVON COSTA 2008"
           db                   0
Text3:
           db                   0
Text4:
           db                   "  ABCDEFGHIJKLMNOPQRSTUVWXYZ"
           db                   0
Text5:
           db                   "  abcdefghijklmnopqrstuvwxyz"
           db                   0
Text6:
           db                   "         0123456789"
           db                   0
Text7:
           db                   2,3,4,11,12,13,14,18,24,25,26,27,232,233,235,187,188,138,134,135,129,128,1,6,7,8,9,10,29,31
           db                   0
Lineu:
           db                   201,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,187
           db                   0
Lined:
           db                   200,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,205,188
           db                   0

Column:
           db                   186
           db                   "                              "
           db                   186
           db                   0

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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