|
楼主 |
发表于 2010-9-5 02:31:37
|
显示全部楼层
$regfile = "m32def.dat"
$crystal = 20000000 'Used crystal frequency
'st2=sdoux tft 2.0
Waitms 200
$hwstack = 120 'Hardware stack
$swstack = 120 'SW stack
$framesize = 120 'Frame space
'**************************************************************************************
$include "Config_MMC.bas"
$include "Config_AVR-DOS.BAS"
Config Portd.7 = Output
Led Alias Portd.7
Config Portb.0 = Input
Config Portb.1 = Input
Config Portb.2 = Input
Config Portb.3 = Input
Portb.0 = 1
Portb.1 = 1
Portb.2 = 1
Portb.3 = 1
Kx Alias Pinb.0
Ko Alias Pinb.1
Ku Alias Pinb.2
Kd Alias Pinb.3
Dim S As String * 4
$lib "glcdKS108.lib"
$include "FONT8X6.font"
Config Graphlcd = 128 * 64sed , Dataport = Porta , Controlport = Portc , Ce = 3 , Ce2 = 4 , Cd = 7 , Rd = 6 , Reset = 2 , Enable = 5
Cls
Circle(30 , 30) , 10 , 1
Led = 1
Setfont Font8x6
'**************************************************************************************
Declare Sub Diskinsertion()
Dim Diskinitialized As Bit
Diskinitialized = 0
$baud = 115200
Open "Com1:" As Binary As #1
Enable Interrupts
Print #1 , "STARTING SYSTEM" ' Log that we are ready to work.
Call Diskinsertion()
'======================================================================================
Dim Ramy As Byte , Ramx As Byte , Fnum As String * 16 , Fnumb As Byte
Dim Mvdat As Byte , Partx_arr As Byte , Y_arr As Byte
Do
Cls
Lcdat 1 , 1 , "Press any key to play."
Waitms 100
If Ko = 0 Then
Waitms 800
Gosub Mvplay
End If
Loop
End
'**************************************************************************************
'*
'* Get disk parameters and reset archive status.
'* This routine is meant to be called when a disk change is detected,
'* or when the system is powered-up.
'* At power up, attempts setting the clock according to the time of most recent file,
'* and salutes users with a system settings summary.
'* Logs disk parameters on I/O stream #1 (connect to PC serial port for debug)
'*
'**************************************************************************************
Sub Diskinsertion()
Local Errorcode As Byte
Diskinitialized = 0
Lcdat 1 , 1 , "Initialize disk... "
Gbdriveerror = Driveinit()
If Gbdriveerror = 0 Then
Print #1 , "Initialize File System ... "
' Select partition 1 (or use 0 for drive without Master Boot Record)
Errorcode = Initfilesystem(1)
If Errorcode <> 0 Then
Print #1 , "Error: " ; Errorcode ; " while initializing file system"
Else
Cls
Print #1 , "Filesystem type: " ; Gbfilesystem
Print #1 , "FAT Start Sector: " ; Glfatfirstsector
Print #1 , "Root Start Sector: " ; Glrootfirstsector
Print #1 , "Data First Sector: " ; Gldatafirstsector
Print #1 , "Max. Cluster Nummber: " ; Glmaxclusternumber
Print #1 , "Sectors per Cluster: " ; Gbsectorspercluster
Print #1 , "Root Entries: " ; Gwrootentries
Print #1 , "Sectors per FAT: " ; Glsectorsperfat
Print #1 , "Number of FATs: " ; Gbnumberoffats
Lcdat 1 , 1 , "Disk size: " ; Disksize() ; " kB"
Lcdat 2 , 1 , "Disk free: " ; Diskfree() ; " kB"
Diskinitialized = 1
Lcdat 4 , 1 , "init ok"
End If
Else
Cls
Lcdat 1 , 1 , "Error during Drive Init: " ; Gbdriveerror
End If
End Sub
Mvplay:
Cls : Fnum = "MOV" + Str(fnumb) + ".SVI"
Open Fnum For Input As #3
Ramy = 184
Ramx = 64
Do
Glcdcmd Ramy , 1 'y=1 a 184
Glcdcmd Ramx , 1 'x=1 a 64
Partx_arr = 0
Do 'a
Line Input #3 , S
Mvdat = Val(s)
Glcddata Mvdat
Partx_arr = Partx_arr + 1
If Partx_arr = 64 Then Exit Do
Loop
Partx_arr = 0
Glcdcmd Ramy , 2 'y=1 b
Glcdcmd Ramx , 2 'x=1 b
Do 'b
Line Input #3 , S
Mvdat = Val(s)
Glcddata Mvdat
Partx_arr = Partx_arr + 1
If Partx_arr = 64 Then Exit Do
Loop
Ramy = Ramy + 1
If Ramy = 192 Then
Ramy = 184 '191 full
Line Input #3 , S
If S = "e" Then Exit Do
Gosub Keyfn
End If
Loop
Close #3
Return
Keyfn:
If Ko = 0 Then
Cls : Lcdat 1 , 1 , "Paulse"
Waitms 800
Do
If Ko = 1 Then Exit Do
Loop
Waitms 800
Do
If Ko = 0 Then Exit Do
Loop
End If
If Ku = 0 Then
Cls : Lcdat 1 , 1 , "NEXT"
Waitms 800
Do
If Ku = 1 Then Exit Do
Loop
Close #3 : Fnumb = Fnumb + 1
Goto Mvplay
End If
If Kd = 0 Then
Cls : Lcdat 1 , 1 , "PREV."
Waitms 800
Do
If Kd = 1 Then Exit Do
Loop
Close #3 : Fnumb = Fnumb - 1
Goto Mvplay
End If
Return |
|