;------------------------------------- ; HC908 Quick Code Test ;------------------------------------- ;Filename: quick.asm ;Written by Kenrick Chin ;2003.12.24 - first writing ;Use this program to test small parts of the code ;Flash memory is not erased ;All code execting from SRAM ;Terminal Emulation required TERM ;------------------------------------- ; Monitor Functions ;------------------------------------- GETBYTE EQU $2800 RDVRRNG EQU $2803 ERARNGE EQU $2806 PRGRNGE EQU $2809 DELNUS EQU $280C PUTBYTE EQU $FEA1 CTRLBYT EQU $88 CPUSPD EQU $89 LADDR EQU $8A DATA EQU $8C ;------------------------------------- ; MCU Definitions ;------------------------------------- SRAM EQU $80 PORTA EQU $00 PORTB EQU $01 DDRA EQU $04 DDRB EQU $05 ;Timer TSC EQU $20 TMODH EQU $23 TMODL EQU $24 TOF EQU 7 TOIE EQU 6 TSTOP EQU 5 TRST EQU 4 ;ADC ADSCR EQU $3C ADR EQU $3E ADICLK EQU $3F COCO EQU 7 RXD EQU 0 ;PORTB bit-0 TXD EQU 0 ;PORTB bit-0 TRIM EQU $FFC0 ;------------------------------------- ; ASCII codes ;------------------------------------- ZERO EQU $30 NINE EQU $39 CR EQU $0D ;------------------------------------- ; Start of SRAM Code ;------------------------------------- ORG SRAM boot BOOT ;------------------------------------- ; Test Code ;------------------------------------- ;send hex to Terminal Emulator LDA #$AB BSR hex ;or flash the test LED ;set for MOD 19230 = $4B1E MOV #$4B TMODH MOV #$1E TMODL ;start timer, divide by 32 clock ;for 2Hz flash MOV #%00010101 TSC MOV #$FF DDRB main1 BRCLR TOF TSC main1 ;wait for overflow flag BCLR TOF TSC ;clear flag COMA STA PORTB BRA main1 ;single hex output ;enter with A = 4-bit nibble hex1 PSHA AND #$0F ADD #ZERO CMP #NINE BLS dec ADD #7 dec JSR PUTBYTE PULA RTS ;hex printout ;enter with A = 8-bit byte ;send two hex chars hex NSA BSR hex1 NSA BSR hex1 RTS ENDB boot END ;------------------------------------- ; End of quick.asm ;-------------------------------------