pcxtest2.exe
UTILEXEC = &
palettel.exe &
- palllist.exe &
palbomb.exe &
palettec.exe &
ps.exe
palettec.exe: palettec.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
palettel.exe: palettel.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
palbomb.exe: palbomb.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
-palllist.exe: palllist.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) ll.$(OBJ)
pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib $(DOSLIB)
#planrpcx.exe: planrpcx.$(OBJ) gfx.lib
maptest.exe: maptest.$(OBJ) 16_map.$(OBJ) 16_head.$(OBJ) gfx.lib $(DOSLIB) $(16LIB)
palettec.$(OBJ): $(SRC)/palettec.c
palettel.$(OBJ): $(SRC)/palettel.c
palbomb.$(OBJ): $(SRC)/palbomb.c
-palllist.$(OBJ): $(SRC)/palllist.c
maptest.$(OBJ):$(SRC)/maptest.c $(SRCLIB)/16_vl.h
#emmtest.$(OBJ):$(SRC)/emmtest.c
#emsdump.$(OBJ):$(SRC)/emsdump.c
#midi.$(OBJ): $(SRCLIB)/midi.c
c_utils.$(OBJ): $(MODEXLIB)/c_utils.asm
modex.$(OBJ): $(MODEXLIB)/modex.asm
-ll.$(OBJ): $(SRCLIB)/ll.c $(SRCLIB)/ll.h
bitmapl.$(OBJ): $(SRCLIB)/bitmapl.c $(SRCLIB)/bitmapl.h
#
// printf(" cf=%04x\npf=%04x\naf=%04x\nzf=%04x\nsf=%04x\ntf=%04x\nif=%04x\ndf=%04x\nof=%04x\n", _CF, _PF, _AF, _ZF, _SF, _TF, _IF, _DF, _OF);\r
printf("cflag: "BYTE_TO_BINARY_PATTERN""BYTE_TO_BINARY_PATTERN"\n", BYTE_TO_BINARY(_cflag>>8), BYTE_TO_BINARY(_cflag));\r
// printf("cflag: %s\n",(_cflag));\r
- printf("dx: "NIBBLE_TO_BINARY_PATTERN""NIBBLE_TO_BINARY_PATTERN"\n", NIBBLE_TO_BINARY(_dx>>4), NIBBLE_TO_BINARY(_dx));\r
#endif\r
+ printf("dx: "NIBBLE_TO_BINARY_PATTERN""NIBBLE_TO_BINARY_PATTERN"\n", NIBBLE_TO_BINARY(_dx>>4), NIBBLE_TO_BINARY(_dx));\r
printf("dx: "BYTE_TO_BINARY_PATTERN""BYTE_TO_BINARY_PATTERN"\n", BYTE_TO_BINARY(_dx>>8), BYTE_TO_BINARY(_dx));\r
+ printf("dx: "WORD_TO_BINARY_PATTERN"\n", WORD_TO_BINARY(_dx));\r
printf(" ---------------------------------------\n");\r
#endif\r
\r
(byte & 0x02 ? '1' : '0'), \\r
(byte & 0x01 ? '1' : '0')\r
\r
+#define WORD_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c"\r
+#define WORD_TO_BINARY(word) \\r
+ (word & 0x8000 ? '1' : '0'), \\r
+ (word & 0x4000 ? '1' : '0'), \\r
+ (word & 0x2000 ? '1' : '0'), \\r
+ (word & 0x1000 ? '1' : '0'), \\r
+ (word & 0x0800 ? '1' : '0'), \\r
+ (word & 0x0400 ? '1' : '0'), \\r
+ (word & 0x0200 ? '1' : '0'), \\r
+ (word & 0x0100 ? '1' : '0'), \\r
+ (word & 0x0080 ? '1' : '0'), \\r
+ (word & 0x0040 ? '1' : '0'), \\r
+ (word & 0x0020 ? '1' : '0'), \\r
+ (word & 0x0010 ? '1' : '0'), \\r
+ (word & 0x0008 ? '1' : '0'), \\r
+ (word & 0x0004 ? '1' : '0'), \\r
+ (word & 0x0002 ? '1' : '0'), \\r
+ (word & 0x0001 ? '1' : '0')\r
+\r
#define NIBBLE_TO_BINARY_PATTERN "%c%c%c%c"\r
-#define NIBBLE_TO_BINARY(byte) \\r
- (byte & 0x08 ? '1' : '0'), \\r
- (byte & 0x04 ? '1' : '0'), \\r
- (byte & 0x02 ? '1' : '0'), \\r
- (byte & 0x01 ? '1' : '0')\r
+#define NIBBLE_TO_BINARY(nibble) \\r
+ (nibble & 0x08 ? '1' : '0'), \\r
+ (nibble & 0x04 ? '1' : '0'), \\r
+ (nibble & 0x02 ? '1' : '0'), \\r
+ (nibble & 0x01 ? '1' : '0')\r
+\r
+#define BOOLEAN_TO_BINARY_PATTERN "%c"\r
+#define BOOLEAN_TO_BINARY(boolean) \\r
+ (boolean & 0x01 ? '1' : '0')\r
\r
#define PRINT_OPAQUE_STRUCT(p) print_mem((p), sizeof(*(p)))\r
\r
+++ /dev/null
-#include "src/lib/ll.h"\r
-\r
-#ifdef OTHERMERGELISTSTIFF\r
-int listLength(node_t * item)\r
-{\r
- node_t * cur = item;\r
- int size = 0;\r
-\r
- while (cur->next != NULL)\r
- {\r
- ++size;\r
- cur = cur->next;\r
- }\r
-\r
- return size;\r
-}\r
-\r
-void print_list(node_t * head)\r
-{\r
- node_t * current = head;\r
-\r
- while (current->next != NULL)\r
- {\r
- printf("[%u]= %d\n", current->id, current->val);\r
- current = current->next;\r
- }\r
-}\r
-\r
-void pushe(node_t * head, int val)\r
-{\r
- node_t * current = head;\r
- current->id = head->id;\r
- current->next->id = current->id+1;\r
-\r
- while (current->next != NULL)\r
- {\r
- current->next->id = current->id;\r
- current = current->next;\r
- current->id++;\r
- }\r
-\r
- // now we can add a new variable\r
- current->next = malloc(sizeof(node_t));\r
- current->next->val = val;\r
- current->next->next = NULL;\r
- current->next->id++;\r
-}\r
-\r
-void pushs(node_t ** head, int val)\r
-{\r
- node_t * new_node;\r
- new_node = malloc(sizeof(node_t));\r
-\r
- new_node->val = val;\r
- new_node->next = *head;\r
- *head = new_node;\r
-}\r
-\r
-int pop(node_t ** head)\r
-{\r
- int retval = -1;\r
- node_t * next_node = NULL;\r
-\r
- if (*head == NULL) {\r
- return -1;\r
- }\r
-\r
- next_node = (*head)->next;\r
- retval = (*head)->val;\r
- free(*head);\r
- *head = next_node;\r
-\r
- return retval;\r
-}\r
-\r
-int remove_last(node_t * head)\r
-{\r
- int retval = 0;\r
- node_t * current;\r
-\r
- /* if there is only one item in the list, remove it */\r
- if (head->next == NULL) {\r
- retval = head->val;\r
- free(head);\r
- return retval;\r
- }\r
-\r
- /* get to the last node in the list */\r
- current = head;\r
- while (current->next->next != NULL) {\r
- current = current->next;\r
- }\r
-\r
- /* now current points to the last item of the list, so let's remove current->next */\r
- retval = current->next->val;\r
- free(current->next);\r
- current->next = NULL;\r
- return retval;\r
-\r
-}\r
-\r
-int remove_by_index(node_t ** head, int n)\r
-{\r
- int i = 0;\r
- int retval = -1;\r
- node_t * current = *head;\r
- node_t * temp_node = NULL;\r
-\r
- if (n == 0) {\r
- return pop(head);\r
- }\r
-\r
- for (i = 0; i < n-1; i++) {\r
- if (current->next == NULL) {\r
- return -1;\r
- }\r
- current = current->next;\r
- }\r
-\r
- temp_node = current->next;\r
- retval = temp_node->val;\r
- current->next = temp_node->next;\r
- free(temp_node);\r
-\r
- return retval;\r
-}\r
-#else\r
-/* Takes two lists sorted in increasing order, and splices\r
- their nodes together to make one big sorted list which\r
- is returned. */\r
-struct node* SortedMerge(struct node* a, struct node* b)\r
-{\r
- /* a dummy first node to hang the result on */\r
- struct node dummy;\r
-\r
- /* tail points to the last result node */\r
- struct node* tail = &dummy;\r
-\r
- /* so tail->next is the place to add new nodes\r
- to the result. */\r
- dummy.next = NULL;\r
- while (1)\r
- {\r
- if (a == NULL)\r
- {\r
- /* if either list runs out, use the\r
- other list */\r
- tail->next = b;\r
- break;\r
- }\r
- else if (b == NULL)\r
- {\r
- tail->next = a;\r
- break;\r
- }\r
- if (a->data <= b->data)\r
- Movenode(&(tail->next), &a);\r
- else\r
- Movenode(&(tail->next), &b);\r
-\r
- tail = tail->next;\r
- }\r
- return(dummy.next);\r
-}\r
-\r
-struct node* LL_merge(struct node* a, struct node* b)\r
-{\r
- /* a dummy first node to hang the result on */\r
- struct node dummy;\r
-\r
- /* tail points to the last result node */\r
- struct node* tail = &dummy;\r
-\r
- /* so tail->next is the place to add new nodes\r
- to the result. */\r
- dummy.next = NULL;\r
- Movenode(&(tail->next), &a);\r
- a = a->next;\r
- tail = tail->next;\r
- while (1)\r
- {\r
- if (a == NULL)\r
- {\r
- /* if either list runs out, use the\r
- other list */\r
- tail->next = b;\r
- break;\r
- }\r
- else if (b == NULL)\r
- {\r
- tail->next = a;\r
- break;\r
- }\r
- if (a->data <= b->data)\r
- Movenode(&(tail->next), &a);\r
- else\r
- Movenode(&(tail->next), &b);\r
-\r
- tail = tail->next;\r
- }\r
- return(dummy.next);\r
-}\r
-\r
-/* The function removes duplicates from a sorted list */\r
-void removeDuplicates(struct node* head)\r
-{\r
- /* Pointer to traverse the linked list */\r
- struct node* current = head;\r
- \r
- /* Pointer to store the next pointer of a node to be deleted*/\r
- struct node* next_next;\r
-\r
- /* do nothing if the list is empty */\r
- if (current == NULL)\r
- return;\r
- \r
- /* Traverse the list till last node */\r
- while (current->next != NULL)\r
- {\r
- /* Compare current node with next node */\r
- if (current->data == current->next->data)\r
- {\r
- /* The sequence of steps is important */\r
- next_next = current->next->next;\r
- free(current->next);\r
- current->next = next_next;\r
- }\r
- else /* This is tricky: only advance if no deletion */\r
- {\r
- current = current->next;\r
- }\r
- }\r
-}\r
-\r
-/* UTILITY FUNCTIONS */\r
-/* Movenode() function takes the node from the front of the\r
- source, and move it to the front of the dest.\r
- It is an error to call this with the source list empty.\r
-\r
- Before calling Movenode():\r
- source == {1, 2, 3}\r
- dest == {1, 2, 3}\r
-\r
- Affter calling Movenode():\r
- source == {2, 3}\r
- dest == {1, 1, 2, 3} */\r
-void Movenode(struct node** destRef, struct node** sourceRef)\r
-{\r
- /* the front source node */\r
- struct node* newnode = *sourceRef;\r
- assert(newnode != NULL);\r
-\r
- /* Advance the source pointer */\r
- *sourceRef = newnode->next;\r
-\r
- /* Link the old dest off the new node */\r
- newnode->next = *destRef;\r
-\r
- /* Move dest to point to the new node */\r
- *destRef = newnode;\r
-}\r
-\r
-/* Function to insert a node at the beginging of the\r
- linked list */\r
-void pushll(struct node** head_ref, int new_data)\r
-{\r
- /* allocate node */\r
- struct node* new_node =\r
- (struct node*) malloc(sizeof(struct node));\r
-\r
- /* put in the data */\r
- new_node->data = new_data;\r
-\r
- /* link the old list off the new node */\r
- new_node->next = (*head_ref);\r
-\r
- /* move the head to point to the new node */\r
- (*head_ref) = new_node;\r
-}\r
-\r
-/* Function to print nodes in a given linked list */\r
-void printList(struct node *node)\r
-{\r
- while (node!=NULL)\r
- {\r
- printf("%d ", node->data);\r
- node = node->next;\r
- }\r
-}\r
-#endif\r
+++ /dev/null
-#ifndef __LL_H__\r
-#define __LL_H__\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <assert.h>\r
-#include "src/lib/16_tail.h"\r
-\r
-//#define OTHERMERGELISTSTIFF\r
-\r
-/* Link list node_t */\r
-typedef struct node\r
-{\r
- struct node *prev;\r
- rgb_t d;\r
- int data;\r
- struct node *next;\r
- word id;\r
-} node_t;\r
-\r
-#ifdef OTHERMERGELISTSTIFF\r
-int listLength(node_t * item);\r
-void print_list(node_t * head);\r
-void pushe(node_t * head, int val);\r
-void pushs(node_t ** head, int val);\r
-int pop(node_t ** head);\r
-int remove_last(node_t * head);\r
-int remove_by_index(node_t ** head, int n);\r
-#else\r
-/* pull off the front node of the source and put it in dest */\r
-void Movenode(struct node** destRef, struct node** sourceRef);\r
-struct node* SortedMerge(struct node* a, struct node* b);\r
-struct node* LL_merge(struct node* a, struct node* b);\r
-void pushll(struct node** head_ref, int new_data);\r
-void printList(struct node *node);\r
-void removeDuplicates(struct node* head);\r
-#endif\r
-\r
-#endif\r
--- /dev/null
+/*
+ * palllist experiment
+ */
+/*
+ * An experiment where I make 2 small linked list which points to 2 arrays
+ * one is the "hardware palette" array
+ * the other is "image palette" array
+ * and their respectable pointers point to their [i] stuff
+ *
+ * the palette updater stuff i want to make is this:
+ *
+ * VGA IMG
+ * 1- 2-
+ * 2- 4-
+ * 3- 0-
+ * 4- 9-
+ * 5- 0-(I will figure this out later if there is dup numbs)
+ * 6-
+ * 7-
+ * 8-
+ *
+ * MERGE THEM INTO
+ *
+ * VGA
+ * 1-
+ * 2->IMG[0]
+ * 3-
+ * 4->IMG[1]
+ * 5
+ * 6
+ * 7
+ * 8
+ * 9->IMG[3]
+ * 0->IMG[2]->IMG[4]
+ *
+ * i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon! .
+ * ==== PRE SHOWPAGE TO SHOWMV CONVERSION ==== i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon!
+ */
+++ /dev/null
-/* Project 16 Source Code~\r
- * Copyright (C) 2012-2018 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
- *\r
- * This file is part of Project 16.\r
- *\r
- * Project 16 is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 3 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Project 16 is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
- * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
- * Fifth Floor, Boston, MA 02110-1301 USA.\r
- *\r
- */\r
-/*\r
- * palllist experiment\r
- */\r
-/*\r
- * An experiment where I make 2 small linked list which points to 2 arrays\r
- * one is the "hardware palette" array\r
- * the other is "image palette" array\r
- * and their respectable pointers point to their [i] stuff\r
- *\r
- * the palette updater stuff i want to make is this:\r
- *\r
- * VGA IMG\r
- * 1- 2-\r
- * 2- 4-\r
- * 3- 0-\r
- * 4- 9-\r
- * 5- 0-(I will figure this out later if there is dup numbs)\r
- * 6-\r
- * 7-\r
- * 8-\r
- *\r
- * MERGE THEM INTO\r
- *\r
- * VGA\r
- * 1-\r
- * 2->IMG[0]\r
- * 3-\r
- * 4->IMG[1]\r
- * 5\r
- * 6\r
- * 7\r
- * 8\r
- * 9->IMG[3]\r
- * 0->IMG[2]->IMG[4]\r
- *\r
- * i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon! .\r
- * ==== PRE SHOWPAGE TO SHOWMV CONVERSION ==== i am going to work on a really big area of code it will be on the refresh system, the walking/scrolling system, things that use showpage, adding disableing 8087 functions if no 8087 detected, and a bunch of other things i cannot remember off the top of my head because i am BURNT. I need a small break~ -- -- -- -- update! i am working on this i made ZC_WALK and i am going to move to VRL/VRS soon!\r
- */\r
-#include "src/lib/ll.h"\r
-\r
-#if 0\r
-//def OTHERMERGELISTSTIFF\r
-\r
-void\r
-main(int argc, char *argv[])\r
-{\r
- int i;\r
- node_t * vga = NULL; node_t * imgpal = NULL;\r
- vga = malloc(sizeof(node_t)); imgpal = malloc(sizeof(node_t));\r
- vga->val = 24; imgpal->val = 9;\r
- vga->next=NULL; imgpal->next=NULL;\r
- vga->id=0; imgpal->id=0;\r
-\r
- printf(" ");\r
- for(i=1; i<=\r
- //PAL_SIZE\r
- 6\r
- ; i++)\r
- {\r
- if(!(i%3)) printf("\n ");\r
- printf("%d,", i);\r
- pushe(vga, i);\r
- }\r
-\r
- printf("\n\n ");\r
-\r
- for(i=4; i>0; i--)\r
- {\r
- if(!(i%3)) printf("\n ");\r
- printf("%d,", i);\r
- pushe(imgpal, i);\r
- }\r
- printf("\n");\r
-\r
- printf("size of vga = %d\n", listLength(vga));\r
-//#if 0\r
- printf("\n=======================\n");\r
- printf("vga list printings\n=======================\n");\r
- print_list(vga);\r
- printf("\n=======================\n");\r
- printf("imgpal list printings\n=======================\n");\r
- print_list(imgpal);\r
-// printf("\n=======================\n");\r
-//#endif\r
- i=1;//skip overscan\r
- while(i!=listLength(imgpal))\r
- {\r
- \r
- }\r
- free(vga);\r
- free(imgpal);\r
-}\r
-#else\r
-#if 0\r
-/* C/C++ program to merge two sorted linked lists */\r
-// from http://www.geeksforgeeks.org/merge-two-sorted-linked-lists/\r
-\r
-/* Drier program to test above functions*/\r
-void main()\r
-{\r
- /* Start with the empty list */\r
- struct node* res = NULL;\r
- struct node* a = NULL;\r
- struct node* b = NULL;\r
-\r
- /* Let us create two sorted linked lists to test\r
- the functions\r
- Created lists, a: 5->10->15, b: 2->3->20 */\r
- pushll(&a, 15);\r
- pushll(&a, 10);\r
- pushll(&a, 4);\r
- pushll(&a, 3);\r
- pushll(&a, 2);\r
- pushll(&a, 1);\r
- pushll(&a, 0);\r
-\r
- pushll(&b, 20);\r
- pushll(&b, 3);\r
- pushll(&b, 2);\r
- pushll(&b, 4);\r
-\r
- printf("\n");\r
- printf("The 2 Linked List are: \n");\r
- printList(a); printf("\n");\r
- printList(b); printf("\n");\r
-\r
- /* Remove duplicates from linked list */\r
- res = SortedMerge(a, b);\r
-// res = LL_merge(a, b);\r
- \r
- printf("Merged Linked List is: \n");\r
- printList(res);\r
-}\r
-#endif\r
-/* C Program to remove duplicates from a sorted linked list */\r
-\r
-/* Drier program to test above functions*/\r
-void main()\r
-{\r
- /* Start with the empty list */\r
- struct node* head = NULL;\r
- \r
- /* Let us create a sorted linked list to test the functions\r
- Created linked list will be 11->11->11->13->13->20 */\r
- pushll(&head, 20);\r
- pushll(&head, 13);\r
- pushll(&head, 13);\r
- pushll(&head, 11);\r
- pushll(&head, 11);\r
- pushll(&head, 11);\r
-\r
- printf("\n Linked list before duplicate removal ");\r
- printList(head);\r
-\r
- /* Remove duplicates from linked list */\r
- removeDuplicates(head);\r
-\r
- printf("\n Linked list after duplicate removal ");\r
- printList(head);\r
-}\r
-#endif\r