SHARE
TWEET

NETServ v1.1

a guest Dec 11th, 2013 178 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM ================================
  2. REM * NETLIB v2.0
  3. REM The base library for NET code
  4. REM ================================
  5. NETLIB:
  6.  
  7. REM --------
  8. REM # Init
  9. REM --------
  10.  
  11. REM # Turn on monitor
  12. SET A, 0
  13. SET B, [@ScreenStart]
  14. HWI 0
  15.  
  16. REM # Setup screen
  17. JSR ClearScreen
  18. JSR ResetCursorChar
  19.  
  20. REM # Setup interrupts
  21. IAS HardwareIterrupt
  22.  
  23. REM # Start code
  24. SET PC, [@CodeStart]
  25.  
  26. REM ##############
  27. REM NETLIB Vars
  28. REM ##############
  29. @CodeStart:      DAT NETServ
  30.  
  31. @ScreenStart:    DAT 0x8000
  32. @NextLine:       DAT 0x7FE0
  33. @NextPrint:      DAT 0x7FE0
  34. @ScreenEnd:      DAT 0x817F
  35. @PacketHandler:  DAT 0x0000
  36. @KeyHandler:     DAT 0x0000
  37. @TimeoutAddress: DAT 0x0000
  38. @TimeoutTicks:   DAT 0x0000
  39. @HandlerReg:     DAT 0x0000
  40. @IP:             DAT 0x0000
  41. @ClearStack:     DAT 0x0000
  42. @CursorChar:     DAT 0x0000
  43.  
  44. @Input:
  45. DAT 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  46.  
  47. $InvalidInput:
  48. DAT "Invalid input", 0x0
  49.  
  50. $Failed:
  51. DAT "Failed", 0x0
  52.  
  53. REM #- ResetCursorChar -###########
  54. REM Reset to default @CursorChar
  55. REM ###############################
  56. ResetCursorChar:
  57. SET [@CursorChar], 0x193E
  58. SET PC, POP
  59.  
  60. REM #- WaitForIP -#################
  61. REM Wait until you get an IP
  62. REM ###############################
  63. WaitForIP:
  64. SET A, 9
  65. SET B, 0xffff
  66. WaitForIP_hang:
  67. HWI 4
  68. IFE B, 0xffff
  69.   MOV WaitForIP_hang
  70.  
  71. REM # Store IP
  72. SET [@IP], B
  73.  
  74. SET PC, POP
  75.  
  76. REM #- LoadNextLine -##############
  77. REM Loads the address of the next
  78. REM line into B
  79. REM ###############################
  80. LoadNextLine:
  81. ADD [@NextLine], 0x20
  82. IFG [@NextLine], [@ScreenEnd]
  83.   JSR ScrollUp
  84.  
  85. REM # Set return register
  86. SET B, [@NextLine]
  87.  
  88. REM # Update next print
  89. SET [@NextPrint], B
  90.  
  91. SET PC, POP
  92.  
  93. REM #- ScrollUp -####################
  94. REM Scroll the screen up a line
  95. REM #################################
  96. ScrollUp:
  97. SET PUSH, C
  98. SET PUSH, I
  99. SET I, [@ScreenStart]
  100.  
  101. SET C, [@ScreenEnd]
  102. SUB C, 0x1F
  103.  
  104. REM # Store updated position
  105. SET [@NextLine], C
  106. SET [@NextPrint], C
  107.  
  108. ScrollUp_loop:
  109. SET [I], [I + 0x20]
  110. SET [I + 0x20], 0x1920
  111. ADD I, 1
  112. IFL I, C
  113.   SET PC, ScrollUp_loop
  114.  
  115. SET I, POP
  116. SET C, POP
  117. SET PC, POP
  118.  
  119. REM #- Print -#####################
  120. REM Prints null-string at [A]
  121. REM continuing at the last point
  122. REM ###############################
  123. Print:
  124. SET PUSH, A
  125. SET PUSH, B
  126.  
  127. SET B, [@NextPrint]
  128. JSR PrintStr_A
  129.  
  130. SET B, POP
  131. SET A, POP
  132. SET PC, POP
  133.  
  134. REM #- PrintLn -###################
  135. REM Print null-str at [A] on a
  136. REM new line
  137. REM ###############################
  138. PrintLn:
  139. SET PUSH, A
  140. SET PUSH, B
  141.  
  142. REM # Load line to B
  143. JSR LoadNextLine
  144. JSR PrintStr_A
  145.  
  146. SET B, POP
  147. SET A, POP
  148. SET PC, POP
  149.  
  150. REM #- PrintStr -##################
  151. REM Print null-str at [A] starting
  152. REM at [B]. Target point 'B' will
  153. REM be shifted on return.
  154. REM ###############################
  155. PrintStr:
  156. SET PUSH, A
  157.  
  158. JSR PrintStr_A
  159.  
  160. SET A, POP
  161. SET PC, POP
  162.  
  163. REM #- PrintStr_A -################
  164. REM Same as PrintStr, but input
  165. REM point 'A' will also be shifted
  166. REM ###############################
  167. PrintStr_A:
  168. SET PUSH, C
  169.  
  170. PrintStr_A_loop:
  171. IFE [A], 0
  172.   MOV PrintStr_A_exit
  173.  
  174. SET C, [A]
  175. BOR C, 0x1900
  176. SET [B], C
  177.  
  178. ADD A, 1
  179. ADD B, 1
  180. MOV PrintStr_A_loop
  181.  
  182. PrintStr_A_exit:
  183. REM # Past null termination
  184. ADD A, 1
  185.  
  186. REM # Update next print position
  187. SET [@NextPrint], B
  188.  
  189. SET C, POP
  190. SET PC, POP
  191.  
  192. REM #-PrintHex -###################
  193. REM Print a hex number A to [B]
  194. REM ###############################
  195. PrintHex:
  196. PUSHA
  197.  
  198. REM # "0x"
  199. SET [B], 0x1930
  200. ADD B, 1
  201. SET [B], 0x1978
  202. ADD B, 1
  203.  
  204. SET I, 12
  205. PrintHex_loop:
  206. SET C, A
  207. SHR C, I
  208. AND C, 0xf
  209. IFG C, 0x9
  210.   ADD C, 0x37
  211. IFL C, 0xa
  212.   ADD C, 0x30
  213.  
  214. BOR C, 0x1900
  215. SET [B], C
  216. ADD B, 1
  217. SUB I, 4
  218. IFA I, 0xffff
  219.   SET PC, PrintHex_loop
  220.  
  221. POPA
  222. SET PC, POP
  223.  
  224. REM #- PrintChar -###################
  225. REM Print a character C to [B++]
  226. REM   NOTE: Doesn't effect @NextPrint
  227. REM #################################
  228. PrintChar:
  229. SET PUSH, A
  230.  
  231. REM # Check for end of line
  232. SET A, [@NextLine]
  233. ADD A, 0x1E
  234. IFG B, A
  235.  MOV PrintChar_skip
  236.  
  237. SET [B], C
  238. BOR [B], 0x1900
  239. ADD B, 1
  240.  
  241. PrintChar_skip:
  242. SET [B], 0x199D
  243.  
  244. SET A, POP
  245. SET PC, POP
  246.  
  247. REM #- PrintBackspace -##############
  248. REM Clears screen at [--B]
  249. REM   NOTE: Doesn't effect @NextPrint
  250. REM #################################
  251. PrintBackspace:
  252. SET PUSH, A
  253.  
  254. SET [B], 0x1920
  255.  
  256. REM # Check for start of line
  257. SET A, [@NextLine]
  258. ADD A, 3
  259. IFL B, A
  260.   MOV PrintBackspace_skip
  261.  
  262. SUB B, 1
  263. SET [B], 0x1920
  264.  
  265. PrintBackspace_skip:
  266. SET [B], 0x199D
  267.  
  268. SET A, POP
  269. SET PC, POP
  270.  
  271. REM #- ClearScreen -#################
  272. REM Clears the screen to 0x1920
  273. REM #################################
  274. ClearScreen:
  275. PUSHA
  276. SET A, [@ScreenStart]
  277. SET B, [@ScreenEnd]
  278. ADD B, 1
  279.  
  280. SET [@NextLine], 0x7FE0
  281. SET [@NextPrint], 0x7FE0
  282.  
  283. ClearScreen_loop:
  284. SET [A], 0x1920
  285. ADD A, 1
  286. IFL A, B
  287.   MOV ClearScreen_loop
  288.  
  289. POPA
  290. SET PC, POP
  291.  
  292. REM #- TrimStr -#####################
  293. REM Trims tailing white space from
  294. REM null-string at [A]
  295. REM #################################
  296. TrimStr:
  297. SET PUSH, A
  298.  
  299. TrimStr_findend:
  300. IFE [A], 0
  301.   MOV TrimStr_trimspace
  302.  
  303. ADD A, 1
  304. MOV TrimStr_findend
  305.  
  306. TrimStr_trimspace:
  307. REM # Back from null
  308. SUB A, 1
  309.  
  310. TrimStr_trimspace_loop:
  311. IFN [A], 0x20
  312.   MOV TrimStr_exit
  313.  
  314. SUB A, 1
  315. MOV TrimStr_trimspace_loop
  316.  
  317. TrimStr_exit:
  318. SET [A + 1], 0
  319.  
  320. SET A, POP
  321. SET PC, POP
  322.  
  323. REM #- StrEquals -###################
  324. REM If string [A] == string [B] {
  325. REM   JSR to C and after
  326. REM   return to I if I != 0
  327. REM } else { do nothing }
  328. REM #################################
  329. StrEquals:
  330. PUSHA
  331.  
  332. StrEquals_loop:
  333. IFN [A], [B]
  334.   MOV StrEquals_nomatch
  335.  
  336. IFE [A], 0
  337.   IFE [B], 0
  338.     MOV StrEquals_match
  339.  
  340. ADD A, 1
  341. ADD B, 1
  342. MOV StrEquals_loop
  343.  
  344. StrEquals_match:
  345. JSR C
  346.  
  347. IFE I, 0
  348.   MOV StrEquals_nomatch
  349.  
  350. POPA
  351. REM # Clear PC from stack
  352. SET [@ClearStack], POP
  353. SET PC, I
  354.        
  355. REM # No match found
  356. StrEquals_nomatch:
  357. POPA
  358. SET PC, POP
  359.  
  360. REM #- WaitForNumber -################
  361. REM Wait for a hex number with then
  362. REM   format #### to be entered
  363. REM ##################################
  364. WaitForNumber:
  365. SET PUSH, B
  366. SET PUSH, C
  367.  
  368. REM # Load line to B
  369. JSR LoadNextLine
  370.  
  371. REM # %
  372. SET [B], 0x1925
  373. ADD B, 2
  374. SET [B], 0x199D
  375.  
  376. SET C, &InputNumber
  377. JSR SetKeyCallback
  378.  
  379. SET C, POP
  380. SET B, POP
  381. SET PC, POP
  382.  
  383. REM ------------------------
  384. REM # Input line CALLBACK
  385. REM ------------------------
  386. &InputNumber:
  387. SET PUSH, C
  388.  
  389. SET A, 1
  390. HWI 1
  391. IFE C, 0x10
  392.   JSR PrintBackspace
  393. IFE C, 0x11
  394.   MOV &InputNumber_done
  395.  
  396. REM # Shorter char range check
  397. SET A, [@NextLine]
  398. ADD A, 0x5
  399. IFG B, A
  400.   MOV &InputNumber_exit
  401.  
  402. REM # 0-9
  403. IFG C, 0x2F
  404.   IFL C, 0x3A
  405.     JSR PrintChar
  406.  
  407. REM # a-f
  408. IFG C, 0x60
  409.   IFL C, 0x67
  410.     JSR PrintChar
  411.  
  412. REM # Not done yet
  413. MOV &InputNumber_exit
  414.  
  415. &InputNumber_done:
  416. SET [B], 0x1920
  417. JSR ClearKeyCallback
  418.  
  419. &InputNumber_exit:
  420. SET C, POP
  421. SET PC, POP
  422.  
  423. REM #- ParseNumber -#################
  424. REM Parses a number stored in @Input
  425. REM and stores the result in C
  426. REM If error I == 0xffff
  427. REM #################################
  428. ParseNumber:
  429. SET PUSH, A
  430. SET PUSH, B
  431.  
  432. SET C, 0
  433. SET I, 12
  434.  
  435. SET A, @Input
  436. ParseNumber_loop:
  437. SET B, [A]
  438.  
  439. REM # 0-9
  440. IFL B, 0x3A
  441.   SUB B, 0x30
  442.  
  443. REM # a-f
  444. IFG B, 0x60
  445.   IFL B, 0x67
  446.    SUB B, 0x57
  447.    
  448. IFG B, 0xF
  449.   MOV ParseNumber_bad
  450.  
  451. REM # Add to number
  452. SHL B, I
  453. ADD C, B
  454.  
  455. ADD A, 1
  456. SUB I, 4
  457.  
  458. REM # IF > -1
  459. IFA I, 0xffff
  460.   MOV ParseNumber_loop
  461.  
  462. REM # Is a 4 char number
  463. IFE [A], 0x20
  464.   MOV ParseNumber_done
  465. IFE [A], 0x00
  466.   MOV ParseNumber_done
  467.  
  468. REM # Bad input
  469. ParseNumber_bad:
  470. SET I, 0xffff
  471. SET A, $InvalidInput
  472. JSR PrintLn
  473.  
  474. ParseNumber_done:
  475. SET B, POP
  476. SET A, POP
  477. SET PC, POP
  478.  
  479. REM #- WaitForString -################
  480. REM Wait for a command to be entered
  481. REM ##################################
  482. WaitForString:
  483. SET PUSH, B
  484. SET PUSH, C
  485.  
  486. REM # Load line to B
  487. JSR LoadNextLine
  488.  
  489. REM # >
  490. SET [B], [@CursorChar]
  491. ADD B, 2
  492. SET [B], 0x199D
  493.  
  494. SET C, &InputLine
  495. JSR SetKeyCallback
  496.  
  497. SET C, POP
  498. SET B, POP
  499. SET PC, POP
  500.  
  501. REM # Input line CALLBACK
  502. &InputLine:
  503. SET PUSH, C
  504.  
  505. SET A, 1
  506. HWI 1
  507. IFE C, 0x10
  508.   JSR PrintBackspace
  509. IFE C, 0x11
  510.   MOV &InputLine_done
  511. IFG C, 0x1F
  512.   IFL C, 0x7F
  513.     JSR PrintChar
  514.  
  515. REM # Not done
  516. MOV &InputLine_exit
  517.  
  518. &InputLine_done:
  519. SET [B], 0x1900
  520. JSR ClearKeyCallback
  521. JSR ParseLineInput
  522.  
  523. &InputLine_exit:
  524. SET C, POP
  525. SET PC, POP
  526.  
  527. REM #- ParseLineInput -##############
  528. REM Parses the input out of this line
  529. REM #################################
  530. ParseLineInput:
  531. PUSHA
  532.  
  533. SET A, @Input
  534. SET B, [@NextLine]
  535. ADD B, 2
  536.  
  537. SET C, B
  538. ADD C, 28
  539.  
  540. ParseLineInput_loop:
  541. IFE [B], 0x1900
  542.   MOV ParseLineInput_end
  543. IFG B, C
  544.   MOV ParseLineInput_end
  545.  
  546. SET [A], [B]
  547. AND [A], 0x00ff
  548. ADD A, 1
  549. ADD B, 1
  550. MOV ParseLineInput_loop
  551.  
  552. ParseLineInput_end:
  553. REM # End with null
  554. SET [A], 0
  555.  
  556. POPA
  557. SET PC, POP
  558.  
  559. REM #- SendWordPacket -##############
  560. REM Send a packet to the IP 'XL', at
  561. REM port 'XH' with data 'YL'. Calls
  562. REM to hander 'YH' if reply
  563. REM #################################
  564. SendWordPacket:
  565. PUSHA
  566.  
  567. REM # Open ping port 'XH'
  568. SET A, 0
  569. SET B, XH
  570. HWI 4
  571.  
  572. REM # Set target to 'XL':'XH'
  573. SET A, 3
  574. SET B, XL
  575. SET C, XH
  576. HWI 4
  577.  
  578. REM # Append data 'YL'
  579. SET A, 4
  580. SET B, YL
  581. HWI 4
  582.  
  583. REM # Set time-out for 3 seconds
  584. SET A, 3
  585. SET B, SendWordPacket_Timeout
  586. JSR SetTimeout
  587.  
  588. REM # Send packet
  589. SET A, 5
  590. HWI 4
  591.  
  592. REM # Listen with callback 'YH'
  593. SET C, YH
  594. JSR SetPacketCallback
  595.  
  596. REM # Wait until handler cleared
  597. SendWordPacket_wait:
  598. IFN [@PacketHandler], 0
  599.   SET PC, SendWordPacket_wait
  600.  
  601. SendWordPacket_exit:
  602. REM # Close port
  603. SET A, 1
  604. SET B, XH
  605. HWI 4
  606.  
  607. POPA
  608. SET PC, POP
  609.  
  610. REM -----------------------------
  611. REM # Packet timeout HANDLER
  612. REM # if timeout pick-up here
  613. REM -----------------------------
  614. SendWordPacket_Timeout:
  615. JSR ClearPacketCallback
  616.  
  617. SET A, $Failed
  618. JSR PrintLn
  619.  
  620. MOV SendWordPacket_exit
  621.  
  622. REM #- SetKeyCallback -###############
  623. REM Set an event for a keyboard event
  624. REM Will MOV to C when event triggers
  625. REM Hangs until @KeyHandler == 0
  626. REM ##################################
  627. SetKeyCallback:
  628. SET PUSH, A
  629. SET PUSH, B
  630.  
  631. SET A, 3
  632. SET B, C
  633. SET [@KeyHandler], B
  634. HWI 1
  635.  
  636. SET B, POP
  637. SET A, POP
  638.  
  639. REM # Wait for the state to update
  640. SetKeyCallback_wait:
  641. IFN [@KeyHandler], 0
  642.   MOV SetKeyCallback_wait
  643.  
  644. SET PC, POP
  645.  
  646. REM #- ClearKeyCallback -#############
  647. REM Clears a KeyCallback
  648. REM ##################################
  649. ClearKeyCallback:
  650. SET PUSH, A
  651. SET PUSH, B
  652. SET [@KeyHandler], 0x0000
  653.  
  654. SET A, 0
  655. HWI 1
  656.  
  657. SET A, 3
  658. SET B, 0
  659. HWI 1
  660.  
  661. SET A, POP
  662. SET B, POP
  663. SET PC, POP
  664.  
  665. REM #- SetPacketCallback -############
  666. REM Set event for receiving a packet
  667. REM Will MOV to C when event triggers
  668. REM ##################################
  669. SetPacketCallback:
  670. SET PUSH, A
  671. SET PUSH, B
  672.  
  673. SET [@PacketHandler], C
  674.  
  675. SET A, 0xC
  676. SET B, C
  677. HWI 4
  678.  
  679. SET B, POP
  680. SET A, POP
  681. SET PC, POP
  682.  
  683. REM #- ClearPacketCallback -##########
  684. REM Clears a PacketCallback
  685. REM ##################################
  686. ClearPacketCallback:
  687. SET PUSH, A
  688. SET PUSH, B
  689. SET [@PacketHandler], 0x0000
  690.  
  691. REM # Clear packet buffer
  692. SET A, 0xB
  693. HWI 4
  694.  
  695. REM # Clear message
  696. SET A, 0xC
  697. SET B, 0
  698. HWI 4
  699.  
  700. SET A, POP
  701. SET B, POP
  702. SET PC, POP
  703.  
  704. REM #- SetTimeout -###################
  705. REM Starts a timeout which will MOV
  706. REM to B after A seconds
  707. REM * NOTE:
  708. REM    Timeout is not a handler,
  709. REM    will permanently move to the
  710. REM    timeout address  
  711. REM ##################################
  712. SetTimeout:
  713. SET PUSH, A
  714. SET PUSH, B
  715.  
  716. SET [@TimeoutTicks], A
  717. SET [@TimeoutAddress], B
  718.  
  719. REM # Int with message B
  720. SET A, 2
  721. HWI 2
  722.  
  723. REM # Start timer
  724. SET A, 0
  725. SET B, 60
  726. HWI 2
  727.  
  728. SET B, POP
  729. SET A, POP
  730. SET PC, POP
  731.  
  732. REM #- DoTimeout -####################
  733. REM Checks for timeout completion, if
  734. REM done moves to the timeout address
  735. REM ##################################
  736. DoTimeout:
  737. SET PUSH, C
  738.  
  739. REM # Get ticks
  740. SET A, 1
  741. HWI 2
  742.  
  743. REM # If less than timeout ticks skip
  744. IFL C, [@TimeoutTicks]
  745.   MOV DoTimeout_notyet
  746. SET C, POP
  747.  
  748. REM # Clear the timeout
  749. SET [@HandlerReg], [@TimeoutAddress]
  750. JSR ClearTimeout
  751.  
  752. REM # Reset from JSR
  753. SET [@ClearStack], POP
  754.  
  755. REM # Reset from interrupt
  756. SET A, POP
  757. SET [@ClearStack], POP
  758. SET [@ClearStack], POP
  759. IAQ 0
  760.  
  761. REM # Move to the handler
  762. SET PC, [@HandlerReg]
  763.  
  764. DoTimeout_notyet:
  765. SET C, POP
  766. SET PC, POP
  767.  
  768. REM #- ClearTimeout -#################
  769. REM Clears the current timeout
  770. REM ##################################
  771. ClearTimeout:
  772. SET PUSH, A
  773. SET PUSH, B
  774. SET [@TimeoutAddress], 0
  775.  
  776. REM # Stop timer
  777. SET A, 0
  778. SET B, 0
  779. HWI 2
  780.  
  781. REM # Clear message
  782. SET A, 2
  783. SET B, 0
  784. HWI 2
  785.  
  786. SET B, POP
  787. SET A, POP
  788. SET PC, POP
  789.  
  790. REM #- HardwareInterrupt -############
  791. REM The hardware interrupt handler
  792. REM ##################################
  793. HardwareIterrupt:
  794. IFE A, 0
  795.   RFI 0x0
  796.  
  797. REM # Event handlers
  798. IFE A, [@KeyHandler]
  799.   JSR [@KeyHandler]
  800.  
  801. IFE A, [@PacketHandler]
  802.   JSR [@PacketHandler]
  803.  
  804. REM # Insertion handlers
  805. IFE A, [@TimeoutAddress]
  806.   JSR DoTimeout
  807.  
  808. RFI 0x0
  809.  
  810. FILL NETLIB, 1024
  811.  
  812. REM ===================================
  813. REM * NETServ v1.1
  814. REM Host a dedicated server
  815. REM ===================================
  816. NETServ:
  817. SET A, $NetServ
  818. JSR PrintLn
  819.  
  820. SET A, $Connecting
  821. JSR PrintLn
  822.  
  823. JSR WaitForIP
  824.  
  825. REM # Print "Connected IP: #"
  826. SET B, [@NextLine]
  827. SET A, $Connected
  828. JSR PrintStr
  829.  
  830. SET A, [@IP]
  831. JSR PrintHex
  832.  
  833. REM # Open ports
  834. SET A, 0
  835. SET B, 64
  836. HWI 4
  837. SET B, 112
  838. HWI 4
  839. SET B, 113
  840. HWI 4
  841.  
  842. REM # Listen for packet
  843. SET C, &ServerPacket
  844. JSR SetPacketCallback
  845.  
  846. SET A, $ServerStarted
  847. JSR PrintLn
  848.  
  849. Server_loop:
  850. SET PC, Server_loop
  851.  
  852. NETServ_exit:
  853. HNG
  854.  
  855. REM ##########################
  856. REM # Server packet handler
  857. REM ##########################
  858. &ServerPacket:
  859. REM # Prepare to read
  860. SET A, 6
  861. HWI 4
  862.  
  863. REM # Load packet source
  864. SET A, 7
  865. HWI 4
  866.  
  867. IFE C, 64
  868.   MOV *Ping
  869.  
  870. IFE C, 112
  871.   MOV *RequestMenu
  872.  
  873. IFE C, 113
  874.   MOV *RequestCode
  875.  
  876. &ServerPacket_exit:
  877. SET PC, POP
  878.  
  879. REM #- Request Code 113 #####
  880. *RequestCode:
  881. REM # Get option selected
  882. SET A, 8
  883. HWI 4
  884.  
  885. REM # Verify range
  886. IFG B, 1
  887.   MOV &ServerPacket_exit
  888.  
  889. REM # Set code target
  890. IFE B, 0
  891.   SET I, $MenuCode_0
  892. IFE B, 1
  893.   SET I, $MenuCode_1
  894.  
  895. REM # Set sender to target
  896. SET A, 7
  897. HWI 4
  898. SET A, 3
  899. HWI 4
  900.  
  901. REM # Add data to packet
  902. SET A, 4
  903. *RequestCode_loop:
  904. SET B, [I]
  905. IFE B, 0
  906.   MOV *RequestCode_loaded
  907.  
  908. HWI 4
  909. ADD I, 1
  910. MOV *RequestCode_loop
  911.  
  912. *RequestCode_loaded:
  913. REM # Send packet
  914. SET A, 5
  915. HWI 4
  916.  
  917. MOV &ServerPacket_exit
  918.  
  919. REM #- Request Menu 112 #####
  920. *RequestMenu:
  921. REM # Verify is menu
  922. REM # First word 0x0000
  923. SET A, 8
  924. HWI 4
  925. IFN B, 0
  926.   MOV &ServerPacket_exit
  927.  
  928. REM # Set sender to target
  929. SET A, 7
  930. HWI 4
  931. SET A, 3
  932. HWI 4
  933.  
  934. REM # Add data to packet
  935. SET A, 4
  936. SET I, $MenuText
  937. *RequestMenu_loop:
  938. SET B, [I]
  939. HWI 4
  940.  
  941. ADD I, 1
  942. IFL I, $MenuText_End
  943.   MOV *RequestMenu_loop
  944.  
  945. REM # Send packet
  946. SET A, 5
  947. HWI 4
  948.  
  949. MOV &ServerPacket_exit
  950.  
  951. REM #- Ping 64 -#############
  952. *Ping:
  953. REM # Verify is ping
  954. REM # First word 0x0001
  955. SET A, 8
  956. HWI 4
  957. IFN B, 1
  958.   MOV &ServerPacket_exit
  959.  
  960. REM # Set sender to target.
  961. REM # Save sender IP in I
  962. SET A, 7
  963. SET I, B
  964. HWI 4
  965. SET A, 3
  966. HWI 4
  967.  
  968. REM # Append 2
  969. SET A, 4
  970. SET B, 2
  971. HWI 4
  972.  
  973. REM # Send packet
  974. SET A, 5
  975. HWI 4
  976.  
  977. REM # Print sender IP
  978. SET A, I
  979. JSR LoadNextLine
  980. JSR PrintHex
  981.  
  982. MOV &ServerPacket_exit
  983.  
  984. REM ##############
  985. REM Strings
  986. REM  < 32 chars
  987. REM ##############
  988. $NetServ:
  989. DAT "NETServ v1.1", 0x0
  990.  
  991. $Connecting:
  992. DAT "Connecting...", 0x0
  993.  
  994. $Connected:
  995. DAT "Connected IP: ", 0x0
  996.  
  997. $ServerStarted:
  998. DAT "Server started", 0x0
  999.  
  1000.  
  1001. REM !!!!!!!!!!!!!!!!
  1002. REM CHANGE THIS
  1003. REM !!!!!!!!!!!!!!!!
  1004. $MenuText:
  1005. DAT "Print('Hell');", 0x0
  1006. DAT "Print('123');", 0x0
  1007. $MenuText_End:
  1008.  
  1009. $MenuCode_0:
  1010. DAT "SET A,0x8020;SET [A],'H';SET [A+1],'e';SET [A+2],'l';SET [A+3],'l'", 0x0
  1011. $MenuCode_1:
  1012. DAT "SET A,0x8020;SET [A],0x1830;SET [A+1],0x1831;SET [A+2],0x1832", 0x0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top