EUG PD


Bug Eyes 2

 
Published in EUG #71

BUGEYES: example of changing filenames. The disassembly is of BUG2, executing at &6EF.

 
06EF LDX #&00  \set up user event 
06F1 STX &0220 \routine
06F4 LDX #&04  \at &400
06F6 STX &0221
06F9 LDX #4  \*FX4,12 same as *FX4,0
06FB LDA #12 \Enable cursors
06FD JSR OSbyte
0700 LDX #&3B  \Load in file at &73B
0702 LDY #&07  \BUGEYES is the first name of the
0704 JSR OScli \changing filename
0707 JSR &0724 \set up text window
070A LDX #&03  \*FX3,14 same as *FX3,6
070C LDA #&0E  \Disable printer driver
070E JSR OSbyte \not much point though
0711 LDA #50  \short delay routine
0713 PHA      \put counter on stack
0714 LDA #19   \*FX19
0716 JSR OSbyte
0719 PLA 
071A CLC 
071B SBC #&00  \and counter down
071D CMP #&00  \to zero
071F BNE &0713
0721 JMP &1E0A \and execute game

0724 LDX #&00    \VDU codes
0726 LDA &0735,X
0729 CMP #&FF    \&FF marks end of sequence
072B BEQ &0734   \so branch to exit
072D JSR OSwrch  \else VDU it
0730 INX        \bump pointer
0731 JMP &0726  \and jump back to loop
0734 RTS  \come here when all VDU codes done

\filename and VDU sequence VDU28,0,29,15,6 text window
0735 1C 00 1D 0F 06 FF 4C 2E ......L.
073D 22 42 55 47 45 59 45 53 "BUGEYES
0745 20 22 0D ** ** ** ** **  ".
0748 EQUB &FF \used at &414

\User event routine - change tape filename
0400 PHP       \Preserve registers
0401 PHA 
0402 TXA 
0403 PHA 
0404 TYA 
0405 PHA 
0406 JSR &0411 \perform event
0409 PLA       \and restore registers
040A TAY 
040B PLA 
040C TAX 
040D PLA 
040E PLP 
040F RTS 

0410 RTS 
0411 LDA &03C6 \load block number (lo) of tape block
0414 STA &0748 \store
0417 LDA #0    \?&7F=0
0419 STA &7F
041B STA &03C7 \zeroise tape block number hi
041E LDA &03CA \ensure file unlocked 
0421 AND #&FE  \by clearing bit 1
0423 STA &03CA \of &3CA
0426 AND #&06  \examine bit 1+2 of block flag
0428 CMP #&06  \if both set
042A BNE &0410 \then finished block
042C LDA &0748 \retrieve block number lo
042F STA &7E   \put in &7E
0431 LDX #&03
0433 CLC 
0434 ROL &7E   \multiply address by 8
0436 ROL &7F   \to point to next message
0438 DEX 
0439 BNE &0433
043B LDX #0
043D LDY #0
043F LDA &7E
0441 CLC       \&7C/D = &7E/F + &45D
0442 ADC #&5D  \to point to messages
0444 STA &7C
0446 LDA &7F
0448 ADC #&04
044A STA &7D
044C LDA (&7C),Y  \get character of message
044E STA &03D2,X  \and put in block header area
0451 INX
0452 INY 
0453 CPY #&08     \until got 8 characters
0455 BNE &044C
0457 LDA #&00
0459 STA &03D2,Y  \filename terminates with zero
045C RTS 

\these are the &51 filenames to feed into filename in block
\header of memory (&3B2-&3BD) to give a changing filename

045D 42 55 47 45 59 45 53 20 BUGEYES 
0465 20 20 49 49 20 20 20 20   II    
046D 20 20 49 53 20 20 20 20   IS    
0475 4C 4F 41 44 49 4E 47 20 LOADING 
047D 20 20 20 20 20 20 20 20         
0485 57 52 49 54 54 45 4E 20 WRITTEN 
048D 20 20 42 59 20 20 20 20   BY    
0495 20 20 54 48 45 20 20 20   THE   
049D 20 20 41 52 54 20 20 20   ART   
04A5 20 20 43 52 45 57 20 20   CREW  
04AD 20 20 57 49 54 48 20 20   WITH  
04B5 20 54 48 41 4E 4B 53 20  THANKS 
04BD 20 20 20 54 4F 20 20 20    TO   
04C5 20 42 45 43 4B 59 2C 20  BECKY, 
04CD 20 54 52 41 43 59 20 26  TRACY &
04D5 49 2E 57 41 55 47 48 2E I.WAUGH.
04DD 20 20 20 20 20 20 20 20         
04E5 20 57 41 54 43 48 20 20  WATCH  
04ED 20 20 4F 55 54 20 20 20   OUT   
04F5 20 20 46 4F 52 20 20 20   FOR   
04FD 20 54 48 45 53 45 20 20  THESE  
0505 20 4F 54 48 45 52 20 20  OTHER  
050D 20 47 52 45 41 54 20 20  GREAT  
0515 52 45 4C 45 41 53 45 53 RELEASES
051D 20 20 46 52 4F 4D 20 20   FROM  
0525 20 41 2E 53 2E 4C 20 20  A.S.L  
052D 20 20 4C 54 44 20 20 20   LTD   
0535 20 20 41 4E 44 20 20 20   AND   
053D 20 20 54 48 45 20 20 20   THE   
0545 41 52 54 20 43 52 45 57 ART CREW
054D 2A 2A 2A 2A 2A 2A 2A 2A ********
0555 20 20 20 20 20 20 20 20         
055D 20 5A 45 4C 44 41 20 20  ZELDA  
0565 20 4D 45 45 54 53 20 20  MEETS  
056D 20 20 54 48 45 20 20 20   THE   
0575 42 55 47 45 59 45 53 2C BUGEYES,
057D 47 45 4E 45 53 49 53 20 GENESIS 
0585 20 50 52 4F 42 45 2C 20  PROBE, 
058D 43 41 56 45 4D 41 4E 20 CAVEMAN 
0595 20 43 41 50 45 52 53 20  CAPERS 
059D 20 20 20 20 20 20 20 20         
05A5 20 48 45 4C 4C 4F 20 20  HELLO  
05AD 20 20 54 4F 20 20 20 20   TO    
05B5 20 20 41 4C 4C 20 20 20   ALL   
05BD 20 20 41 54 20 20 20 20   AT    
05C5 20 20 54 48 45 20 20 20   THE   
05CD 20 20 54 59 4E 45 20 20   TYNE  
05D5 20 20 41 4E 44 20 20 20   AND   
05DD 20 20 57 45 41 52 20 20   WEAR  
05E5 20 20 42 42 43 20 20 20   BBC   
05ED 20 20 55 53 45 52 20 20   USER  
05F5 20 47 52 4F 55 50 20 20  GROUP  
05FD 20 20 20 20 20 20 20 20         
0605 2A 2A 2A 2A 2A 2A 2A 2A ********
060D 20 20 54 48 49 53 20 20   THIS  
0615 20 20 47 41 4D 45 20 20   GAME  
061D 20 20 44 4F 45 53 20 20   DOES  
0625 20 20 4E 4F 54 20 20 20   NOT   
062D 20 49 4E 43 4C 55 44 45  INCLUDE
0635 46 4C 49 43 4B 45 52 2C FLICKER,
063D 31 36 4B 20 52 4F 4D 2C 16K ROM,
0645 20 53 4D 41 4C 4C 20 20  SMALL  
064D 53 50 52 49 54 45 53 2C SPRITES,
0655 20 20 20 4F 52 20 20 20    OR   
065D 20 20 41 4E 59 20 20 20   ANY   
0665 20 4F 54 48 45 52 20 20  OTHER  
066D 20 20 42 41 44 20 20 20   BAD   
0675 50 4F 49 4E 54 53 20 21 POINTS !
067D 20 20 20 20 20 20 20 20         
0685 20 43 4F 55 4E 54 20 20  COUNT  
068D 20 20 44 4F 57 4E 20 20   DOWN  
0695 20 54 20 2D 20 38 20 20  T - 8  
069D 20 54 20 2D 20 37 20 20  T - 7  
06A5 20 54 20 2D 20 36 20 20  T - 6  
06AD 20 54 20 2D 20 35 20 20  T - 5  
06B5 20 54 20 2D 20 34 20 20  T - 4  
06BD 20 54 20 2D 20 33 20 20  T - 3  
06C5 20 54 20 2D 20 32 20 20  T - 2  
06CD 20 54 20 2D 20 31 20 20  T - 1  
06D5 20 20 20 20 20 20 20 20         
06DD 20 20 20 20 20 20 20 20         

Mr Spock 28 Mar 2004

Mr. Spock