OSAK1025 - Operating System For AK1025 (ATJ2091N/H)
Download












IMPORTANT NOTE: the text below referes to an older version. The new version contains more functions and some structural (minor) changes...For complete notes please take a look at the sources ...
The new version includes: programl loader, a better debuger, solitare game, and some electric potential viewer, mono images support, bug fixes and other stuff ...




GiveIO_bas - program used to boot/install osak1025. Has lots of debugging tools.


GiveIO_bas - File explorer & management utility for EFS filesystem


GiveIO_bas - File explorer - inside view


GiveIO_bas - File explorer - viewing an image(stored on MP4's flash)


GiveIO_bas - OS installer


GiveIO_bas - NAND Flash debugging tools

OSAK1025 is an Operating System for AK1025 (ATJ209x).
It's short name is ElectronZ80. It is dedicated to engineers and will contain many programs
especially for electrical engineers and for programmers !
Currently, OS supports (working funcs):
  • banked memory support
  • NAND FLASH interface for v9 device (partially for non-v9 -older)
  • USB interface compatible with wiRe's giveIo and USB MassStorage-BulkOnly(under devel.)
  • Color LCD display driver (128*160 pixels, 16bit colors), TextMode driver, Mono driver
  • "Keyboard" driver (rather we can call this "buttons" driver)
  • Text viewer, image viewer, application loader
  • Math integer functions : shl, shr, mul, div ...
  • MCU(cpu) frequency regulator

    Hoppefuly, the OS will soon support:
  • DOS debug like program (with inline asm), z80 assembler and disassembler
  • FAT16/32, EXT2 driver
  • A better Viewer (text/binary)
  • Editor (text/binary)
  • Flash tools
  • A better Picture Viewer (BMP,JPG,GIF,RAW), with picture scrolling facility
  • A better Program loader (you'll be able to run Z80 programs from your FAT formated flash
  • USB tools, including a interface to read from PC's keyboard and even more
  • Microphone(/FM) Record, wave player
  • BOOT Manager, so that you can load your old OS(from Actions Semicond.) - if it's working any more ... or to boot s1sdk apps
  • In the future mp3 player (maybe ogg, wma but when ... don't know)
  • Still in the future AMV/AVI player
  • DMA functions

    Not supported, yet:
  • DSP : I don't have any information about the opcode's that DSP is using ...
  • RTC/CTC : currently not working ... I didn't find out how to set the clock source ...




    OSAK1025 - main menu (MP4 is now standalone)


    OSAK1025 - inside file navigator


    OSAK1025 - text viewer


    OSAK1025 - cl+4 image viewer


    OSAK1025 - App Debuger - Disassembler window


    OSAK1025 - Solitare (cards game)

  • Finnished kernel modules
    Kernel himself (USB,FLASH,MUL,DIV,TEXTMODE RUTINES,ETC)osak1025.o0x800 to 0x2f00
    More kernel functions(important +viewer for text/imgs)osakmore.ofrom 0x5000 to 0x7fff (default bank 0xf0)
    Kernel mem management& others(calculator,etc )osak_mem.ofrom 0x5000 to 0x7fff (default bank 0xf1)
    Kernel graphics (mono/4/16/256/16bit)osak_gpx.o from 0x5000 to 0x7fff (default bank 0xf2)
    Kernel math floting point funcs (add,sub,mul,div,sqr,sin,etc) osak_math.o from 0x5000 to 0x7fff (default bank 0xf4)
    Kernel filesystem management (FAT32&EXT2)osak_fs.o from 0x5000 to 0x7fff (default bank 0xf5)
    Applicationsapp.comfrom 0x4000 to 0x7fff (default bank: 0xf6, default entry: 0x5000)
    Other important files
    Fonts file (8bytes per ASCII). can use your own fonts(page)fonts.binfrom 0x2000 to 0x27ff
    DisAssembler mnemonics (5 groups)dasmstuff.binon flash... depends (for dummy booting @ page 10000)
    Applications that are ready for use
    Debug (running on Z80 mcu) : disassembler, port dump, mem dump, Z80 opcodes viewer (you must try it. very useful !!!)osak_app.o
    (debug.o)
    from 0x5000 to 0x7fff (default bank: 0xf6, data entry:0x4000)
    Solitare cards game...osak_sol.ofrom 0x5000 to 0x7fff (default bank: 0xf6, data entry:0x4000)

    Kernel functions (level 0)
    fmul_bytes0 bytes multiplication function: regL* regE->reg HL
    fmul_words1 words multiplication function: BC * DE ->HL'(high)HL(low)
    fmul_dwords2 dwords multiplication : DE(High)BC(Low) * DE'(High)BC(low) -> IY(HIGHEST)HL(High)HL'(low)IX(lowest)
    fmul_qwords3 qword mul. (64b*64b -> 64b) : {DE,BC,HL',IX}*{IY,HL,DE',BC'} -> {IY,HL,HL',IX} (all are of form {highest,high,low,lowest}
    fdiv_bytes4 bytes division : A div C -> E, remainder in A
    fdiv_words5 HL div DE -> BC, remainder in HL
    fdiv_dwords6 {HL',HL} div {DE',DE} -> {BC',BC}, remainder in {HL',HL} ; all are of form {high word (eg. HL'),low word(HL)}
    fdiv_qwords7 {IY,HL,HL'IX} div {DE,BC,DE',BC'} -> {DE(highest),BC,DE',BC'(lowest)}, remainder in {IY,HL,HL',IX}
    fshl_word8 shift left word in DE , B times
    fshr_word9 shift right word in DE , B times
    finit_mcu10 initializes MCU (Z80 cpu of MP4)
    finit_nand11 initializes/prepares nand flash for read/write(program)/erase . Must call restore_portsv9 after finnishing.
    finit_isr12 init Interrupt service rutine.
    finit_key13 init "keyboard" (buttons)
    finit_rtc14 init real time cloc ... (bugy)
    fvcall300015 initializes video card : LCD (only color LCD 128*160pixels 16bit color)
    frestore_portsv916 unprepares ports altered by init_nand... This must be called all the time after finnishing with nand
    fviewer17 call internal (emergency) viewer. Can view texts from nand, from mem, can view raw pictures, has calculator, can goto an nand page, can load application/module
    fcomplete_usb_tx18 completes an usb transaction (sends CSW)
    fvfastup19 a faster way to update display in text mode ...
    fvcls20 clear text screen
    fload_to_banks21 used by emergency console to move data from zram2 to any bank
    fmy_usb22 driver for USB. compatible with wiRe's giveio (actually it's wiRe giveIo, but modified by zdupy)
    femergency_console23 this is called by x86 PC in order to do stuff ...
    finkey24 reads buttons key ... in A
    fload_module25
    fread_page226 reads NAND FLASH page. (you need first to call init_nand) page at : dword(krnlpage), offset in page at : word(krnloffs), size at : word(krnlsize), where at : word(where)
    fwrite_page227 write NAND FLASH page. (you need first to call init_nand) page at : dword(krnlpage), offset in page at : word(krnloffs), size at : word(krnlsize), where at : word(where)
    fvput_all_screen28 prepares LCD to receive 128*160*2 bytes of data if C=0 , else if C=1 unprepares rutine
    fvtextmode_update29 updates LCD in text mode. must call vput_all_screen first.
    fvprint30 prints text from (DE) , (BC) characters
    fvlocate31 text position (20*16 => {0..19,0..15}): E = x, D = y
    fvcolor32 E = text color, D=background color {16 colors for each. same as in DOS(x86)
    fvupdate_screen33 tells LCD to swap working page with visual page. Updates screen :)
    flcd_turn_on34 turn on LCD from off state.
    flcd_turn_off35 turn of current for LCD
    flcd_cmd36 send command to LCD
    flcd_data37 send data to LCD
    flcd_data_r38
    flcd_cmd_r39
    fusb_rx40 receives USB packet
    fusb_tx41 tx USB packet
    fv9detect42 detect if device is v9 or not
    fgiveio_init_standalone43 preapare USB driver
    fadd_dwords44 add dwords {HL'(high),HL(low)} + {DE'(high),DE(low)} = {BC'(high),BC(low)}
    fadd_qwords45 add 64bit numbers (HL)+(DE)->(BC)
    fsub_dwords46 HL'(high)HL(low) - DE'(high)DE(low) = HL'(high)HL(low)
    fsub_qwords47
    ftt_power48 ten to power
    ft_power49
    fmsb50 most segnificant bit
    fmul_dwords3251
    fvprint_calc52 translation (x,y) position to memory location in buffer
    fvprint_num1653
    fvprint_num54 print dword in hl'(high)hl(low)
    fadd_dwords_mem55
    fadd_many56
    fmove_bank_to_bank57 move data from bank A, (HL) to bank A', (DE) ,,, BC nunber of bytes
    fstosbtobank58
    flodsbfrombank59
    fkernel_extended_func10f0h Calls a function in OSAKmore
    fkernel_extended_func20f1h Calls a function in OSAK_MEM
    fkernel_extended_func30f2h Calls a function from OSAK_GPX
    fkernel_extended_func40f3h Calls a function from OSAK_MATH
    fkernel_extended_func50f4h Calls a function from OSAK_FS
    fkernel_extended_func60f6h Calls a function from user module or starts application
    fkernel_extended_func70f7h
    fkernel_extended_func80f8h
    fkernel_extended_func90f9h
    fkernel_extended_func100fAh
    fkernel_help_me_the_user0ffh
    osakmore functions ( level 1 )
    extf1_get_smart0 get a line (like "line input" or "scanf" or "readln") ; DE=where to store text (can contain predefined text) ; BC=size of predefined text ; HL=text position h=y, l=x
    extf1_shl_dword1 shift left dword DE(low word)HL(high word) by B times
    extf1_shr_dword2 shift right dword DE(low word)HL(high word) by B times
    extf1_valuint3 convert string number to dword value ; HL=string address, DE=dword address(where storing result)
    extf1_viewer4 view a file stored in memory (HL=space occupied in last used bank, D=last usedf bank) or VIEW contents of flash in text mode (removes chars 13&10) or raw image viewer (flash)
    extf1_lowspeedmcu5 set MCU speed to the lowset state known ..
    extf1_highspeedmcu6 set z80 speed to the highest speed known ..
    extf1_erase_page27 erase page (so that it can be programmed ! No erase , no programming (you will be unable to write to flash page not until you erase page) - WARNING : NAND FLASHES SUPPORT a maximum of 100000 re-programmings (erases) ! (they are like CD-reweiteble, not like harddisk)
    extf1_loadimg8 load raw,continous,... image from flash. global variables krnlpage,...etc holds imiage pos
    extf1_str9 convert dword hl(low),hl'(high) to (de)ascii num (base 10)
    extf1_hex10 convert dword de(low),hl(high) to (bc) ascii HEX (base 16)
    extf1_hexalt11 convert dword de(low),hl(high) to (bc) ascii HEX (base 16) (8 chars alignament)
    extf1_ten2power12 returns at address (DE), as DWORD, ten to power C
    osak_mem functions ( level 2)
    extmem_allocate:0
    extmem_deallocate:1
    extmem_menugetopts:2
    extmem_calculator:3
    extmem_getnum:4
    extmem_gotopage:5
    osak_gpx functions ( level 3)
    ak_gpx codes
    extgpx_screen:0
    extgpx_line:1
    extgpx_pset:2
    extgpx_updatescreen:3
    extgpx_cls:4
    osak_gpx functions ( level 3)
    incomplete notes.
    OSAK_GPX contains graphics rutines.
    Currently only mono (2colors) mode is working.
    But you can use osak_directx for 16bit color mode !
    osak_math functions ( level 4)
    incomplete notes.
    This supposed to be a floating point operations library.
    It contains only fp add/sub. All other math operations are under development (div,mul,sqr,sin,cos,log,..etc)
    osak_fs functions ( level 5)
    incomplete notes.
    This is the default support for FAT32.
    You can "mount", get/put fat entry, get/put cluster, get a dir_entry and others...
    Maybe it will contain some basic EXT2 funcs and/or ISO9660
    I'll probably devide EXT2/ISO9660/FAT32 functions in separate modules 'cause there is not enough space
    for all of them in the same module
    osak_directx functions (dynamical-loaded-library)
    incomplete notes.
    This is a "dynamical-loaded-library" loaded at 0x3060, used to manage 16bit color mode.
    Actually there's only one mode the 16bit mode ! The rest are "software modes" (like the text mode, mono mode ...)
    It uses 3 other banks (default 0xf2,0xf4,0xf5) to store pixels. When told, it updates video memory with data
    from this banks...The 'DLL' lengths only 0x110 bytes !

    Useful note :
    How to create image files for osak pgm4viewer.o ?
    And how to can I view a PDF document (like a university course) on the MP4 ?

    Answer :
    The OSAK1025 distribution contains also helping tools.
    One of the tool is calle [ak_convimg.exe] (image converter)

    To create images for MP4 follow this steps :
    1) create an empty directory
    2) convert the images to BMP (bitmap format) and store the BMPs inside the newly created folde
    Osak image viewer can view :
    - raw images (128*160) 16bit colors
    - mono images (128*160) 2colors
    - gry4 (any size with width multiple of 128 and height multiple of 160) gray scale - 16 colors
    - cl+4 (any size with width multiple of 128 and height multiple of 160) 16 colors (16bit color entries)

    If you want to use raw format (16bit color), then BMPs can use any color format (2/16/256/65535/2M)
    If you want to use mono format then BMPs should be MONOCHROME.
    If you want gray scale format then use PGM gray scale and save in 16colors (4bit) format
    If you want cl+4 format then BMPs should be saved with 4bit color format (16colors - RGB24 pallete)


    3) create another empty directory; this will be used by [ak_convimg] to store converted images.

    4) now open a command prompt window
    go to OSAK1025 distribution folder; enter into the sub-directory called [diverse]
    run program:
    ak_convimg.exe [/w (your 128*multiple pixels width)] [/h (your 160*multiple pixels height)] [/colored | /mono | /pgmto4b | cl+4] [/scr_mode (screen mode : 18=640x640 ; 19=800x600 ; 20=1024x768 ...] [/fullscreen] [/illgivepath (your folder with BMP/PGM images) (destination folders for converted images)
    5) plug-in your MP4; start giveio_bas.exe
    6) from giveio_bas menu go to : [Offline Mp3/4 flash tools]
    7) search and start [Write files from a dir to flash] (inside Tools menu)
    8) enter the starting flash page (where images will be stored)
    9) the program will display the starting page; select [yes] to continue (only for free pages)
    10) the program will ask you the folder path where files are (in our case the converted images); enter the full path of that folder (the second folder you have created)
    11) the program will ask for an extension mask (the images use BMP extension even if they use a different format)
    12) program will copy now data to flash
    13) exit giveio_bas
    14) restart giveio_bas; this time go to [Fast link to EFS explorer](inside giveio_bas's menu)
    15) now inside explorer you will have to create a file entry with a single name for your images; enter the [starting page] you previously used in the copy section; also enter the number of pages used by all files (size = (((length in bytes of all files) - 1) / 2048) + 1) )
    16) now you are done !
    17) Boot osak1025 and load pgm4viewer.o; run app ; navigate and select the SINGLE file name ; enjoy !

    To find a free continous portion on the flash with the size needed for your files USE : EFS explorer (inside giveio_bas menu).
    Press [F3] inside explore to view the list of free pages; select a partition that has the coresponding size and remember the starting page


    To view PDF files directly its not yet possible. Instead you have to convert you PDF to bmp/pgm. You can use the freedos/linux/win32 tool called pdf2ppm (or pdf2bmp or pdftoppm or pdftobmp)

    To convert files of any format to any other format I recommand you using [IrfanView]; you can get IrfanView from author's web page.

    The distribution contains also a version of IrfanView (from year '99)

    [IrfanView] i_view32.exe accepts command line parameters to be given :
    for example, to convert all images inside a folder to BMP and store them to another folder use :
    i_view32.exe c:\folder\*.extension_mask [/gray] [/bpp=4] /convert=c:\an_emty_folder\*.bmp

    GOOD !
    Now that you can see how complex is this operation for a simple user (non-programmer)
    Because of this (so complex ops) I decided to add up a user friendly convertion gui , inside the next version of giveio_bas
    I hope you now either ask me : [ Why don't you create a better viewer ?!?!?! ] or [ When the user friendly conversion gui will be ready !?]

    My answer is simple : I don't get any money from this ; I have to find resources by myself ; so since no one pays me you need to be patient !
    Or maybe you can send me a donation !
    If you wanna donate : mail me at : mbarboi@home.ro
    If you don't have money or other stuff ... thanks for using my software, any-way !



    S1MP3(TM) is a registrated trade mark of it's owners ! S1emu and S1fwx are built by WIRE !

    [IrfanView] is Copyright (C) 1996-2010 by Irfan Skiljan; authors email: irfanview@gmx.net