URL
https://opencores.org/ocsvn/z80soc/z80soc/trunk
Subversion Repositories z80soc
[/] [z80soc/] [branches/] [RonivonCosta/] [ROM/] [SoC_PS2.z8a] - Rev 31
Compare with Previous | Blame | View Log
ld sp,0FFFFh ; Put Stack on top of memoryinicio:call clearld hl,8242ld de,Text1call printmsgld hl,8282ld de,Text2call printmsgcall Borderld hl,8518ld de,Text3call printmsgld hl,8598ld de,Text4call printmsgld hl,8678ld de,Text5call printmsgld hl,8758ld de,Text6call printmsgld hl,8798ld de,Text7call printmsgsetDelay: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 resetsetprint:ld de,8918ld bc,30loopprint:call read_kbdcp 41hjr z,go_onOUT (11H),Ald (de),ainc dedec bcld a,bor cjr z,setprintjr loopprintgo_on:ld hl,4000h ; RAM Addressld a,0 ; Value to store in memoryloop1:ld (hl),a ; Store A into Memory (HL)inc hl ; Point to next memory locationinc a ; Add 1 to value to store in memoryjr 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,1out (01h),acall delaycall delaycall delaycall read_key0 ; Wait until KEY0 is pressedcall delaycall read_key0;ld hl,4000h ; Get back the start RAM addressloop2:ld a,hout (11h),ald a,lout (10h),ald a,(hl) ; Read back the values stored in loop1out (01h),a ; Send to Green Ledscall delay ; Call sub-routine to delay some timeinc hl ; Add 1 to the memory locationld a,(hl) ; Read the value in the memorycp FFh ; check if equal 255jr nz,loop2 ; If not equal 255, continue loop2; end of First executionld a,00h ;out (01h),a ; Turn off ledsout (02h),acall read_key0 ; Wait until KEY0 is pressedjP inicio ; Restart programread_key0:loop3:call delayin a,(30h) ; Read KEYs (all 4 KEYs)out (10h),acp 0Eh ; check if returns "00001110"jr nz,loop3 ; KEY0 not pressed, continue checkingretiodelay:ld a,(0E000h) ; Read the number of times to looploop4:dec a ; Start counting backwardsjr nz,loop4 ; If A greather than 0, continue loopret ; return to calling programdelay:ld a,(0E000h) ; Read the delay mulpitplierloop5:PUSH afld a,ffh ; Every delay has at least 255 loopsloop6:dec a ; Start counting backwardsjr nz,loop6 ; If A greather than 0, continue looppop af ; Get multiplier backdec a ;jr nz,loop5ret ; return to calling programclear:ld hl,2000hld de,1200clean_loop:ld a,20hld (hl),ainc hldec deld a,dor ejr nz,clean_loopretprintmsg:ploop:ld a,(de)or aret zld (hl),ainc hlinc dejr ploopread_kbd:call delayin a,(80h)or ajr z,read_kbdretBorder:ld de,Lineuld hl,8437call printmsgld hl,8477ld a,10brdloop:ld de,Columnpush afpush hlcall printmsgpop hlpop afld bc,40add hl,bcdec ajr nz,brdloopld de,Linedcall printmsgretText1:db "Z80 SYSTEM ON CHIP"db 0Text2:db "RONIVON COSTA 2008"db 0Text3:db 0Text4:db " ABCDEFGHIJKLMNOPQRSTUVWXYZ"db 0Text5:db " abcdefghijklmnopqrstuvwxyz"db 0Text6:db " 0123456789"db 0Text7: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,31db 0Lineu: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,187db 0Lined: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,188db 0Column:db 186db " "db 186db 0
