From d04b4dfa993681060d363b5ef994c1a635f3c1f9 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Thu, 28 Dec 2023 17:12:54 -0800 Subject: Checkpoint --- demo/test-1.hex | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 demo/test-1.hex (limited to 'demo/test-1.hex') diff --git a/demo/test-1.hex b/demo/test-1.hex new file mode 100644 index 0000000..e7f7c6e --- /dev/null +++ b/demo/test-1.hex @@ -0,0 +1,64 @@ +; Function header (3 args, 3 variables) +00 03 00 03 + +; Store the listing +10 BE 91 D8 8A 21 02 8B 53 C2 01 2B D7 8A 21 01 8B 52 C2 C8 +13 80 + +; Store the min price +10 0F +13 81 + +; Store the best offer +10 0F +13 82 + +; Iterate the offers +19 80 + +; offersloop: (34) +03 ; DUP2 +38 F7 ; IFGE2 end +1B 80 ; STEPIN 1 + +; structloop: (39) +03 ; DUP2 +38 D1 ; IFGE2 missingprice +1E 80 ; SFIELD 1 +10 71 0B ; PUSH price +36 B3 ; IFEQ2 endstructloop +1A 80 ; NEXT 1 +01 A5 ; JMP structloop + +; endstructloop: (53) +1D 80 ; LOADVALUE 1 + +12 81 ; LOAD 2 +10 0F ; PUSH null +36 C1 ; IFEQ2 saveprice + +12 81 ; LOAD 2 +3B CE ; IFLT2 skipoffer + +; saveprice: (65) +1D 80 ; SVALUE 1 ; Save the lowest price in var2. +13 81 ; STORE 2 +1C ; STEPOUT +1D 80 ; VALUE 1 ; Save the whole struct in var3. +13 82 ; STORE 3 +1A 80 ; NEXT 1 +01 A0 ; JMP offersloop + +; skipoffer: (78) +1C ; STEPOUT +1A 80 ; NEXT 1 +01 A0 ; JMP offersloop + +; missingprice: (83) +10 8E 9F 65 72 72 6F 72 3A 20 6D 69 73 73 69 6E 67 20 70 72 69 63 65 20 69 6E 20 6C 69 73 74 69 6E 67 ; PUSH "error: missing price in listing" +13 82 ; STORE 3 + +; end: (119) +11 +11 +11 -- cgit v1.2.3