Advertisement
Guest User

Untitled

a guest
May 7th, 2023
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | Source Code | 0 0
  1. dnl # compile with: https://github.com/DW0RKiN/M4_FORTH
  2. dnl # z80 output : https://pastebin.com/z2Rv1fvr
  3. dnl
  4. include(`../M4/FIRST.M4')dnl
  5. ORG 0x8000
  6. INIT(60000)
  7. define({USE_FONT_5x8})
  8.  
  9. PCONSTANT(22,10,_10)
  10. PCONSTANT(22,99,_99)
  11. PCONSTANT(22,0, _tmp_print)
  12. PCONSTANT(22,0, _tmp2)
  13. PPUSH_VALUE(22,99,_tmp3)
  14.  
  15. PUSH(_99)
  16. PUSH(_tmp3)
  17. PUSH(_tmp2)
  18.  
  19. PUSH(20) FOR
  20.  
  21. dnl #PUMUL(b) ( p3 p2 p1 -- p3 p2 p1 ) [p1] = [p3] * [p2]
  22. PUMUL(22)
  23.  
  24. _2DUP SWAP
  25.  
  26. dnl # ( 99 old new -- 99 new old new old )
  27.  
  28. PUSH(22) MOVE
  29.  
  30. dnl # ( 99 new old -- 99 new _10 old _tmp_print )
  31.  
  32. PUSH(_10) SWAP PUSH(_tmp_print)
  33.  
  34. dnl # PUDOT(b) ( p3 p2 p1 -- p3 px py ) print [p2], [py]= 0, [px]=first_number
  35.  
  36. PUDOT(22) CR
  37.  
  38. dnl # ( 99 new _10 old _tmp_print -- 99 new old )
  39.  
  40. DROP NIP
  41. NEXT
  42.  
  43. DROP DROP DROP
  44. DEPTH UDOT CR
  45.  
  46. STOP
Tags: M4 Forth
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement