Author Topic: Things the MSM don't show you about Ukraine  (Read 3159 times)

Gunther

  • Member
  • *****
  • Posts: 4145
  • Forgive your enemies, but never forget their names
Re: Things the MSM don't show you about Ukraine
« Reply #15 on: April 13, 2022, 09:25:39 PM »
Jack,

no, it really is not my cup of tea

I understand that. From what I could see, they compile via a C compiler. An inline assembler doesn't seem to exist either.
You have to know the facts before you can distort them.

jj2007

  • Member
  • *****
  • Posts: 13633
  • Assembly is fun ;-)
    • MasmBasic
Re: Things the MSM don't show you about Ukraine
« Reply #16 on: April 13, 2022, 09:37:00 PM »
you may be interested in some flavor of Basic like https://www.cerberus-x.com/community/index.php

Looks like an ugly caricature of C++

Code: [Select]
Strict

Import brl.filestream

Class KeyValuePair
Public
  Field _isValid:Bool
  Field _key:String
  Field _value:String
End Class

Class IniHandler
Private
  Field _sections:StringMap<StringMap<String>>
  Field _modified:StringMap<StringMap<String>>
  Field _iniString:String

Public
  Method New()
    _sections = New StringMap<StringMap<String>>()
    _modified = New StringMap<StringMap<String>>()
  End Method

  Method open:Void(path:String)
    Local file:FileStream = FileStream.Open("cerberus://data/" + path, "r")
    If file
      _iniString = file.ReadString()
      file.Close()
    Else
      Print "File '" + path + "' not found!"
    EndIf
   
    refresh()
    file.Close()
  End Method

  Method doesSectionExist:Bool(sectionName:String)
    Return _sections.Contains(sectionName)
  End Method

  Method doesKeyExist:Bool(sectionName:String, key:String)
    Local section:StringMap<String>
    ' check if the section exists
    If _sections.Contains(sectionName)
      section = _sections.Get(sectionName)
      Return section.Contains(key)
    Else
      Return False
    EndIf
  End Method

  Method readValue:String(sectionName:String, key:String, defaultValue:String)
    If Not _sections.Contains(sectionName)
      Return defaultValue
    EndIf

    Local section:StringMap<String>
    section = _sections.Get(sectionName)
    If Not section.Contains(key)
      Return defaultValue
    EndIf

    Return section.Get(key)
  End Method

  Method readValue:Int(sectionName:String, key:String, defaultValue:Int)
    Local str:String = readValue(sectionName, key, String(defaultValue))
    str = splitComment(str)
    Return Int(str)
  End Method

  Method readValue:Float(sectionName:String, key:String, defaultValue:Float)
    Local str:String = readValue(sectionName, key, String(defaultValue))
    str = splitComment(str)
    Return Float(str)
  End Method

  Method readValue:Bool(sectionName:String, key:String, defaultValue:Bool)
    Local defaultStr:String = "False"
    If defaultValue Then defaultStr = "True"
    Local str:String = readValue(sectionName, key, defaultStr)
    str = splitComment(str)
    If str.ToLower() = "true"
      Return True
    Else
      Return False
    EndIf
  End Method

  Method readArray:Int[](sectionName:String, key:String, defaultValue:Int[])
    Local defaultStr:String
    For Local i:Int = 0 Until defaultValue.Length
      defaultStr += String(defaultValue[i])
      If i < defaultValue.Length - 1
        defaultStr += ","
      EndIf
    Next
    Local str:String = readValue(sectionName, key, defaultStr)
    str = splitComment(str)
    Local val:String[] = str.Split(",")
    ' convert to int
    Local valFinal:Int[] = New Int[val.Length]
    For Local i:Int = 0 Until val.Length
      valFinal[i] = Int(val[i])
    Next

    Return valFinal
  End Method

  Method readArray:Float[](sectionName:String, key:String, defaultValue:Float[])
    Local defaultStr:String
    For Local i:Int = 0 Until defaultValue.Length
      defaultStr += String(defaultValue[i])
      If i < defaultValue.Length - 1
        defaultStr += ","
      EndIf
    Next
    Local str:String = readValue(sectionName, key, defaultStr)
    str = splitComment(str)
    Local val:String[] = str.Split(",")
    ' convert to float
    Local valFinal:Float[] = New Float[val.Length]
    For Local i:Int = 0 Until val.Length
      valFinal[i] = Float(val[i])
    Next

    Return valFinal
  End Method

  Method readArray:Bool[](sectionName:String, key:String, defaultValue:Bool[])
    Local defaultStr:String
    For Local i:Int = 0 Until defaultValue.Length
      If defaultValue[i]
        defaultStr += "True"
      Else
        defaultStr += "False"
      EndIf
      If i < defaultValue.Length - 1
        defaultStr += ","
      EndIf
    Next
    Local str:String = readValue(sectionName, key, defaultStr)
    str = splitComment(str)
    Local val:String[] = str.Split(",")
    ' convert to bool
    Local valFinal:Bool[] = New Bool[val.Length]
    For Local i:Int = 0 Until val.Length
      If val[i].ToLower() = "true"
        valFinal[i] = True
      Else
        valFinal[i] = False
      EndIf
    Next

    Return valFinal
  End Method

Private
  Method refresh:Void()
    ' clear local cache
    _sections.Clear()
    _modified.Clear()
   
    Local currentSection:StringMap<String> = Null
    Local sectionName:String

    Local lines:String[] = _iniString.Trim().Split("~n")
    For Local str:String = EachIn lines
      ' remove possible "carriage return"
      If str.EndsWith("~r")
        str = str[..str.Length-1]
      EndIf

      ' check for section names
      sectionName = parseSectionName(str)
      If sectionName.Length > 0
        ' only the first occurrence of a section is loaded
        If _sections.Contains(sectionName)
          currentSection = Null
        Else
          currentSection = New StringMap<String>()
          _sections.Add(sectionName, currentSection)
        EndIf
      ElseIf currentSection <> Null
        ' check for key+value pair
        Local keyValuePair:KeyValuePair = parseKeyValuePair(str)
        If keyValuePair._isValid
          ' only the first occurrence of a key is loaded
          If Not currentSection.Contains(keyValuePair._key)
            currentSection.Add(keyValuePair._key, keyValuePair._value)
          EndIf
        EndIf
      EndIf
    Next
  End Method

jack

  • Member
  • **
  • Posts: 221
Re: Things the MSM don't show you about Ukraine
« Reply #17 on: April 13, 2022, 11:02:15 PM »
@Gunther
QB64 translates basic code to C/C++ and the C++ compiler and tools does the rest, and you are right- there's no inline asm support
@jj
I have not even tried cerberus-x, it's main focus seems to be game programming for which I simply lack interest and talent

jack

  • Member
  • **
  • Posts: 221
Re: Things the MSM don't show you about Ukraine
« Reply #18 on: April 13, 2022, 11:47:16 PM »
to elaborate just a bit more, I have seen the talent for programming and teaching of TerryRitchie hence my recommendation to his game tutorial

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10277
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Things the MSM don't show you about Ukraine
« Reply #19 on: April 14, 2022, 03:43:51 AM »
If I have it right, most high end gaming is C++ based and backed up by GPU libraries that access the capacity of modern video cards. The C++ is fast enough for ordinary code operations and the GPU libraries add the pace for video display. Something I find funny is with 3 of my computers, they have Radeon RX 580 8 gig video cards which work fine for what I do and they never get hot enough to turn the fans on.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

caballero

  • Member
  • *****
  • Posts: 2096
  • Matrix - Noah
    • abre ojos ensamblador
Re: Things the MSM don't show you about Ukraine
« Reply #20 on: April 18, 2022, 08:53:18 AM »
@Asm45prog
I agree with hutch, you may be interested in some flavor of Basic like https://www.cerberus-x.com/community/index.php or there's an excellent tutorial in QB64 for game programming http://qb64sourcecode.com/
That's a nice tuto, I was making some basic stuff with some sprites within it in my spare time, just a small and basic piece. You have to unzip both files in the same folder to execute it.

100% masm32 source code with GDI, no external dll, etc.
« Last Edit: April 30, 2022, 11:44:46 PM by caballero »
The logic of the error is hidden among the most unexpected lines of the program

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10277
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Things the MSM don't show you about Ukraine
« Reply #21 on: April 18, 2022, 11:10:03 AM »
 :biggrin:

Works fine here, a yellow bird flying across a black client area.  :thumbsup:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Gunther

  • Member
  • *****
  • Posts: 4145
  • Forgive your enemies, but never forget their names
Re: Things the MSM don't show you about Ukraine
« Reply #22 on: April 19, 2022, 11:02:53 PM »
Works fine here, a yellow bird flying across a black client area.  :thumbsup:

The same here. The BMP file is larger than the EXE by a factor of 40.
You have to know the facts before you can distort them.

caballero

  • Member
  • *****
  • Posts: 2096
  • Matrix - Noah
    • abre ojos ensamblador
Re: Things the MSM don't show you about Ukraine
« Reply #23 on: April 23, 2022, 08:17:30 AM »
For no wasting unnecesary space, I will put all versions in the first post
« Last Edit: April 23, 2022, 08:10:26 PM by caballero »
The logic of the error is hidden among the most unexpected lines of the program

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10277
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Things the MSM don't show you about Ukraine
« Reply #24 on: April 23, 2022, 08:51:11 AM »
"error fin del bmp"

Works fine when the bmp is available.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

caballero

  • Member
  • *****
  • Posts: 2096
  • Matrix - Noah
    • abre ojos ensamblador
Re: Things the MSM don't show you about Ukraine
« Reply #25 on: April 23, 2022, 07:55:02 PM »
For no wasting unnecesary space, I will put all versions in the first post
The logic of the error is hidden among the most unexpected lines of the program

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10277
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Things the MSM don't show you about Ukraine
« Reply #26 on: April 23, 2022, 07:58:39 PM »
I got it going by downloading the original zip. Will try these.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Greenhorn

  • Member
  • ***
  • Posts: 450
Re: Things the MSM don't show you about Ukraine
« Reply #27 on: April 23, 2022, 11:13:53 PM »
Nice !  :thumbsup:

"Three Little Birds" (Bob Marley)  :biggrin:
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

caballero

  • Member
  • *****
  • Posts: 2096
  • Matrix - Noah
    • abre ojos ensamblador
Re: Things the MSM don't show you about Ukraine
« Reply #28 on: April 24, 2022, 01:14:07 AM »
Serveral birds flying around, in the same direction and the same layer, a flock of birds.

http://masm32.com/board/index.php?topic=9934.msg109516#msg109516


Next objective: several birds flying in two directions (left to right and viceversa) and three layers, with the same two bmp files.
The logic of the error is hidden among the most unexpected lines of the program

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10277
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Things the MSM don't show you about Ukraine
« Reply #29 on: April 24, 2022, 09:04:49 AM »
 :thumbsup:

All 4 demos work fine here.  :biggrin:
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: