?? test8key3.lst
字號:
(0155)
(0156) ;-----------------------------------------------
(0157) ; Bargraph definitions
(0158) ;-----------------------------------------------
(0159)
(0160) LCD_BG_CHAR_WIDTH: equ 16 ; 16 characters in width
(0161) LCD_BG_SEG_WIDTH: equ 80 ; 16 * 5 = 80
(0162) LCD_BG_COL_START: equ 0 ; Always start in the left most column
(0163)
(0164) ; Offsets for 2x16, 2x20, 4x20
(0165) ; Change these values for a custome LCD
(0166)
(0167) LCD_ROW1_OFFSET: equ 80h ; Address/command offset for row 1
(0168) LCD_ROW2_OFFSET: equ C0h ; Address/command offset for row 2
(0169) LCD_ROW3_OFFSET: equ 94h ; Address/command offset for row 1
(0170) LCD_ROW4_OFFSET: equ D4h ; Address/command offset for row 2
(0171)
(0172) LCD_BG_ROW1_OFFSET: equ 80h ; Address/command offset for row 1
(0173) LCD_BG_ROW2_OFFSET: equ C0h ; Address/command offset for row 2
(0174)
(0175) CG_RAM_OFFSET: equ 40h ; Offset to character RAM
(0176)
(0177) AREA UserModules (ROM, REL)
(0178)
(0179) .SECTION
(0180) ;-----------------------------------------------------------------------------
(0181) ; FUNCTION NAME: LCD_1_PrCString
(0182) ;
(0183) ; DESCRIPTION:
(0184) ; Print constant (ROM) string to LCD
(0185) ;-----------------------------------------------------------------------------
(0186) ;
(0187) ; ARGUMENTS:
(0188) ; A:X Pointer to String
(0189) ; A contains MSB of string address
(0190) ; X contains LSB of string address
(0191) ;
(0192) ; RETURNS: none
(0193) ;
(0194) ; SIDE EFFECTS:
(0195) ; The A and X registers may be modified by this or future implementations
(0196) ; of this function. The same is true for all RAM page pointer registers in
(0197) ; the Large Memory Model. When necessary, it is the calling function's
(0198) ; responsibility to perserve their values across calls to fastcall16
(0199) ; functions.
(0200) ;
(0201) ; Currently only the page pointer registers listed below are modified:
(0202) ; CUR_PP
(0203) ;
(0204) LCD_1_PrCString:
(0205) _LCD_1_PrCString:
(0206) RAM_PROLOGUE RAM_USE_CLASS_1
(0207) Loop_PrCString:
(0208) push A ; Store ROM pointer
02D5: 08 PUSH A
(0209) push X
02D6: 10 PUSH X
(0210) romx ; Get character from ROM
02D7: 28 ROMX
(0211) jnz LCD_PrCString_WR ; print character and advance pointer
02D8: B0 04 JNZ 0x02DD
(0212) pop X ; Restore the stack
02DA: 20 POP X
(0213) pop A
02DB: 18 POP A
(0214) RAM_EPILOGUE RAM_USE_CLASS_1
(0215) ret ; Return
02DC: 7F RET
(0216)
(0217) LCD_PrCString_WR:
(0218) call LCD_1_WriteData ; Write data to LCD
02DD: 90 46 CALL 0x0325
(0219) pop X ; Get ROM pointer
02DF: 20 POP X
(0220) pop A
02E0: 18 POP A
(0221) inc X ; Inc LSB of pointer
02E1: 75 INC X
(0222) jnc Loop_PrCString
02E2: DF F2 JNC 0x02D5
(0223) inc A ; Inc MSB of pointer if LSB overflow
02E4: 74 INC A
(0224) jmp Loop_PrCString
02E5: 8F EF JMP 0x02D5
02E7: 30 HALT
02E8: 31 32 XOR A,50
02EA: 33 34 XOR A,[X+52]
02EC: 35 36 XOR [X+54],A
02EE: 37 38 39 XOR [X+56],57
02F1: 41 42 43 AND REG[66],67
02F4: 44 45 46 OR REG[X+69],70
(0225)
(0226) .ENDSECTION
(0227)
(0228) ;-----------------------------------------------------------------------------
(0229) ; FUNCTION NAME: LCD_1_PrHexByte
(0230) ;
(0231) ; DESCRIPTION:
(0232) ; Print a byte in Hex (two characters) to current LCD position
(0233) ;
(0234) ;-----------------------------------------------------------------------------
(0235) ;
(0236) ; ARGUMENTS:
(0237) ; A => (BYTE) Data/char to be printed
(0238) ;
(0239) ; RETURNS: none
(0240) ;
(0241) ; SIDE EFFECTS:
(0242) ; The A and X registers may be modified by this or future implementations
(0243) ; of this function. The same is true for all RAM page pointer registers in
(0244) ; the Large Memory Model. When necessary, it is the calling function's
(0245) ; responsibility to perserve their values across calls to fastcall16
(0246) ; functions.
(0247) ;
(0248) ; Currently only the page pointer registers listed below are modified:
(0249) ; CUR_PP
(0250) ;
(0251) .LITERAL
(0252) LCD_HEX_STR::
(0253) DS "0123456789ABCDEF"
(0254) .ENDLITERAL
(0255) .SECTION
(0256)
(0257) LCD_1_PrHexByte:
(0258) _LCD_1_PrHexByte:
(0259) RAM_PROLOGUE RAM_USE_CLASS_1
(0260) push A ; Save lower nibble
02F7: 08 PUSH A
(0261) asr A ; Shift high nibble to right
02F8: 67 ASR A
(0262) asr A
02F9: 67 ASR A
(0263) asr A
02FA: 67 ASR A
(0264) asr A
02FB: 67 ASR A
(0265) and A,0Fh ; Mask off nibble
02FC: 21 0F AND A,15
(0266) index LCD_HEX_STR ; Get Hex value
02FE: FF E7 INDEX 0x02E7
(0267) call LCD_1_WriteData ; Write data to screen
0300: 90 23 CALL 0x0325
(0268) pop A ; Restore value
0302: 18 POP A
(0269) and A,0Fh ; Mask off lower nibble
0303: 21 0F AND A,15
(0270) index LCD_HEX_STR ; Get Hex value
0305: FF E0 INDEX 0x02E7
(0271) call LCD_1_WriteData ; Write data to screen
0307: 90 1C CALL 0x0325
(0272) RAM_EPILOGUE RAM_USE_CLASS_1
(0273) ret
0309: 7F RET
(0274) .ENDSECTION
(0275)
(0276) .SECTION
(0277) ;-----------------------------------------------------------------------------
(0278) ; FUNCTION NAME: LCD_1_PrHexInt
(0279) ;
(0280) ; DESCRIPTION:
(0281) ; Print an Int in Hex (four characters) to current LCD position
(0282) ;
(0283) ;-----------------------------------------------------------------------------
(0284) ;
(0285) ; ARGUMENTS:
(0286) ; A:X Integer value
(0287) ; A contains LSB of Int
(0288) ; X contains MSB of Int
(0289) ;
(0290) ; RETURNS: none
(0291) ;
(0292) ; SIDE EFFECTS:
(0293) ; The A and X registers may be modified by this or future implementations
(0294) ; of this function. The same is true for all RAM page pointer registers in
(0295) ; the Large Memory Model. When necessary, it is the calling function's
(0296) ; responsibility to perserve their values across calls to fastcall16
(0297) ; functions.
(0298) ;
(0299) ; Currently only the page pointer registers listed below are modified:
(0300) ; CUR_PP
(0301) ;
(0302) LCD_1_PrHexInt:
(0303) _LCD_1_PrHexInt:
(0304) RAM_PROLOGUE RAM_USE_CLASS_1
(0305) swap A,X
030A: 4B SWAP A,X
(0306) call LCD_1_PrHexByte ; Print MSB
030B: 9F EA CALL 0x02F7
(0307) mov A,X ; Move LSB into position
030D: 5B MOV A,X
(0308) call LCD_1_PrHexByte ; Print LSB
030E: 9F E7 CALL 0x02F7
(0309) RAM_EPILOGUE RAM_USE_CLASS_1
(0310) ret
0310: 7F RET
(0311) .ENDSECTION
(0312)
(0313) .SECTION
(0314) ;-----------------------------------------------------------------------------
(0315) ; FUNCTION NAME: LCD_1_PrString
(0316) ;
(0317) ; DESCRIPTION:
(0318) ; Print (RAM) ASCII string to LCD
(0319) ;
(0320) ;-----------------------------------------------------------------------------
(0321) ;
(0322) ; ARGUMENTS:
(0323) ; A:X contains pointer to string
(0324) ; X contains LSB of string pointer
(0325) ; A contains MSB or page of string pointer (not used at this time)
(0326) ;
(0327) ; RETURNS:
(0328) ;
(0329) ; SIDE EFFECTS:
(0330) ; The A and X registers may be modified by this or future implementations
(0331) ; of this function. The same is true for all RAM page pointer registers in
(0332) ; the Large Memory Model. When necessary, it is the calling function's
(0333) ; responsibility to perserve their values across calls to fastcall16
(0334) ; functions.
(0335) ;
(0336) ; Currently only the page pointer registers listed below are modified:
(0337) ; CUR_PP
(0338) ; IDX_PP
(0339) ;
(0340) ;
(0341) LCD_1_PrString:
(0342) _LCD_1_PrString:
(0343) RAM_PROLOGUE RAM_USE_CLASS_3
0311: 70 BF AND F,191
(0344) RAM_SETPAGE_IDX A
0313: 60 D3 MOV REG[211],A
(0345) Loop_PrString:
(0346) mov A,[X] ; Get value pointed to by X
0315: 52 00 MOV A,[X+0]
(0347) jz End_LCD_PrString ; Check for end of string
0317: A0 08 JZ 0x0320
(0348) ;LCD_1_writeData is known not to modify X so no need to perserve
(0349) call LCD_1_WriteData ; Write data to screen
0319: 90 0A CALL 0x0325
(0350) inc X ; Advance pointer to next character
031B: 75 INC X
(0351) push X
031C: 10 PUSH X
(0352) pop X
031D: 20 POP X
(0353) jmp Loop_PrString ; Go get next character
031E: 8F F6 JMP 0x0315
0320: 70 3F AND F,63
(0354) End_LCD_PrString:
(0355) RAM_EPILOGUE RAM_USE_CLASS_3
0322: 71 C0 OR F,192
(0356) ret
0324: 7F RET
(0357) .ENDSECTION
(0358)
(0359) .SECTION
(0360) ;-----------------------------------------------------------------------------
(0361) ; FUNCTION NAME: LCD_1_WriteData
(0362) ;
(0363) ; DESCRIPTION:
(0364) ; Write a byte to the LCD's data register.
(0365) ;
(0366) ;-----------------------------------------------------------------------------
(0367) ;
(0368) ; ARGUMENTS:
(0369) ; A contains byte to be written to LCD data register
(0370) ;
(0371) ; RETURNS: none
(0372) ;
(0373) ; SIDE EFFECTS:
(0374) ; The A and X registers may be modified by this or future implementations
(0375) ; of this function. The same is true for all RAM page pointer registers in
(0376) ; the Large Memory Model. When necessary, it is the calling function's
(0377) ; responsibility to perserve their values across calls to fastcall16
(0378) ; functions.
(0379) ;
(0380) ; Currently only the page pointer registers listed below are modified:
(0381) ; CUR_PP
(0382) ;
(0383) LCD_1_WriteData:
(0384) _LCD_1_WriteData:
(0385) LCD_1_Write_Data: ; Do not use
(0386) _LCD_1_Write_Data: ; Do not use
(0387) RAM_PROLOGUE RAM_USE_CLASS_1
(0388) call LCD_Check_Ready ; Make sure controller is ready
0325: 90 65 CALL 0x038C
(0389) ; A is preserved in LCD_Check_Ready
(0390) push A ; Save copy of character
0327: 08 PUSH A
(0391) asr A ; Shift high nibble to right
0328: 67 ASR A
(0392) asr A
0329: 67 ASR A
(0393) asr A
032A: 67 ASR A
(0394) asr A
032B: 67 ASR A
(0395) and A,0Fh ; Mask off high nibble
032C: 21 0F AND A,15
(0396) call LCD_WDATA_Nibble ; Write Upper nibble
032E: 90 3B CALL 0x036B
(0397) pop A ; Retrieve copy of character
0330: 18 POP A
(0398) and A,0Fh ; Mask off high nibble
0331: 21 0F AND A,15
(0399) nop
0333: 40 NOP
(0400) nop
0334: 40 NOP
(0401) nop
0335: 40 NOP
(0402) call LCD_WDATA_Nibble ; Write Lower nibble
0336: 90 33 CALL 0x036B
(0403) RAM_EPILOGUE RAM_USE_CLASS_1
(0404) ret
0338: 7F RET
(0405) .ENDSECTION
(
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -