Permalink
Browse files

MegaZeux 2.69 release.

  • Loading branch information...
1 parent 2eda533 commit 378f1e3ad884da2adae6881386323bcea8b844b3 @ajs1984 committed Aug 11, 2008
Showing with 696 additions and 153 deletions.
  1. +25 −1 arrowkey.asm
  2. +1 −0 arrowkey.h
  3. +2 −1 arrowkey.inc
  4. +1 −0 boardmem.cpp
  5. +14 −11 char_ed.cpp
  6. +131 −32 counter.cpp
  7. +3 −1 cursor.asm
  8. +1 −0 data.inc
  9. +1 −0 data2.cpp
  10. BIN default.spl
  11. +11 −2 edit.cpp
  12. +2 −2 egacode.cpp
  13. +1 −0 egacode.h
  14. +14 −0 expr.cpp
  15. +15 −1 ezboard.cpp
  16. +11 −9 game.cpp
  17. +3 −1 game.h
  18. +12 −9 game_run.cpp
  19. +12 −2 main.cpp
  20. +2 −2 main_run.cpp
  21. +1 −0 mzm.cpp
  22. +166 −49 palette.cpp
  23. +17 −0 palette.h
  24. +9 −7 runrobo2.cpp
  25. +4 −4 runrobot.cpp
  26. +2 −0 runrobot.h
  27. +45 −8 saveload.cpp
  28. +178 −1 scrdump.cpp
  29. +1 −0 scrdump.h
  30. +11 −10 sprite.cpp
View
@@ -88,6 +88,16 @@ action_tbl2 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;000h - 00Fh
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 ;0E0h - 0EFh
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;0F0h - 0FFh
+state_table db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;000h - 00Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;010h - 01Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;020h - 02Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;030h - 03Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;040h - 04Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;050h - 05Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;060h - 06Fh
+ db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;070h - 07Fh
+
+
;
; Function- intercept_09
;
@@ -110,7 +120,21 @@ proc intercept_09 far
; Get scan code
sti
in al,60h
- mov [key_code],al
+ ; This is special code that will set the key array too.
+ ; The msb determines if the key was set or released..
+ mov cl, al
+ ; Not it; 0 for released, 1 for pressed.
+ not cl
+ ; Put it at the lsb...
+ shr cl, 7
+ ; Make another copy for the index...
+ mov bx, ax
+ ; Only interested in the 7 least significant bits.
+ and bx, 07Fh
+ add bx, OFFSET cs:state_table
+ ; Voila!
+ mov [cs:bx], cl
+ mov [key_code],al
; Set dl to 0, which means no loop
; xor dl,dl
View
@@ -34,6 +34,7 @@ extern char far del_pressed;
extern char far key_code; /* Latest key code */
extern char far keyb_mode; /* Set to 1 for different key discard code */
extern char far curr_table; /* The current keyboard table (0/1) */
+extern char far state_table[128];
#ifdef __cplusplus
extern "C" {
View
@@ -14,4 +14,5 @@ global C del_pressed:byte
global C kb_installed:byte
global C keyb_mode:byte ; Set to 1 for alternate code
global C switch_keyb_table:far
-global C curr_table:byte
+global C curr_table:byte
+global C state_table:far
View
@@ -3,6 +3,7 @@
*
* Copyright (C) 1996 Greg Janson
* Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
+ * Copyright (C) 2002 Gilead Kutnick - exophase@adelphia.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
View
@@ -94,7 +94,7 @@ F5 Revert to MZX",40,4,143,current_pg_seg);
{
//Update char
m_hide();
- /*if (smzx_mode)
+ if (smzx_mode)
{
for(t2=0;t2<14;t2++)
{
@@ -119,17 +119,20 @@ F5 Revert to MZX",40,4,143,current_pg_seg);
t1++;
}
}
- }*/
- for(t1=0;t1<8;t1++)
- {
- for(t2=0;t2<14;t2++)
- {
- bit=matrix[t2]&(128>>t1);
- if(bit) write_string("ÛÛ",22+(t1<<1),5+t2,135,
- current_pg_seg);
- else write_string("úú",22+(t1<<1),5+t2,135,current_pg_seg);
- }
}
+ else
+ {
+ for(t1=0;t1<8;t1++)
+ {
+ for(t2=0;t2<14;t2++)
+ {
+ bit=matrix[t2]&(128>>t1);
+ if(bit) write_string("ÛÛ",22+(t1<<1),5+t2,135,
+ current_pg_seg);
+ else write_string("úú",22+(t1<<1),5+t2,135,current_pg_seg);
+ }
+ }
+ }
for(t2=0;t2<14;t2++)
write_number(matrix[t2],135,17,5+t2,current_pg_seg,3);
View
@@ -31,6 +31,8 @@
#include "counter.h"
+#include "getkey.h"
+#include "arrowkey.h"
#include "bwsb.h"
#include "egacode.h"
#include "blink.h"
@@ -57,6 +59,7 @@
#include "saveload.h"
#include "ezboard.h"
#include "mod.h"
+#include "palette.h"
long off;
char fileio;
@@ -372,6 +375,12 @@ int get_counter(char far *name,unsigned char id)
return((get_counter("INT") >> place) & 1);
}
+ // Prepare for SMZX palette
+ if(!str_cmp(name, "SMZX_PALETTE"))
+ {
+ fileio = 6;
+ }
+
//Open input_file! -Koji
if(!strn_cmp(name, "FREAD", 5))
{
@@ -402,10 +411,6 @@ int get_counter(char far *name,unsigned char id)
return(ftell(input_file) >> 15);
}
- if(!str_cmp(name + 5, "_SGAME"))
- {
- }
-
//Reads from input_file. -Koji
if(name[5] == 0)
{
@@ -573,9 +578,32 @@ int get_counter(char far *name,unsigned char id)
}
// }if(MZXAKWENDEVERSION == 1)
- // {
- // if(!str_cmp(name,"SMZX_MODE"))
- // return smzx_mode;
+ if(!strn_cmp(name,"SMZX_", 5))
+ {
+ if(!str_cmp(name + 5, "MODE"))
+ {
+ return smzx_mode;
+ }
+ if((name[5] == 'R') || (name[5] == 'r'))
+ {
+ int c;
+ c = strtol(name + 6, NULL, 10) & 255;
+ return smzx_mode2_palette[c * 3];
+ }
+ if((name[5] == 'G') || (name[5] == 'g'))
+ {
+ int c;
+ c = strtol(name + 6, NULL, 10) & 255;
+ return smzx_mode2_palette[(c * 3) + 1];
+ }
+ if((name[5] == 'B') || (name[5] == 'b'))
+ {
+ int c;
+ c = strtol(name + 6, NULL, 10) & 255;
+ return smzx_mode2_palette[(c * 3) + 2];
+ }
+ }
+
if(!strn_cmp(name, "DATE_", 5))
{
if(!str_cmp(name + 5,"DAY"))
@@ -658,7 +686,46 @@ int get_counter(char far *name,unsigned char id)
//Next, check for global, non-standard counters
if(!str_cmp(name,"INPUT")) return num_input;
if(!str_cmp(name,"INPUTSIZE")) return input_size;
- if(!str_cmp(name,"KEY")) return last_key;
+ if(!strn_cmp(name,"KEY",3))
+ {
+ if(!str_cmp(name + 3, "_PRESSED"))
+ {
+ return key_get;
+ }
+ if(!str_cmp(name + 3, "_RELEASE"))
+ {
+ int r = (unsigned char)key_code - 128;
+ if(r < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return r;
+ }
+ }
+ if(!str_cmp(name + 3, "_CODE"))
+ {
+ if(key_code < 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return key_code;
+ }
+ }
+ if(name[3] == 0)
+ {
+ return last_key;
+ }
+ else
+ {
+ int n = strtol(name + 3, NULL, 10) & 0x7F;
+ return state_table[n];
+ }
+ }
+
if(!str_cmp(name,"SCORE")) return(unsigned int)score;
if(!str_cmp(name,"TIMERESET")) return time_limit;
if(!str_cmp(name,"PLAYERFACEDIR")) return player_last_dir>>4;
@@ -1029,6 +1096,12 @@ void set_counter(char far *name,int value,unsigned char id)
}
break;
}
+ // Load SMZX palette
+ case 6:
+ {
+ load_smzx_palette(name);
+ break;
+ }
}
fileio = 0;
@@ -1053,7 +1126,8 @@ void set_counter(char far *name,int value,unsigned char id)
if(string_type(name) == 2)
{
set_str_char(name, value);
- }
+ return;
+ }
//Ok, ok. I did steal the "pos" within "page" idea from Akwende.
//It is a great idea to be able to read more than 32767 bytes.
@@ -1267,39 +1341,64 @@ void set_counter(char far *name,int value,unsigned char id)
overlay_mode = 4;
}
*/
-/* if(!str_cmp(name,"SMZX_MODE"))
+
+ if(!strn_cmp(name, "SMZX_", 5))
+ {
+ if(!str_cmp(name + 5, "MODE"))
{
smzx_mode = (char)value % 3;
-
- if(smzx_mode==1)
+
+ if(smzx_mode)
{
- smzx_14p_mode();
- cursor_off();
- blink_off();
- ec_update_set();
- //init_palette();
- smzx_update_palette(0);
+ init_smzx_mode();
}
else
{
- if(smzx_mode==1)
- {
- ega_14p_mode();
- cursor_off();
- blink_off();
- ec_update_set();
- update_palette(0);
- }
- else
- {
+ default_EGA_hardware_pal[6] = 20;
+ m_deinit();
ega_14p_mode();
cursor_off();
blink_off();
+ m_init();
ec_update_set();
- update_palette(0);
- }
- }
- }*/
+ update_palette(0);
+ reinit_palette();
+ m_show();
+ }
+ return;
+ }
+ if((name[5] == 'R') || (name[5] == 'r'))
+ {
+ int c = strtol(name + 6, NULL, 10);
+ smzx_mode2_palette[c * 3] = char(value & 63);
+ if(smzx_mode == 2)
+ update_smzx_color((unsigned char)c);
+ return;
+ }
+ if((name[5] == 'G') || (name[5] == 'g'))
+ {
+ int c = strtol(name + 6, NULL, 10);
+ smzx_mode2_palette[(c * 3) + 1] = char(value & 63);
+ if(smzx_mode == 2)
+ update_smzx_color((unsigned char)c);
+ return;
+ }
+ if((name[5] == 'B') || (name[5] == 'b'))
+ {
+ int c = strtol(name + 6, NULL, 10);
+ smzx_mode2_palette[(c * 3) + 2] = char(value & 63);
+ if(smzx_mode == 2)
+ update_smzx_color((unsigned char)c);
+ return;
+ }
+ }
+
+ // Commands per cycle - Exo
+ if(!str_cmp(name, "COMMANDS"))
+ {
+ commands = value;
+ return;
+ }
if(!strn_cmp(name, "BOARD_", 6))
{
View
@@ -30,10 +30,12 @@ p186
JUMPS
include "model.inc"
-Codeseg
+Dataseg
cursor_mode db CURSOR_UNDERL
+Codeseg
+
;
; Function- cursor_underline
;
View
@@ -134,6 +134,7 @@ global C max_bsiz_mode:byte
global C max_bxsiz:word
global C max_bysiz:word
global C mesg_edges:byte
+
; New values for s2
global C saved_mouse_x:word
View
@@ -3,6 +3,7 @@
*
* Copyright (C) 1996 Greg Janson
* Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
+ * Copyright (C) 2002 Gilead Kutnick - exophase@adelphia.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 378f1e3

Please sign in to comment.