Recent Posts

Pages: [1] 2 3 ... 10
1
UASM Assembler Development / UASM 2.40 release
« Last post by habran on Today at 06:13:02 AM »
Hello folks,
UASM 2.40 release is out, with fixes:
   .SWITCH to allow negative and positive cases and usage of multi cases:
         .case 1, 2, 3, 4... or
         .case 1
         .case 2
         .case 3
         .case 4
   .FOR will report an error if you don't use 2 columns, this is the minimum requirement ( : : )
   
   Improved integers usage for building with different environments
   
   fixed some problem with literals in 32 bit
   
   fixed some listing issues

 check it here:     
Uasm (Site) http://www.terraspace.co.uk/uasm.html
Uasm (GitHub) https://github.com/Terraspace/UASM
2
The Campus / Re: Serial DCB BITRECORD structure in windows.inc
« Last post by jj2007 on Today at 04:15:38 AM »
You need to set the bits manually...
Code: [Select]
if 1
  mov edx, 1*xxx+2*yyy+4*zzz+.... 
else
  mov SerialSettings.fOutxCtsFlow, FALSE                  ; No RTS
  mov SerialSettings.fRtsControl, RTS_CONTROL_DISABLE     ; No CTS
  mov SerialSettings.fOutxDsrFlow, FALSE                  ; No DSR TX inhibiting
  mov SerialSettings.fDsrSensitivity, FALSE               ; No DSR RX inhibiting
  mov SerialSettings.fDtrControl, DTR_CONTROL_ENABLE      ; Enable DTR Signal
  mov SerialSettings.fOutX, TRUE                          ; xOn/xOff enabled for TX
  mov SerialSettings.fInX, FALSE                          ; Suspend Xon/Xoff for RCV
  mov SerialSettings.fNull, TRUE                          ; Discard NULL bytes
  mov SerialSettings.fAbortOnError, FALSE                 ; Do not Abort on Error
  mov SerialSettings.fBinary, TRUE                        ; Binary Transfer
  mov SerialSettings.fParity, TRUE                        ; Parity Enabled
endif

There is also a SetField macro in the MasmBasic package, but honestly, I've never used it.

See also
http://masm32.com/board/index.php?topic=6293.0
http://www.masmforum.com/board/index.php?topic=17452.0
http://www.masmforum.com/board/index.php?topic=13386.msg104286#msg104286
3
The Campus / Serial DCB BITRECORD structure in windows.inc
« Last post by pcMike on Today at 03:28:23 AM »
I found a serial port monitor in the old forum posted by Redskull in 2006, and it fails to build due to not recognizing  the DCB BITRECORD structure.
http://www.masmforum.com/board/index.php?topic=5972.0

Quote
.486
.model flat, stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib

.data
szFrameError db "!"                            ; Display character for errors
displaystring1 db "Monitoring for Data:",0     ; Output display string

.data?
hSerialPort DWORD ?                             ; handle for serial port
SerialSettings DCB {?}                          ; settings for serial port
SerialTimeOuts COMMTIMEOUTS {?}                 ; timeout settings for serial port
NumberOfBytesRead DWORD ?                       ; rcv variable for bytes read from ReadFile
EvtMask DWORD ?                                 ; rcv variable for comm event returned
SerialError DWORD ?                             ; holder for error occured
RcvBuffer DWORD ?                               ; variable for holding input to go to screen

hConsoleOutput DWORD ?                          ; Handle to the display console
ConsoleWriteBytes DWORD ?                       ; rcv variable for bytes written to console

.const
Comm1 db "COM1:", 0                             ; Comm port constants
Comm2 db "COM2:", 0
Comm3 db "COM3:", 0

.code
start:
;-----------------------------
; Allocate a console for displaying output
;-----------------------------
invoke AllocConsole
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsoleOutput, eax
; do not process control codes, display thier hex equivalents
invoke SetConsoleMode, hConsoleOutput, ENABLE_WRAP_AT_EOL_OUTPUT

;-----------------------------
; Serial Port initialization
;-----------------------------
invoke CreateFile, ADDR Comm1, GENERIC_READ OR\         ; Open the Serial Port
    GENERIC_WRITE,0, NULL, OPEN_EXISTING,0,NULL
mov hSerialPort, eax                                    ; save the handle
mov SerialSettings.DCBlength, SIZEOF DCB                ; configure the Settings variable
invoke GetCommState, hSerialPort, ADDR SerialSettings   ; fill it with the current settings
mov SerialSettings.BaudRate, CBR_19200                  ; Baud Rate
mov SerialSettings.ByteSize, 8                          ; Data Bits: 8
mov SerialSettings.Parity, NOPARITY                     ; Parity: None
mov SerialSettings.StopBits, ONESTOPBIT                 ; Stop Bits: 1
mov SerialSettings.fOutxCtsFlow, FALSE                  ; No RTS
mov SerialSettings.fRtsControl, RTS_CONTROL_DISABLE     ; No CTS
mov SerialSettings.fOutxDsrFlow, FALSE                  ; No DSR TX inhibiting
mov SerialSettings.fDsrSensitivity, FALSE               ; No DSR RX inhibiting
mov SerialSettings.fDtrControl, DTR_CONTROL_ENABLE      ; Enable DTR Signal
mov SerialSettings.fOutX, TRUE                          ; xOn/xOff enabled for TX
mov SerialSettings.fInX, FALSE                          ; Suspend Xon/Xoff for RCV
mov SerialSettings.fNull, TRUE                          ; Discard NULL bytes
mov SerialSettings.fAbortOnError, FALSE                 ; Do not Abort on Error
mov SerialSettings.fBinary, TRUE                        ; Binary Transfer
mov SerialSettings.fParity, TRUE                        ; Parity Enabled
invoke SetCommState, hSerialPort, ADDR SerialSettings   ; Apply the new settinsg

; Set the Time-outs to occur immedietly with everything in the buffer
invoke GetCommTimeouts, hSerialPort, ADDR SerialTimeOuts
mov SerialTimeOuts.ReadIntervalTimeout, MAXDWORD
mov SerialTimeOuts.ReadTotalTimeoutMultiplier, 0
mov SerialTimeOuts.ReadTotalTimeoutConstant, 0
mov SerialTimeOuts.WriteTotalTimeoutMultiplier, 0
mov SerialTimeOuts.WriteTotalTimeoutConstant, 0
invoke SetCommTimeouts, hSerialPort, ADDR SerialTimeOuts

;Generate events for received bytes and errors
invoke SetCommMask, hSerialPort, (EV_RXCHAR OR EV_ERR)
;------------------------------------------------------

invoke WriteConsole, hConsoleOutput, ADDR displaystring1, \  ; display a prompt
    SIZEOF displaystring1, ADDR NumberOfBytesRead, NULL
   
;-----------------------------
; Poll the serial port for RCV data
;-----------------------------

.WHILE TRUE                                                 ; Enter an endless loop
invoke WaitCommEvent, hSerialPort, ADDR EvtMask, NULL      ; Hold up for either a character or an error

.IF EvtMask == EV_ERR                                      ; If an error came in...
  invoke SetConsoleTextAttribute, hConsoleOutput,\          ; change to a red font
   FOREGROUND_RED
  invoke WriteConsole, hConsoleOutput, ADDR szFrameError,\  ; print an exclamation point
   SIZEOF szFrameError, ADDR ConsoleWriteBytes, NULL
  invoke SetConsoleTextAttribute, hConsoleOutput,\          ; change back to white font
   FOREGROUND_BLUE OR FOREGROUND_GREEN OR FOREGROUND_RED
  invoke ClearCommError, hSerialPort, ADDR SerialError, NULL; clear the error
.ENDIF

.IF EvtMask == EV_RXCHAR                                   ; if a chracter was recieved...
  .WHILE TRUE                                               ; start a loop to empty out the serial port
   invoke ReadFile, hSerialPort, RcvBuffer, SIZEOF\         ; Read in one DWORD from the serial port
    RcvBuffer, ADDR NumberOfBytesRead, NULL
   .BREAK .IF NumberOfBytesRead == 0                        ; exit if the buffer is empty
   invoke WriteConsole, hConsoleOutput, RcvBuffer,\         ; print out any characters recieved
    NumberOfBytesRead, ADDR ConsoleWriteBytes, NULL
  .ENDW
.ENDIF
.ENDW

invoke CloseHandle, hSerialPort                             ; close the serial port
invoke ExitProcess, NULL                                     ; End the Program

END start

It fails to assemble due all the <BITRECORD> values below generate "error A2600: undefined symbol" messages:

mov SerialSettings.fOutxCtsFlow, FALSE                  ; No RTS
mov SerialSettings.fRtsControl, RTS_CONTROL_DISABLE     ; No CTS
mov SerialSettings.fOutxDsrFlow, FALSE                  ; No DSR TX inhibiting
mov SerialSettings.fDsrSensitivity, FALSE               ; No DSR RX inhibiting
mov SerialSettings.fDtrControl, DTR_CONTROL_ENABLE      ; Enable DTR Signal
mov SerialSettings.fOutX, TRUE                          ; xOn/xOff enabled for TX
mov SerialSettings.fInX, FALSE                          ; Suspend Xon/Xoff for RCV
mov SerialSettings.fNull, TRUE                          ; Discard NULL bytes
mov SerialSettings.fAbortOnError, FALSE                 ; Do not Abort on Error
mov SerialSettings.fBinary, TRUE                        ; Binary Transfer

I checked windows.inc and I see they are listed as part of the DCB:
BITRECORD RECORD fBinary:1,fParity:1,fOutxCtsFlow:1,fOutxDsrFlow:1,fDtrControl:2,fDsrSensitivity:1,fTXContinueOnXoff:1,fOutX:1,fInX:1,fErrorChar:1,fNull:1,fRtsControl:2,fAbortOnError:1,fDummy2:17

DCB STRUCT
  DCBlength     DWORD      ?
  BaudRate      DWORD       ?
  fbits         BITRECORD      <>
  wReserved     WORD       ?
  XonLim        WORD          ?
  XoffLim       WORD         ?
  ByteSize      BYTE        ?
  Parity        BYTE          ?
  StopBits      BYTE        ?
  XonChar       BYTE         ?
  XoffChar      BYTE        ?
  ErrorChar     BYTE       ?
  EofChar       BYTE         ?
  EvtChar       BYTE         ?
  wReserved1    WORD       ?
DCB ENDS

Can someone tell me what I needs to be done to get past the errors?

Mike
4
The Workshop / Re: TITA IN LABYRINTHS!
« Last post by felipe on Today at 03:01:57 AM »

; ÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷         Thanks aw27!


            sub                 esi,10                                              ; input_rec start.                               

            cmp                 byte ptr[esi+4],TRUE                                ; bKeyDown element. Key should be pressed to move tita,
            jne                 notyet0                                             ;  and should not move when it is released (FALSE).

            add                 esi,10                                              ; wVirtualKeyCode again.

; ÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷·÷



You are right, at least that line should say: cmp dword ptr[esi+4],TRUE. I think that happen when you try to fix something to fast. (Seems like i'm trying to get rid of this job).  :P
Corrected this in the new attachment.
5
64 Bit Assembler / Re: masm64 sdk binaries
« Last post by markallyn on Today at 02:44:16 AM »
Hi JJ,

I will.  Thanks for taking an interest.  I'll get back to you after reading.

Regards,
Mark
6
The Workshop / Re: TITA IN LABYRINTHS!
« Last post by aw27 on Today at 02:36:15 AM »
This of course is written in a redundant way (i mean the use of esi for addressing).

No doubt, you could have declared this way
input_rec INPUT_RECORD <>
and not this way
input_rec   dword               4 dup (?)

Then you could watch for the keydown like this:

Code: [Select]
@@:
            push                offset rec_reads
            push                1 
            push                offset input_rec
            push                stdin
            call                ReadConsoleInput
      cmp dword ptr input_rec.KeyEvent.bKeyDown, 0
    je @b

 :t
7
Tools & Toys / Re: Updated 64 bit editor.
« Last post by jj2007 on Today at 02:17:33 AM »
Works fine with a 1,335,639,380 bytes file :t

After closing this file, the whole machine remains in slow motion mode (a factor 20...50 slower than usual) for some minutes. Maybe I need more than 4GB RAM.

In any case, for my tiny 1-2MB sources, I prefer another editor ;)
8
The Colosseum / Re: Friday afternoon jokes
« Last post by felipe on Today at 01:54:36 AM »
 :greensml: hilarious
9
64 Bit Assembler / Re: masm64 sdk binaries
« Last post by jj2007 on Today at 01:53:50 AM »
Check your private messages, Mark.
10
The Colosseum / Re: Friday afternoon jokes
« Last post by jj2007 on Today at 01:52:09 AM »
Ah, Timmy again...!
Pages: [1] 2 3 ... 10