The Depths of Insanity
Would you like to react to this message? Create an account in a few clicks or log in to continue.
The Depths of Insanity

Where?
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log in  

 

 simon code

Go down 
AuthorMessage
Heliumbanana
Admin
Admin
Heliumbanana


Posts : 269
Join date : 2009-08-13
Age : 34

simon code Empty
PostSubject: simon code   simon code EmptyFri Nov 27, 2009 1:52 pm

Start
enable port t and port m

goes to play music
Run
Play
load sequence number from a
read sequence
play sequence
end if end is set to 1
Loop
enable interupts
reading
read sequence
wait for button
if right
wait
increment sequence
if end of sequence play win sequence set end=1
if wrong
go to play fail sequence set end = 1

PTT: equ $00000240 ;*** PTT - Port T I/O

Register
PTIT: equ $00000241 ;*** PTIT - Port T Input

Register
DDRT: equ $00000242 ;*** DDRT - Port T Data

Direction Register
RDRT: equ $00000243 ;*** RDRT - Port T

Reduced Drive Register
PERT: equ $00000244 ;*** PERT - Port T Pull

Device Enable Register
PPST: equ $00000245 ;*** PPST - Port T

Polarity Select Register

;*** PTM - Port M I/O Register; 0x00000250 ***
PTM: equ $00000250 ;*** PTM - Port M I/O

Register
PTIM: equ $00000251 ;*** PTIM - Port M Input

Register
DDRM: equ $00000252 ;*** DDRM - Port M Data

Direction Register
RDRM: equ $00000253 ;*** RDRM - Port M

Reduced Drive Register
PERM: equ $00000254 ;*** PERM - Port M Pull

Device Enable Register
PPSM: equ $00000255 ;*** PPSM - Port M

Polarity Select Register
WOMM: equ $00000256 ;*** WOMM - Port M

Wired-Or Mode Register

Entry lds #STACK
bsr Tmr_Init
cli
WLoop wai
ldd TC5
std StartTime
wai
ldd TC5
std MidTime
wai
ldd TC5
std EndTime
subd StartTime
std Period


movb #$FF, DDRT
movb #$2f, DDRM
ldab #10
ldaa #$99
daa
bsr Write

Loop
bsr Wait
cmpa #0
beq InOnes
adda #$99
daa
bsr Write
bra Loop

Done
Back to top Go down
http://tdoi.vampire-legend.com
Heliumbanana
Admin
Admin
Heliumbanana


Posts : 269
Join date : 2009-08-13
Age : 34

simon code Empty
PostSubject: Re: simon code   simon code EmptyFri Nov 27, 2009 4:01 pm

********************************************************************************
**
** File: templateREL.asm
**
** Author: Dr. McGaughey
**
** Description: This file contains a template for relocatable assembly code
**
** Revision History: Rev 0: 17 Nov 09
**
********************************************************************************

; Stack initialization
XREF __SEG_END_SSTACK


; export symbols
XDEF Entry ; export 'Entry' symbol
XDEF myISR1, myISR2 ; export ISR names

INCLUDE "eee351.inc"

************Constants*********************


; ***** Define global variables
MY_GLOBALS SECTION
; Add global variables here


************ Constants **************************
MY_CONSTANTS SECTION
; Add constants here

;********************************************************************************
;*
;* Subroutine: Entry
;*
;* Description: The main routine of the any program
;*
;* Inputs:
;*
;* Outputs:
;*
;* Notes:
;********************************************************************************

MY_CODE SECTION

Entry lds #__SEG_END_SSTACK ; Set up stack (needed for bsr/rts instructions).
; Add yout code here
; ...
; ...
bgnd
bgnd

;********************************************************************************
;*
;* Subroutine:
;*
;* Description:
;*
;* Inputs:
;*
;* Outputs:
;*
;* Notes:
;********************************************************************************
mySubRoutine:
; Add your code here
; ...
; ...

rts

;********************************************************************************
;* myISR1:
;*
;* Description: Code for an interrupt service routine
;*
;* Inputs:
;* Outputs: masterTimerCnt - semaphore to indicate a master timer has expired
;********************************************************************************
myISR1
; Add your code here
; ...
; ...

rti
Back to top Go down
http://tdoi.vampire-legend.com
Heliumbanana
Admin
Admin
Heliumbanana


Posts : 269
Join date : 2009-08-13
Age : 34

simon code Empty
PostSubject: Re: simon code   simon code EmptyFri Nov 27, 2009 4:01 pm

PTT: equ $00000240 ;*** PTT - Port T I/O

Register
PTIT: equ $00000241 ;*** PTIT - Port T Input

Register
DDRT: equ $00000242 ;*** DDRT - Port T Data

Direction Register
RDRT: equ $00000243 ;*** RDRT - Port T

Reduced Drive Register
PERT: equ $00000244 ;*** PERT - Port T Pull

Device Enable Register
PPST: equ $00000245 ;*** PPST - Port T

Polarity Select Register

;*** PTM - Port M I/O Register; 0x00000250 ***
PTM: equ $00000250 ;*** PTM - Port M I/O

Register
PTIM: equ $00000251 ;*** PTIM - Port M Input

Register
DDRM: equ $00000252 ;*** DDRM - Port M Data

Direction Register
RDRM: equ $00000253 ;*** RDRM - Port M

Reduced Drive Register
PERM: equ $00000254 ;*** PERM - Port M Pull

Device Enable Register
PPSM: equ $00000255 ;*** PPSM - Port M

Polarity Select Register
WOMM: equ $00000256 ;*** WOMM - Port M

Wired-Or Mode Register

Entry lds #STACK
bsr Tmr_Init
cli
WLoop wai
ldd TC5
std StartTime
wai
ldd TC5
std MidTime
wai
ldd TC5
std EndTime
subd StartTime
std Period


movb #$FF, DDRT
movb #$2f, DDRM
ldab #10
ldaa #$99
daa
bsr Write

Loop
bsr Wait
cmpa #0
beq InOnes
adda #$99
daa
bsr Write
bra Loop

Done
Back to top Go down
http://tdoi.vampire-legend.com
Heliumbanana
Admin
Admin
Heliumbanana


Posts : 269
Join date : 2009-08-13
Age : 34

simon code Empty
PostSubject: Re: simon code   simon code EmptyFri Nov 27, 2009 6:44 pm

;********************************************************************************
;**
;** File: templateREL.asm
;**
;** Author: Dr. McGaughey
;**
;** Description: This file contains a template for relocatable assembly code
;**
;** Revision History: Rev 0: 17 Nov 09
;**
;********************************************************************************

; Stack initialization
XREF __SEG_END_SSTACK


; export symbols
XDEF Entry ; export 'Entry' symbol
XDEF myISR1; export ISR names

INCLUDE "eee351.inc"

;************Constants*********************


; ***** Define global variables
MY_GLOBALS SECTION
; Add global variables here
tens DS.W 1
DONE DS.B 1
StartTime DS.W 1
MidTime DS.W 1
EndTime DS.W 1
Period DS.W 1
endtime DS.W 1
Perioda DS.W 1
count DC.B 0
duration DS.W 1



;************ Constants **************************
MY_CONSTANTS SECTION

;********************************************************************************
;*
;* Subroutine: Entry
;*
;* Description: The main routine of the any program
;*
;* Inputs:
;*
;* Outputs:
;*
;* Notes:
;********************************************************************************

MY_CODE SECTION

Entry lds #__SEG_END_SSTACK ; Set up stack (needed for bsr/rts instructions).
; Add yout code here
; ...
; ...

ldd #000 ;32 base 0 = no noise
std Perioda
bsr Tmr_Init
movb #$FF, DDRT
movb #$3f, DDRM
cli
WLoop
wai
ldd TC5
std StartTime
wai
ldd TC5
std MidTime
wai
ldd TC5
std EndTime
subd StartTime
std Period

bra WLoop

bgnd

;********************************************************************************
;*
;* Subroutine:
;*
;* Description:
;*
;* Inputs:
;*
;* Outputs:
;*
;* Notes:
;********************************************************************************
; Add your code here
; ...
; ...
Tmr_Init movb #$05,TSCR2
movb #$80,TSCR1
movb #$20,TIOS
movb #$20,TIE
ldd TCNT
addd Perioda
std TC5
rts

;********************************************************************************
;* myISR1:
;*
;* Description: Code for an interrupt service routine
;*
;* Inputs:
;* Outputs: masterTimerCnt - semaphore to indicate a master timer has expired
;********************************************************************************
myISR1
; Add your code here
; ...
; ...
movb #$20,TFLG1

ldd TC5
addd Perioda
std TC5
ldaa PTM
eora #$20
staa PTM
rti
Back to top Go down
http://tdoi.vampire-legend.com
Heliumbanana
Admin
Admin
Heliumbanana


Posts : 269
Join date : 2009-08-13
Age : 34

simon code Empty
PostSubject: Re: simon code   simon code EmptyFri Dec 04, 2009 2:34 am

***********************************************************************************
* Lab 9 - ECE 171 - Fall 2005 *
* Simon Says *
* *
* Programmer: Sean P. O. MacCath-Moran *
* Date: 07 Apr 2005 *
* *
* *
***********************************************************************************
******************** DATA *******************
DIPSWITCHES EQU $1003
*1 & 2 reserved for PC0 and PC1
DIPSWITCH1 EQU $01
DIPSWITCH2 EQU $02
*3 & 4 set nothing
DIPSWITCH3 EQU $04
DIPSWITCH4 EQU $08
*5, 6 & 7 set nothing
DIPSWITCH5 EQU $10
DIPSWITCH6 EQU $20
DIPSWITCH7 EQU $40
*Termination switch
DIPSWITCH8 EQU $80
********************* CODE *******************
ORG $AFFF
RANDVAL RMB 1 ;randomizing value for next light
SEQLENGTH RMB 1 ;current lengh of memorized sequence
SEQUENCE RMB 40
***************** MAIN PROGRAM ***************
START ORG $8800 ;start out in timbucktoo
LDS #$DFFF ;initialize stack pointer.
JSR KEYSCANINIT ;initialize keypad usage
JSR MIMICINIT ;initialize MIMIC usage
LDY #MIMICFLAGS ;retrieve address of mimic flags
WAITAGAIN JSR INITnWAIT ;wait for user to press key
CLR SEQLENGTH ;init sequence length to 0
GETNEXTSEQ JSR INCSEQ ;get new value onto SEQUENCE stack
JSR DISPLAY ;show the current sequence to the user
JSR MIMIC ;accept sequence of button presses
BRCLR 0,Y MIMICFLAGERR GETNEXTSEQ
;if no errorflag, then get next value
JSR ERRORDISPLAY ;display error message to user
ENDISNIGH LDAA #DIPSWITCH8 ;check for end switch
BITA DIPSWITCHES
BEQ ENDISWAYNEIGH
JMP WAITAGAIN ;keep up with loop until switch set ENDISWAYNEIGH SWI ;ok - love ya - bye bye now
* Main END ************************************************************************
***********************************************************************************
* Initialize and Wait *
* *
* PURPOSE: Setup for next game start and wait for user interaction *
* *
* USE: Call the function *
* *
* MODIFIES: Flags *
* *
***********************************************************************************
********************* DATA *******************
INITPORTB EQU $1004
INITPAUSETIME EQU 2
****************** CODE START ****************
INITnWAIT PSHB ;save the B reg state
PSHA ;save the A reg state
PSHY ;save the X reg state
CLR INITPORTB ;blank out the LEDs
LDY #KEYPADFLAGS ;load X with address of flags
INITnWAIT1 LDAA #INITPAUSETIME ;setup to pause for about 1/4 second
JSR DELAY10X ;pause for x/10th second
INC RANDVAL ;set random value to next digit
JSR KEYSCAN ;check status of keypad
BRCLR 0,Y KEYPADFLAGPRE INITnWAIT1

;wait until a key is pressed
LDAB KEYPADKEYCHK ;retrieve the key being pressed
JSR DISPLAYKEY ;display this key to user while it's being pressed
INITnWAIT2 JSR KEYSCAN ;check status of keypad
BRSET 0,Y KEYPADFLAGPRE INITnWAIT2
;wait until key is released
CLR INITPORTB ;blank out the LEDs
PULY ;restore the X reg state
PULA ;restore the A reg state
PULB ;restore the B reg state
RTS ;return to sender *weg*
* INITnWAIT END *******************************************************************
***********************************************************************************
* Increment Sequence *
* *
* PURPOSE: generate the next value in the sequence *
* *
* USE: Call the function *
* *
* MODIFIES: Flags *
* *
***********************************************************************************
********************* DATA *******************
INCSEQVALMASK EQU %00000011 ;mask to retrieve bits used in random value
****************** CODE START ****************
INCSEQ PSHX ;save the X reg state
PSHB ;save the B reg state
PSHA ;save the A reg state
LDX #SEQUENCE ;retrieve memory position of SEQUENCE
LDAB SEQLENGTH ;retrieve lench of SEQUENCE
ABX ;move X to end of sequence
LDAA RANDVAL ;retrieve the current random value
ANDA #INCSEQVALMASK ;keep only those values in mask
INCA ;add 1 to value for use as index
STAA 0,X ;store new value at end of SEQUENCE
INC SEQLENGTH ;increase length of sequence by 1
PULA ;restore the A reg state
PULB ;restore the B reg state
PULX ;restore the X reg state
RTS ;return to sender *weg*
* INITnWAIT END *******************************************************************
***********************************************************************************
* Accept Sequence *
* *
* PURPOSE: Accpept button presses from user and check them against the SEQUENCE. *
* If a wrong key is pressed or if more than three seconds elapses in *
* waiting for a button, then MIMIC will abort with an error. If all *
* keys are pressed correctly, then MIMIC returns with no ERROR. *
* *
* USE: Call the function *
* *
* MODIFIES: Flags *
* *
***********************************************************************************
********************* DATA *******************
MIMICFLAGERR EQU %00000001 ;flag for user error detected
MIMICFLAGB EQU %00000010 ;flag for ?
MIMICFLAGC EQU %00000100 ;flag for ?
MIMICFLAGD EQU %00001000 ;flag for ?
MIMICFLAGE EQU %00010000 ;flag for ?
MIMICFLAGF EQU %00100000 ;flag for ?
MIMICFLAGG EQU %01000000 ;flag for ?
MIMICFLAGH EQU %10000000 ;flag for ?
MIMICPAUSETIM EQU 2
MIMICBCNTRVAL EQU 15
MIMICPORTB EQU $1004
****************** CODE **********************
MIMICFLAGS RMB 1 ;status flags for MIMIC
;0 = Error,
;1 = ?, 2 = ?, 3 = ?, 4 = ?, 5 = ?, 6 = ?, 7 = ?
MIMICBCNTR RMB 1 ;BCounter value
MIMICSCNTR RMB 1 ;SEQLENGTH value
****************** CODE INITIALIZATION *******
MIMICINIT
CLR MIMICFLAGS ;clear all flags
RTS ;return to sender *weg*
****************** CODE START ****************
MIMIC PSHB ;save the B reg state
PSHA ;save the A reg state
PSHY ;save the X reg state
PSHX ;save the X reg state
LDY #MIMICFLAGS ;retrieve location of flags
BSET 0,Y MIMICFLAGERR ;set the error flag
LDY #KEYPADFLAGS ;load Y with address of flags
LDX #SEQUENCE ;retrieve memory position of SEQUENCE
LDAA SEQLENGTH ;retrieve the SEQLENGTH
STAA MIMICSCNTR ;init the total sequence length count
MIMICNEXTBUT LDAA #MIMICBCNTRVAL ;retrive BCOUNTER value
STAA MIMICBCNTR ;initialize BCOUNTER value
MIMICWAITBUT INC RANDVAL ;set random value to next digit
LDAA #MIMICPAUSETIM ;setup pause count
JSR DELAY10X ;pause for x/10th second
DEC MIMICBCNTR ;count down pause timer
BEQ MIMICEND ;if out of time, then end
JSR KEYSCAN ;check status of keypad
BRCLR 0,Y KEYPADFLAGPRE MIMICWAITBUT
;wait for button pressed status
LDAA 0,X ;retrieve value pointed to by stack
CMPA KEYPADKEYCHK ;check for match with value from KEYSCAN
BNE MIMICEND ;wrong button pressed
LDAB KEYPADKEYCHK ;retrieve the key being pressed
JSR DISPLAYKEY ;display this key to user while it's being pressed
MIMICWAITREL JSR KEYSCAN ;check status of keypad
BRSET 0,Y KEYPADFLAGPRE MIMICWAITREL
;wait for button released status
CLR MIMICPORTB ;blank out the LEDs
INX ;point at next value
DEC MIMICSCNTR ;count off another success
BNE MIMICNEXTBUT ;go wait for next button press if not done
LDY #MIMICFLAGS ;retrieve location of flags
BCLR 0,Y MIMICFLAGERR ;clear the error flag
MIMICEND
PULX ;restore the X reg state
PULY ;restore the X reg state
PULA ;restore the A reg state
PULB ;restore the B reg state
RTS ;return to sender *weg*
* INITnWAIT END *******************************************************************
***********************************************************************************

* Display Sequence *
* *
* PURPOSE: Display the required sequence to the user *
* *
* USE: Call the function *
* *
* MODIFIES: Flags *
* *
***********************************************************************************
201 ********************* DATA *******************
202 DISPLAYPORTB EQU $1004
203 DISPLAYPAUSE EQU 3
204 ****************** CODE **********************
205 DISPLAYINDEX RMB 1
206 ****************** CODE START ****************
207 DISPLAY PSHB ;save the B reg state
208 PSHA ;save the A reg state
209 PSHX ;save the X reg state
210 LDAA SEQLENGTH ;retrieve current length
211 STAA DISPLAYINDEX ;init index to length
212 LDAA #DISPLAYPAUSE ;init time to pause for each cycle
213 LDX #SEQUENCE ;point at the next value to display
214 DISPLAYNEXT CLR DISPLAYPORTB ;clear the LEDs
215 JSR DELAY10X ;pause for DISPLAYPAUSE/10th sec
216 LDAB 0,X ;retrieve the next value in SEQUENCE
217 JSR DISPLAYKEY ;display the next value in SEQUENCE
218 JSR DELAY10X ;pause for DISPLAYPAUSE/10th sec
219 INX ;point at the next value to display
220 DEC DISPLAYINDEX ;completed another loop
221 BNE DISPLAYNEXT ;show next value if not done
222 CLR DISPLAYPORTB ;clear the LEDs
223 PULX ;restore the X reg state
224 PULA ;restore the A reg state
225 PULB ;restore the B reg state
226 RTS ;return to sender *weg*
227 * INITnWAIT END *******************************************************************
228 ***********************************************************************************
229 * Check Next Key *
230 * *
231 * PURPOSE: Retrieve the next key being pressed, returning indicators via flags *
232 * to determine if a key has been pressed, is being pressed, or was just *
233 * pressed. *
234 * *
235 * USE: Call function and examine flags to determine keypad status. *
236 * *
237 * MODIFIES: Flags *
238 * *
239 ***********************************************************************************
240 ********************* DATA *******************
241 KEYPADLAST EQU 3333 ;Holds the last key value pressed
242 KEYPADPRTG EQU $6200 ;keypad memory address
243 KEYPADPRTGMSK EQU $6202 ;keypad mask memory address
244 KEYPADPRTGINI EQU %00001111 ;mask for DDRG
245 KEYPADCNTROWS EQU 4 ;number of rows of buttons to initialize to
246 KEYPADCNTCOLS EQU 4 ;number of columns of buttons to initialize to
247 KEYPADCNTBUTS EQU 16 ;total number of buttons to initialize too
248 KEYPADSCANPAT EQU %11110111 ;starting scan pattern for keypad
249 KEYPADFLAGDET EQU %00000001 ;flag for no current activity detected
250 KEYPADFLAGPRE EQU %00000010 ;flag for key is currenty being pressed by user
251 KEYPADFLAGPRO EQU %00000100 ;flag for key has been released and is ready to be processed
252 KEYPADFLAGD EQU %00001000 ;flag for ?
253 KEYPADFLAGE EQU %00010000 ;flag for ?
254 KEYPADFLAGF EQU %00100000 ;flag for ?
255 KEYPADFLAGG EQU %01000000 ;flag for ?
256 KEYPADFLAGH EQU %10000000 ;flag for ?
257 ********************* CODE *******************
258 KEYPADFLAGS RMB 1 ;set of byte flags for use by Get Next Key function (0 = false, 1 = true)
259 ;bit 0: No current activity detected
260 ;bit 1: Key is currently being pressed
261 ;bit 2: Key is ready to be processed
262 ;bit 3:
263 ;bit 4:
264 ;bit 5:
265 ;bit 6:
266 ;bit 7:
267 KEYPADSMASK RMB 1 ;scan pattern for keypad
268 KEYPADCURRENT RMB 1 ;
269 KEYPADKEYCHK RMB 1 ;
270 KEYPADROWNUM RMB 1 ;
271 KEYPADCOLNUM RMB 1 ;
272 ****************** CODE INITIALIZATION *******
273 KEYSCANINIT PSHA ;save the A reg state
274 LDAA #KEYPADPRTGINI ;retrieve the DDRG mask and ...
275 STAA KEYPADPRTGMSK ;... initialize the DDRG mask
276 CLR KEYPADFLAGS ;clear the flags register
277 PULA ;restore the A reg state
278 RTS ;return to sender *weg*
279 ****************** CODE START ****************
280 KEYSCAN PSHX ;save the X reg state
281 PSHB ;save the B reg state
282 PSHA ;save the A reg state
283 LDAA #KEYPADCNTROWS ;retrieve the row count and ...
284 STAA KEYPADROWNUM ;... initialize the number of rows
285 LDAA #KEYPADCNTBUTS ;retrive the button count and ...
286 STAA KEYPADCURRENT ;... initialize the current button position
287 LDAA #KEYPADSCANPAT ;retrieve the starting scan pattern ...
288 STAA KEYPADSMASK ;... initialize the current mask
289 ;why isn't this working????
290 ;BCLR KEYPADFLAGS,KEYPADFLAGPRE ;clear the "key is being pressed" flag
291 LDAB #KEYPADFLAGPRE ;retrieve the "key is being pressed" flag
292 COMB ;reverse the flag to create a mask
293 ANDB KEYPADFLAGS ;clear the "key is being pressed" flag if it was set
294 STAB KEYPADFLAGS ;store the resulting flag set
295 KEYPADOUTTER LDAA KEYPADSMASK ;Retrieve the current mask and ...
296 STAA KEYPADPRTG ;... set the keypad mask to this value
297 LDAA KEYPADPRTG ;retrieve the current row from the keypad (leave in A reg)
298 *Start Process Row
299 LDAB #KEYPADCNTCOLS ;retrieve the coloumn count and ...
300 STAB KEYPADCOLNUM ;... initialize the number of columns
301 KEYPADINNER LSLA ;rotate the PortG values to find if next bit is set
302 BCS KEYPADSKIPKEYCAPTURE ;if carry isn't set then don't capture the key
303 LDAB KEYPADCURRENT ;retrieve the current key value
304 STAB KEYPADKEYCHK ;store the current key value
305 LDAB KEYPADFLAGS ;retrieve the set of flags
306 ORAB #KEYPADFLAGPRE ;set the "key is being pressed" flag
307 ORAB #KEYPADFLAGPRO ;set the "ready to process" flag
308 STAB KEYPADFLAGS ;store the resulting flag set
309 KEYPADSKIPKEYCAPTURE ;target for jumping over the key kapture
310 DEC KEYPADCURRENT ;decrement current key value
311 DEC KEYPADCOLNUM ;decrement column number
312 BNE KEYPADINNER ;check next column
313 *End Process Row
314 LSR KEYPADSMASK ;rotate the mask to set the next entry point
315 DEC KEYPADROWNUM ;decrement row number
316 BNE KEYPADOUTTER ;check next row
317 PULA ;restore the A reg state
318 PULB ;restore the B reg state
319 PULX ;restore the X reg state
320 RTS ;return to sender *weg*
321 * KEYPADLAST END ******************************************************************
322 ***********************************************************************************
323 * User Error *
324 * *
325 * PURPOSE: Indicates to the user that an error has occured *
326 * *
327 * USE: Call the function *
328 * *
329 * MODIFIES: Flags *
330 * *
331 ***********************************************************************************
332 ********************* DATA *******************
333 ERRFLASHES EQU 4 ;20000 c / (3c + 3c) -- pause 1/100th sec
334 ERRSHOWTIME EQU 2
335 ERRPORTB EQU $1004
336 ****************** CODE START ****************
337 ERRORDISPLAY PSHB ;save the B reg state
338 PSHA ;save the A reg state
339 CLR ERRPORTB ;clear out the LED lights display
340 LDAA #ERRSHOWTIME ;load the time (in x/100ths) to pause
341 LDAB #ERRFLASHES ;load port B with number of flashes to execute
342 DISPLAYERRLP JSR DELAY10X ;pause for x/10th second
343 COM ERRPORTB ;turn on all port be lights
344 JSR DELAY10X ;pause for x/10th second
345 COM ERRPORTB ;turn off all port be lights
346 DECB ;count off a completed loop
347 BNE DISPLAYERRLP ;show next flash if not done
348 PULA ;restore the A reg state
349 PULB ;restore the A reg state
350 RTS ;return to sender *weg*
351 * Password Rejected END ***********************************************************
352 ***********************************************************************************
353 * Display LED Value At Pos *
354 * *
355 * PURPOSE: Display a specific value in LED *
356 * *
357 * USE: Reg B = what position value to display (0-4) *
358 * *
359 * MODIFIES: Flags *
360 * *
361 ***********************************************************************************
362 ********************* DATA *******************
363 DISPLAYKEYPB EQU $1004
364 ********************* CODE *******************
365 DISPLAYKEYTABLE ;values of display mask
366 FCB %00000000 ;dummey value
367 FCB %10000000 ;1 (leftmost)
368 FCB %01000000 ;2 (second from left)
369 FCB %00100000 ;3 (second from right)
370 FCB %00010000 ;4 (rightmost)
371 ****************** CODE START ****************
372 DISPLAYKEY PSHX ;save the X reg state
373 PSHB ;save the B reg state
374 CLR DISPLAYKEYPB ;clear the display in port B
375 TSTB ;make sure position is not set to 0
376 BEQ DISPLAYKEYEND ;jump to end if it is
377 LDX #DISPLAYKEYTABLE
378 ABX
379 LDAB 0, X ;retrieve the display mask of current digit
380 STAB DISPLAYKEYPB ;store the digit mask to display into port B
381 DISPLAYKEYEND PULB ;restore the B reg state
382 PULX ;restore the X reg state
383 RTS ;return to sender *weg*
384 * Display LED Value At Pos END ****************************************************
385 ***********************************************************************************
386 * PAUSE BY X/100th SECOND *
387 * *
388 * PURPOSE: Pauses program execution for X/10th seconds. X is indicated by the *
389 * value in the A register *
390 * *
391 * USE: Load the A register with the number of 1/10th seconds to pause *
392 * *
393 * MODIFIES: Flags *
394 * *
395 ***********************************************************************************
396 ********************* DATA *******************
397 PAUSE100thVAL EQU 3333 ;20000 c / (3c + 3c) -- pause 1/100th sec
398 PAUSE10thVAL EQU 10 ;bring pause time incrments up to a 10th
399 ****************** CODE START ****************
400 DELAY10X PSHX ;save the X reg state
401 PSHB ;save the B reg state
402 PSHA ;save the A reg state
403 PAUSE10th LDAB #PAUSE10thVAL ;set B reg to count of 10
404 PAUSE100th LDX #PAUSE100thVAL ;load X with 1/100th worth of counter
405 PAUSEINNER DEX ;count down one in pause loop
406 BNE PAUSEINNER ;continue loop if not done with 1/100th pause
407 DECB ;count down another 1/100 sec
408 BNE PAUSE100th ;continue loop if not done with 1/10th pause
409 DECA ;decrement user specified pause count
410 BNE PAUSE10th ;continue loop if not done with this pause
411 PULA ;restore the A reg state
412 PULB ;restore the B reg state
413 PULX ;restore the X reg state
414 RTS ;return to sender *weg*
415 * PAUSE END ***********************************************************************
416 ENDOFCODE
Back to top Go down
http://tdoi.vampire-legend.com
Sponsored content





simon code Empty
PostSubject: Re: simon code   simon code Empty

Back to top Go down
 
simon code
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The Depths of Insanity :: RP zone :: In the Beginning-
Jump to: