Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Programming with NASM / Re: IDE for asm
« Last post by avcaballero on October 06, 2019, 07:25:54 AM »
Notepad++  (+) batch file?
22
Using NASM / which ide for asm
« Last post by trazom on October 05, 2019, 09:38:37 PM »
hello,
which asm compiler and IDE unser Linux Centos7
23
Programming with NASM / IDE for asm
« Last post by trazom on October 05, 2019, 09:31:28 PM »
Hello,
which program to use to edit and compile asm?
T
24
Using NASM / Re: How do I define a function alias for an imported function?
« Last post by vitsoft on October 05, 2019, 08:14:58 AM »
The second method (the actual Windows DLL forwarding) is, IMHO, up to the linker, not the compiler/nasm.
Indeed. In EuroAssembler linker is DLL forwarding implemented at export with keyword FWD=. Example of linker script:

Code: [Select]
proxy PROGRAM Format=DLL
        EXPORT abcd1234, LIB=original.dll, FWD=abcd
      ENDPROGRAM

Those three lines, when euroassembled, will create proxy.dll which exports function abcd from original.dll under a new name abcd1234.
25
Programming with NASM / Re: Problems with interrupt 1Ah
« Last post by avcaballero on October 01, 2019, 01:23:50 PM »
Look if this helps
26
Programming with NASM / Problems with interrupt 1Ah
« Last post by yoran on September 29, 2019, 09:04:47 AM »
(16 bit NASM bare bones)
I use int 1Ah to get time and date, however the time functions seems to have stopped working for some reason.
My time function:
;I/O: BX = string location
get_time:
   pusha

   mov di, bx

   clc               ;anti bios-bug team
   mov ah, 2      ;BIOS time > bcd
   int 1Ah
   jnc .read

   clc
   mov ah, 2
   int 1Ah

.read:
   mov al, ch         ;hours > integer
   call bcd_to_int
   mov dx, ax         ;save

   mov al,   ch         ;hour
   shr al, 4            ;higher bcd > lower
   and ch, 0Fh         ;1`s
   test byte [fmt_12_24], 0FFh
   jz .twelve_hr

   call .add_digit
   mov al, ch
   call .add_digit
   jmp short .minutes

.twelve_hr:
   cmp dx, 0
   je .midnight

   cmp dx, 10
   jl .twelve_st1

   cmp dx, 12
   jle .twelve_st2

   mov ax, dx
   sub ax, 12
   mov bl, 10
   div bl
   mov ch, ah

   cmp al, 0                        ;1-9 PM
   je .twelve_st1

   jmp short .twelve_st2      ;10-11 PM

.midnight:
   mov al, 1
   mov ch, 2

.twelve_st2:
   call .add_digit               ;modified bcd
.twelve_st1:
   mov al, ch
   call .add_digit

   mov al, ':'
   stosb

.minutes:
   mov al, cl         ;minute
   shr al, 4            ;higher bcd > lower
   and cl, 0Fh         ;1`s
   call .add_digit
   mov al, cl
   call .add_digit

   mov al, ' '
   stosb

   mov si, .hours_format      ;assume 24 hour format
   test byte [fmt_12_24], 0FFh
   jnz .copy

   mov si, .pm_format      ;pm?
   cmp dx, 12                  ;test it!
   jg .copy

   mov si, .am_format      ;no? am!

.copy:
   lodsb
   stosb
   cmp al, 0
   jne .copy

   popa
   ret

.add_digit:
   add al, '0'      ;into ASCII
   stosb               ;string into buffer
   ret

   .hours_format   db 'hours',0
   .am_format       db 'AM',0
   .pm_format       db 'PM',0

However my date function still works so Im guessing it isnt to do with the interrupt itself:
;I/O: BX = string
get_date:
   pusha

   mov di, bx

   clc                  ;anti-bug
   mov ah, 4         ;data from BIOS in BCD
   int 1Ah
   jnc .fmt1_day

   clc
   mov ah, 4         ;BIOS updating
   int 1Ah

.fmt1_day:
   mov ah, dl      ;dd
   call .add_2digits

   mov al, '/'
   stosb               ;d/m seperator

.fmt1_month:
   mov ah,   dh      ;mm
   call .add_2digits

   mov al, '/'
   stosb

.fmt1_century:
   mov ah,   ch      ;??00
   call .add_2digits

.fmt1_year:
   mov ah, cl      ;00??
   call .add_2digits

   mov al, 0
   stosb

   popa
   ret

.add_2digits:
   mov al, ah         ;AH to 2 ASCII dig
   shr al, 4
   call .add_digit
   mov al, ah
   and al, 0Fh
   call .add_digit
   ret

.add_digit:
   add al, '0'
   stosb
   ret


How do I fix the time function?
It will either: leak a bit of the memory and crash or just crash (crash as in stop, behaves like jmp $)

EDIT:
I have added a password function to my OS, after I implemented it the get_time function stopped working.
If I do not enter the password and fall back to my terminal, and then use the time function it DOES work, does this have to do with memory leaks/overflows?
EDIT 2: It also seems to depend on the length of the password, if its 1 char then it doesnt "influence" the time function but if its longer the function stops working.
EDIT 3: After debugging a bit the code seems to get stuck at the call bcd_to_int, it does not reach it nor does it return. The bcd_to_int function itself does work however
27
Summer of Code Ideas / Re: Can NASM get a debugger?
« Last post by Frank Kotler on September 25, 2019, 08:24:14 PM »
Hi  mayureshkathe,

Welcome to the forum.

I am only guessing, but I would guess that Nasm will not soon be seeing a "netwide" debugger. While Patrick's ALD is great for Linux and the BSDs, it won't do much for our dos/doze users who have not yet made the step up. :)

Unless you'd like to contribute something...

Best,
Frank

28
Summer of Code Ideas / Can NASM get a debugger?
« Last post by mayureshkathe on September 25, 2019, 08:39:28 AM »
Can the NASM distribution get a assembly language debugger too?
Searching around led me to http://ald.sourceforge.net/
Maybe the team can learn how ALD does it and build something of their own for NASM!
29
Programming with NASM / Re: how to split my 16bit/dos/medium model sample into files
« Last post by llm on September 18, 2019, 03:56:03 AM »
Quote
My first thought is to declare "global seg000" alongside of "global text". Try that and see if it helps any...

global seg000 in seg000.asm does not help and i don't think that the segment is handled like an external at all

but i solved it by adding an segment "forward declaration" inc that contains all segments (empty and in order)

segments.inc
Code: [Select]
BITS 16

segment seg000
segment seg001
segment seg002
segment seg003 stack

and included that

seg001.asm
Code: [Select]
BITS 16

%include "segments.inc"

extern print

segment seg001

..start:
mov ax,seg000
mov ds,ax

call far print

mov ax,0x4c00
int 0x21

seems to work - but i still don't know if it is the "correct" way of doing it
30
Programming with NASM / Re: how to split my 16bit/dos/medium model sample into files
« Last post by Frank Kotler on September 17, 2019, 08:52:31 PM »
Hi lim,

Welcome to the forum. Congratulations on your determination!

At one time, I knew how to do this... but that was a long time ago!

My first thought is to declare "global seg000" alongside of "global text". Try that and see if it helps any...

I wish I could help more but I'm old and tired and my memory is all shot. Examples I had were lost in a crash with no backup... Good luck!

Best,
Frank

Pages: 1 2 [3] 4 5 ... 10