1 / 49

WHYP -- An Extensible Language

WHYP -- An Extensible Language. Chapter 4. WHYP--An Extensible Language. A Closer Look at WHYP Defining New WHYP Words Variables Constants EEPROM. A Closer Look at WHYP. WHYP--An Extensible Language. A Closer Look at WHYP Defining New WHYP Words Variables Constants EEPROM.

lawson
Download Presentation

WHYP -- An Extensible Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WHYP-- An Extensible Language Chapter 4

  2. WHYP--An Extensible Language • A Closer Look at WHYP • Defining New WHYP Words • Variables • Constants • EEPROM

  3. A Closer Look at WHYP

  4. WHYP--An Extensible Language • A Closer Look at WHYP • Defining New WHYP Words • Variables • Constants • EEPROM

  5. Colon Definitions : <name> --- --- --- --- ; : squared ( n -- n2 ) DUP * ; 16 4104 JSR DUP 16 4337 JSR * 3D RTS

  6. WHYP12.CFG

  7. SEE and SHOW see squared squared DUP * ; ok show squared squared 16 41 4 16 43 37 3D ok see cubed cubed DUP squared * ; ok show cubed cubed 16 41 4 16 50 0 16 43 37 3D ok

  8. Single Stepping ok 5 step squared squared DUP * ; S:[1] 5 R:[0] DUP S:[2] 5 5 R:[0] * S:[1] 19 R:[0] Exit single step ok . 25 ok

  9. Single Stepping ok 5 step cubed cubed DUP squared * ; S:[1] 5 R:[0] DUP S:[2] 5 5 R:[0] squared S:[2] 5 19 R:[0] * S:[1] 7D R:[0] Exit single step ok . 125 ok

  10. Loading WHYP words from a file square.whp

  11. Loading WHYP words from a file

  12. CR and ." : bar ( -- ) \ print a bar CR ." ******" ; : post ( -- ) \ print a post CR ." *" CR ." *" CR ." *" ;

  13. CR and ." : C ( -- ) \ print a C bar post bar cr ; : E ( -- ) \ print an E bar post bar post bar cr;

  14. WHYP--An Extensible Language • A Closer Look at WHYP • Defining New WHYP Words • Variables • Constants • EEPROM

  15. Variables VARIABLE my.name Stores the following code at tdp.my.name executes this code. 16 451E JSR (LIT) 0800 0800 3D RTS my.name . 800 ok

  16. Variables Variables are stored in memory at address vdp. The value of vdp can be changed by pressing F8. VHERE puts the current value of vdp on the data stack.

  17. Fetch and Store

  18. Examples of @ and ! C:\WHYP\WHYP12>whyp12 Using WHYP12.HED Communicating with COM1 68HC12 WHYP12 - Version 4.6 Press <Esc> or type BYE to exit ok VARIABLE my.name ok hex ok my.name . 800 ok 7 my.name! ok 800 10 dump 0 1 2 3 4 5 6 7 8 9 A B C D E F 0800 00 07 86 80 52 00 80 02 09 00 28 18 90 00 83 00 ..R . ( . . ok my.name @ . 7 ok 12 my.name c! ok 34 my.name 1+ c! ok 800 10 dump 0 1 2 3 4 5 6 7 8 9 A B C D E F 0800 12 34 86 80 52 00 80 02 09 00 28 18 90 00 83 00 4..R . ( . . ok my.name c@ . 12 ok my.name 1+ c@ . 34 ok

  19. 68HC12 code for !, @, C!, and C@

  20. Plus-store 1 my.name +!

  21. 68HC12 code for 2!, and 2@

  22. System Variables: SP0, RP0

  23. Arrays VARIABLE my.array 8 VALLOT my.array 3 2* + @ . will print the value of my.array[3]

  24. Arrays VARIABLE my.array 8 VALLOT my.array 3 2* + @ . : A@ ( ix addr -- n ) SWAP 2* + @ ; 3 my.array A@ . will print the value of my.array[3] Chap 13: 3 my.array @ . 1234 3 my.array !

  25. WHYP--An Extensible Language • A Closer Look at WHYP • Defining New WHYP Words • Variables • Constants • EEPROM

  26. Constants 25 CONSTANT quarter Stores the following code at tdp.quarter executes this code. 16 451E JSR (LIT) 0019 0019 3D RTS quarter . will print the value 25 on the screen.

  27. Examples of using CONSTANTs

  28. Tables CREATE table

  29. HEX CREATE table 5 , 8 , 23 ,

  30. Example of creating a table

  31. HEX CREATE table 5 C, 8 C, 23 C,

  32. EEPROM • MC68HC812A4 • 4 Kbytes of EEPROM • $1000 - 1FFF • MC68HC912B32 • 768 bytes of EEPROM • $0D00 - $0FFF

  33. EEPROM Initial Position Register

  34. MC68HC812A4 EEPROMBlock Protect Register

  35. MC68HC912B32 EEPROMBlock Protect Register In WHYP12: CLR EEPROT

  36. The EEPROM Control Register

  37. Erasing an EEPROM Byte

  38. Delay 10 Milliseconds

  39. Erase Entire EEPROM

  40. Program an EEPROM Byte

  41. Examples of using EEPROMmemory access words

  42. square.hed

  43. whyp12.cfg

More Related